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