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 <svtools/stdctrl.hxx>
23 #include <vcl/combobox.hxx>
24 #include <vcl/edit.hxx>
25 #include <vcl/button.hxx>
26 #include <vcl/layout.hxx>
27 #include <vcl/lstbox.hxx>
28 #include <vcl/group.hxx>
29 #include <vcl/fixed.hxx>
30 #include <vcl/dialog.hxx>
31 #include <sfx2/childwin.hxx>
32 #include <sfx2/basedlgs.hxx>
33 #include <svtools/svmedit.hxx>
34 #include <svl/srchdefs.hxx>
35 #include <svx/svxdllapi.h>
39 class SfxStyleSheetBasePool
;
40 class SvxJSearchOptionsPage
;
41 class SvxSearchController
;
43 struct SearchDlg_Impl
;
51 // class SearchAttrItemList ----------------------------------------------
53 typedef std::vector
<SearchAttrItem
> SrchAttrItemList
;
55 class SVX_DLLPUBLIC SearchAttrItemList
: private SrchAttrItemList
58 SearchAttrItemList() {}
59 SearchAttrItemList( const SearchAttrItemList
& rList
);
60 ~SearchAttrItemList();
62 void Put( const SfxItemSet
& rSet
);
63 SfxItemSet
& Get( SfxItemSet
& rSet
);
65 sal_uInt16
Count() const { return SrchAttrItemList::size(); }
66 SearchAttrItem
& operator[](sal_uInt16 nPos
)
67 { return SrchAttrItemList::operator[]( nPos
); }
68 SearchAttrItem
& GetObject( sal_uInt16 nPos
)
69 { return SrchAttrItemList::operator[]( nPos
); }
71 // the pointer to the item is not being copied, so don't delete
72 void Insert( const SearchAttrItem
& rItem
)
73 { SrchAttrItemList::push_back( rItem
); }
74 // deletes the pointer to the items
75 void Remove(size_t nPos
, size_t nLen
= 1);
79 // class SvxSearchDialogWrapper ------------------------------------------
89 class SvxSearchDialog
;
90 class SVX_DLLPUBLIC SvxSearchDialogWrapper
: public SfxChildWindow
92 SvxSearchDialog
*dialog
;
94 SvxSearchDialogWrapper( Window
*pParent
, sal_uInt16 nId
,
95 SfxBindings
* pBindings
, SfxChildWinInfo
* pInfo
);
97 virtual ~SvxSearchDialogWrapper ();
98 SvxSearchDialog
*getDialog ();
99 static void SetSearchLabel(const SearchLabel
& rSL
);
100 SFX_DECL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper
);
103 // class SvxSearchDialog -------------------------------------------------
106 In this modeless dialog the attributes for a search are configured
107 and a search is started from it. Several search types
108 (search, search all, replace, replace all) are possible.
111 <SvxSearchItem><SID_ATTR_SEARCH>
114 class SvxSearchDialog
: public SfxModelessDialog
116 friend class SvxSearchController
;
117 friend class SvxSearchDialogWrapper
;
118 friend class SvxJSearchOptionsDialog
;
121 SvxSearchDialog( Window
* pParent
, SfxChildWindow
* pChildWin
, SfxBindings
& rBind
);
122 virtual ~SvxSearchDialog();
124 virtual bool Close() SAL_OVERRIDE
;
127 virtual void Activate() SAL_OVERRIDE
;
129 const SearchAttrItemList
* GetSearchItemList() const
130 { return pSearchList
; }
131 const SearchAttrItemList
* GetReplaceItemList() const
132 { return pReplaceList
; }
134 inline bool HasSearchAttributes() const;
135 inline bool HasReplaceAttributes() const;
137 PushButton
& GetReplaceBtn() { return *m_pReplaceBtn
; }
139 sal_Int32
GetTransliterationFlags() const;
141 void SetDocWin( Window
* pDocWin
) { mpDocWin
= pDocWin
; }
142 Window
* GetDocWin() { return mpDocWin
; }
143 void SetSrchFlag( bool bSuccess
= false ) { mbSuccess
= bSuccess
; }
144 bool GetSrchFlag() { return mbSuccess
; }
145 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>
146 GetComponentInterface( sal_Bool bCreate
) SAL_OVERRIDE
;
148 void SetSaveToModule(bool b
);
150 void SetSearchLabel(const OUString
& rStr
) { m_pSearchLabel
->SetText(rStr
); }
156 VclFrame
* m_pSearchFrame
;
157 ComboBox
* m_pSearchLB
;
158 ListBox
* m_pSearchTmplLB
;
159 FixedText
* m_pSearchAttrText
;
160 FixedText
* m_pSearchLabel
;
162 VclFrame
* m_pReplaceFrame
;
163 ComboBox
* m_pReplaceLB
;
164 ListBox
* m_pReplaceTmplLB
;
165 FixedText
* m_pReplaceAttrText
;
167 PushButton
* m_pSearchBtn
;
168 PushButton
* m_pSearchAllBtn
;
169 PushButton
* m_pReplaceBtn
;
170 PushButton
* m_pReplaceAllBtn
;
172 VclFrame
* m_pComponentFrame
;
173 PushButton
* m_pSearchComponent1PB
;
174 PushButton
* m_pSearchComponent2PB
;
176 CheckBox
* m_pMatchCaseCB
;
177 CheckBox
* m_pWordBtn
;
179 PushButton
* m_pCloseBtn
;
180 CheckBox
* m_pIgnoreDiacritics
;
181 CheckBox
* m_pIgnoreKashida
;
182 CheckBox
* m_pSelectionBtn
;
183 CheckBox
* m_pBackwardsBtn
;
184 CheckBox
* m_pRegExpBtn
;
185 CheckBox
* m_pSimilarityBox
;
186 PushButton
* m_pSimilarityBtn
;
187 CheckBox
* m_pLayoutBtn
;
188 CheckBox
* m_pNotesBtn
;
189 CheckBox
* m_pJapMatchFullHalfWidthCB
;
190 CheckBox
* m_pJapOptionsCB
;
191 PushButton
* m_pJapOptionsBtn
;
193 PushButton
* m_pAttributeBtn
;
194 PushButton
* m_pFormatBtn
;
195 PushButton
* m_pNoFormatBtn
;
197 VclContainer
* m_pCalcGrid
;
198 FixedText
* m_pCalcSearchInFT
;
199 ListBox
* m_pCalcSearchInLB
;
200 FixedText
* m_pCalcSearchDirFT
;
201 RadioButton
* m_pRowsBtn
;
202 RadioButton
* m_pColumnsBtn
;
203 CheckBox
* m_pAllSheetsCB
;
205 SfxBindings
& rBindings
;
213 sal_uIntPtr nModifyFlag
;
216 OUString aLayoutWriterStr
;
217 OUString aLayoutCalcStr
;
220 std::vector
<OUString
> aSearchStrings
;
221 std::vector
<OUString
> aReplaceStrings
;
223 SearchDlg_Impl
* pImpl
;
224 SearchAttrItemList
* pSearchList
;
225 SearchAttrItemList
* pReplaceList
;
226 SvxSearchItem
* pSearchItem
;
228 SvxSearchController
* pSearchController
;
229 SvxSearchController
* pOptionsController
;
230 SvxSearchController
* pFamilyController
;
231 SvxSearchController
* pSearchSetController
;
232 SvxSearchController
* pReplaceSetController
;
234 mutable sal_Int32 nTransliterationFlags
;
236 DECL_LINK( ModifyHdl_Impl
, ComboBox
* pEdit
);
237 DECL_LINK( FlagHdl_Impl
, Control
* pCtrl
);
238 DECL_LINK( CommandHdl_Impl
, Button
* pBtn
);
239 DECL_LINK(TemplateHdl_Impl
, void *);
240 DECL_LINK( FocusHdl_Impl
, Control
* );
241 DECL_LINK(LoseFocusHdl_Impl
, void *);
242 DECL_LINK(FormatHdl_Impl
, void *);
243 DECL_LINK(NoFormatHdl_Impl
, void *);
244 DECL_LINK(AttributeHdl_Impl
, void *);
245 DECL_LINK( TimeoutHdl_Impl
, Timer
* );
247 void Construct_Impl();
248 void InitControls_Impl();
249 void ShowOptionalControls_Impl();
250 void Init_Impl( bool bHasItemSet
);
251 void InitAttrList_Impl( const SfxItemSet
* pSSet
,
252 const SfxItemSet
* pRSet
);
253 void Remember_Impl( const OUString
&rStr
, bool bSearch
);
254 void PaintAttrText_Impl();
255 OUString
& BuildAttrText_Impl( OUString
& rStr
, bool bSrchFlag
) const;
257 void TemplatesChanged_Impl( SfxStyleSheetBasePool
& rPool
);
258 void EnableControls_Impl( const sal_uInt16 nFlags
);
259 void EnableControl_Impl( Control
* pCtrl
);
260 void SetItem_Impl( const SvxSearchItem
* pItem
);
262 void SetModifyFlag_Impl( const Control
* pCtrl
);
263 void SaveToModule_Impl();
265 void ApplyTransliterationFlags_Impl( sal_Int32 nSettings
);
268 inline bool SvxSearchDialog::HasSearchAttributes() const
270 bool bLen
= !m_pSearchAttrText
->GetText().isEmpty();
271 return ( m_pSearchAttrText
->IsEnabled() && bLen
);
274 inline bool SvxSearchDialog::HasReplaceAttributes() const
276 bool bLen
= !m_pReplaceAttrText
->GetText().isEmpty();
277 return ( m_pReplaceAttrText
->IsEnabled() && bLen
);
282 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */