Bump version to 6.4-15
[LibreOffice.git] / include / svx / srchdlg.hxx
blob34419ef28a5abe94c52069ffe29127f9e3bfa03e
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 <memory>
29 #include <vector>
31 class SvxSearchItem;
32 class SfxStyleSheetBasePool;
33 class SvxJSearchOptionsPage;
34 class SvxSearchController;
35 class VclAbstractDialog;
36 struct SearchDlg_Impl;
37 enum class ModifyFlags;
38 enum class TransliterationFlags;
40 struct SearchAttrItem
42 sal_uInt16 nSlot;
43 SfxPoolItem* pItem;
46 typedef std::vector<SearchAttrItem> SrchAttrItemList;
48 class SVX_DLLPUBLIC SearchAttrItemList : private SrchAttrItemList
50 public:
51 SearchAttrItemList() {}
52 SearchAttrItemList( const SearchAttrItemList& rList );
53 ~SearchAttrItemList();
55 void Put( const SfxItemSet& rSet );
56 SfxItemSet& Get( SfxItemSet& rSet );
57 void Clear();
58 sal_uInt16 Count() const { return SrchAttrItemList::size(); }
59 SearchAttrItem& operator[](sal_uInt16 nPos)
60 { return SrchAttrItemList::operator[]( nPos ); }
61 SearchAttrItem& GetObject( sal_uInt16 nPos )
62 { return SrchAttrItemList::operator[]( nPos ); }
64 // the pointer to the item is not being copied, so don't delete
65 void Insert( const SearchAttrItem& rItem )
66 { SrchAttrItemList::push_back( rItem ); }
67 // deletes the pointer to the items
68 void Remove(size_t nPos);
71 enum class SearchLabel
73 Empty,
74 End,
75 Start,
76 EndSheet,
77 NotFound,
78 StartWrapped,
79 EndWrapped,
80 NavElementNotFound
83 class SvxSearchDialog;
84 class SVX_DLLPUBLIC SvxSearchDialogWrapper final : public SfxChildWindow
86 std::shared_ptr<SvxSearchDialog> dialog;
87 public:
88 SvxSearchDialogWrapper( vcl::Window*pParent, sal_uInt16 nId,
89 SfxBindings* pBindings, SfxChildWinInfo const * pInfo );
91 virtual ~SvxSearchDialogWrapper () override;
92 SvxSearchDialog *getDialog () { return dialog.get();}
93 static void SetSearchLabel(const SearchLabel& rSL);
94 static void SetSearchLabel(const OUString& sStr);
95 static OUString GetSearchLabel();
96 SFX_DECL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper);
99 /**
100 In this modeless dialog the attributes for a search are configured
101 and a search is started from it. Several search types
102 (search, search all, replace, replace all) are possible.
106 class SVX_DLLPUBLIC SvxSearchDialog : public SfxModelessDialogController
108 friend class SvxSearchController;
109 friend class SvxSearchDialogWrapper;
110 friend class SvxJSearchOptionsDialog;
112 public:
113 SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind );
114 virtual ~SvxSearchDialog() override;
116 virtual void ChildWinDispose() override;
117 virtual void Close() override;
119 // Window
120 virtual void Activate() override;
122 const SearchAttrItemList* GetSearchItemList() const
123 { return pSearchList.get(); }
124 const SearchAttrItemList* GetReplaceItemList() const
125 { return pReplaceList.get(); }
127 TransliterationFlags GetTransliterationFlags() const;
129 void SetSaveToModule(bool b);
131 void SetSearchLabel(const OUString& rStr);
133 private:
134 SfxBindings& rBindings;
135 bool bWriter;
136 bool bSearch;
137 bool bFormat;
138 bool bReplaceBackwards;
139 SearchOptionFlags nOptions;
140 bool bSet;
141 bool bConstruct;
142 ModifyFlags nModifyFlag;
143 OUString aStylesStr;
144 OUString aLayoutStr;
145 OUString aLayoutWriterStr;
146 OUString aLayoutCalcStr;
147 OUString aCalcStr;
148 sal_uInt16 nRememberSize;
150 std::vector<OUString> aSearchStrings;
151 std::vector<OUString> aReplaceStrings;
153 std::unique_ptr<SearchDlg_Impl> pImpl;
154 std::unique_ptr<SearchAttrItemList> pSearchList;
155 std::unique_ptr<SearchAttrItemList> pReplaceList;
156 std::unique_ptr<SvxSearchItem> pSearchItem;
158 std::unique_ptr<SvxSearchController> pSearchController;
159 std::unique_ptr<SvxSearchController> pOptionsController;
160 std::unique_ptr<SvxSearchController> pFamilyController;
162 mutable TransliterationFlags
163 nTransliterationFlags;
165 bool m_executingSubDialog = false;
167 std::unique_ptr<weld::Frame> m_xSearchFrame;
168 std::unique_ptr<weld::ComboBox> m_xSearchLB;
169 std::unique_ptr<weld::ComboBox> m_xSearchTmplLB;
170 std::unique_ptr<weld::Label> m_xSearchAttrText;
171 std::unique_ptr<weld::Label> m_xSearchLabel;
173 std::unique_ptr<weld::Frame> m_xReplaceFrame;
174 std::unique_ptr<weld::ComboBox> m_xReplaceLB;
175 std::unique_ptr<weld::ComboBox> m_xReplaceTmplLB;
176 std::unique_ptr<weld::Label> m_xReplaceAttrText;
178 std::unique_ptr<weld::Button> m_xSearchBtn;
179 std::unique_ptr<weld::Button> m_xBackSearchBtn;
180 std::unique_ptr<weld::Button> m_xSearchAllBtn;
181 std::unique_ptr<weld::Button> m_xReplaceBtn;
182 std::unique_ptr<weld::Button> m_xReplaceAllBtn;
184 std::unique_ptr<weld::Frame> m_xComponentFrame;
185 std::unique_ptr<weld::Button> m_xSearchComponent1PB;
186 std::unique_ptr<weld::Button> m_xSearchComponent2PB;
188 std::unique_ptr<weld::CheckButton> m_xMatchCaseCB;
189 std::unique_ptr<weld::CheckButton> m_xSearchFormattedCB;
190 std::unique_ptr<weld::CheckButton> m_xWordBtn;
192 std::unique_ptr<weld::Button> m_xCloseBtn;
193 std::unique_ptr<weld::CheckButton> m_xIncludeDiacritics;
194 std::unique_ptr<weld::CheckButton> m_xIncludeKashida;
195 std::unique_ptr<weld::Expander> m_xOtherOptionsExpander;
196 std::unique_ptr<weld::CheckButton> m_xSelectionBtn;
197 std::unique_ptr<weld::CheckButton> m_xRegExpBtn;
198 std::unique_ptr<weld::CheckButton> m_xWildcardBtn;
199 std::unique_ptr<weld::CheckButton> m_xSimilarityBox;
200 std::unique_ptr<weld::Button> m_xSimilarityBtn;
201 std::unique_ptr<weld::CheckButton> m_xLayoutBtn;
202 std::unique_ptr<weld::CheckButton> m_xNotesBtn;
203 std::unique_ptr<weld::CheckButton> m_xJapMatchFullHalfWidthCB;
204 std::unique_ptr<weld::CheckButton> m_xJapOptionsCB;
205 std::unique_ptr<weld::CheckButton> m_xReplaceBackwardsCB;
206 std::unique_ptr<weld::Button> m_xJapOptionsBtn;
208 std::unique_ptr<weld::Button> m_xAttributeBtn;
209 std::unique_ptr<weld::Button> m_xFormatBtn;
210 std::unique_ptr<weld::Button> m_xNoFormatBtn;
212 std::unique_ptr<weld::Widget> m_xCalcGrid;
213 std::unique_ptr<weld::Label> m_xCalcSearchInFT;
214 std::unique_ptr<weld::ComboBox> m_xCalcSearchInLB;
215 std::unique_ptr<weld::Label> m_xCalcSearchDirFT;
216 std::unique_ptr<weld::RadioButton> m_xRowsBtn;
217 std::unique_ptr<weld::RadioButton> m_xColumnsBtn;
218 std::unique_ptr<weld::CheckButton> m_xAllSheetsCB;
219 std::unique_ptr<weld::Label> m_xCalcStrFT;
221 DECL_DLLPRIVATE_LINK( ModifyHdl_Impl, weld::ComboBox&, void );
222 DECL_DLLPRIVATE_LINK( FlagHdl_Impl, weld::Button&, void );
223 DECL_DLLPRIVATE_LINK( CommandHdl_Impl, weld::Button&, void );
224 DECL_DLLPRIVATE_LINK(TemplateHdl_Impl, weld::Button&, void);
225 DECL_DLLPRIVATE_LINK( FocusHdl_Impl, weld::Widget&, void );
226 DECL_DLLPRIVATE_LINK( LBSelectHdl_Impl, weld::ComboBox&, void );
227 DECL_DLLPRIVATE_LINK(LoseFocusHdl_Impl, weld::Widget&, void);
228 DECL_DLLPRIVATE_LINK(FormatHdl_Impl, weld::Button&, void);
229 DECL_DLLPRIVATE_LINK(NoFormatHdl_Impl, weld::Button&, void);
230 DECL_DLLPRIVATE_LINK(AttributeHdl_Impl, weld::Button&, void);
231 DECL_DLLPRIVATE_LINK( TimeoutHdl_Impl, Timer*, void );
232 SVX_DLLPRIVATE void ClickHdl_Impl(const weld::Widget* pCtrl);
234 SVX_DLLPRIVATE void Construct_Impl();
235 SVX_DLLPRIVATE void InitControls_Impl();
236 SVX_DLLPRIVATE void ShowOptionalControls_Impl();
237 SVX_DLLPRIVATE void Init_Impl( bool bHasItemSet );
238 SVX_DLLPRIVATE void InitAttrList_Impl( const SfxItemSet* pSSet,
239 const SfxItemSet* pRSet );
240 SVX_DLLPRIVATE void Remember_Impl( const OUString &rStr, bool bSearch );
241 SVX_DLLPRIVATE void PaintAttrText_Impl();
242 SVX_DLLPRIVATE OUString& BuildAttrText_Impl( OUString& rStr, bool bSrchFlag ) const;
244 SVX_DLLPRIVATE void TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool );
245 SVX_DLLPRIVATE void EnableControls_Impl( const SearchOptionFlags nFlags );
246 SVX_DLLPRIVATE void EnableControl_Impl(const weld::Widget& rCtrl);
247 SVX_DLLPRIVATE void SetItem_Impl( const SvxSearchItem* pItem );
249 SVX_DLLPRIVATE void SetModifyFlag_Impl(const weld::Widget* pCtrl);
250 SVX_DLLPRIVATE void SaveToModule_Impl();
252 SVX_DLLPRIVATE void ApplyTransliterationFlags_Impl( TransliterationFlags nSettings );
253 SVX_DLLPRIVATE bool IsOtherOptionsExpanded() const;
255 SVX_DLLPRIVATE short executeSubDialog(VclAbstractDialog * dialog);
258 #endif
260 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */