26#include <kfinddialog.h>
28#include <kreplacedialog.h>
29#include "KoTextIterator.h"
30#include "KoTextFormat.h"
34#include <tqstringlist.h>
35#include <koffice_export.h>
56class KOTEXT_EXPORT KoSearchContext
64 Family = 1 * KFindDialog::MinimumUserOption,
65 Color = 2 * KFindDialog::MinimumUserOption,
66 Size = 4 * KFindDialog::MinimumUserOption,
67 Bold = 8 * KFindDialog::MinimumUserOption,
68 Italic = 16 * KFindDialog::MinimumUserOption,
69 Underline = 32 * KFindDialog::MinimumUserOption,
70 VertAlign = 64 * KFindDialog::MinimumUserOption,
71 StrikeOut = 128 * KFindDialog::MinimumUserOption,
72 BgColor = 256 * KFindDialog::MinimumUserOption,
73 Shadow = 512 * KFindDialog::MinimumUserOption,
74 WordByWord = 1024 * KFindDialog::MinimumUserOption,
75 Attribute = 2048 * KFindDialog::MinimumUserOption,
76 Language = 4096 * KFindDialog::MinimumUserOption
84 TQColor m_backGroundColor;
86 KoTextFormat::VerticalAlignment m_vertAlign;
87 KoTextFormat::UnderlineType m_underline;
88 KoTextFormat::StrikeOutType m_strikeOut;
89 KoTextFormat::AttributeStyle m_attribute;
91 TQStringList m_strings;
100class KoSearchContextUI :
public TQObject
105 KoSearchContextUI( KoSearchContext *ctx, TQWidget *parent );
106 void setCtxOptions(
long options );
107 void setCtxHistory(
const TQStringList & history );
108 KoSearchContext *context()
const {
return m_ctx;}
109 bool optionSelected()
const {
return m_bOptionsShown;}
111 void slotShowOptions();
114 KoSearchContext *m_ctx;
115 TQGridLayout *m_grid;
116 bool m_bOptionsShown;
117 TQPushButton *m_btnShowOptions;
124class KOTEXT_EXPORT KoSearchDia:
131 KoSearchDia( TQWidget *parent,
const char *name, KoSearchContext *find,
bool hasSelection,
bool hasCursor );
132 KoSearchContext * searchContext() {
133 return m_findUI->context();
135 bool optionSelected()
const {
return m_findUI->optionSelected();}
141 KoSearchContextUI *m_findUI;
147class KOTEXT_EXPORT KoReplaceDia:
148 public KReplaceDialog
155 KoReplaceDia( TQWidget *parent,
const char *name, KoSearchContext *find, KoSearchContext *replace,
bool hasSelection,
bool hasCursor );
156 KoSearchContext * searchContext() {
157 return m_findUI->context();
159 KoSearchContext * replaceContext() {
160 return m_replaceUI->context();
162 bool optionFindSelected()
const {
return m_findUI->optionSelected();}
163 bool optionReplaceSelected()
const {
return m_replaceUI->optionSelected();}
169 KoSearchContextUI *m_findUI;
170 KoSearchContextUI *m_replaceUI;
183 virtual bool validateMatch(
const TQString &text,
int index,
int matchedlength );
196 KoTextReplace(
const TQString &pattern,
const TQString &replacement,
long options,
KoFindReplace *_findReplace, TQWidget *parent = 0);
198 virtual bool validateMatch(
const TQString &text,
int index,
int matchedlength );
212 KoFindReplace( TQWidget * parent, KoSearchDia * dialog,
const TQValueList<KoTextObject *> & lstObject,
KoTextView* textView );
213 KoFindReplace( TQWidget * parent, KoReplaceDia * dialog,
const TQValueList<KoTextObject *> & lstObject,
KoTextView* textView );
216 KoTextParag *currentParag() {
217 return m_textIterator.currentParag();
220 bool isReplace()
const {
return m_replace != 0L; }
222 bool shouldRestart();
234 void setActiveWindow();
239 virtual void emitNewCommand(
KCommand *) = 0;
247 bool validateMatch(
const TQString &text,
int index,
int matchedlength );
250 void replaceWithAttribut( KoTextCursor * cursor,
int index );
252 long options()
const;
253 void setOptions(
long opt);
254 void removeHighlight();
255 bool needData()
const {
return m_find ? m_find->needData() : m_replace->needData(); }
256 void setData(
const TQString& data,
int startPos = -1 ) {
257 if ( m_find ) m_find->setData( data, startPos );
258 else m_replace->setData( data, startPos );
263 void optionsChanged();
265 void highlight(
const TQString &text,
int matchingIndex,
int matchingLength );
266 void replace(
const TQString &text,
int replacementIndex,
int replacedLength,
int searchLength );
267 void slotCurrentParagraphModified(
int,
int,
int );
270 void connectFind( KFind* find );
276 KoSearchContext m_searchContext;
277 KoSearchContext m_replaceContext;
278 bool m_searchContextEnabled;
281 bool m_currentParagraphModified;
302 KoFormatDia( TQWidget* parent,
const TQString & _caption, KoSearchContext *_ctx,
const char* name=0L);
310 TQCheckBox *m_checkFamily;
311 TQCheckBox *m_checkSize;
312 TQCheckBox *m_checkColor;
313 TQCheckBox *m_checkBgColor;
314 TQCheckBox *m_checkBold;
315 TQCheckBox *m_checkItalic;
316 TQCheckBox *m_checkShadow;
317 TQCheckBox *m_checkWordByWord;
318 TQCheckBox *m_checkUnderline;
319 TQCheckBox *m_checkVertAlign;
320 TQCheckBox *m_checkStrikeOut;
321 TQCheckBox *m_checkFontAttribute;
322 TQCheckBox *m_checkLanguage;
325 TQSpinBox *m_sizeItem;
328 TQRadioButton *m_boldYes;
329 TQRadioButton *m_boldNo;
330 TQRadioButton *m_italicYes;
331 TQRadioButton *m_italicNo;
332 TQRadioButton *m_shadowYes;
333 TQRadioButton *m_shadowNo;
334 TQRadioButton *m_wordByWordYes;
335 TQRadioButton *m_wordByWordNo;
337 TQComboBox *m_vertAlignItem;
338 TQComboBox *m_underlineItem;
339 TQComboBox *m_strikeOutItem;
340 TQComboBox *m_fontAttributeItem;
341 TQComboBox *m_languageItem;
342 KoSearchContext *m_ctx;
This class implements the 'find' functionality ( the "search next, prompt" loop ) and the 'replace' f...
virtual void highlightPortion(KoTextParag *parag, int index, int length, KoTextDocument *textdoc, KDialogBase *dialog)=0
Highlight a match.
Reimplement KFind to provide our own validateMatch - for the formatting options.
A convenient way to iterate over paragraphs, possibly in multiple textobjects, with many options (fro...
The KoTextObject is the high-level object that contains a KoTextDocument (the list of paragraphs),...
Reimplement KoReplace to provide our own validateMatch - for the formatting options.
Object that is created to edit a KoTextObject.
TDEAction * replace(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *name=0)
@ Size
size (width, height)