lib

KoAutoFormatDia.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
00003                  2001       Sven Leiber         <s.leiber@web.de>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef koautoformatdia_h
00022 #define koautoformatdia_h
00023 
00024 #include <kdialogbase.h>
00025 #include <qlineedit.h>
00026 #include <KoAutoFormat.h>
00027 class QCheckBox;
00028 class KCharSelect;
00029 class QComboBox;
00030 
00031 
00035 class KoAutoFormatLineEdit : public QLineEdit
00036 {
00037     Q_OBJECT
00038 public:
00039     KoAutoFormatLineEdit ( QWidget * parent, const char * name=0 );
00040 
00041 protected:
00042     virtual void keyPressEvent ( QKeyEvent * );
00043  signals:
00044     void keyReturnPressed();
00045 };
00046 
00047 /******************************************************************/
00048 /* Class: KoAutoFormatExceptionWidget                             */
00049 /******************************************************************/
00050 
00051 class KoAutoFormatExceptionWidget : public QWidget
00052 {
00053     Q_OBJECT
00054 
00055 public:
00056     KoAutoFormatExceptionWidget(QWidget *_parent, const QString &name,const QStringList &_list, bool _autoInclude, bool _abbreviation=false);
00057 
00058     void setListException( const QStringList &list);
00059     QStringList getListException(){return m_listException;}
00060     bool autoInclude();
00061     void setAutoInclude( bool b );
00062 protected slots:
00063     void slotAddException();
00064     void slotRemoveException();
00065     void textChanged ( const QString & );
00066     void slotExceptionListSelected();
00067  private:
00068     QListBox *exceptionList;
00069     KoAutoFormatLineEdit *exceptionLine;
00070     QPushButton *pbAddException,*pbRemoveException;
00071     QCheckBox *cbAutoInclude;
00072     QStringList m_listException;
00073     bool m_bAbbreviation;
00074 };
00075 
00076 /******************************************************************/
00077 /* Class: KoAutoFormatDia                                         */
00078 /******************************************************************/
00079 
00080 class KOTEXT_EXPORT KoAutoFormatDia : public KDialogBase
00081 {
00082     Q_OBJECT
00083 
00084 public:
00085     KoAutoFormatDia( QWidget *parent, const char *name, KoAutoFormat * autoFormat );
00086     ~KoAutoFormatDia();
00087     void addEntryList(const QString &key, KoAutoFormatEntry *_autoEntry);
00088     void editEntryList(const QString &key,const QString &newFindString, KoAutoFormatEntry *_autoEntry);
00089 protected:
00090     bool applyConfig();
00091     void setupTab1();
00092     void setupTab2();
00093     void setupTab3();
00094     void setupTab4();
00095 
00096     void refreshEntryList();
00097 
00098     void initTab1();
00099     void initTab2();
00100     void initTab3();
00101     void initTab4();
00102 
00103     typedef QMap<QString, QString> KoExceptionLanguageName;
00104     KoExceptionLanguageName exceptionLanguageName;
00105 
00106     QWidget *tab1;
00107     QWidget *tab2;
00108     QWidget *tab3;
00109     QWidget *tab4;
00110 
00111     QComboBox *autoFormatLanguage;
00112 
00113     QCheckBox *cbTypographicSimpleQuotes, *cbTypographicDoubleQuotes,*cbUpperCase, *cbUpperUpper, *cbDetectUrl,
00114         *cbBackgroundSpellCheck, *cbAdvancedAutoCorrection,*cbIgnoreDoubleSpace , *cbRemoveSpaceBeginEndLine, *cbUseBulletStyle, *cbAutoChangeFormat, *cbAutoReplaceNumber, *cbUseNumberStyle, *cbAutoSuperScript, *cbAutoCorrectionWithFormat, *cbCapitalizeDaysName;
00115     QPushButton *pbDoubleQuote1, *pbDoubleQuote2,  *pbRemove, *pbAdd, *pbDoubleDefault,
00116                 *pbSpecialChar1, *pbSpecialChar2, *pbBulletStyle, *pbDefaultBulletStyle;
00117 
00118     QPushButton *pbSimpleQuote1, *pbSimpleQuote2, *pbSimpleDefault;
00119     QPushButton *pbChangeFormat, *pbClearFormat;
00120     KCharSelect *charselect;
00121     KoAutoFormatLineEdit *m_find, *m_replace;
00122     KListView *m_pListView;
00123 
00124     QChar oSimpleBegin, oSimpleEnd;
00125     QChar oDoubleBegin, oDoubleEnd;
00126 
00127     QChar bulletStyle;
00128     KoAutoFormat m_autoFormat; // The copy we're working on
00129     KoAutoFormat * m_docAutoFormat; // Pointer to the real one (in KWDocument)
00130 
00131     KoAutoFormatExceptionWidget *abbreviation;
00132     KoAutoFormatExceptionWidget *twoUpperLetter;
00133 
00134     KoAutoFormatEntry *newEntry;
00135 
00136     QString initialLanguage;
00137     bool noSignal;
00138     bool changeLanguage;
00139 
00140     bool autocorrectionEntryChanged;
00141 protected slots:
00142     virtual void slotOk();
00143     virtual void slotCancel();
00144 
00145     void slotBulletStyleToggled( bool );
00146     void slotItemRenamed(QListViewItem * item, const QString & newText, int column);
00147     void slotRemoveEntry();
00148     void slotEditEntry();
00149     void slotfind( const QString & );
00150     void slotfind2( const QString & );
00151     void chooseSpecialChar1();
00152     void chooseSpecialChar2();
00153     void chooseDoubleQuote1();
00154     void chooseDoubleQuote2();
00155     void defaultDoubleQuote();
00156 
00157     void chooseSimpleQuote1();
00158     void chooseSimpleQuote2();
00159     void defaultSimpleQuote();
00160 
00161     void slotChangeStateSimple(bool);
00162     void slotChangeStateDouble(bool);
00163 
00164     void slotAddEntry();
00165     void chooseBulletStyle();
00166     void defaultBulletStyle();
00167     void slotChangeTextFormatEntry();
00168     void slotResetConf();
00169     void changeAutoformatLanguage(const QString & );
00170     void slotClearTextFormatEntry();
00171     void slotChangeAdvancedAutoCorrection();
00172 };
00173 
00174 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys