1 /* 2 For general Scribus (>=1.3.2) copyright and licensing information please refer 3 to the COPYING file provided with the program. Following this notice may exist 4 a copyright and/or license notice that predates the release of Scribus 1.3.2 5 for which a new license (GPL+exception) is in place. 6 */ 7 #ifndef TFFILTER_H 8 #define TFFILTER_H 9 10 #include <QWidget> 11 class QCheckBox; 12 class QBoxLayout; 13 class QFrame; 14 class QLabel; 15 class QCheckBox; 16 class QPushButton; 17 class QComboBox; 18 #include <prefstable.h> 19 #include <prefscontext.h> 20 21 enum Action { 22 REMOVE, 23 REPLACE, 24 APPLY 25 }; 26 27 enum MatchStyle { 28 ALL_PARAGRAPHS, 29 STARTS_WITH, 30 LESS_THAN, 31 MORE_THAN 32 }; 33 34 enum SecondaryAction { 35 REMOVE_MATCH, 36 DO_NOT_REMOVE_MATCH 37 }; 38 39 class tfFilter : public QWidget 40 { 41 Q_OBJECT 42 private: 43 QCheckBox* enableCheck; 44 QBoxLayout* alayout; 45 QBoxLayout* blayout; 46 QFrame* actionFrame; 47 QComboBox* firstCombo; 48 QLabel* firstLabel; 49 QComboBox* secondCombo; 50 QCheckBox* secondRegexpCheck; 51 QLabel* secondLabel; 52 QComboBox* thirdCombo; 53 // QCheckBox* thirdRegexpCheck; 54 QLabel* thirdLabel; 55 QComboBox* fourthCombo; 56 QLabel* fourthLabel; 57 QComboBox* fifthCombo; 58 QCheckBox* fifthRegexpCheck; 59 QLabel* fifthLabel; 60 QComboBox* sixthCombo; 61 QPushButton* removeButton; 62 QPushButton* addButton; 63 int currentAction; 64 PrefsContext* prefs; 65 PrefsTable* history; 66 void createWidget(); 67 void getFirstCombo(); 68 void getSecondCombo(); 69 void getThirdCombo(int secondIndex); 70 void getFourthCombo(); 71 void getFifthCombo(); 72 void getSixthCombo(); 73 void resetBRow(); 74 void getParagraphStyles(); 75 public: 76 tfFilter(QWidget *parent, const char *name, 77 int action, const QString& regExp, const QString& replace, const QString& pstyleName, 78 int less, int more, int style, bool match, bool enabled, bool regexp); 79 tfFilter(QWidget* parent = nullptr, const char *name = 0); 80 ~tfFilter(); 81 void setRemovable(bool b); 82 int getAction(); 83 QString regExp(); 84 QString replaceWith(); 85 QString getPStyleName(); 86 int getLessThan(); 87 int getMoreThan(); 88 int getStyle(); 89 bool removeMatch(); 90 bool isEnabled(); 91 bool isRegExp(); 92 signals: 93 void actionChanged(tfFilter* tff); 94 void removeClicked(tfFilter* tff); 95 void addClicked(tfFilter* tff); 96 private slots: 97 void enableToggled(bool on); 98 void addClick(); 99 void removeClick(); 100 void firstChanged(int index); 101 void secondChanged(int index); 102 void thirdChanged(int index); 103 void fourthChanged(int index); 104 void fifthChanged(int index); 105 void sixthChanged(int index); 106 }; 107 108 #endif // TFFILTER_H 109