LibreOffice Module svx (master)  1
srchdlg.hxx
Go to the documentation of this file.
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 INCLUDED_SVX_SRCHDLG_HXX
20 #define INCLUDED_SVX_SRCHDLG_HXX
21 
22 #include <sfx2/childwin.hxx>
23 #include <sfx2/basedlgs.hxx>
24 #include <svl/poolitem.hxx>
25 #include <svl/srchdefs.hxx>
26 #include <svl/srchitem.hxx>
27 #include <svx/svxdllapi.h>
28 #include <vcl/timer.hxx>
29 #include <memory>
30 #include <vector>
31 
32 class SvxSearchItem;
36 class VclAbstractDialog;
37 struct SearchDlg_Impl;
38 enum class ModifyFlags;
39 enum class TransliterationFlags;
40 
42 {
43  sal_uInt16 nSlot;
45 };
46 
47 typedef std::vector<SearchAttrItem> SrchAttrItemList;
48 
50 {
51 public:
53  SearchAttrItemList( const SearchAttrItemList& rList );
55 
56  void Put( const SfxItemSet& rSet );
57  SfxItemSet& Get( SfxItemSet& rSet );
58  void Clear();
59  sal_uInt16 Count() const { return SrchAttrItemList::size(); }
60  SearchAttrItem& operator[](sal_uInt16 nPos)
61  { return SrchAttrItemList::operator[]( nPos ); }
62  SearchAttrItem& GetObject( sal_uInt16 nPos )
63  { return SrchAttrItemList::operator[]( nPos ); }
64 
65  // the pointer to the item is not being copied, so don't delete
66  void Insert( const SearchAttrItem& rItem )
67  { SrchAttrItemList::push_back( rItem ); }
68  // deletes the pointer to the items
69  void Remove(size_t nPos);
70 };
71 
72 enum class SearchLabel
73 {
74  Empty,
75  End,
76  Start,
77  EndSheet,
78  NotFound,
80  EndWrapped,
84 };
85 
86 class SvxSearchDialog;
88 {
89  std::shared_ptr<SvxSearchDialog> dialog;
90 public:
91  SvxSearchDialogWrapper( vcl::Window*pParent, sal_uInt16 nId,
92  SfxBindings* pBindings, SfxChildWinInfo const * pInfo );
93 
94  virtual ~SvxSearchDialogWrapper () override;
95  SvxSearchDialog *getDialog () { return dialog.get();}
96  static void SetSearchLabel(const SearchLabel& rSL);
97  static void SetSearchLabel(const OUString& sStr);
98  static OUString GetSearchLabel();
100 };
101 
110 {
111 friend class SvxSearchController;
114 
115 public:
116  SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind );
117  virtual ~SvxSearchDialog() override;
118 
119  virtual void ChildWinDispose() override;
120  virtual void Close() override;
121 
122  // Window
123  virtual void Activate() override;
124 
126  { return pSearchList.get(); }
128  { return pReplaceList.get(); }
129 
131 
132  void SetSaveToModule(bool b);
133 
134  void SetSearchLabel(const OUString& rStr);
135 
136  // bring this window back to the foreground
137  void Present();
138 
139 private:
142  bool bWriter;
143  bool bSearch;
144  bool bFormat;
147  bool bSet;
150  OUString aStylesStr;
151  OUString aLayoutStr;
153  OUString aLayoutCalcStr;
154  OUString aCalcStr;
155  sal_uInt16 nRememberSize;
156 
157  std::vector<OUString> aSearchStrings;
158  std::vector<OUString> aReplaceStrings;
159 
160  std::unique_ptr<SearchDlg_Impl> pImpl;
161  std::unique_ptr<SearchAttrItemList> pSearchList;
162  std::unique_ptr<SearchAttrItemList> pReplaceList;
163  std::unique_ptr<SvxSearchItem> pSearchItem;
164 
165  std::unique_ptr<SvxSearchController> pSearchController;
166  std::unique_ptr<SvxSearchController> pOptionsController;
167  std::unique_ptr<SvxSearchController> pFamilyController;
168 
169  mutable TransliterationFlags
171 
172  bool m_executingSubDialog = false;
173 
174  std::unique_ptr<weld::Frame> m_xSearchFrame;
175  std::unique_ptr<weld::ComboBox> m_xSearchLB;
176  std::unique_ptr<weld::ComboBox> m_xSearchTmplLB;
177  std::unique_ptr<weld::Label> m_xSearchAttrText;
178  std::unique_ptr<weld::Label> m_xSearchLabel;
179 
180  std::unique_ptr<weld::Frame> m_xReplaceFrame;
181  std::unique_ptr<weld::ComboBox> m_xReplaceLB;
182  std::unique_ptr<weld::ComboBox> m_xReplaceTmplLB;
183  std::unique_ptr<weld::Label> m_xReplaceAttrText;
184 
185  std::unique_ptr<weld::Button> m_xSearchBtn;
186  std::unique_ptr<weld::Button> m_xBackSearchBtn;
187  std::unique_ptr<weld::Button> m_xSearchAllBtn;
188  std::unique_ptr<weld::Button> m_xReplaceBtn;
189  std::unique_ptr<weld::Button> m_xReplaceAllBtn;
190 
191  std::unique_ptr<weld::Frame> m_xComponentFrame;
192  std::unique_ptr<weld::Button> m_xSearchComponent1PB;
193  std::unique_ptr<weld::Button> m_xSearchComponent2PB;
194 
195  std::unique_ptr<weld::CheckButton> m_xMatchCaseCB;
196  std::unique_ptr<weld::CheckButton> m_xSearchFormattedCB;
197  std::unique_ptr<weld::CheckButton> m_xWordBtn;
198 
199  std::unique_ptr<weld::Button> m_xCloseBtn;
200  std::unique_ptr<weld::CheckButton> m_xIncludeDiacritics;
201  std::unique_ptr<weld::CheckButton> m_xIncludeKashida;
202  std::unique_ptr<weld::Expander> m_xOtherOptionsExpander;
203  std::unique_ptr<weld::CheckButton> m_xSelectionBtn;
204  std::unique_ptr<weld::CheckButton> m_xRegExpBtn;
205  std::unique_ptr<weld::CheckButton> m_xWildcardBtn;
206  std::unique_ptr<weld::CheckButton> m_xSimilarityBox;
207  std::unique_ptr<weld::Button> m_xSimilarityBtn;
208  std::unique_ptr<weld::CheckButton> m_xLayoutBtn;
209  std::unique_ptr<weld::CheckButton> m_xNotesBtn;
210  std::unique_ptr<weld::CheckButton> m_xJapMatchFullHalfWidthCB;
211  std::unique_ptr<weld::CheckButton> m_xJapOptionsCB;
212  std::unique_ptr<weld::CheckButton> m_xReplaceBackwardsCB;
213  std::unique_ptr<weld::Button> m_xJapOptionsBtn;
214 
215  std::unique_ptr<weld::Button> m_xAttributeBtn;
216  std::unique_ptr<weld::Button> m_xFormatBtn;
217  std::unique_ptr<weld::Button> m_xNoFormatBtn;
218 
219  std::unique_ptr<weld::Widget> m_xCalcGrid;
220  std::unique_ptr<weld::Label> m_xCalcSearchInFT;
221  std::unique_ptr<weld::ComboBox> m_xCalcSearchInLB;
222  std::unique_ptr<weld::Label> m_xCalcSearchDirFT;
223  std::unique_ptr<weld::RadioButton> m_xRowsBtn;
224  std::unique_ptr<weld::RadioButton> m_xColumnsBtn;
225  std::unique_ptr<weld::CheckButton> m_xAllSheetsCB;
226  std::unique_ptr<weld::Label> m_xCalcStrFT;
227 
228  DECL_DLLPRIVATE_LINK( ModifyHdl_Impl, weld::ComboBox&, void );
229  DECL_DLLPRIVATE_LINK( FlagHdl_Impl, weld::Button&, void );
230  DECL_DLLPRIVATE_LINK( CommandHdl_Impl, weld::Button&, void );
231  DECL_DLLPRIVATE_LINK(TemplateHdl_Impl, weld::Button&, void);
232  DECL_DLLPRIVATE_LINK( FocusHdl_Impl, weld::Widget&, void );
233  DECL_DLLPRIVATE_LINK( LBSelectHdl_Impl, weld::ComboBox&, void );
234  DECL_DLLPRIVATE_LINK(LoseFocusHdl_Impl, weld::Widget&, void);
235  DECL_DLLPRIVATE_LINK(FormatHdl_Impl, weld::Button&, void);
236  DECL_DLLPRIVATE_LINK(NoFormatHdl_Impl, weld::Button&, void);
237  DECL_DLLPRIVATE_LINK(AttributeHdl_Impl, weld::Button&, void);
238  DECL_DLLPRIVATE_LINK( TimeoutHdl_Impl, Timer*, void );
239  SVX_DLLPRIVATE void ClickHdl_Impl(const weld::Widget* pCtrl);
240 
241  SVX_DLLPRIVATE void Construct_Impl();
242  SVX_DLLPRIVATE void InitControls_Impl();
243  SVX_DLLPRIVATE void ShowOptionalControls_Impl();
244  SVX_DLLPRIVATE void Init_Impl( bool bHasItemSet );
245  SVX_DLLPRIVATE void InitAttrList_Impl( const SfxItemSet* pSSet,
246  const SfxItemSet* pRSet );
247  SVX_DLLPRIVATE void Remember_Impl( const OUString &rStr, bool bSearch );
248  SVX_DLLPRIVATE void PaintAttrText_Impl();
249  SVX_DLLPRIVATE OUString& BuildAttrText_Impl( OUString& rStr, bool bSrchFlag ) const;
250 
251  SVX_DLLPRIVATE void TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool );
252  SVX_DLLPRIVATE void EnableControls_Impl( const SearchOptionFlags nFlags );
253  SVX_DLLPRIVATE void EnableControl_Impl(const weld::Widget& rCtrl);
254  SVX_DLLPRIVATE void SetItem_Impl( const SvxSearchItem* pItem );
255 
256  SVX_DLLPRIVATE void SetModifyFlag_Impl(const weld::Widget* pCtrl);
257  SVX_DLLPRIVATE void SaveToModule_Impl();
258 
259  SVX_DLLPRIVATE void ApplyTransliterationFlags_Impl( TransliterationFlags nSettings );
260  SVX_DLLPRIVATE bool IsOtherOptionsExpanded() const;
261 
262  SVX_DLLPRIVATE short executeSubDialog(VclAbstractDialog * dialog);
263 
264  DECL_DLLPRIVATE_LINK(PresentTimeoutHdl_Impl, Timer*, void);
265 };
266 
267 #endif
268 
269 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DECL_DLLPRIVATE_LINK(FocusChangeHdl, weld::Widget &, void)
OUString aStylesStr
Definition: srchdlg.hxx:150
std::unique_ptr< weld::Button > m_xSearchComponent2PB
Definition: srchdlg.hxx:193
std::unique_ptr< SearchAttrItemList > pReplaceList
Definition: srchdlg.hxx:162
std::unique_ptr< weld::Expander > m_xOtherOptionsExpander
Definition: srchdlg.hxx:202
std::unique_ptr< weld::Button > m_xSearchAllBtn
Definition: srchdlg.hxx:187
std::unique_ptr< weld::Label > m_xReplaceAttrText
Definition: srchdlg.hxx:183
std::unique_ptr< weld::ComboBox > m_xCalcSearchInLB
Definition: srchdlg.hxx:221
SfxPoolItem * pItem
Definition: srchdlg.hxx:44
SearchOptionFlags nOptions
Definition: srchdlg.hxx:146
std::vector< SearchAttrItem > SrchAttrItemList
Definition: srchdlg.hxx:47
SearchAttrItem & GetObject(sal_uInt16 nPos)
Definition: srchdlg.hxx:62
std::unique_ptr< weld::Button > m_xFormatBtn
Definition: srchdlg.hxx:216
TransliterationFlags nTransliterationFlags
Definition: srchdlg.hxx:170
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
std::unique_ptr< weld::CheckButton > m_xIncludeKashida
Definition: srchdlg.hxx:201
Put
SfxBindings & rBindings
Definition: srchdlg.hxx:140
std::unique_ptr< weld::CheckButton > m_xRegExpBtn
Definition: srchdlg.hxx:204
std::unique_ptr< weld::Frame > m_xComponentFrame
Definition: srchdlg.hxx:191
std::unique_ptr< weld::CheckButton > m_xWordBtn
Definition: srchdlg.hxx:197
std::vector< OUString > aReplaceStrings
Definition: srchdlg.hxx:158
std::unique_ptr< weld::ComboBox > m_xSearchTmplLB
Definition: srchdlg.hxx:176
std::unique_ptr< weld::Widget > m_xCalcGrid
Definition: srchdlg.hxx:219
std::unique_ptr< weld::CheckButton > m_xSimilarityBox
Definition: srchdlg.hxx:206
virtual void Close() override
std::unique_ptr< weld::CheckButton > m_xReplaceBackwardsCB
Definition: srchdlg.hxx:212
std::unique_ptr< weld::ComboBox > m_xReplaceLB
Definition: srchdlg.hxx:181
std::unique_ptr< weld::CheckButton > m_xAllSheetsCB
Definition: srchdlg.hxx:225
std::unique_ptr< weld::Label > m_xCalcSearchInFT
Definition: srchdlg.hxx:220
std::unique_ptr< weld::Button > m_xBackSearchBtn
Definition: srchdlg.hxx:186
std::unique_ptr< weld::Button > m_xJapOptionsBtn
Definition: srchdlg.hxx:213
std::unique_ptr< weld::CheckButton > m_xWildcardBtn
Definition: srchdlg.hxx:205
std::unique_ptr< weld::CheckButton > m_xSelectionBtn
Definition: srchdlg.hxx:203
TransliterationFlags
std::unique_ptr< weld::CheckButton > m_xJapOptionsCB
Definition: srchdlg.hxx:211
std::unique_ptr< weld::CheckButton > m_xIncludeDiacritics
Definition: srchdlg.hxx:200
sal_uInt16 nSlot
Definition: srchdlg.hxx:43
std::unique_ptr< SearchDlg_Impl > pImpl
Definition: srchdlg.hxx:160
std::unique_ptr< SvxSearchController > pFamilyController
Definition: srchdlg.hxx:167
bool bReplaceBackwards
Definition: srchdlg.hxx:145
ModifyFlags nModifyFlag
Definition: srchdlg.hxx:149
OUString aLayoutWriterStr
Definition: srchdlg.hxx:152
std::unique_ptr< weld::CheckButton > m_xLayoutBtn
Definition: srchdlg.hxx:208
virtual void ChildWinDispose() override
sal_uInt16 nRememberSize
Definition: srchdlg.hxx:155
sal_uInt16 Count() const
Definition: srchdlg.hxx:59
std::unique_ptr< weld::Button > m_xCloseBtn
Definition: srchdlg.hxx:199
std::unique_ptr< weld::Label > m_xCalcSearchDirFT
Definition: srchdlg.hxx:222
SearchLabel
Definition: srchdlg.hxx:72
SearchAttrItem & operator[](sal_uInt16 nPos)
Definition: srchdlg.hxx:60
std::unique_ptr< SvxSearchController > pOptionsController
Definition: srchdlg.hxx:166
std::unique_ptr< SearchAttrItemList > pSearchList
Definition: srchdlg.hxx:161
std::unique_ptr< weld::Frame > m_xSearchFrame
Definition: srchdlg.hxx:174
std::shared_ptr< SvxSearchDialog > dialog
Definition: srchdlg.hxx:89
std::unique_ptr< weld::Label > m_xSearchLabel
Definition: srchdlg.hxx:178
std::unique_ptr< weld::RadioButton > m_xRowsBtn
Definition: srchdlg.hxx:223
std::unique_ptr< weld::Button > m_xSearchComponent1PB
Definition: srchdlg.hxx:192
std::unique_ptr< weld::Button > m_xAttributeBtn
Definition: srchdlg.hxx:215
std::unique_ptr< weld::Button > m_xSimilarityBtn
Definition: srchdlg.hxx:207
std::unique_ptr< weld::CheckButton > m_xMatchCaseCB
Definition: srchdlg.hxx:195
virtual void Activate() override
std::unique_ptr< weld::Label > m_xCalcStrFT
Definition: srchdlg.hxx:226
std::unique_ptr< weld::RadioButton > m_xColumnsBtn
Definition: srchdlg.hxx:224
std::unique_ptr< weld::Label > m_xSearchAttrText
Definition: srchdlg.hxx:177
std::unique_ptr< weld::Button > m_xReplaceAllBtn
Definition: srchdlg.hxx:189
std::unique_ptr< weld::Button > m_xNoFormatBtn
Definition: srchdlg.hxx:217
std::unique_ptr< weld::Button > m_xSearchBtn
Definition: srchdlg.hxx:185
In this modeless dialog the attributes for a search are configured and a search is started from it...
Definition: srchdlg.hxx:109
SvxSearchDialog * getDialog()
Definition: srchdlg.hxx:95
std::unique_ptr< weld::ComboBox > m_xSearchLB
Definition: srchdlg.hxx:175
std::unique_ptr< weld::ComboBox > m_xReplaceTmplLB
Definition: srchdlg.hxx:182
void Insert(const SearchAttrItem &rItem)
Definition: srchdlg.hxx:66
std::unique_ptr< weld::Button > m_xReplaceBtn
Definition: srchdlg.hxx:188
#define SFX_DECL_CHILDWINDOW_WITHID(Class)
ModifyFlags
Definition: srchdlg.cxx:89
TransliterationFlags GetTransliterationFlags() const
std::unique_ptr< weld::CheckButton > m_xSearchFormattedCB
Definition: srchdlg.hxx:196
Timer m_aPresentIdle
Definition: srchdlg.hxx:141
OUString aCalcStr
Definition: srchdlg.hxx:154
std::unique_ptr< weld::CheckButton > m_xJapMatchFullHalfWidthCB
Definition: srchdlg.hxx:210
const SearchAttrItemList * GetReplaceItemList() const
Definition: srchdlg.hxx:127
std::unique_ptr< SvxSearchController > pSearchController
Definition: srchdlg.hxx:165
std::unique_ptr< weld::CheckButton > m_xNotesBtn
Definition: srchdlg.hxx:209
OUString aLayoutStr
Definition: srchdlg.hxx:151
OUString aLayoutCalcStr
Definition: srchdlg.hxx:153
#define SVX_DLLPRIVATE
Definition: svxdllapi.h:30
SearchOptionFlags
STDMETHOD() Get(VARIANT *val)=0
std::vector< OUString > aSearchStrings
Definition: srchdlg.hxx:157
std::unique_ptr< weld::Frame > m_xReplaceFrame
Definition: srchdlg.hxx:180
std::unique_ptr< SvxSearchItem > pSearchItem
Definition: srchdlg.hxx:163
const SearchAttrItemList * GetSearchItemList() const
Definition: srchdlg.hxx:125