00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef koautoformatdia_h
00022 #define koautoformatdia_h
00023
00024 #include <kdialogbase.h>
00025 #include <qlineedit.h>
00026 #include <koAutoFormat.h>
00027 #include <koffice_export.h>
00028 class QPushButton;
00029 class QCheckBox;
00030 class QVBox;
00031 class QHBox;
00032 class KCharSelect;
00033 class KListView;
00034 class KLineEdit;
00035 class QListBox;
00036 class QSpinBox;
00037 class QComboBox;
00038 class KIntNumInput;
00042 class KoAutoFormatLineEdit : public QLineEdit
00043 {
00044 Q_OBJECT
00045 public:
00046 KoAutoFormatLineEdit ( QWidget * parent, const char * name=0 );
00047
00048 protected:
00049 virtual void keyPressEvent ( QKeyEvent * );
00050 signals:
00051 void keyReturnPressed();
00052 };
00053
00054
00055
00056
00057
00058 class KoAutoFormatExceptionWidget : public QWidget
00059 {
00060 Q_OBJECT
00061
00062 public:
00063 KoAutoFormatExceptionWidget(QWidget *_parent, const QString &name,const QStringList &_list, bool _autoInclude, bool _abbreviation=false);
00064
00065 void setListException( const QStringList &list);
00066 QStringList getListException(){return m_listException;}
00067 bool autoInclude();
00068 void setAutoInclude( bool b );
00069 protected slots:
00070 void slotAddException();
00071 void slotRemoveException();
00072 void textChanged ( const QString & );
00073 void slotExceptionListSelected();
00074 private:
00075 QListBox *exceptionList;
00076 KoAutoFormatLineEdit *exceptionLine;
00077 QPushButton *pbAddException,*pbRemoveException;
00078 QCheckBox *cbAutoInclude;
00079 QStringList m_listException;
00080 bool m_bAbbreviation;
00081 };
00082
00083
00084
00085
00086
00087 class KOTEXT_EXPORT KoAutoFormatDia : public KDialogBase
00088 {
00089 Q_OBJECT
00090
00091 public:
00092 KoAutoFormatDia( QWidget *parent, const char *name, KoAutoFormat * autoFormat );
00093 ~KoAutoFormatDia();
00094 void addEntryList(const QString &key, KoAutoFormatEntry *_autoEntry);
00095 void editEntryList(const QString &key,const QString &newFindString, KoAutoFormatEntry *_autoEntry);
00096 protected:
00097 bool applyConfig();
00098 void setupTab1();
00099 void setupTab2();
00100 void setupTab3();
00101 void setupTab4();
00102
00103 void refreshEntryList();
00104
00105 void initTab1();
00106 void initTab2();
00107 void initTab3();
00108 void initTab4();
00109
00110 typedef QMap<QString, QString> KoExceptionLanguageName;
00111 KoExceptionLanguageName exceptionLanguageName;
00112
00113 QWidget *tab1;
00114 QWidget *tab2;
00115 QWidget *tab3;
00116 QWidget *tab4;
00117
00118 QComboBox *autoFormatLanguage;
00119
00120 QCheckBox *cbTypographicSimpleQuotes, *cbTypographicDoubleQuotes,*cbUpperCase, *cbUpperUpper, *cbDetectUrl,
00121 *cbBackgroundSpellCheck, *cbAdvancedAutoCorrection,*cbIgnoreDoubleSpace , *cbRemoveSpaceBeginEndLine, *cbUseBulletStyle, *cbAutoChangeFormat, *cbAutoReplaceNumber, *cbUseNumberStyle, *cbAutoSuperScript, *cbAutoCorrectionWithFormat, *cbCapitalizeDaysName;
00122 QPushButton *pbDoubleQuote1, *pbDoubleQuote2, *pbRemove, *pbAdd, *pbDoubleDefault,
00123 *pbSpecialChar1, *pbSpecialChar2, *pbBulletStyle, *pbDefaultBulletStyle;
00124
00125 QPushButton *pbSimpleQuote1, *pbSimpleQuote2, *pbSimpleDefault;
00126 QPushButton *pbChangeFormat, *pbClearFormat;
00127 KCharSelect *charselect;
00128 KoAutoFormatLineEdit *m_find, *m_replace;
00129 KListView *m_pListView;
00130
00131 QChar oSimpleBegin, oSimpleEnd;
00132 QChar oDoubleBegin, oDoubleEnd;
00133
00134 QChar bulletStyle;
00135 KoAutoFormat m_autoFormat;
00136 KoAutoFormat * m_docAutoFormat;
00137
00138 KoAutoFormatExceptionWidget *abbreviation;
00139 KoAutoFormatExceptionWidget *twoUpperLetter;
00140
00141 KoAutoFormatEntry *newEntry;
00142
00143 QString initialLanguage;
00144 bool noSignal;
00145 bool changeLanguage;
00146
00147 bool autocorrectionEntryChanged;
00148 protected slots:
00149 virtual void slotOk();
00150 virtual void slotCancel();
00151
00152 void slotBulletStyleToggled( bool );
00153 void slotItemRenamed(QListViewItem * item, const QString & newText, int column);
00154 void slotRemoveEntry();
00155 void slotEditEntry();
00156 void slotfind( const QString & );
00157 void slotfind2( const QString & );
00158 void chooseSpecialChar1();
00159 void chooseSpecialChar2();
00160 void chooseDoubleQuote1();
00161 void chooseDoubleQuote2();
00162 void defaultDoubleQuote();
00163
00164 void chooseSimpleQuote1();
00165 void chooseSimpleQuote2();
00166 void defaultSimpleQuote();
00167
00168 void slotChangeStateSimple(bool);
00169 void slotChangeStateDouble(bool);
00170
00171 void slotAddEntry();
00172 void chooseBulletStyle();
00173 void defaultBulletStyle();
00174 void slotChangeTextFormatEntry();
00175 void slotResetConf();
00176 void changeAutoformatLanguage(const QString & );
00177 void slotClearTextFormatEntry();
00178 void slotChangeAdvancedAutoCorrection();
00179 };
00180
00181 class KOTEXT_EXPORT KoCompletionDia : public KDialogBase
00182 {
00183 Q_OBJECT
00184
00185 public:
00186 KoCompletionDia( QWidget *parent, const char *name, KoAutoFormat * autoFormat );
00187 protected slots:
00188 virtual void slotOk();
00189 void slotRemoveCompletionEntry();
00190 void slotCompletionWordSelected( const QString & );
00191 void slotSaveCompletionEntry();
00192 void slotAddCompletionEntry();
00193 void slotResetConf();
00194 bool applyConfig();
00195 void changeButtonStatus();
00196 protected:
00197 void setup();
00198 KoAutoFormat m_autoFormat;
00199 KoAutoFormat * m_docAutoFormat;
00200 QStringList m_listCompletion;
00201 QCheckBox *cbAllowCompletion, *cbAppendSpace, *cbAddCompletionWord, *cbShowToolTip;
00202 QPushButton *pbRemoveCompletionEntry;
00203 QPushButton *pbSaveCompletionEntry;
00204 QPushButton *pbAddCompletionEntry;
00205 QListBox *m_lbListCompletion;
00206 KIntNumInput *m_minWordLength;
00207 KIntNumInput *m_maxNbWordCompletion;
00208 QComboBox *m_completionKeyAction;
00209 QLabel *m_completionKeyActionLabel;
00210
00211 };
00212 #endif
00213
00214