Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / svx / srchdlg.hxx
blob2b975e43508395971c1ed653ec8d22e3afc3e52c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SVX_SRCHDLG_HXX
20 #define INCLUDED_SVX_SRCHDLG_HXX
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>
32 class SvxSearchItem;
33 class SfxStyleSheetBasePool;
34 class SvxJSearchOptionsPage;
35 class SvxSearchController;
36 class VclAbstractDialog;
37 struct SearchDlg_Impl;
38 enum class ModifyFlags;
39 enum class TransliterationFlags;
41 struct SearchAttrItem
43 sal_uInt16 nSlot;
44 SfxPoolItem* pItem;
47 typedef std::vector<SearchAttrItem> SrchAttrItemList;
49 class SVX_DLLPUBLIC SearchAttrItemList : private SrchAttrItemList
51 public:
52 SearchAttrItemList() {}
53 SearchAttrItemList( const SearchAttrItemList& rList );
54 SearchAttrItemList( SearchAttrItemList&& rList );
55 ~SearchAttrItemList();
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 ); }
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);
73 enum class SearchLabel
75 Empty,
76 End,
77 Start,
78 EndSheet,
79 NotFound,
80 StartWrapped,
81 EndWrapped,
82 NavElementNotFound,
83 ReminderStartWrapped,
84 ReminderEndWrapped
87 class SvxSearchDialog;
88 class SVX_DLLPUBLIC SvxSearchDialogWrapper final : public SfxChildWindow
90 std::shared_ptr<SvxSearchDialog> dialog;
91 public:
92 SvxSearchDialogWrapper( vcl::Window*pParent, sal_uInt16 nId,
93 SfxBindings* pBindings, SfxChildWinInfo const * pInfo );
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();
100 SFX_DECL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper);
104 In this modeless dialog the attributes for a search are configured
105 and a search is started from it. Several search types
106 (search, search all, replace, replace all) are possible.
110 class SVX_DLLPUBLIC SvxSearchDialog final : public SfxModelessDialogController
112 friend class SvxSearchController;
113 friend class SvxSearchDialogWrapper;
114 friend class SvxJSearchOptionsDialog;
116 public:
117 SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind );
118 virtual ~SvxSearchDialog() override;
120 virtual void ChildWinDispose() override;
121 virtual void Close() override;
123 // Window
124 virtual void Activate() override;
126 const SearchAttrItemList* GetSearchItemList() const
127 { return pSearchList.get(); }
128 const SearchAttrItemList* GetReplaceItemList() const
129 { return pReplaceList.get(); }
131 TransliterationFlags GetTransliterationFlags() const;
133 void SetSaveToModule(bool b);
135 void SetSearchLabel(const OUString& rStr);
137 // bring this window back to the foreground
138 void Present();
140 private:
141 SfxBindings& rBindings;
142 Timer m_aPresentIdle;
143 bool bWriter;
144 bool bSearch;
145 bool bFormat;
146 bool bReplaceBackwards;
147 SearchOptionFlags nOptions;
148 bool bSet;
149 bool bConstruct;
150 ModifyFlags nModifyFlag;
151 OUString aStylesStr;
152 OUString aLayoutStr;
153 OUString aLayoutWriterStr;
154 OUString aLayoutCalcStr;
155 OUString aCalcStr;
156 sal_uInt16 nRememberSize;
158 std::vector<OUString> aSearchStrings;
159 std::vector<OUString> aReplaceStrings;
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;
166 std::unique_ptr<SvxSearchController> pSearchController;
167 std::unique_ptr<SvxSearchController> pOptionsController;
168 std::unique_ptr<SvxSearchController> pFamilyController;
170 mutable TransliterationFlags
171 nTransliterationFlags;
173 bool m_executingSubDialog = false;
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;
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;
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;
192 std::unique_ptr<weld::Frame> m_xComponentFrame;
193 std::unique_ptr<weld::Button> m_xSearchComponent1PB;
194 std::unique_ptr<weld::Button> m_xSearchComponent2PB;
196 std::unique_ptr<weld::CheckButton> m_xMatchCaseCB;
197 std::unique_ptr<weld::CheckButton> m_xSearchFormattedCB;
198 std::unique_ptr<weld::CheckButton> m_xWordBtn;
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;
216 std::unique_ptr<weld::Button> m_xAttributeBtn;
217 std::unique_ptr<weld::Button> m_xFormatBtn;
218 std::unique_ptr<weld::Button> m_xNoFormatBtn;
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;
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);
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;
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 );
257 SVX_DLLPRIVATE void SetModifyFlag_Impl(const weld::Widget* pCtrl);
258 SVX_DLLPRIVATE void SaveToModule_Impl();
260 SVX_DLLPRIVATE void ApplyTransliterationFlags_Impl( TransliterationFlags nSettings );
261 SVX_DLLPRIVATE bool IsOtherOptionsExpanded() const;
263 SVX_DLLPRIVATE short executeSubDialog(VclAbstractDialog * dialog);
265 DECL_DLLPRIVATE_LINK(PresentTimeoutHdl_Impl, Timer*, void);
268 #endif
270 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */