Back to index

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

#include <tffilter.h>

List of all members.

Signals

void removeClicked (tfFilter *tff)
void addClicked (tfFilter *tff)

Public Member Functions

 tfFilter (QWidget *parent, const char *name, int action, QString regExp, QString replace, QString pstyleName, int less, int more, int style, bool match, bool enabled, bool regexp)
 tfFilter (QWidget *parent=0, const char *name=0)
 ~tfFilter ()
void setRemovable (bool b)
int getAction ()
QString regExp ()
QString replaceWith ()
QString getPStyleName ()
int getLessThan ()
int getMoreThan ()
int getStyle ()
bool removeMatch ()
bool isEnabled ()
bool isRegExp ()

Private Slots

void enableToggled (bool on)
void addClick ()
void removeClick ()
void firstChanged (int index)
void secondChanged (int index)
void thirdChanged (int index)
void fourthChanged (int index)
void fifthChanged (int index)
void sixthChanged (int index)

Private Member Functions

void createWidget ()
void getFirstCombo ()
void getSecondCombo ()
void getThirdCombo (int secondIndex)
void getFourthCombo ()
void getFifthCombo ()
void getSixthCombo ()
void resetBRow ()
void getParagraphStyles ()

Private Attributes

QCheckBox * enableCheck
QBoxLayout * alayout
QBoxLayout * blayout
QFrame * actionFrame
QComboBox * firstCombo
QLabel * firstLabel
QComboBox * secondCombo
QCheckBox * secondRegexpCheck
QLabel * secondLabel
QComboBox * thirdCombo
QLabel * thirdLabel
QComboBox * fourthCombo
QLabel * fourthLabel
QComboBox * fifthCombo
QCheckBox * fifthRegexpCheck
QLabel * fifthLabel
QComboBox * sixthCombo
QPushButton * removeButton
QPushButton * addButton
int currentAction
PrefsContext * prefs
PrefsTable * history

Detailed Description

Definition at line 38 of file tffilter.h.


Constructor & Destructor Documentation

tfFilter::tfFilter ( QWidget *  parent,
const char *  name,
int  action,
QString  regExp,
QString  replace,
QString  pstyleName,
int  less,
int  more,
int  style,
bool  match,
bool  enabled,
bool  regexp 
)

Definition at line 19 of file tffilter.cpp.

                   : QWidget(parent, name)
{
       createWidget();

       firstChanged(action);
       currentAction = action;
       firstCombo->setCurrentItem(action);
       if (action == APPLY)
       {
              thirdCombo->setCurrentText(pstyleName);
              fourthChanged(style);
              fourthCombo->setCurrentItem(style);
              if (style == STARTS_WITH)
              {
                     fifthCombo->setCurrentText(regExp);
                     fifthRegexpCheck->setChecked(regexp);
                     if (match)
                            sixthCombo->setCurrentItem(0);
                     else
                            sixthCombo->setCurrentItem(1);
              }
              else if (style == LESS_THAN)
              {
                     if (less > 0)
                            fifthCombo->setCurrentText(QString("%1").arg(less));
              }
              else if (style == MORE_THAN)
              {
                     if (more > 0)
                            fifthCombo->setCurrentText(QString("%1").arg(more));
              }
       }
       else if (action == REMOVE) 
       {
              secondCombo->setCurrentText(regExp);
              secondRegexpCheck->setChecked(regexp);
       }
       else if (action == REPLACE)
       {
              secondCombo->setCurrentText(regExp);
              secondRegexpCheck->setChecked(regexp);
              thirdCombo->setCurrentText(replace);
       }
       enableCheck->setChecked(enabled);
       enableToggled(enabled);
}

Here is the call graph for this function:

tfFilter::tfFilter ( QWidget *  parent = 0,
const char *  name = 0 
)

Definition at line 69 of file tffilter.cpp.

                                                    : QWidget(parent, name)
{
       createWidget();
}

Here is the call graph for this function:

Definition at line 572 of file tffilter.cpp.

{

}

Member Function Documentation

void tfFilter::addClick ( ) [private, slot]

Definition at line 148 of file tffilter.cpp.

{
       emit addClicked(this);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tfFilter::addClicked ( tfFilter tff) [signal]

Here is the caller graph for this function:

void tfFilter::createWidget ( ) [private]

Definition at line 74 of file tffilter.cpp.

{
       firstCombo = NULL;
       firstLabel = NULL;
       secondCombo = NULL;
       secondLabel = NULL;
       thirdCombo = NULL;
       thirdLabel = NULL;
       fourthCombo = NULL;
       fourthLabel = NULL;
       fifthCombo = NULL;
       fifthLabel = NULL;
       sixthCombo = NULL;
       secondRegexpCheck = NULL;
//     thirdRegexpCheck = NULL;
       fifthRegexpCheck = NULL;

       prefs = PrefsManager::instance()->prefsFile->getPluginContext("TextFilter");
       history = prefs->getTable("history");

       QHBoxLayout *layout = new QHBoxLayout(this);
       layout->setMargin(0);

       enableCheck = new QCheckBox(this, "enableCheck");
       enableCheck->setMaximumSize(QSize(25,25));
       enableCheck->setMinimumSize(QSize(25,25));
       enableCheck->setChecked(true);
       QToolTip::add(enableCheck, tr("Disable or enable this filter row"));
       layout->addWidget(enableCheck);

       actionFrame = new QFrame(this, "actionFrame");
       layout->addWidget(actionFrame);

       QBoxLayout* layout2 = new QVBoxLayout(actionFrame);
       alayout = new QHBoxLayout();
       alayout->setMargin(0);
       layout2->addLayout(alayout);
       layout2->addSpacing(4);
       blayout = new QHBoxLayout();
       blayout->setMargin(0);
       layout2->addLayout(blayout);

       currentAction = REMOVE;
       getFirstCombo();

//     layout->addStretch(10);

       layout->addSpacing(20);
       removeButton = new QPushButton(loadIcon("22/list-remove.png"), 0, this, "removeButton");
       QToolTip::add(removeButton, tr("Remove this filter row"));
       removeButton->setMaximumSize(QSize(25,25));
       removeButton->setMinimumSize(QSize(25,25));
       layout->addWidget(removeButton);
       addButton = new QPushButton(loadIcon("22/list-add.png"), 0, this, "addButton");
       QToolTip::add(addButton, tr("Add a new filter row"));
       addButton->setMaximumSize(QSize(25,25));
       addButton->setMinimumSize(QSize(25,25));
       layout->addWidget(addButton);

       connect(enableCheck, SIGNAL(toggled(bool)), this, SLOT(enableToggled(bool)));
       connect(addButton, SIGNAL(clicked()), this, SLOT(addClick()));
       connect(removeButton, SIGNAL(clicked()), this, SLOT(removeClick()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tfFilter::enableToggled ( bool  on) [private, slot]

Definition at line 143 of file tffilter.cpp.

{
       actionFrame->setEnabled(on);
}

Here is the caller graph for this function:

void tfFilter::fifthChanged ( int  index) [private, slot]

Definition at line 221 of file tffilter.cpp.

{

}

Here is the caller graph for this function:

void tfFilter::firstChanged ( int  index) [private, slot]

Definition at line 158 of file tffilter.cpp.

{
       currentAction = index;
       getSecondCombo();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tfFilter::fourthChanged ( int  index) [private, slot]

Definition at line 174 of file tffilter.cpp.

{
       switch (currentAction)
       {
              case APPLY:
                     thirdLabel->setText( tr("to"));
                     thirdLabel->show();
//                   thirdRegexpCheck->hide();
                     switch (index)
                     {
                            case ALL_PARAGRAPHS:
                                   fourthLabel->hide();
                                   fifthCombo->hide();
                                   fifthLabel->hide();
                                   sixthCombo->hide();
                                   fifthRegexpCheck->hide();
                                   break;
                            case STARTS_WITH:
                                   fourthLabel->hide();
                                   fifthCombo->clear();
                                   fifthCombo->setEditable(true);
                                   fifthCombo->show();
                                   fifthRegexpCheck->show();
                                   fifthLabel->setText( tr("and"));
                                   fifthLabel->show();
                                   sixthCombo->clear();
                                   sixthCombo->setEditable(false);
                                   sixthCombo->insertItem( tr("remove match"));
                                   sixthCombo->insertItem( tr("do not remove match"));
                                   sixthCombo->show();
                                   break;
                            case LESS_THAN:
                            case MORE_THAN:
                                   fourthLabel->hide();
                                   fifthCombo->clear();
                                   fifthCombo->setEditable(true);
                                   fifthCombo->show();
                                   fifthRegexpCheck->hide();
                                   fifthLabel->setText( tr("words"));
                                   fifthLabel->show();
                                   sixthCombo->hide();
                                   break;
                     }
                     break;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 484 of file tffilter.cpp.

{
       return currentAction;
}

Here is the caller graph for this function:

void tfFilter::getFifthCombo ( ) [private]

Definition at line 396 of file tffilter.cpp.

{
       if (!fifthCombo)
       {
              fifthCombo = new QComboBox(0, actionFrame, "fifthCombo");
              fifthCombo->insertItem("");
              fifthCombo->hide();
              blayout->addWidget(fifthCombo, 8);
              blayout->addSpacing(5);
              connect(fifthCombo, SIGNAL(activated(int)), this, SLOT(fifthChanged(int)));
       }
       if (!fifthRegexpCheck)
       {
              fifthRegexpCheck = new QCheckBox(actionFrame, "secondRegexpCheck");
              QToolTip::add(fifthRegexpCheck, tr("Value at the left is a regular expression"));
              fifthRegexpCheck->hide();
              blayout->addWidget(fifthRegexpCheck, -1);
              blayout->addSpacing(5);
       }
       if (!fifthLabel)
       {
              fifthLabel = new QLabel(actionFrame, "fifthLabel");
              fifthLabel->hide();
              blayout->addWidget(fifthLabel, -1);
              blayout->addSpacing(5);
       }
       getSixthCombo();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tfFilter::getFirstCombo ( ) [private]

Definition at line 231 of file tffilter.cpp.

{
       resetBRow();
       if (!firstCombo)
       {
              firstCombo = new QComboBox(0, actionFrame, "firstCombo");
              firstCombo->insertItem("");
              firstCombo->show();
              alayout->addWidget(firstCombo, -1);
              alayout->setSpacing(5);
              connect(firstCombo, SIGNAL(activated(int)), this, SLOT(firstChanged(int)));
       }
       if (!firstLabel)
       {
              firstLabel = new QLabel(actionFrame, "secondLabel");
              alayout->addWidget(firstLabel, -1);
              firstLabel->hide();
       }
       firstCombo->clear();
       firstCombo->setMinimumSize(QSize(120, 0));
       firstCombo->insertItem( tr("Remove"));
       firstCombo->insertItem( tr("Replace"));
       firstCombo->insertItem( tr("Apply"));
       firstCombo->show();
       getSecondCombo();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tfFilter::getFourthCombo ( ) [private]

Definition at line 361 of file tffilter.cpp.

{
       if (!fourthCombo)
       {
              fourthCombo = new QComboBox(0, actionFrame, "fourthCombo");
              fourthCombo->insertItem("");
              fourthCombo->hide();
              blayout->addWidget(fourthCombo, 8);
              connect(fourthCombo, SIGNAL(activated(int)), this, SLOT(fourthChanged(int)));
       }
       if (!fourthLabel)
       {
              fourthLabel = new QLabel(actionFrame, "fourthLabel");
              fourthLabel->hide();
              blayout->addWidget(fourthLabel, -1);
              blayout->addSpacing(5);
       }
       switch (currentAction)
       {
              case APPLY:
                     thirdLabel->setText( tr("to"));
                     thirdLabel->show();
                     fourthCombo->clear();
                     fourthCombo->insertItem( tr("all paragraphs"));
                     fourthCombo->insertItem( tr("paragraphs starting with"));
                     fourthCombo->insertItem( tr("paragraphs with less than"));
                     fourthCombo->insertItem( tr("paragraphs with more than"));
                     fourthCombo->setEditable(false);
                     fourthCombo->show();
                     fourthLabel->hide();
                     getFifthCombo();
                     break;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 525 of file tffilter.cpp.

{
       if (!fifthCombo)
              return -1;
       bool ok = false;
       QString text = QString(fifthCombo->currentText());
       int i = text.toInt(&ok);
       if (ok)
              return i;
       else
              return -1;
}

Here is the caller graph for this function:

Definition at line 552 of file tffilter.cpp.

{
       return getLessThan();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tfFilter::getParagraphStyles ( ) [private]

Definition at line 475 of file tffilter.cpp.

{
       thirdCombo->insertItem("");
       for (uint i = 0; i < ScCore->primaryMainWindow()->doc->paragraphStyles().count(); ++i)
       {
              thirdCombo->insertItem(ScCore->primaryMainWindow()->doc->paragraphStyles()[i].name());
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 518 of file tffilter.cpp.

{
       if (!thirdCombo)
              return "";
       return QString(thirdCombo->currentText());
}

Here is the caller graph for this function:

void tfFilter::getSecondCombo ( ) [private]

Definition at line 258 of file tffilter.cpp.

{
       resetBRow();
       if (!secondCombo)
       {
              secondCombo = new QComboBox(0, actionFrame, "secondCombo");
              secondCombo->insertItem("");
              secondCombo->show();
              alayout->addWidget(secondCombo, 8);
              connect(secondCombo, SIGNAL(activated(int)), this, SLOT(secondChanged(int)));
       }
       if (!secondRegexpCheck)
       {
              secondRegexpCheck = new QCheckBox(actionFrame, "secondRegexpCheck");
              QToolTip::add(secondRegexpCheck, tr("Value at the left is a regular expression"));
              secondRegexpCheck->show();
              alayout->addWidget(secondRegexpCheck, -1);
       }
       if (!secondLabel)
       {
              secondLabel = new QLabel(actionFrame, "secondLabel");
              secondLabel->hide();
              alayout->addWidget(secondLabel, -1);
       }
       switch (currentAction)
       {
              case REPLACE:
                     firstLabel->hide();
                     secondLabel->setText( tr("with"));
                     secondLabel->show();
                     secondCombo->setEditable(true);
                     secondCombo->clear();
                     secondCombo->show();
                     secondRegexpCheck->show();
                     break;
              case APPLY:
                     firstLabel->hide();
                     secondLabel->hide();
                     secondCombo->setEditable(false);
                     secondCombo->clear();
                     secondCombo->insertItem( tr("paragraph style"));
                     secondRegexpCheck->hide();
                     break;
              case REMOVE:
                     firstLabel->setText( tr("all instances of"));
                     firstLabel->show();
                     secondCombo->clear();
                     secondCombo->setEditable(true);
                     secondCombo->show();
                     secondLabel->hide();
                     secondRegexpCheck->show();
                     break;
       }
       getThirdCombo(secondCombo->currentItem());
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tfFilter::getSixthCombo ( ) [private]

Definition at line 425 of file tffilter.cpp.

{
       if (!sixthCombo)
       {
              sixthCombo = new QComboBox(0, actionFrame, "sixthCombo");
              sixthCombo->insertItem("");
              sixthCombo->hide();
              blayout->addWidget(sixthCombo, 7);
              connect(sixthCombo, SIGNAL(activated(int)), this, SLOT(sixthChanged(int)));
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 538 of file tffilter.cpp.

{
       if (!fourthCombo)
              return 0;
       return fourthCombo->currentItem();
}

Here is the caller graph for this function:

void tfFilter::getThirdCombo ( int  secondIndex) [private]

Definition at line 314 of file tffilter.cpp.

{
       if (!thirdCombo)
       {
              thirdCombo = new QComboBox(0, actionFrame, "thirdCombo");
              thirdCombo->insertItem("");
              thirdCombo->hide();
              alayout->addWidget(thirdCombo, 8);
              connect(thirdCombo, SIGNAL(activated(int)), this, SLOT(thirdChanged(int)));
       }
//     if (!thirdRegexpCheck)
//     {
//            thirdRegexpCheck = new QCheckBox(actionFrame, "secondRegexpCheck");
//            QToolTip::add(thirdRegexpCheck, tr("Value is treated as a regular expression"));
//            thirdRegexpCheck->hide();
//            alayout->addWidget(thirdRegexpCheck, -1);
//     }
       if (!thirdLabel)
       {
              thirdLabel = new QLabel(actionFrame, "thirdLabel");
              thirdLabel->hide();
              blayout->addWidget(thirdLabel, -1);
              blayout->addSpacing(5);
       }
       switch (currentAction)
       {
              case REPLACE:
                     thirdCombo->clear();
                     thirdCombo->setEditable(true);
                     thirdCombo->show();
//                   thirdRegexpCheck->show();
                     break;
              case APPLY:
                     thirdCombo->clear();
                     getParagraphStyles();
                     thirdCombo->setEditable(true);
                     thirdCombo->show();
//                   thirdRegexpCheck->hide();
                     getFourthCombo();
                     break;
              case REMOVE:
                     thirdCombo->hide();
//                   thirdRegexpCheck->hide();
                     break;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 557 of file tffilter.cpp.

{
       return enableCheck->isChecked();
}

Here is the caller graph for this function:

Definition at line 562 of file tffilter.cpp.

{
       bool checked = false;
       if ((currentAction == REPLACE) || (currentAction == REMOVE))
              checked = secondRegexpCheck->isChecked();
       else if (currentAction == APPLY)
              checked = fifthRegexpCheck->isChecked();
       return checked;
}

Here is the caller graph for this function:

QString tfFilter::regExp ( )

Definition at line 489 of file tffilter.cpp.

{
       switch (currentAction)
       {
              case REMOVE:
              case REPLACE:
                     if (!secondCombo)
                            return "";
                     return QString(secondCombo->currentText());
                     break;
              case APPLY:
                     if (!fifthCombo)
                            return "";
                     return QString(fifthCombo->currentText());
                     break;
              default:
                     return "";
                     break;
       }
       return "";
}

Here is the caller graph for this function:

void tfFilter::removeClick ( ) [private, slot]

Definition at line 153 of file tffilter.cpp.

{
       emit removeClicked(this);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tfFilter::removeClicked ( tfFilter tff) [signal]

Here is the caller graph for this function:

Definition at line 545 of file tffilter.cpp.

{
       if (!sixthCombo)
              return false;
       return sixthCombo->currentItem() == 0;
}

Here is the caller graph for this function:

QString tfFilter::replaceWith ( )

Definition at line 511 of file tffilter.cpp.

{
       if (!thirdCombo)
              return "";
       return QString(thirdCombo->currentText());
}

Here is the caller graph for this function:

void tfFilter::resetBRow ( ) [private]

Definition at line 437 of file tffilter.cpp.

{
       if (thirdLabel)
       {
              thirdLabel->hide();
              thirdLabel->setText("");
       }
       if (fourthCombo)
       {
              fourthCombo->hide();
              fourthCombo->clear();
       }
       if (fourthLabel)
       {
              fourthLabel->hide();
              fourthLabel->setText("");
       }
       if (fifthCombo)
       {
              fifthCombo->hide();
              fifthCombo->clear();
       }
       if (fifthRegexpCheck)
       {
              fifthRegexpCheck->hide();
       }
       if (fifthLabel)
       {
              fifthLabel->hide();
              fifthLabel->setText("");
       }
       if (sixthCombo)
       {
              sixthCombo->hide();
              sixthCombo->clear();
       }
}

Here is the caller graph for this function:

void tfFilter::secondChanged ( int  index) [private, slot]

Definition at line 164 of file tffilter.cpp.

{

}

Here is the caller graph for this function:

Definition at line 138 of file tffilter.cpp.

{
       removeButton->setEnabled(b);
}
void tfFilter::sixthChanged ( int  index) [private, slot]

Definition at line 226 of file tffilter.cpp.

{

}

Here is the caller graph for this function:

void tfFilter::thirdChanged ( int  index) [private, slot]

Definition at line 169 of file tffilter.cpp.

{

}

Here is the caller graph for this function:


Member Data Documentation

QFrame* tfFilter::actionFrame [private]

Definition at line 45 of file tffilter.h.

QPushButton* tfFilter::addButton [private]

Definition at line 61 of file tffilter.h.

QBoxLayout* tfFilter::alayout [private]

Definition at line 43 of file tffilter.h.

QBoxLayout* tfFilter::blayout [private]

Definition at line 44 of file tffilter.h.

Definition at line 62 of file tffilter.h.

QCheckBox* tfFilter::enableCheck [private]

Definition at line 42 of file tffilter.h.

QComboBox* tfFilter::fifthCombo [private]

Definition at line 56 of file tffilter.h.

QLabel* tfFilter::fifthLabel [private]

Definition at line 58 of file tffilter.h.

QCheckBox* tfFilter::fifthRegexpCheck [private]

Definition at line 57 of file tffilter.h.

QComboBox* tfFilter::firstCombo [private]

Definition at line 46 of file tffilter.h.

QLabel* tfFilter::firstLabel [private]

Definition at line 47 of file tffilter.h.

QComboBox* tfFilter::fourthCombo [private]

Definition at line 54 of file tffilter.h.

QLabel* tfFilter::fourthLabel [private]

Definition at line 55 of file tffilter.h.

PrefsTable* tfFilter::history [private]

Definition at line 64 of file tffilter.h.

PrefsContext* tfFilter::prefs [private]

Definition at line 63 of file tffilter.h.

QPushButton* tfFilter::removeButton [private]

Definition at line 60 of file tffilter.h.

QComboBox* tfFilter::secondCombo [private]

Definition at line 48 of file tffilter.h.

QLabel* tfFilter::secondLabel [private]

Definition at line 50 of file tffilter.h.

QCheckBox* tfFilter::secondRegexpCheck [private]

Definition at line 49 of file tffilter.h.

QComboBox* tfFilter::sixthCombo [private]

Definition at line 59 of file tffilter.h.

QComboBox* tfFilter::thirdCombo [private]

Definition at line 51 of file tffilter.h.

QLabel* tfFilter::thirdLabel [private]

Definition at line 53 of file tffilter.h.


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