26#include <tqvaluelist.h>
27#include <tqstringlist.h>
28#include <tqptrvector.h>
33#include <koffice_export.h>
38class KoVariableCollection;
49class KoCompletionBox :
public TQLabel
54 KoCompletionBox( TQWidget * parent = 0,
const char * name = 0, WFlags f = 0 );
57 void setLastWord(TQString
const &);
60 void mousePressEvent( TQMouseEvent * );
71class KoAutoFormatEntry
76 KoAutoFormatEntry(
const TQString& replace = TQString());
78 TQString
replace()
const {
return m_replace; }
79 void changeReplace(
const TQString & rep){ m_replace = rep; }
81 KoSearchContext *formatEntryContext()
const;
82 void createNewEntryContext();
83 void setFormatEntryContext( KoSearchContext * );
84 void clearFormatEntryContext( );
89 KoSearchContext *m_formatOptions;
92typedef TQMap< TQString, KoAutoFormatEntry > KoAutoFormatEntryMap;
97class KOTEXT_EXPORT KoAutoFormat
107 KoAutoFormat(
const KoAutoFormat& format );
111 enum KeyCompletionAction { Enter = 0, Tab = 1, Space = 2, End = 3, Right = 4};
118 void doAutoFormat( KoTextCursor* cursor, KoTextParag *parag,
int index, TQChar ch,
KoTextObject *txtObj );
123 bool doCompletion( KoTextCursor* textEditCursor, KoTextParag *parag,
int const index,
KoTextObject *txtObj );
125 bool doToolTipCompletion( KoTextCursor* textEditCursor, KoTextParag *parag,
int index,
KoTextObject *txtObj,
int keyPress );
126 void showToolTipBox(KoTextParag *parag,
int index, TQWidget *widget,
const TQPoint &pos);
127 void removeToolTipCompletion();
129 bool doIgnoreDoubleSpace( KoTextParag *parag,
int index,TQChar ch );
134 static TQString getLastWord( KoTextParag *parag,
int const index );
135 TQString getLastWord(
const int max_words, KoTextParag *parag,
int const index );
142 static TQString getWordAfterSpace( KoTextParag * parag,
int const index);
145 struct TypographicQuotes
152 void configTypographicDoubleQuotes( TypographicQuotes _tq );
153 void configTypographicSimpleQuotes( TypographicQuotes _tq );
155 void configUpperCase(
bool _uc );
156 void configUpperUpper(
bool _uu );
157 void configAdvancedAutocorrect(
bool _aa );
158 void configAutoDetectUrl(
bool _au);
159 void configIgnoreDoubleSpace(
bool _ids);
160 void configRemoveSpaceBeginEndLine(
bool _space);
161 void configUseBulletStyle(
bool _ubs);
163 void configBulletStyle( TQChar b );
165 void configAutoChangeFormat(
bool b);
167 void configAutoReplaceNumber(
bool b );
169 void configAutoNumberStyle(
bool b );
171 void configCompletion(
bool b );
173 void configToolTipCompletion(
bool b );
175 void configAppendSpace(
bool b);
177 void configMinWordLength( uint val );
179 void configNbMaxCompletionWord( uint val );
181 void configAddCompletionWord(
bool b );
183 void configIncludeTwoUpperUpperLetterException(
bool b);
185 void configIncludeAbbreviation(
bool b );
187 void configAutoSuperScript(
bool b );
189 void configCorrectionWithFormat(
bool b);
191 void configCapitalizeNameOfDays(
bool b);
193 void configAutoFormatLanguage(
const TQString &_lang);
195 void configKeyCompletionAction( KeyCompletionAction action );
197 TypographicQuotes getConfigTypographicSimpleQuotes()
const
198 {
return m_typographicSimpleQuotes; }
200 TypographicQuotes getConfigTypographicDoubleQuotes()
const
201 {
return m_typographicDoubleQuotes; }
203 TypographicQuotes getDefaultTypographicDoubleQuotes()
const
204 {
return m_typographicDefaultDoubleQuotes; }
206 TypographicQuotes getDefaultTypographicSimpleQuotes()
const
207 {
return m_typographicDefaultSimpleQuotes; }
209 bool getConfigUpperCase()
const
210 {
return m_convertUpperCase; }
211 bool getConfigUpperUpper()
const
212 {
return m_convertUpperUpper; }
213 bool getConfigAdvancedAutoCorrect()
const
214 {
return m_advancedAutoCorrect;}
215 bool getConfigAutoDetectUrl()
const
216 {
return m_autoDetectUrl;}
218 bool getConfigIgnoreDoubleSpace()
const
219 {
return m_ignoreDoubleSpace;}
221 bool getConfigRemoveSpaceBeginEndLine()
const
222 {
return m_removeSpaceBeginEndLine;}
224 bool getConfigUseBulletSyle()
const
225 {
return m_useBulletStyle;}
227 TQChar getConfigBulletStyle()
const
228 {
return m_bulletStyle; }
230 bool getConfigAutoChangeFormat()
const
231 {
return m_autoChangeFormat;}
233 bool getConfigAutoReplaceNumber()
const
234 {
return m_autoReplaceNumber; }
236 bool getConfigAutoNumberStyle()
const
237 {
return m_useAutoNumberStyle; }
239 bool getConfigCompletion()
const
240 {
return m_completion; }
242 bool getConfigToolTipCompletion()
const
243 {
return m_toolTipCompletion; }
245 bool getConfigAppendSpace()
const
246 {
return m_completionAppendSpace; }
248 uint getConfigMinWordLength()
const
249 {
return m_minCompletionWordLength; }
251 uint getConfigNbMaxCompletionWord()
const
252 {
return m_nbMaxCompletionWord; }
254 bool getConfigAddCompletionWord()
const
255 {
return m_addCompletionWord; }
257 bool getConfigIncludeTwoUpperUpperLetterException()
const
258 {
return m_includeTwoUpperLetterException; }
260 bool getConfigIncludeAbbreviation()
const
261 {
return m_includeAbbreviation; }
263 bool getConfigAutoSuperScript( )
const
264 {
return m_bAutoSuperScript; }
266 bool getConfigCorrectionWithFormat()
const
267 {
return m_bAutoCorrectionWithFormat; }
269 bool getConfigCapitalizeNameOfDays()
const
270 {
return m_bCapitalizeNameOfDays; }
272 TQString getConfigAutoFormatLanguage( )
const
273 {
return m_autoFormatLanguage;}
275 KeyCompletionAction getConfigKeyAction()
const
276 {
return m_keyCompletionAction;}
278 const TQDict<KoAutoFormatEntry> & getAutoFormatEntries()
const{
282 KoAutoFormatEntry * findFormatEntry(
const TQString & text) {
283 return m_entries[text];
287 void addAutoFormatEntry(
const TQString &key, KoAutoFormatEntry *entry ) {
288 m_entries.insert( key, entry );
292 void addAutoFormatEntry(
const TQString &key,
const TQString &replace );
295 void removeAutoFormatEntry(
const TQString &key ) {
296 m_entries.setAutoDelete(
true);
297 m_entries.remove( key );
298 m_entries.setAutoDelete(
false);
303 void copyAutoFormatEntries(
const KoAutoFormat & other )
304 { m_entries = other.m_entries; }
306 void copyListException(
const TQStringList & _list)
307 { m_upperCaseExceptions=_list;}
309 void copyListTwoUpperCaseException(
const TQStringList &_list)
310 { m_twoUpperLetterException=_list; }
312 TQStringList listException()
const {
return m_upperCaseExceptions;}
314 TQStringList listTwoUpperLetterException()
const {
return m_twoUpperLetterException;}
316 TQStringList listCompletion()
const;
318 TDECompletion *getCompletion()
const {
return m_listCompletion; }
320 int nbSuperScriptEntry()
const
321 {
return m_superScriptEntries.count(); }
324 void readConfig(
bool force =
false);
327 static bool isUpper(
const TQChar &c );
328 static bool isLower(
const TQChar &c );
329 static bool isMark(
const TQChar &c );
330 static bool isSeparator(
const TQChar &c );
332 void updateMaxWords();
335 KCommand *doAutoCorrect( KoTextCursor* textEditCursor, KoTextParag *parag,
int & index,
KoTextObject *txtObj );
336 KCommand *doUpperCase( KoTextCursor* textEditCursor, KoTextParag *parag,
int index,
const TQString & word ,
KoTextObject *txtObj );
337 KCommand * doTypographicQuotes( KoTextCursor* textEditCursor, KoTextParag *parag,
int index,
KoTextObject *txtObj,
bool doubleQuotes );
340 void doAutoDetectUrl( KoTextCursor *textEditCursor, KoTextParag *parag,
int & index, TQString & word,
KoTextObject *txtObj );
341 KCommand *doRemoveSpaceBeginEndLine( KoTextCursor *textEditCursor, KoTextParag *parag,
KoTextObject *txtObj,
int& index );
342 KCommand *doAutoChangeFormat( KoTextCursor *textEditCursor, KoTextParag *parag,
int index,
const TQString & word,
KoTextObject *txtObj );
343 KCommand *doUseBulletStyle(KoTextCursor *textEditCursor, KoTextParag *parag,
KoTextObject *txtObj,
int& index );
345 KCommand *doAutoReplaceNumber( KoTextCursor* textEditCursor, KoTextParag *parag,
int & index,
const TQString & word ,
KoTextObject *txtObj );
347 KCommand *doUseNumberStyle(KoTextCursor * , KoTextParag *parag,
KoTextObject *txtObj,
int& index );
349 void doAutoIncludeUpperUpper(KoTextCursor *textEditCursor, KoTextParag *parag,
KoTextObject *txtObj );
350 void doAutoIncludeAbbreviation(KoTextCursor *textEditCursor, KoTextParag *parag,
KoTextObject *txtObj );
352 KCommand *doAutoSuperScript( KoTextCursor* textEditCursor, KoTextParag *parag,
int index,
const TQString & word ,
KoTextObject *txtObj );
354 KCommand *doCapitalizeNameOfDays( KoTextCursor* textEditCursor, KoTextParag *parag,
int index,
const TQString & word ,
KoTextObject *txtObj );
356 static void changeTextFormat(KoSearchContext *formatOptions,
KoTextFormat * format,
int & flags );
357 void loadEntry(
const TQDomElement &nl,
bool _allLanguages =
false);
358 TQDomElement saveEntry( TQDictIterator<KoAutoFormatEntry> _entry, TQDomDocument doc);
360 void detectStartOfLink(KoTextParag * parag,
int const index,
bool const insertedDot);
361 void autoFormatIsActive();
362 void loadListOfWordCompletion();
363 void loadAutoCorrection(
const TQDomElement & _de,
bool _allLanguages =
false );
364 void loadAllLanguagesAutoCorrection();
365 KCommand *autoFormatWord( KoTextCursor* textEditCursor, KoTextParag *parag,
int &index,
KoTextObject *txtObj, TQString * _wordArray,
bool _allLanguages );
366 void readAutoCorrectConfig();
369 KoVariableCollection *m_varCollection;
372 TQString m_autoFormatLanguage;
374 bool m_convertUpperCase, m_convertUpperUpper,m_advancedAutoCorrect;
375 bool m_autoDetectUrl, m_ignoreDoubleSpace, m_removeSpaceBeginEndLine;
376 bool m_useBulletStyle, m_autoChangeFormat, m_autoReplaceNumber;
377 bool m_useAutoNumberStyle;
379 bool m_toolTipCompletion;
380 bool m_completionAppendSpace;
381 bool m_addCompletionWord;
382 bool m_includeTwoUpperLetterException;
383 bool m_includeAbbreviation;
384 bool m_ignoreUpperCase;
385 bool m_bAutoFormatActive;
387 bool m_bAutoSuperScript;
388 bool m_bAutoCorrectionWithFormat;
389 bool m_bCapitalizeNameOfDays;
392 TQChar m_bulletStyle;
394 TypographicQuotes m_typographicSimpleQuotes;
396 TypographicQuotes m_typographicDoubleQuotes;
398 TypographicQuotes m_typographicDefaultDoubleQuotes;
400 TypographicQuotes m_typographicDefaultSimpleQuotes;
402 TDECompletion *m_listCompletion;
404 TQDict<KoAutoFormatEntry> m_entries;
405 TQDict<KoAutoFormatEntry> m_allLanguages;
407 KoAutoFormatEntryMap m_superScriptEntries;
409 TQStringList m_upperCaseExceptions;
410 TQStringList m_twoUpperLetterException;
412 uint m_maxFindLength;
413 uint m_minCompletionWordLength;
414 uint m_nbMaxCompletionWord;
415 uint m_countMaxWords;
416 TQStringList m_cacheNameOfDays;
417 KoCompletionBox *m_completionBox;
418 KeyCompletionAction m_keyCompletionAction;
The KOffice document class.
Each character (KoTextStringChar) points to a KoTextFormat that defines the formatting of that charac...
The KoTextObject is the high-level object that contains a KoTextDocument (the list of paragraphs),...
TDEAction * replace(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *name=0)