1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
33 class SfxStyleSheetBasePool
;
34 class SvxJSearchOptionsPage
;
35 class SvxSearchController
;
36 class VclAbstractDialog
;
37 struct SearchDlg_Impl
;
38 enum class ModifyFlags
;
39 enum class TransliterationFlags
;
47 typedef std::vector
<SearchAttrItem
> SrchAttrItemList
;
49 class SVX_DLLPUBLIC SearchAttrItemList
: private SrchAttrItemList
52 SearchAttrItemList() {}
53 SearchAttrItemList( const SearchAttrItemList
& rList
);
54 ~SearchAttrItemList();
56 void Put( const SfxItemSet
& rSet
);
57 SfxItemSet
& Get( SfxItemSet
& rSet
);
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
); }
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
);
72 enum class SearchLabel
86 class SvxSearchDialog
;
87 class SVX_DLLPUBLIC SvxSearchDialogWrapper final
: public SfxChildWindow
89 std::shared_ptr
<SvxSearchDialog
> dialog
;
91 SvxSearchDialogWrapper( vcl::Window
*pParent
, sal_uInt16 nId
,
92 SfxBindings
* pBindings
, SfxChildWinInfo
const * pInfo
);
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();
99 SFX_DECL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper
);
103 In this modeless dialog the attributes for a search are configured
104 and a search is started from it. Several search types
105 (search, search all, replace, replace all) are possible.
109 class SVX_DLLPUBLIC SvxSearchDialog
: public SfxModelessDialogController
111 friend class SvxSearchController
;
112 friend class SvxSearchDialogWrapper
;
113 friend class SvxJSearchOptionsDialog
;
116 SvxSearchDialog(weld::Window
* pParent
, SfxChildWindow
* pChildWin
, SfxBindings
& rBind
);
117 virtual ~SvxSearchDialog() override
;
119 virtual void ChildWinDispose() override
;
120 virtual void Close() override
;
123 virtual void Activate() override
;
125 const SearchAttrItemList
* GetSearchItemList() const
126 { return pSearchList
.get(); }
127 const SearchAttrItemList
* GetReplaceItemList() const
128 { return pReplaceList
.get(); }
130 TransliterationFlags
GetTransliterationFlags() const;
132 void SetSaveToModule(bool b
);
134 void SetSearchLabel(const OUString
& rStr
);
136 // bring this window back to the foreground
140 SfxBindings
& rBindings
;
141 Timer m_aPresentIdle
;
145 bool bReplaceBackwards
;
146 SearchOptionFlags nOptions
;
149 ModifyFlags nModifyFlag
;
152 OUString aLayoutWriterStr
;
153 OUString aLayoutCalcStr
;
155 sal_uInt16 nRememberSize
;
157 std::vector
<OUString
> aSearchStrings
;
158 std::vector
<OUString
> aReplaceStrings
;
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
;
165 std::unique_ptr
<SvxSearchController
> pSearchController
;
166 std::unique_ptr
<SvxSearchController
> pOptionsController
;
167 std::unique_ptr
<SvxSearchController
> pFamilyController
;
169 mutable TransliterationFlags
170 nTransliterationFlags
;
172 bool m_executingSubDialog
= false;
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
;
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
;
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
;
191 std::unique_ptr
<weld::Frame
> m_xComponentFrame
;
192 std::unique_ptr
<weld::Button
> m_xSearchComponent1PB
;
193 std::unique_ptr
<weld::Button
> m_xSearchComponent2PB
;
195 std::unique_ptr
<weld::CheckButton
> m_xMatchCaseCB
;
196 std::unique_ptr
<weld::CheckButton
> m_xSearchFormattedCB
;
197 std::unique_ptr
<weld::CheckButton
> m_xWordBtn
;
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
;
215 std::unique_ptr
<weld::Button
> m_xAttributeBtn
;
216 std::unique_ptr
<weld::Button
> m_xFormatBtn
;
217 std::unique_ptr
<weld::Button
> m_xNoFormatBtn
;
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
;
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
);
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;
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
);
256 SVX_DLLPRIVATE
void SetModifyFlag_Impl(const weld::Widget
* pCtrl
);
257 SVX_DLLPRIVATE
void SaveToModule_Impl();
259 SVX_DLLPRIVATE
void ApplyTransliterationFlags_Impl( TransliterationFlags nSettings
);
260 SVX_DLLPRIVATE
bool IsOtherOptionsExpanded() const;
262 SVX_DLLPRIVATE
short executeSubDialog(VclAbstractDialog
* dialog
);
264 DECL_DLLPRIVATE_LINK(PresentTimeoutHdl_Impl
, Timer
*, void);
269 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */