Back to index

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

#include <tocindexprefs.h>

List of all members.

Public Slots

virtual void setup (ToCSetupVector *tocsetups, ScribusDoc *doc)
virtual void generatePageItemList ()
virtual void setupItemAttrs (QStringList newNames)
virtual void selectToC (int numberSelected)
virtual void addToC ()
virtual void updateToCListBox ()
virtual void updateParagraphStyleComboBox ()
virtual void deleteToC ()
virtual void itemAttributeSelected (const QString &itemAttributeName)
virtual void itemFrameSelected (const QString &frameName)
virtual void itemPageNumberPlacedSelected (const QString &pageLocation)
virtual void itemParagraphStyleSelected (const QString &itemStyle)
virtual void setToCName (const QString &newName)
virtual void nonPrintingFramesSelected (bool showNonPrinting)

Public Member Functions

 TOCIndexPrefs (QWidget *parent=0, const char *name=0, WFlags fl=0)
 Constructs a TOCIndexPrefs as a child of 'parent', with the name 'name' and widget flags set to 'f'.
 ~TOCIndexPrefs ()
virtual void enableGUIWidgets ()
virtual ToCSetupVectorgetNewToCs ()

Protected Slots

virtual void languageChange ()

Protected Attributes

uint numSelected
QString strPNNotShown
QString strPNEnd
QString strPNBeginning
QString trStrPNNotShown
QString trStrPNEnd
QString trStrPNBeginning
ToCSetupVector localToCSetupVector
QString trStrNone
ScribusDoc * currDoc
QString selectedTOCAttrName
QStringList paragraphStyleList
QString strNone

Private Member Functions

void init ()
void destroy ()

Detailed Description

Definition at line 31 of file tocindexprefs.h.


Constructor & Destructor Documentation

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

Constructs a TOCIndexPrefs as a child of 'parent', with the name 'name' and widget flags set to 'f'.

Definition at line 45 of file tocindexprefs.cpp.

       : TOCIndexPrefsBase( parent, name, fl )
{
       languageChange();
       itemDestFrameComboBox->setMaximumWidth(fontMetrics().width( "This is a very long Name" ));
       itemAttrComboBox->setMaximumWidth(fontMetrics().width( "This is a very long Name" ));
       itemNumberPlacementComboBox->setMaximumWidth(fontMetrics().width( "This is a very long Name" ));
       itemParagraphStyleComboBox->setMaximumWidth(fontMetrics().width( "This is a very long Name" ));
       resize( QSize(444, 234).expandedTo(minimumSizeHint()) );
       clearWState( WState_Polished );

       // signals and slots connections
       connect( tocListBox, SIGNAL( highlighted(int) ), this, SLOT( selectToC(int) ) );
       connect( tocAddButton, SIGNAL( clicked() ), this, SLOT( addToC() ) );
       connect( tocDeleteButton, SIGNAL( clicked() ), this, SLOT( deleteToC() ) );
       connect( itemAttrComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemAttributeSelected(const QString&) ) );
       connect( itemDestFrameComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemFrameSelected(const QString&) ) );
       connect( itemParagraphStyleComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemParagraphStyleSelected(const QString&) ) );
       connect( itemNumberPlacementComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemPageNumberPlacedSelected(const QString&) ) );
       connect( tocNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( setToCName(const QString&) ) );
       connect( itemListNonPrintingCheckBox, SIGNAL( toggled(bool) ), this, SLOT( nonPrintingFramesSelected(bool) ) );
       init();
}

Here is the call graph for this function:

Definition at line 72 of file tocindexprefs.cpp.

{
       // no need to delete child widgets, Qt does it all for us
}

Member Function Documentation

void TOCIndexPrefs::addToC ( ) [virtual, slot]

Definition at line 237 of file tocindexprefs.cpp.

{
       bool found=false;
       QString newName=tocNameLineEdit->text();
       for(ToCSetupVector::Iterator it = localToCSetupVector.begin(); it!= localToCSetupVector.end(); ++it)
       {
              if ((*it).name==newName)
                     found=true;
       }
       if (found || newName.isEmpty())
              newName=tr("Table of Contents %1").arg(localToCSetupVector.count()+1);
       ToCSetup newToCEntry;
       newToCEntry.name=newName;
       newToCEntry.itemAttrName=strNone;
       newToCEntry.frameName=strNone;
       newToCEntry.textStyle=strNone;
       newToCEntry.pageLocation=End;
       newToCEntry.listNonPrintingFrames=false;
       localToCSetupVector.append(newToCEntry);
       disconnect( tocListBox, SIGNAL( highlighted(int) ), this, SLOT( selectToC(int) ) );
       updateToCListBox();
       if (localToCSetupVector.count()==1) //reinit parastyles if we are adding the first TOC
              updateParagraphStyleComboBox();
       tocListBox->setCurrentItem(localToCSetupVector.count()-1);
       selectToC(localToCSetupVector.count()-1);
       enableGUIWidgets();
       connect( tocListBox, SIGNAL( highlighted(int) ), this, SLOT( selectToC(int) ) );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TOCIndexPrefs::deleteToC ( ) [virtual, slot]

Definition at line 302 of file tocindexprefs.cpp.

{
       int numberSelected=tocListBox->currentItem();
       if (numberSelected>=0)
       {
              int i=0;
              ToCSetupVector::Iterator it=localToCSetupVector.begin();
              while (it!= localToCSetupVector.end() && i<numberSelected)
              {
                     ++it;
                     ++i;
              }
              localToCSetupVector.erase(it);
              updateToCListBox();
              enableGUIWidgets();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TOCIndexPrefs::destroy ( ) [private]

Definition at line 123 of file tocindexprefs.cpp.

{

}

Here is the caller graph for this function:

void TOCIndexPrefs::enableGUIWidgets ( ) [virtual]

Definition at line 289 of file tocindexprefs.cpp.

{
       bool enabled=(localToCSetupVector.count()>0);
       tocListBox->setEnabled(enabled);
       tocDeleteButton->setEnabled(enabled);
       itemAttrComboBox->setEnabled(enabled);
       itemNumberPlacementComboBox->setEnabled(enabled);
       bool haveDoc=enabled && currDoc!=NULL;
       itemDestFrameComboBox->setEnabled(haveDoc);
       itemParagraphStyleComboBox->setEnabled(haveDoc);
}

Here is the caller graph for this function:

void TOCIndexPrefs::generatePageItemList ( ) [virtual, slot]

Definition at line 147 of file tocindexprefs.cpp.

{
       itemDestFrameComboBox->clear();
       itemDestFrameComboBox->insertItem(trStrNone);
       if (currDoc!=NULL)
       {
              for (uint d = 0; d < currDoc->DocItems.count(); ++d)
              {
                     if (currDoc->DocItems.at(d)->itemType()==PageItem::TextFrame)
                            itemDestFrameComboBox->insertItem(currDoc->DocItems.at(d)->itemName());
              }
       }
       else
              itemDestFrameComboBox->setEnabled(false);
}

Here is the caller graph for this function:

Definition at line 404 of file tocindexprefs.cpp.

{
       return &localToCSetupVector;
}
void TOCIndexPrefs::init ( void  ) [private]

Definition at line 102 of file tocindexprefs.cpp.

{
       disconnect( tocListBox, SIGNAL( highlighted(int) ), this, SLOT( selectToC(int) ) );
       trStrNone=tr("None");
       strNone=CommonStrings::None;
       trStrPNBeginning=tr("At the beginning");
       strPNBeginning="At the beginning";
       trStrPNEnd=tr("At the end");
       strPNEnd="At the end";
       trStrPNNotShown=tr("Not Shown");
       strPNNotShown="Not Shown";

       itemNumberPlacementComboBox->clear();
       itemNumberPlacementComboBox->insertItem(trStrPNEnd);
       itemNumberPlacementComboBox->insertItem(trStrPNBeginning);
       itemNumberPlacementComboBox->insertItem(trStrPNNotShown);
       itemNumberPlacementComboBox->setCurrentText(trStrPNEnd);
       numSelected=999;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TOCIndexPrefs::itemAttributeSelected ( const QString &  itemAttributeName) [virtual, slot]

Definition at line 321 of file tocindexprefs.cpp.

{
       int numberSelected=tocListBox->currentItem();
       if (numberSelected>=0)
       {
              int i=0;
              ToCSetupVector::Iterator it=localToCSetupVector.begin();
              while (it!= localToCSetupVector.end() && i<numberSelected)
              {
                     ++it;
                     ++i;
              }
              if (itemAttributeName==trStrNone)
                     (*it).itemAttrName=strNone;
              else
                     (*it).itemAttrName=itemAttributeName;
       }
}

Here is the caller graph for this function:

void TOCIndexPrefs::itemFrameSelected ( const QString &  frameName) [virtual, slot]

Definition at line 341 of file tocindexprefs.cpp.

{
       int numberSelected=tocListBox->currentItem();
       if (numberSelected>=0)
       {
              int i=0;
              ToCSetupVector::Iterator it=localToCSetupVector.begin();
              while (it!= localToCSetupVector.end() && i<numberSelected)
              {
                     ++it;
                     ++i;
              }
              if (frameName==trStrNone)
                     (*it).frameName=strNone;
              else
                     (*it).frameName=frameName;
       }

}

Here is the caller graph for this function:

void TOCIndexPrefs::itemPageNumberPlacedSelected ( const QString &  pageLocation) [virtual, slot]

Definition at line 362 of file tocindexprefs.cpp.

{
       int numberSelected=tocListBox->currentItem();
       if (numberSelected>=0)
       {
              int i=0;
              ToCSetupVector::Iterator it=localToCSetupVector.begin();
              while (it!= localToCSetupVector.end() && i<numberSelected)
              {
                     ++it;
                     ++i;
              }
              if (pageLocation==trStrPNBeginning || pageLocation==strPNBeginning)
                     (*it).pageLocation=Beginning;
              else
              if (pageLocation==trStrPNEnd || pageLocation==strPNEnd)
                     (*it).pageLocation=End;
              else
                     (*it).pageLocation=NotShown;
       }
}

Here is the caller graph for this function:

void TOCIndexPrefs::itemParagraphStyleSelected ( const QString &  itemStyle) [virtual, slot]

Definition at line 385 of file tocindexprefs.cpp.

{
       int numberSelected=tocListBox->currentItem();
       if (numberSelected>=0)
       {
              int i=0;
              ToCSetupVector::Iterator it=localToCSetupVector.begin();
              while (it!= localToCSetupVector.end() && i<numberSelected)
              {
                     ++it;
                     ++i;
              }
              if (itemStyle==trStrNone)
                     (*it).textStyle=strNone;
              else
                     (*it).textStyle=itemStyle;
       }
}

Here is the caller graph for this function:

void TOCIndexPrefs::languageChange ( ) [protected, virtual, slot]

Definition at line 81 of file tocindexprefs.cpp.

{
       setCaption( tr( "Table of Contents and Indexes" ) );
       tocAddButton->setText( tr( "&Add" ) );
       tocAddButton->setAccel( QKeySequence( tr( "Alt+A" ) ) );
       tocDeleteButton->setText( tr( "&Delete" ) );
       tocDeleteButton->setAccel( QKeySequence( tr( "Alt+D" ) ) );
       QToolTip::add( itemDestFrameComboBox, tr( "The frame the table of contents will be placed into" ) );
       tocNumberPlacementLabel->setText( tr( "Page Numbers Placed:" ) );
       tocItemAttrLabel->setText( tr( "Item Attribute Name:" ) );
       QToolTip::add( itemAttrComboBox, tr( "The Item Attribute that will be set on frames used as a basis for creation of the entries" ) );
       QToolTip::add( itemNumberPlacementComboBox, tr( "Place page numbers of the entries at the beginning or the end of the line, or not at all" ) );
       itemListNonPrintingCheckBox->setText( tr( "List Non-Printing Entries" ) );
       QToolTip::add( itemListNonPrintingCheckBox, tr( "Include frames that are set to not print as well" ) );
       QToolTip::add( itemParagraphStyleComboBox, tr( "The paragraph style used for the entry lines" ) );
       tocParagraphStyleLabel->setText( tr( "Paragraph Style:" ) );
       tocDestFrameLabel->setText( tr( "Destination Frame:" ) );
       tabTOCIndexWidget->changeTab( tab, tr( "Table Of Contents" ) );
//     tabTOCIndexWidget->changeTab( tab_2, tr( "Inde&x" ) );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TOCIndexPrefs::nonPrintingFramesSelected ( bool  showNonPrinting) [virtual, slot]

Definition at line 428 of file tocindexprefs.cpp.

{
       int numberSelected=tocListBox->currentItem();
       if (numberSelected>=0)
       {
              int i=0;
              ToCSetupVector::Iterator it=localToCSetupVector.begin();
              while (it!= localToCSetupVector.end() && i<numberSelected)
              {
                     ++it;
                     ++i;
              }
              (*it).listNonPrintingFrames=showNonPrinting;
       }
}

Here is the caller graph for this function:

void TOCIndexPrefs::selectToC ( int  numberSelected) [virtual, slot]

Definition at line 181 of file tocindexprefs.cpp.

{
       numSelected=numberSelected;
       if (localToCSetupVector.isEmpty())
              return;
       if (localToCSetupVector.count()<numSelected)
              numSelected=0;
       disconnect( tocListBox, SIGNAL( highlighted(int) ), this, SLOT( selectToC(int) ) );
       disconnect( itemAttrComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemAttributeSelected(const QString&) ) );
       disconnect( itemDestFrameComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemFrameSelected(const QString&) ) );
       disconnect( itemParagraphStyleComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemParagraphStyleSelected(const QString&) ) );
       disconnect( itemNumberPlacementComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemPageNumberPlacedSelected(const QString&) ) );
       disconnect( tocNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( setToCName(const QString&) ) );
       disconnect( itemListNonPrintingCheckBox, SIGNAL( toggled(bool) ), this, SLOT( nonPrintingFramesSelected(bool) ) );
       if (localToCSetupVector[numSelected].itemAttrName==strNone)
              itemAttrComboBox->setCurrentText(trStrNone);
       else
              itemAttrComboBox->setCurrentText(localToCSetupVector[numSelected].itemAttrName);
       if (localToCSetupVector[numSelected].pageLocation==NotShown)
              itemNumberPlacementComboBox->setCurrentText(trStrPNNotShown);
       else
              if (localToCSetupVector[numSelected].pageLocation==Beginning)
              itemNumberPlacementComboBox->setCurrentText(trStrPNBeginning);
       else
              itemNumberPlacementComboBox->setCurrentText(trStrPNEnd);

       itemListNonPrintingCheckBox->setChecked(localToCSetupVector[numSelected].listNonPrintingFrames);
       if (currDoc!=NULL)
       {
              if (localToCSetupVector[numSelected].frameName==strNone)
                     itemDestFrameComboBox->setCurrentText(trStrNone);
              else
                     itemDestFrameComboBox->setCurrentText(localToCSetupVector[numSelected].frameName);

              if (itemParagraphStyleComboBox->count()>0)
              {
                     if (!paragraphStyleList.contains(localToCSetupVector[numSelected].textStyle) || localToCSetupVector[numSelected].textStyle==strNone)
                            itemParagraphStyleComboBox->setCurrentText(trStrNone);
                     else
                            itemParagraphStyleComboBox->setCurrentText(localToCSetupVector[numSelected].textStyle);
              }
       }

       //if (numSelected>=0)
              tocNameLineEdit->setText(tocListBox->currentText());

       connect( tocListBox, SIGNAL( highlighted(int) ), this, SLOT( selectToC(int) ) );
       connect( itemAttrComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemAttributeSelected(const QString&) ) );
       connect( itemDestFrameComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemFrameSelected(const QString&) ) );
       connect( itemParagraphStyleComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemParagraphStyleSelected(const QString&) ) );
       connect( itemNumberPlacementComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemPageNumberPlacedSelected(const QString&) ) );
       connect( tocNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( setToCName(const QString&) ) );
       connect( itemListNonPrintingCheckBox, SIGNAL( toggled(bool) ), this, SLOT( nonPrintingFramesSelected(bool) ) );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TOCIndexPrefs::setToCName ( const QString &  newName) [virtual, slot]

Definition at line 410 of file tocindexprefs.cpp.

{
       int numberSelected=tocListBox->currentItem();
       if (numberSelected!=-1)
       {
              tocListBox->changeItem(newName, numberSelected);
              int i=0;
              ToCSetupVector::Iterator it=localToCSetupVector.begin();
              while (it!= localToCSetupVector.end() && i<numberSelected)
              {
                     ++it;
                     ++i;
              }
              (*it).name=newName;
       }
}

Here is the caller graph for this function:

void TOCIndexPrefs::setup ( ToCSetupVector tocsetups,
ScribusDoc *  doc 
) [virtual, slot]

Definition at line 128 of file tocindexprefs.cpp.

{
       localToCSetupVector=* tocsetups;
       currDoc=doc;
       generatePageItemList();
       bool enabled=(localToCSetupVector.count()>0);
       if (enabled)
       {
              updateToCListBox();
              updateParagraphStyleComboBox();
              tocListBox->setCurrentItem(0);
              selectToC(0);
       }
       else
              tocListBox->clear();
       enableGUIWidgets();
       connect( tocListBox, SIGNAL( highlighted(int) ), this, SLOT( selectToC(int) ) );
}

Here is the call graph for this function:

void TOCIndexPrefs::setupItemAttrs ( QStringList  newNames) [virtual, slot]

Definition at line 164 of file tocindexprefs.cpp.

{
       disconnect( itemAttrComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemAttributeSelected(const QString&) ) );
       itemAttrComboBox->clear();
       itemAttrComboBox->insertItem(trStrNone);
       itemAttrComboBox->insertStringList(newNames);
       if (numSelected!=999)
       {
              if (localToCSetupVector[numSelected].itemAttrName==strNone)
                     itemAttrComboBox->setCurrentText(trStrNone);
              else
                     itemAttrComboBox->setCurrentText(localToCSetupVector[numSelected].itemAttrName);
       }
       connect( itemAttrComboBox, SIGNAL( activated(const QString&) ), this, SLOT( itemAttributeSelected(const QString&) ) );
}

Here is the call graph for this function:

Definition at line 274 of file tocindexprefs.cpp.

{
       paragraphStyleList.clear();
       paragraphStyleList.append(trStrNone);

       if(currDoc!=NULL) // && currDoc->docParagraphStyles.count()>5)
       {
              for (uint i = 0; i < currDoc->paragraphStyles().count(); ++i)
                     paragraphStyleList.append(currDoc->paragraphStyles()[i].name());
       }
       itemParagraphStyleComboBox->clear();
       itemParagraphStyleComboBox->insertStringList(paragraphStyleList);
}

Here is the caller graph for this function:

void TOCIndexPrefs::updateToCListBox ( ) [virtual, slot]

Definition at line 267 of file tocindexprefs.cpp.

{
       tocListBox->clear();
       for(ToCSetupVector::Iterator it = localToCSetupVector.begin(); it!= localToCSetupVector.end(); ++it)
              tocListBox->insertItem((*it).name);
}

Here is the caller graph for this function:


Member Data Documentation

ScribusDoc* TOCIndexPrefs::currDoc [protected]

Definition at line 68 of file tocindexprefs.h.

Definition at line 66 of file tocindexprefs.h.

uint TOCIndexPrefs::numSelected [protected]

Definition at line 59 of file tocindexprefs.h.

QStringList TOCIndexPrefs::paragraphStyleList [protected]

Definition at line 70 of file tocindexprefs.h.

Definition at line 69 of file tocindexprefs.h.

QString TOCIndexPrefs::strNone [protected]

Definition at line 71 of file tocindexprefs.h.

QString TOCIndexPrefs::strPNBeginning [protected]

Definition at line 62 of file tocindexprefs.h.

QString TOCIndexPrefs::strPNEnd [protected]

Definition at line 61 of file tocindexprefs.h.

QString TOCIndexPrefs::strPNNotShown [protected]

Definition at line 60 of file tocindexprefs.h.

QString TOCIndexPrefs::trStrNone [protected]

Definition at line 67 of file tocindexprefs.h.

QString TOCIndexPrefs::trStrPNBeginning [protected]

Definition at line 65 of file tocindexprefs.h.

QString TOCIndexPrefs::trStrPNEnd [protected]

Definition at line 64 of file tocindexprefs.h.

QString TOCIndexPrefs::trStrPNNotShown [protected]

Definition at line 63 of file tocindexprefs.h.


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