summaryrefslogtreecommitdiffstats
path: root/lib/kotext/KoAutoFormatDia.h
blob: 341903c81face568623facc3435820d1588eedcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/* This file is part of the KDE project
   Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
                 2001       Sven Leiber         <s.leiber@web.de>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
*/

#ifndef koautoformatdia_h
#define koautoformatdia_h

#include <kdialogbase.h>
#include <tqlineedit.h>
#include <KoAutoFormat.h>
class TQCheckBox;
class KCharSelect;
class TQComboBox;


/**
 *
 */
class KoAutoFormatLineEdit : public TQLineEdit
{
    TQ_OBJECT
  
public:
    KoAutoFormatLineEdit ( TQWidget * parent, const char * name=0 );

protected:
    virtual void keyPressEvent ( TQKeyEvent * );
 signals:
    void keyReturnPressed();
};

/******************************************************************/
/* Class: KoAutoFormatExceptionWidget                             */
/******************************************************************/

class KoAutoFormatExceptionWidget : public TQWidget
{
    TQ_OBJECT
  

public:
    KoAutoFormatExceptionWidget(TQWidget *_parent, const TQString &name,const TQStringList &_list, bool _autoInclude, bool _abbreviation=false);

    void setListException( const TQStringList &list);
    TQStringList getListException(){return m_listException;}
    bool autoInclude();
    void setAutoInclude( bool b );
protected slots:
    void slotAddException();
    void slotRemoveException();
    void textChanged ( const TQString & );
    void slotExceptionListSelected();
 private:
    TQListBox *exceptionList;
    KoAutoFormatLineEdit *exceptionLine;
    TQPushButton *pbAddException,*pbRemoveException;
    TQCheckBox *cbAutoInclude;
    TQStringList m_listException;
    bool m_bAbbreviation;
};

/******************************************************************/
/* Class: KoAutoFormatDia                                         */
/******************************************************************/

class KOTEXT_EXPORT KoAutoFormatDia : public KDialogBase
{
    TQ_OBJECT
  

public:
    KoAutoFormatDia( TQWidget *parent, const char *name, KoAutoFormat * autoFormat );
    ~KoAutoFormatDia();
    void addEntryList(const TQString &key, KoAutoFormatEntry *_autoEntry);
    void editEntryList(const TQString &key,const TQString &newFindString, KoAutoFormatEntry *_autoEntry);
protected:
    bool applyConfig();
    void setupTab1();
    void setupTab2();
    void setupTab3();
    void setupTab4();

    void refreshEntryList();

    void initTab1();
    void initTab2();
    void initTab3();
    void initTab4();

    typedef TQMap<TQString, TQString> KoExceptionLanguageName;
    KoExceptionLanguageName exceptionLanguageName;

    TQWidget *tab1;
    TQWidget *tab2;
    TQWidget *tab3;
    TQWidget *tab4;

    TQComboBox *autoFormatLanguage;

    TQCheckBox *cbTypographicSimpleQuotes, *cbTypographicDoubleQuotes,*cbUpperCase, *cbUpperUpper, *cbDetectUrl,
        *cbBackgroundSpellCheck, *cbAdvancedAutoCorrection,*cbIgnoreDoubleSpace , *cbRemoveSpaceBeginEndLine, *cbUseBulletStyle, *cbAutoChangeFormat, *cbAutoReplaceNumber, *cbUseNumberStyle, *cbAutoSuperScript, *cbAutoCorrectionWithFormat, *cbCapitalizeDaysName;
    TQPushButton *pbDoubleQuote1, *pbDoubleQuote2, /**pbEdit,*/ *pbRemove, *pbAdd, *pbDoubleDefault,
                *pbSpecialChar1, *pbSpecialChar2, *pbBulletStyle, *pbDefaultBulletStyle;

    TQPushButton *pbSimpleQuote1, *pbSimpleQuote2, *pbSimpleDefault;
    TQPushButton *pbChangeFormat, *pbClearFormat;
    KCharSelect *charselect;
    KoAutoFormatLineEdit *m_find, *m_replace;
    TDEListView *m_pListView;

    TQChar oSimpleBegin, oSimpleEnd;
    TQChar oDoubleBegin, oDoubleEnd;

    TQChar bulletStyle;
    KoAutoFormat m_autoFormat; // The copy we're working on
    KoAutoFormat * m_docAutoFormat; // Pointer to the real one (in KWDocument)

    KoAutoFormatExceptionWidget *abbreviation;
    KoAutoFormatExceptionWidget *twoUpperLetter;

    KoAutoFormatEntry *newEntry;

    TQString initialLanguage;
    bool noSignal;
    bool changeLanguage;

    bool autocorrectionEntryChanged;
protected slots:
    virtual void slotOk();
    virtual void slotCancel();

    void slotBulletStyleToggled( bool );
    void slotItemRenamed(TQListViewItem * item, const TQString & newText, int column);
    void slotRemoveEntry();
    void slotEditEntry();
    void slotfind( const TQString & );
    void slotfind2( const TQString & );
    void chooseSpecialChar1();
    void chooseSpecialChar2();
    void chooseDoubleQuote1();
    void chooseDoubleQuote2();
    void defaultDoubleQuote();

    void chooseSimpleQuote1();
    void chooseSimpleQuote2();
    void defaultSimpleQuote();

    void slotChangeStateSimple(bool);
    void slotChangeStateDouble(bool);

    void slotAddEntry();
    void chooseBulletStyle();
    void defaultBulletStyle();
    void slotChangeTextFormatEntry();
    void slotResetConf();
    void changeAutoformatLanguage(const TQString & );
    void slotClearTextFormatEntry();
    void slotChangeAdvancedAutoCorrection();
};

#endif