Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / svx / srchdlg.hxx
blob6c30e4bcbe9df41f7680b1613232e3382150f876
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 <vcl/combobox.hxx>
23 #include <vcl/edit.hxx>
24 #include <vcl/button.hxx>
25 #include <vcl/layout.hxx>
26 #include <vcl/lstbox.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 <memory>
36 #include <vector>
38 class SvxSearchItem;
39 class SfxStyleSheetBasePool;
40 class SvxJSearchOptionsPage;
41 class SvxSearchController;
42 struct SearchDlg_Impl;
43 enum class ModifyFlags;
44 enum class TransliterationFlags;
47 struct SearchAttrItem
49 sal_uInt16 nSlot;
50 SfxPoolItem* pItem;
53 // class SearchAttrItemList ----------------------------------------------
55 typedef std::vector<SearchAttrItem> SrchAttrItemList;
57 class SVX_DLLPUBLIC SearchAttrItemList : private SrchAttrItemList
59 public:
60 SearchAttrItemList() {}
61 SearchAttrItemList( const SearchAttrItemList& rList );
62 ~SearchAttrItemList();
64 void Put( const SfxItemSet& rSet );
65 SfxItemSet& Get( SfxItemSet& rSet );
66 void Clear();
67 sal_uInt16 Count() const { return SrchAttrItemList::size(); }
68 SearchAttrItem& operator[](sal_uInt16 nPos)
69 { return SrchAttrItemList::operator[]( nPos ); }
70 SearchAttrItem& GetObject( sal_uInt16 nPos )
71 { return SrchAttrItemList::operator[]( nPos ); }
73 // the pointer to the item is not being copied, so don't delete
74 void Insert( const SearchAttrItem& rItem )
75 { SrchAttrItemList::push_back( rItem ); }
76 // deletes the pointer to the items
77 void Remove(size_t nPos);
81 // class SvxSearchDialogWrapper ------------------------------------------
83 enum class SearchLabel
85 Empty,
86 End,
87 Start,
88 EndSheet,
89 NotFound
92 class SvxSearchDialog;
93 class SVX_DLLPUBLIC SvxSearchDialogWrapper : public SfxChildWindow
95 VclPtr<SvxSearchDialog> dialog;
96 public:
97 SvxSearchDialogWrapper( vcl::Window*pParent, sal_uInt16 nId,
98 SfxBindings* pBindings, SfxChildWinInfo* pInfo );
100 virtual ~SvxSearchDialogWrapper () override;
101 SvxSearchDialog *getDialog () { return dialog;}
102 static void SetSearchLabel(const SearchLabel& rSL);
103 static void SetSearchLabel(const OUString& sStr);
104 SFX_DECL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper);
107 // class SvxSearchDialog -------------------------------------------------
109 [Description]
110 In this modeless dialog the attributes for a search are configured
111 and a search is started from it. Several search types
112 (search, search all, replace, replace all) are possible.
114 [Items]
115 <SvxSearchItem><SID_ATTR_SEARCH>
118 class SvxSearchDialog : public SfxModelessDialog
120 friend class SvxSearchController;
121 friend class SvxSearchDialogWrapper;
122 friend class SvxJSearchOptionsDialog;
124 public:
125 SvxSearchDialog( vcl::Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind );
126 virtual ~SvxSearchDialog() override;
127 virtual void dispose() override;
129 virtual bool Close() override;
131 // Window
132 virtual void Activate() override;
134 const SearchAttrItemList* GetSearchItemList() const
135 { return pSearchList; }
136 const SearchAttrItemList* GetReplaceItemList() const
137 { return pReplaceList; }
139 TransliterationFlags GetTransliterationFlags() const;
141 void SetDocWin( vcl::Window* pDocWin ) { mpDocWin = pDocWin; }
142 vcl::Window* GetDocWin() { return mpDocWin; }
143 void SetSrchFlag( bool bSuccess ) { mbSuccess = bSuccess; }
144 bool GetSrchFlag() { return mbSuccess; }
145 virtual css::uno::Reference< css::awt::XWindowPeer >
146 GetComponentInterface( bool bCreate = true ) override;
148 void SetSaveToModule(bool b);
150 void SetSearchLabel(const OUString& rStr) { m_pSearchLabel->SetText(rStr); }
152 private:
153 VclPtr<vcl::Window> mpDocWin;
154 bool mbSuccess;
156 VclPtr<VclFrame> m_pSearchFrame;
157 VclPtr<ComboBox> m_pSearchLB;
158 VclPtr<ListBox> m_pSearchTmplLB;
159 VclPtr<FixedText> m_pSearchAttrText;
160 VclPtr<FixedText> m_pSearchLabel;
162 VclPtr<VclFrame> m_pReplaceFrame;
163 VclPtr<ComboBox> m_pReplaceLB;
164 VclPtr<ListBox> m_pReplaceTmplLB;
165 VclPtr<FixedText> m_pReplaceAttrText;
167 VclPtr<PushButton> m_pSearchBtn;
168 VclPtr<PushButton> m_pBackSearchBtn;
169 VclPtr<PushButton> m_pSearchAllBtn;
170 VclPtr<PushButton> m_pReplaceBtn;
171 VclPtr<PushButton> m_pReplaceAllBtn;
173 VclPtr<VclFrame> m_pComponentFrame;
174 VclPtr<PushButton> m_pSearchComponent1PB;
175 VclPtr<PushButton> m_pSearchComponent2PB;
177 VclPtr<CheckBox> m_pMatchCaseCB;
178 VclPtr<CheckBox> m_pSearchFormattedCB;
179 VclPtr<CheckBox> m_pWordBtn;
181 VclPtr<PushButton> m_pCloseBtn;
182 VclPtr<CheckBox> m_pIgnoreDiacritics;
183 VclPtr<CheckBox> m_pIgnoreKashida;
184 VclPtr<CheckBox> m_pSelectionBtn;
185 VclPtr<CheckBox> m_pRegExpBtn;
186 VclPtr<CheckBox> m_pWildcardBtn;
187 VclPtr<CheckBox> m_pSimilarityBox;
188 VclPtr<PushButton> m_pSimilarityBtn;
189 VclPtr<CheckBox> m_pLayoutBtn;
190 VclPtr<CheckBox> m_pNotesBtn;
191 VclPtr<CheckBox> m_pJapMatchFullHalfWidthCB;
192 VclPtr<CheckBox> m_pJapOptionsCB;
193 VclPtr<CheckBox> m_pReplaceBackwardsCB;
194 VclPtr<PushButton> m_pJapOptionsBtn;
196 VclPtr<PushButton> m_pAttributeBtn;
197 VclPtr<PushButton> m_pFormatBtn;
198 VclPtr<PushButton> m_pNoFormatBtn;
200 VclPtr<VclContainer> m_pCalcGrid;
201 VclPtr<FixedText> m_pCalcSearchInFT;
202 VclPtr<ListBox> m_pCalcSearchInLB;
203 VclPtr<FixedText> m_pCalcSearchDirFT;
204 VclPtr<RadioButton> m_pRowsBtn;
205 VclPtr<RadioButton> m_pColumnsBtn;
206 VclPtr<CheckBox> m_pAllSheetsCB;
208 SfxBindings& rBindings;
209 bool bWriter;
210 bool bSearch;
211 bool bFormat;
212 bool bReplaceBackwards;
213 SearchOptionFlags nOptions;
214 bool bSet;
215 bool bConstruct;
216 ModifyFlags nModifyFlag;
217 OUString aStylesStr;
218 OUString aLayoutStr;
219 OUString aLayoutWriterStr;
220 OUString aLayoutCalcStr;
221 OUString aCalcStr;
223 std::vector<OUString> aSearchStrings;
224 std::vector<OUString> aReplaceStrings;
226 std::unique_ptr<SearchDlg_Impl> pImpl;
227 SearchAttrItemList* pSearchList;
228 SearchAttrItemList* pReplaceList;
229 SvxSearchItem* pSearchItem;
231 SvxSearchController* pSearchController;
232 SvxSearchController* pOptionsController;
233 SvxSearchController* pFamilyController;
234 SvxSearchController* pSearchSetController;
235 SvxSearchController* pReplaceSetController;
237 mutable TransliterationFlags
238 nTransliterationFlags;
240 DECL_LINK( ModifyHdl_Impl, Edit&, void );
241 DECL_LINK( FlagHdl_Impl, Button*, void );
242 DECL_LINK( CommandHdl_Impl, Button*, void );
243 DECL_LINK(TemplateHdl_Impl, Button*, void);
244 DECL_LINK( FocusHdl_Impl, Control&, void );
245 DECL_LINK( LBSelectHdl_Impl, ListBox&, void );
246 DECL_LINK(LoseFocusHdl_Impl, Control&, void);
247 DECL_LINK(FormatHdl_Impl, Button*, void);
248 DECL_LINK(NoFormatHdl_Impl, Button*, void);
249 DECL_LINK(AttributeHdl_Impl, Button*, void);
250 DECL_LINK( TimeoutHdl_Impl, Timer*, void );
251 void ClickHdl_Impl(void* pCtrl);
253 void Construct_Impl();
254 void InitControls_Impl();
255 void ShowOptionalControls_Impl();
256 void Init_Impl( bool bHasItemSet );
257 void InitAttrList_Impl( const SfxItemSet* pSSet,
258 const SfxItemSet* pRSet );
259 void Remember_Impl( const OUString &rStr, bool bSearch );
260 void PaintAttrText_Impl();
261 OUString& BuildAttrText_Impl( OUString& rStr, bool bSrchFlag ) const;
263 void TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool );
264 void EnableControls_Impl( const SearchOptionFlags nFlags );
265 void EnableControl_Impl( Control* pCtrl );
266 void SetItem_Impl( const SvxSearchItem* pItem );
268 void SetModifyFlag_Impl( const Control* pCtrl );
269 void SaveToModule_Impl();
271 void ApplyTransliterationFlags_Impl( TransliterationFlags nSettings );
274 #endif
276 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */