Update ooo320-m1
[ooovba.git] / svx / inc / srchdlg.hxx
blob97a343e8d77777176446b0a2939bb5c94c822f6e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: srchdlg.hxx,v $
10 * $Revision: 1.18 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SVX_SRCHDLG_HXX
31 #define _SVX_SRCHDLG_HXX
33 // include ---------------------------------------------------------------
36 #include <svtools/stdctrl.hxx>
37 #ifndef _COMBOBOX_HXX //autogen
38 #include <vcl/combobox.hxx>
39 #endif
40 #ifndef _EDIT_HXX //autogen
41 #include <vcl/edit.hxx>
42 #endif
43 #ifndef _LSTBOX_HXX //autogen
44 #include <vcl/lstbox.hxx>
45 #endif
46 #ifndef _BUTTON_HXX //autogen
47 #include <vcl/button.hxx>
48 #endif
49 #ifndef _GROUP_HXX //autogen
50 #include <vcl/group.hxx>
51 #endif
52 #ifndef _FIXED_HXX //autogen
53 #include <vcl/fixed.hxx>
54 #endif
55 #ifndef _DIALOG_HXX //autogen
56 #include <vcl/dialog.hxx>
57 #endif
58 #include <sfx2/childwin.hxx>
59 #include <sfx2/basedlgs.hxx>
60 #include <svtools/svarray.hxx>
61 #define _SVSTDARR_STRINGSDTOR
62 #include <svtools/svstdarr.hxx>
63 #include <svtools/svmedit.hxx>
64 #include <sfx2/srchdefs.hxx>
65 #include "svx/svxdllapi.h"
68 // forward ---------------------------------------------------------------
70 class SvxSearchItem;
71 class MoreButton;
72 class SfxStyleSheetBasePool;
73 class SvxJSearchOptionsPage;
74 class SvxSearchController;
76 struct SearchDlg_Impl;
78 #ifndef NO_SVX_SEARCH
80 // struct SearchAttrItem -------------------------------------------------
82 struct SearchAttrItem
84 USHORT nSlot;
85 SfxPoolItem* pItem;
88 // class SearchAttrItemList ----------------------------------------------
90 SV_DECL_VARARR_VISIBILITY(SrchAttrItemList, SearchAttrItem, 8, 8, SVX_DLLPUBLIC)
92 class SVX_DLLPUBLIC SearchAttrItemList : private SrchAttrItemList
94 public:
95 SearchAttrItemList() {}
96 SearchAttrItemList( const SearchAttrItemList& rList );
97 ~SearchAttrItemList();
99 void Put( const SfxItemSet& rSet );
100 SfxItemSet& Get( SfxItemSet& rSet );
101 void Clear();
102 USHORT Count() const { return SrchAttrItemList::Count(); }
103 SearchAttrItem& operator[](USHORT nPos) const
104 { return SrchAttrItemList::operator[]( nPos ); }
105 SearchAttrItem& GetObject( USHORT nPos ) const
106 { return SrchAttrItemList::GetObject( nPos ); }
108 // der Pointer auf das Item wird nicht kopiert!!! (also nicht l"oschen)
109 void Insert( const SearchAttrItem& rItem )
110 { SrchAttrItemList::Insert( rItem, SrchAttrItemList::Count() ); }
111 // l"oscht die Pointer auf die Items
112 void Remove( USHORT nPos, USHORT nLen = 1 );
115 #ifndef SV_NODIALOG
117 // class SvxSearchDialogWrapper ------------------------------------------
119 #include <sfx2/layout.hxx>
120 #include <sfx2/layout-pre.hxx>
122 class SvxSearchDialog;
123 class SVX_DLLPUBLIC SvxSearchDialogWrapper : public SfxChildWindow
125 SvxSearchDialog *dialog;
126 public:
127 SvxSearchDialogWrapper( Window*pParent, USHORT nId,
128 SfxBindings* pBindings, SfxChildWinInfo* pInfo );
130 ~SvxSearchDialogWrapper ();
131 SvxSearchDialog *getDialog ();
132 SFX_DECL_CHILDWINDOW(SvxSearchDialogWrapper);
135 // class SvxSearchDialog -------------------------------------------------
138 {k:\svx\prototyp\dialog\srchdlg.hxx}
140 [Beschreibung]
141 In diesem Modeless-Dialog werden die Attribute einer Suche eingestellt
142 und damit eine Suche gestartet. Es sind mehrere Sucharten
143 ( Suchen, Alle suchen, Ersetzen, Alle ersetzen ) m"oglich.
145 [Items]
146 <SvxSearchItem><SID_ATTR_SEARCH>
149 class SvxSearchDialog : public SfxModelessDialog
151 friend class SvxSearchController;
152 friend class SvxSearchDialogWrapper;
153 friend class SvxJSearchOptionsDialog;
155 public:
156 SvxSearchDialog( Window* pParent, SfxBindings& rBind );
157 SvxSearchDialog( Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind );
158 ~SvxSearchDialog();
160 virtual BOOL Close();
162 // Window
163 virtual void Activate();
165 void GetSearchItems( SfxItemSet& rSet );
166 void GetReplaceItems( SfxItemSet& rSet );
168 const SearchAttrItemList* GetSearchItemList() const
169 { return pSearchList; }
170 const SearchAttrItemList* GetReplaceItemList() const
171 { return pReplaceList; }
173 inline BOOL HasSearchAttributes() const;
174 inline BOOL HasReplaceAttributes() const;
176 PushButton& GetReplaceBtn() { return aReplaceBtn; }
178 INT32 GetTransliterationFlags() const;
180 void SetSaveToModule(bool b);
182 private:
183 FixedText aSearchText;
184 ComboBox aSearchLB;
185 ListBox aSearchTmplLB;
186 FixedInfo aSearchAttrText;
188 FixedText aReplaceText;
189 ComboBox aReplaceLB;
190 ListBox aReplaceTmplLB;
191 FixedInfo aReplaceAttrText;
193 PushButton aSearchBtn;
194 PushButton aSearchAllBtn;
195 FixedLine aSearchCmdLine;
196 PushButton aReplaceBtn;
197 PushButton aReplaceAllBtn;
199 FixedLine aSearchComponentFL;
200 PushButton aSearchComponent1PB;
201 PushButton aSearchComponent2PB;
203 CheckBox aMatchCaseCB;
204 CheckBox aWordBtn;
206 FixedLine aButtonsFL;
207 MoreButton* pMoreBtn;
208 HelpButton aHelpBtn;
209 CancelButton aCloseBtn;
211 FixedLine aOptionsFL;
212 CheckBox aSelectionBtn;
213 CheckBox aBackwardsBtn;
214 CheckBox aRegExpBtn;
215 CheckBox aSimilarityBox;
216 PushButton aSimilarityBtn;
217 CheckBox aLayoutBtn;
218 CheckBox aNotesBtn;
219 CheckBox aJapMatchFullHalfWidthCB;
220 CheckBox aJapOptionsCB;
221 PushButton aJapOptionsBtn;
223 PushButton aAttributeBtn;
224 PushButton aFormatBtn;
225 PushButton aNoFormatBtn;
227 FixedLine aCalcFL;
228 FixedText aCalcSearchInFT;
229 ListBox aCalcSearchInLB;
230 FixedText aCalcSearchDirFT;
231 RadioButton aRowsBtn;
232 RadioButton aColumnsBtn;
233 CheckBox aAllSheetsCB;
235 SfxBindings& rBindings;
236 BOOL bWriter;
237 BOOL bSearch;
238 BOOL bFormat;
239 USHORT nOptions;
240 FASTBOOL bSet;
241 FASTBOOL bReadOnly;
242 FASTBOOL bConstruct;
243 ULONG nModifyFlag;
244 String aStylesStr;
245 String aLayoutStr;
246 LocalizedString aCalcStr;
248 SvStringsDtor aSearchStrings;
249 SvStringsDtor aReplaceStrings;
251 SearchDlg_Impl* pImpl;
252 SearchAttrItemList* pSearchList;
253 SearchAttrItemList* pReplaceList;
254 SvxSearchItem* pSearchItem;
256 SvxSearchController* pSearchController;
257 SvxSearchController* pOptionsController;
258 SvxSearchController* pFamilyController;
259 SvxSearchController* pSearchSetController;
260 SvxSearchController* pReplaceSetController;
262 mutable INT32 nTransliterationFlags;
264 #ifdef _SVX_SRCHDLG_CXX
265 DECL_LINK( ModifyHdl_Impl, ComboBox* pEdit );
266 DECL_LINK( FlagHdl_Impl, Control* pCtrl );
267 DECL_LINK( CommandHdl_Impl, Button* pBtn );
268 DECL_LINK( TemplateHdl_Impl, Button* );
269 DECL_LINK( FocusHdl_Impl, Control* );
270 DECL_LINK( LoseFocusHdl_Impl, Control* );
271 DECL_LINK( FormatHdl_Impl, Button* );
272 DECL_LINK( NoFormatHdl_Impl, Button* );
273 DECL_LINK( AttributeHdl_Impl, Button* );
274 DECL_LINK( TimeoutHdl_Impl, Timer* );
276 void Construct_Impl();
277 void InitControls_Impl();
278 void CalculateDelta_Impl();
279 void Init_Impl( int bHasItemSet );
280 void InitAttrList_Impl( const SfxItemSet* pSSet,
281 const SfxItemSet* pRSet );
282 void Remember_Impl( const String &rStr,BOOL bSearch );
283 void PaintAttrText_Impl();
284 String& BuildAttrText_Impl( String& rStr, BOOL bSrchFlag ) const;
286 void TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool );
287 void EnableControls_Impl( const USHORT nFlags );
288 void EnableControl_Impl( Control* pCtrl );
289 void SetItem_Impl( const SvxSearchItem* pItem );
291 void SetModifyFlag_Impl( const Control* pCtrl );
292 void SaveToModule_Impl();
294 void ApplyTransliterationFlags_Impl( INT32 nSettings );
295 #endif
298 #include <sfx2/layout-post.hxx>
300 inline BOOL SvxSearchDialog::HasSearchAttributes() const
302 int bLen = aSearchAttrText.GetText().Len();
303 return ( aSearchAttrText.IsEnabled() && bLen );
306 inline BOOL SvxSearchDialog::HasReplaceAttributes() const
308 int bLen = aReplaceAttrText.GetText().Len();
309 return ( aReplaceAttrText.IsEnabled() && bLen );
313 //////////////////////////////////////////////////////////////////////
316 #endif // SV_NODIALOG
317 #endif // NO_SVX_SEARCH
320 #endif