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 $
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>
40 #ifndef _EDIT_HXX //autogen
41 #include <vcl/edit.hxx>
43 #ifndef _LSTBOX_HXX //autogen
44 #include <vcl/lstbox.hxx>
46 #ifndef _BUTTON_HXX //autogen
47 #include <vcl/button.hxx>
49 #ifndef _GROUP_HXX //autogen
50 #include <vcl/group.hxx>
52 #ifndef _FIXED_HXX //autogen
53 #include <vcl/fixed.hxx>
55 #ifndef _DIALOG_HXX //autogen
56 #include <vcl/dialog.hxx>
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 ---------------------------------------------------------------
72 class SfxStyleSheetBasePool
;
73 class SvxJSearchOptionsPage
;
74 class SvxSearchController
;
76 struct SearchDlg_Impl
;
80 // struct SearchAttrItem -------------------------------------------------
88 // class SearchAttrItemList ----------------------------------------------
90 SV_DECL_VARARR_VISIBILITY(SrchAttrItemList
, SearchAttrItem
, 8, 8, SVX_DLLPUBLIC
)
92 class SVX_DLLPUBLIC SearchAttrItemList
: private SrchAttrItemList
95 SearchAttrItemList() {}
96 SearchAttrItemList( const SearchAttrItemList
& rList
);
97 ~SearchAttrItemList();
99 void Put( const SfxItemSet
& rSet
);
100 SfxItemSet
& Get( SfxItemSet
& rSet
);
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 );
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
;
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}
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.
146 <SvxSearchItem><SID_ATTR_SEARCH>
149 class SvxSearchDialog
: public SfxModelessDialog
151 friend class SvxSearchController
;
152 friend class SvxSearchDialogWrapper
;
153 friend class SvxJSearchOptionsDialog
;
156 SvxSearchDialog( Window
* pParent
, SfxBindings
& rBind
);
157 SvxSearchDialog( Window
* pParent
, SfxChildWindow
* pChildWin
, SfxBindings
& rBind
);
160 virtual BOOL
Close();
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
);
183 FixedText aSearchText
;
185 ListBox aSearchTmplLB
;
186 FixedInfo aSearchAttrText
;
188 FixedText aReplaceText
;
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
;
206 FixedLine aButtonsFL
;
207 MoreButton
* pMoreBtn
;
209 CancelButton aCloseBtn
;
211 FixedLine aOptionsFL
;
212 CheckBox aSelectionBtn
;
213 CheckBox aBackwardsBtn
;
215 CheckBox aSimilarityBox
;
216 PushButton aSimilarityBtn
;
219 CheckBox aJapMatchFullHalfWidthCB
;
220 CheckBox aJapOptionsCB
;
221 PushButton aJapOptionsBtn
;
223 PushButton aAttributeBtn
;
224 PushButton aFormatBtn
;
225 PushButton aNoFormatBtn
;
228 FixedText aCalcSearchInFT
;
229 ListBox aCalcSearchInLB
;
230 FixedText aCalcSearchDirFT
;
231 RadioButton aRowsBtn
;
232 RadioButton aColumnsBtn
;
233 CheckBox aAllSheetsCB
;
235 SfxBindings
& rBindings
;
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
);
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