Back to index

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

#include <docitemattrprefs.h>

List of all members.

Public Member Functions

 DocumentItemAttributes (QWidget *parent=0, const char *name=0, WFlags fl=0)
 ~DocumentItemAttributes ()
virtual QStringList getDocAttributesNames ()
virtual ObjAttrVectorgetNewAttributes ()
virtual void setup (ObjAttrVector *docItemAttrs)

Protected Slots

virtual void tableItemChanged (int row, int col)
virtual void addEntry ()
virtual void deleteEntry ()
virtual void clearEntries ()
virtual void copyEntry ()

Protected Member Functions

virtual void updateTable ()

Detailed Description

Definition at line 12 of file docitemattrprefs.h.


Constructor & Destructor Documentation

DocumentItemAttributes::DocumentItemAttributes ( QWidget *  parent = 0,
const char *  name = 0,
WFlags  fl = 0 
)

Definition at line 14 of file docitemattrprefs.cpp.

       : DocumentItemAttributesBase(parent, name, fl)
{
       relationships << tr("None", "relationship") << tr("Relates To") << tr("Is Parent Of") << tr("Is Child Of");
       relationshipsData << "none" << "relation" << "parent" << "child";
       autoAddTo << tr("None", "auto add") << tr("Text Frames") << tr("Image Frames");
       autoAddToData << "none" << "textframes" << "imageframes";
       types << tr("None", "types") << tr("Boolean") << tr("Integer") << tr("Real Number") << tr("String");
       typesData << "none" << "boolean" << "integer" << "double" << "string";
}

Here is the call graph for this function:

Definition at line 25 of file docitemattrprefs.cpp.

{
}

Member Function Documentation

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

Definition at line 96 of file docitemattrprefs.cpp.

{
       ObjectAttribute blank;
       blank.relationship="none";
       blank.autoaddto="none";
       blank.type="none";
       localAttributes.append(blank);
       updateTable();
}

Here is the call graph for this function:

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

Definition at line 189 of file docitemattrprefs.cpp.

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

Here is the call graph for this function:

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

Definition at line 196 of file docitemattrprefs.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 DocumentItemAttributes::deleteEntry ( ) [protected, virtual, slot]

Definition at line 166 of file docitemattrprefs.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 218 of file docitemattrprefs.cpp.

{
       QStringList nameList;
       for(ObjAttrVector::Iterator it = localAttributes.begin(); it!= localAttributes.end(); ++it)
              nameList.append((*it).name);
       return nameList;
}

Definition at line 35 of file docitemattrprefs.cpp.

{
       return &localAttributes;
}
void DocumentItemAttributes::setup ( ObjAttrVector docItemAttrs) [virtual]

Definition at line 29 of file docitemattrprefs.cpp.

{
       localAttributes=*docItemAttrs;
       updateTable();
}

Here is the call graph for this function:

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

Definition at line 41 of file docitemattrprefs.cpp.

{
       switch (col)
       {
       case 0:
              localAttributes[row].name=attributesTable->text(row, col);
              break;
       case 1:
              {
                     QComboTableItem* qcti=dynamic_cast<QComboTableItem*>(attributesTable->item(row,col));
                     if (qcti!=NULL)
                     {
                            uint index=qcti->currentItem();
                            if (index<typesData.count())
                                   localAttributes[row].type=typesData[index];
                     }
              }
              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:
              {
                     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;
       }
}
void DocumentItemAttributes::updateTable ( ) [protected, virtual]

Definition at line 107 of file docitemattrprefs.cpp.

{
       attributesTable->setNumRows(localAttributes.count());
       int row=0;
       for(ObjAttrVector::Iterator it = localAttributes.begin(); it!= localAttributes.end(); ++it)
       {
              uint i=0;
              //Name
              QTableItem *item1 = new QTableItem(attributesTable, QTableItem::WhenCurrent, (*it).name);
              attributesTable->setItem(row, i++, item1);
              //Type
              QComboTableItem *item2 = new QComboTableItem(attributesTable, types);
              attributesTable->setItem(row, i++, item2);
              int index=typesData.findIndex((*it).type);
              if (index==-1)
              {
                     (*it).type="none";
                     index=0;
              }
              item2->setCurrentItem(index);
              //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);
              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
              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: