Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Public Slots | Public Member Functions | Protected Slots | Protected Member Functions
PageItemAttributes Class Reference

#include <pageitemattributes.h>

List of all members.

Public Slots

virtual void setup (ObjAttrVector *pageItemAttrs, ObjAttrVector *docItemAttrs)
virtual void tableItemChanged (int row, int col)

Public Member Functions

 PageItemAttributes (QWidget *parent=0, const char *name=0, bool modal=false, WFlags fl=0)
 ~PageItemAttributes ()
virtual ObjAttrVectorgetNewAttributes ()

Protected Slots

virtual void languageChange ()
virtual void addEntry ()
virtual void deleteEntry ()
virtual void clearEntries ()
virtual void copyEntry ()
virtual void okClicked ()

Protected Member Functions

virtual void updateTable ()

Detailed Description

Definition at line 12 of file pageitemattributes.h.


Constructor & Destructor Documentation

PageItemAttributes::PageItemAttributes ( QWidget *  parent = 0,
const char *  name = 0,
bool  modal = false,
WFlags  fl = 0 
)

Definition at line 14 of file pageitemattributes.cpp.

       : PageItemAttributesBase(parent, name, modal, fl)
{
       relationships << tr("None", "relationship") << tr("Relates To") << tr("Is Parent Of") << tr("Is Child Of");
       relationshipsData << "none" << "relation" << "parent" << "child";
}

Here is the call graph for this function:

Definition at line 21 of file pageitemattributes.cpp.

{
}

Member Function Documentation

void PageItemAttributes::addEntry ( ) [protected, virtual, slot]

Definition at line 94 of file pageitemattributes.cpp.

{
       ObjectAttribute blank;
       blank.name="";
       blank.relationship=CommonStrings::None;
       blank.autoaddto="none";
       localAttributes.append(blank);
       updateTable();
}

Here is the call graph for this function:

void PageItemAttributes::clearEntries ( ) [protected, virtual, slot]

Definition at line 128 of file pageitemattributes.cpp.

{
       localAttributes.clear();
       updateTable();
}

Here is the call graph for this function:

void PageItemAttributes::copyEntry ( ) [protected, virtual, slot]

Definition at line 135 of file pageitemattributes.cpp.

{
       int currRow=attributesTable->currentRow();
       bool found=false;
       ObjAttrVector::Iterator it;
       int count=0;
       for(it = localAttributes.begin(); it!= localAttributes.end(); ++it)
       {
              if(count==currRow)
              {
                     found=true;
                     break;
              }
              ++count;
       }
       if (found)
       {
              localAttributes.append((*it));
              updateTable();
       }
}

Here is the call graph for this function:

void PageItemAttributes::deleteEntry ( ) [protected, virtual, slot]

Definition at line 105 of file pageitemattributes.cpp.

{
       int currRow=attributesTable->currentRow();
       bool found=false;
       ObjAttrVector::Iterator it;
       int count=0;
       for(it = localAttributes.begin(); it!= localAttributes.end(); ++it)
       {
              if(count==currRow)
              {
                     found=true;
                     break;
              }
              ++count;
       }
       if (found)
       {
              localAttributes.erase(it);
              updateTable();
       }
}

Here is the call graph for this function:

Definition at line 38 of file pageitemattributes.cpp.

{
       return &localAttributes;
}
void PageItemAttributes::languageChange ( ) [protected, virtual, slot]

Definition at line 235 of file pageitemattributes.cpp.

{
}
void PageItemAttributes::okClicked ( ) [protected, virtual, slot]

Definition at line 216 of file pageitemattributes.cpp.

{
       //Qt hack as we will lose data if the user hasnt left a cell
       //http://www.qtforum.org/thread.php?threadid=9078
       if (attributesTable->numRows()>0 && attributesTable->currentRow()!=-1)
       {
              //Avoid selecting 0,0 if 0,0 is current cell
              int selectCol;
              if(attributesTable->currentColumn()!=0)
                     selectCol=0;
              else
                     selectCol=1;

              attributesTable->setCurrentCell(0,selectCol);
              tableItemChanged(attributesTable->currentRow(), attributesTable->currentColumn());
       }
       accept();
}

Here is the call graph for this function:

void PageItemAttributes::setup ( ObjAttrVector pageItemAttrs,
ObjAttrVector docItemAttrs 
) [virtual, slot]

Definition at line 25 of file pageitemattributes.cpp.

{
       localAttributes=*pageItemAttrs;
       localDocAttributes=*docItemAttrs;

       nameList.clear();
       nameList.append("");
       for(ObjAttrVector::Iterator it = localDocAttributes.begin(); it!= localDocAttributes.end(); ++it)
              nameList.append((*it).name);

       updateTable();
}

Here is the call graph for this function:

void PageItemAttributes::tableItemChanged ( int  row,
int  col 
) [virtual, slot]

Definition at line 44 of file pageitemattributes.cpp.

{
       switch (col)
       {
              case 0:
                     localAttributes[row].name=attributesTable->text(row, col);
                     break;
              case 1:
                     localAttributes[row].type=attributesTable->text(row, col);
                     break;
              case 2:
                     localAttributes[row].value=attributesTable->text(row, col);
                     break;
              case 3:
                     localAttributes[row].parameter=attributesTable->text(row, col);
                     break;
              case 4:
              {
                     QComboTableItem* qcti=dynamic_cast<QComboTableItem*>(attributesTable->item(row,col));
                     if (qcti!=NULL)
                     {
                            uint index=qcti->currentItem();
                            if (index<relationshipsData.count())
                                   localAttributes[row].relationship=relationshipsData[index];
                     }
              }
              break;
              case 5:
                     localAttributes[row].relationshipto=attributesTable->text(row, col);
                     break;
              case 6:
                     //AutoAddTo is not used once this gets to the page items
                     /*
                     {
                            QComboTableItem* qcti=dynamic_cast<QComboTableItem*>(attributesTable->item(row,col));
                            if (qcti!=NULL)
                            {
                                   uint index=qcti->currentItem();
                                   if (index<autoAddToData.count())
                                          localAttributes[row].autoaddto=autoAddToData[index];
                            }
                     }
                     */
                     break;
              default:
                     break;
       }
}

Here is the caller graph for this function:

void PageItemAttributes::updateTable ( ) [protected, virtual]

Definition at line 158 of file pageitemattributes.cpp.

{
       attributesTable->setNumRows(localAttributes.count());
       int row=0;
       for(ObjAttrVector::Iterator it = localAttributes.begin(); it!= localAttributes.end(); ++it)
       {
              uint i=0;
              //Name
              QComboTableItem *item1 = new QComboTableItem(attributesTable, nameList, true);
              if (nameList.contains((*it).name))
                     item1->setCurrentItem((*it).name);
              else
                     item1->setCurrentItem("");
              attributesTable->setItem(row, i++, item1);
              //Type
              QTableItem *item2 = new QTableItem(attributesTable, QTableItem::WhenCurrent, (*it).type);
              attributesTable->setItem(row, i++, item2);
              //Default Value
              QTableItem *item3 = new QTableItem(attributesTable, QTableItem::WhenCurrent, (*it).value);
              attributesTable->setItem(row, i++, item3);
              //Default Parameter
              QTableItem *item4 = new QTableItem(attributesTable, QTableItem::WhenCurrent, (*it).parameter);
              attributesTable->setItem(row, i++, item4);
              //Relationship
              QComboTableItem *item5 = new QComboTableItem(attributesTable, relationships);
              attributesTable->setItem(row, i++, item5);
              int index=relationshipsData.findIndex((*it).relationship);
              if (index==-1)
              {
                     (*it).relationship="none";
                     index=0;
              }
              item5->setCurrentItem(index);
              //Relationship to
              QTableItem *item6 = new QTableItem(attributesTable, QTableItem::WhenCurrent, (*it).relationshipto);
              attributesTable->setItem(row, i++, item6);
              //Auto Add to not used here
              /*
              QComboTableItem *item7 = new QComboTableItem(attributesTable, autoAddTo);
              attributesTable->setItem(row, i++, item7);
              index=autoAddToData.findIndex((*it).autoaddto);
              if (index==-1)
              {
                     (*it).autoaddto="none";
                     index=0;
              }
              item7->setCurrentItem(index);
              */

              attributesTable->verticalHeader()->setLabel(row, QString("%1").arg(row));
              row++;
       }
       deleteButton->setEnabled(localAttributes.count()!=0);
       copyButton->setEnabled(localAttributes.count()!=0);
       clearButton->setEnabled(localAttributes.count()!=0);
}

Here is the caller graph for this function:


The documentation for this class was generated from the following files: