Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SVX_SRCHDLG_HXX
29 : : #define _SVX_SRCHDLG_HXX
30 : :
31 : : #include <svtools/stdctrl.hxx>
32 : : #include <vcl/combobox.hxx>
33 : : #include <vcl/edit.hxx>
34 : : #include <vcl/lstbox.hxx>
35 : : #include <vcl/button.hxx>
36 : : #include <vcl/group.hxx>
37 : : #include <vcl/fixed.hxx>
38 : : #include <vcl/dialog.hxx>
39 : : #include <sfx2/childwin.hxx>
40 : : #include <sfx2/basedlgs.hxx>
41 : : #include <svtools/svmedit.hxx>
42 : : #include <svl/srchdefs.hxx>
43 : : #include "svx/svxdllapi.h"
44 : : #include <vector>
45 : :
46 : : class SvxSearchItem;
47 : : class MoreButton;
48 : : class SfxStyleSheetBasePool;
49 : : class SvxJSearchOptionsPage;
50 : : class SvxSearchController;
51 : :
52 : : struct SearchDlg_Impl;
53 : :
54 : : #ifndef NO_SVX_SEARCH
55 : :
56 : : // struct SearchAttrItem -------------------------------------------------
57 : :
58 : : struct SearchAttrItem
59 : : {
60 : : sal_uInt16 nSlot;
61 : : SfxPoolItem* pItem;
62 : : };
63 : :
64 : : // class SearchAttrItemList ----------------------------------------------
65 : :
66 : : typedef std::vector<SearchAttrItem> SrchAttrItemList;
67 : :
68 : : class SVX_DLLPUBLIC SearchAttrItemList : private SrchAttrItemList
69 : : {
70 : : public:
71 : : SearchAttrItemList() {}
72 : : SearchAttrItemList( const SearchAttrItemList& rList );
73 : : ~SearchAttrItemList();
74 : :
75 : : void Put( const SfxItemSet& rSet );
76 : : SfxItemSet& Get( SfxItemSet& rSet );
77 : : void Clear();
78 : 0 : sal_uInt16 Count() const { return SrchAttrItemList::size(); }
79 : 0 : SearchAttrItem& operator[](sal_uInt16 nPos)
80 : 0 : { return SrchAttrItemList::operator[]( nPos ); }
81 : : SearchAttrItem& GetObject( sal_uInt16 nPos )
82 : : { return SrchAttrItemList::operator[]( nPos ); }
83 : :
84 : : // the pointer to the item is not being copied, so don't delete
85 : 0 : void Insert( const SearchAttrItem& rItem )
86 : 0 : { SrchAttrItemList::push_back( rItem ); }
87 : : // deletes the pointer to the items
88 : : void Remove(size_t nPos, size_t nLen = 1);
89 : : };
90 : :
91 : : #ifndef SV_NODIALOG
92 : :
93 : : // class SvxSearchDialogWrapper ------------------------------------------
94 : :
95 : : class SvxSearchDialog;
96 : : class SVX_DLLPUBLIC SvxSearchDialogWrapper : public SfxChildWindow
97 : : {
98 : : SvxSearchDialog *dialog;
99 : : public:
100 : : SvxSearchDialogWrapper( Window*pParent, sal_uInt16 nId,
101 : : SfxBindings* pBindings, SfxChildWinInfo* pInfo );
102 : :
103 : : ~SvxSearchDialogWrapper ();
104 : : SvxSearchDialog *getDialog ();
105 : : SFX_DECL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper);
106 : : };
107 : :
108 : : // class SvxSearchDialog -------------------------------------------------
109 : :
110 : : /*
111 : : {k:\svx\prototyp\dialog\svx/srchdlg.hxx}
112 : :
113 : : [Description]
114 : : In this modeless dialog the attributes for a search are configured
115 : : and a search is started from it. Several search types
116 : : (search, search all, replace, replace all) are possible.
117 : :
118 : : [Items]
119 : : <SvxSearchItem><SID_ATTR_SEARCH>
120 : : */
121 : :
122 : : class SvxSearchDialog : public SfxModelessDialog
123 : : {
124 : : friend class SvxSearchController;
125 : : friend class SvxSearchDialogWrapper;
126 : : friend class SvxJSearchOptionsDialog;
127 : :
128 : : public:
129 : : SvxSearchDialog( Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind );
130 : : ~SvxSearchDialog();
131 : :
132 : : virtual sal_Bool Close();
133 : :
134 : : // Window
135 : : virtual void Activate();
136 : :
137 : 0 : const SearchAttrItemList* GetSearchItemList() const
138 : 0 : { return pSearchList; }
139 : 0 : const SearchAttrItemList* GetReplaceItemList() const
140 : 0 : { return pReplaceList; }
141 : :
142 : : inline sal_Bool HasSearchAttributes() const;
143 : : inline sal_Bool HasReplaceAttributes() const;
144 : :
145 : : PushButton& GetReplaceBtn() { return aReplaceBtn; }
146 : :
147 : : sal_Int32 GetTransliterationFlags() const;
148 : :
149 : : void SetSaveToModule(bool b);
150 : :
151 : : private:
152 : : FixedText aSearchText;
153 : : ComboBox aSearchLB;
154 : : ListBox aSearchTmplLB;
155 : : FixedInfo aSearchAttrText;
156 : :
157 : : FixedText aReplaceText;
158 : : ComboBox aReplaceLB;
159 : : ListBox aReplaceTmplLB;
160 : : FixedInfo aReplaceAttrText;
161 : :
162 : : PushButton aSearchBtn;
163 : : PushButton aSearchAllBtn;
164 : : FixedLine aSearchCmdLine;
165 : : PushButton aReplaceBtn;
166 : : PushButton aReplaceAllBtn;
167 : :
168 : : FixedLine aSearchComponentFL;
169 : : PushButton aSearchComponent1PB;
170 : : PushButton aSearchComponent2PB;
171 : :
172 : : CheckBox aMatchCaseCB;
173 : : CheckBox aWordBtn;
174 : :
175 : : FixedLine aButtonsFL;
176 : : MoreButton* pMoreBtn;
177 : : HelpButton aHelpBtn;
178 : : CancelButton aCloseBtn;
179 : :
180 : : FixedLine aOptionsFL;
181 : : CheckBox aSelectionBtn;
182 : : CheckBox aBackwardsBtn;
183 : : CheckBox aRegExpBtn;
184 : : CheckBox aSimilarityBox;
185 : : PushButton aSimilarityBtn;
186 : : CheckBox aLayoutBtn;
187 : : CheckBox aNotesBtn;
188 : : CheckBox aJapMatchFullHalfWidthCB;
189 : : CheckBox aJapOptionsCB;
190 : : PushButton aJapOptionsBtn;
191 : :
192 : : PushButton aAttributeBtn;
193 : : PushButton aFormatBtn;
194 : : PushButton aNoFormatBtn;
195 : :
196 : : FixedLine aCalcFL;
197 : : FixedText aCalcSearchInFT;
198 : : ListBox aCalcSearchInLB;
199 : : FixedText aCalcSearchDirFT;
200 : : RadioButton aRowsBtn;
201 : : RadioButton aColumnsBtn;
202 : : CheckBox aAllSheetsCB;
203 : :
204 : : SfxBindings& rBindings;
205 : : sal_Bool bWriter;
206 : : sal_Bool bSearch;
207 : : sal_Bool bFormat;
208 : : sal_uInt16 nOptions;
209 : : bool bSet;
210 : : bool bReadOnly;
211 : : bool bConstruct;
212 : : sal_uIntPtr nModifyFlag;
213 : : String aStylesStr;
214 : : String aLayoutStr;
215 : : String aCalcStr;
216 : :
217 : : std::vector<rtl::OUString> aSearchStrings;
218 : : std::vector<rtl::OUString> aReplaceStrings;
219 : :
220 : : SearchDlg_Impl* pImpl;
221 : : SearchAttrItemList* pSearchList;
222 : : SearchAttrItemList* pReplaceList;
223 : : SvxSearchItem* pSearchItem;
224 : :
225 : : SvxSearchController* pSearchController;
226 : : SvxSearchController* pOptionsController;
227 : : SvxSearchController* pFamilyController;
228 : : SvxSearchController* pSearchSetController;
229 : : SvxSearchController* pReplaceSetController;
230 : :
231 : : mutable sal_Int32 nTransliterationFlags;
232 : :
233 : : #ifdef _SVX_SRCHDLG_CXX
234 : : DECL_LINK( ModifyHdl_Impl, ComboBox* pEdit );
235 : : DECL_LINK( FlagHdl_Impl, Control* pCtrl );
236 : : DECL_LINK( CommandHdl_Impl, Button* pBtn );
237 : : DECL_LINK(TemplateHdl_Impl, void *);
238 : : DECL_LINK( FocusHdl_Impl, Control* );
239 : : DECL_LINK(LoseFocusHdl_Impl, void *);
240 : : DECL_LINK(FormatHdl_Impl, void *);
241 : : DECL_LINK(NoFormatHdl_Impl, void *);
242 : : DECL_LINK(AttributeHdl_Impl, void *);
243 : : DECL_LINK( TimeoutHdl_Impl, Timer* );
244 : :
245 : : void Construct_Impl();
246 : : void InitControls_Impl();
247 : : void CalculateDelta_Impl();
248 : : void Init_Impl( int bHasItemSet );
249 : : void InitAttrList_Impl( const SfxItemSet* pSSet,
250 : : const SfxItemSet* pRSet );
251 : : void Remember_Impl( const String &rStr,sal_Bool bSearch );
252 : : void PaintAttrText_Impl();
253 : : String& BuildAttrText_Impl( String& rStr, sal_Bool bSrchFlag ) const;
254 : :
255 : : void TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool );
256 : : void EnableControls_Impl( const sal_uInt16 nFlags );
257 : : void EnableControl_Impl( Control* pCtrl );
258 : : void SetItem_Impl( const SvxSearchItem* pItem );
259 : :
260 : : void SetModifyFlag_Impl( const Control* pCtrl );
261 : : void SaveToModule_Impl();
262 : :
263 : : void ApplyTransliterationFlags_Impl( sal_Int32 nSettings );
264 : : #endif
265 : : };
266 : :
267 : : inline sal_Bool SvxSearchDialog::HasSearchAttributes() const
268 : : {
269 : : int bLen = aSearchAttrText.GetText().Len();
270 : : return ( aSearchAttrText.IsEnabled() && bLen );
271 : : }
272 : :
273 : : inline sal_Bool SvxSearchDialog::HasReplaceAttributes() const
274 : : {
275 : : int bLen = aReplaceAttrText.GetText().Len();
276 : : return ( aReplaceAttrText.IsEnabled() && bLen );
277 : : }
278 : :
279 : :
280 : : //////////////////////////////////////////////////////////////////////
281 : :
282 : :
283 : : #endif // SV_NODIALOG
284 : : #endif // NO_SVX_SEARCH
285 : :
286 : :
287 : : #endif
288 : :
289 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|