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