update credits
[LibreOffice.git] / include / svx / srchdlg.hxx
blob60cf509c745fdc9ff4f3f4ab48bc675eb679e6fc
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 _SVX_SRCHDLG_HXX
20 #define _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"
36 #include <vector>
38 class SvxSearchItem;
39 class MoreButton;
40 class SfxStyleSheetBasePool;
41 class SvxJSearchOptionsPage;
42 class SvxSearchController;
44 struct SearchDlg_Impl;
46 #ifndef NO_SVX_SEARCH
48 // struct SearchAttrItem -------------------------------------------------
50 struct SearchAttrItem
52 sal_uInt16 nSlot;
53 SfxPoolItem* pItem;
56 // class SearchAttrItemList ----------------------------------------------
58 typedef std::vector<SearchAttrItem> SrchAttrItemList;
60 class SVX_DLLPUBLIC SearchAttrItemList : private SrchAttrItemList
62 public:
63 SearchAttrItemList() {}
64 SearchAttrItemList( const SearchAttrItemList& rList );
65 ~SearchAttrItemList();
67 void Put( const SfxItemSet& rSet );
68 SfxItemSet& Get( SfxItemSet& rSet );
69 void Clear();
70 sal_uInt16 Count() const { return SrchAttrItemList::size(); }
71 SearchAttrItem& operator[](sal_uInt16 nPos)
72 { return SrchAttrItemList::operator[]( nPos ); }
73 SearchAttrItem& GetObject( sal_uInt16 nPos )
74 { return SrchAttrItemList::operator[]( nPos ); }
76 // the pointer to the item is not being copied, so don't delete
77 void Insert( const SearchAttrItem& rItem )
78 { SrchAttrItemList::push_back( rItem ); }
79 // deletes the pointer to the items
80 void Remove(size_t nPos, size_t nLen = 1);
83 #ifndef SV_NODIALOG
85 // class SvxSearchDialogWrapper ------------------------------------------
87 class SvxSearchDialog;
88 class SVX_DLLPUBLIC SvxSearchDialogWrapper : public SfxChildWindow
90 SvxSearchDialog *dialog;
91 public:
92 SvxSearchDialogWrapper( Window*pParent, sal_uInt16 nId,
93 SfxBindings* pBindings, SfxChildWinInfo* pInfo );
95 ~SvxSearchDialogWrapper ();
96 SvxSearchDialog *getDialog ();
97 SFX_DECL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper);
100 // class SvxSearchDialog -------------------------------------------------
103 {k:\svx\prototyp\dialog\svx/srchdlg.hxx}
105 [Description]
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.
110 [Items]
111 <SvxSearchItem><SID_ATTR_SEARCH>
114 class SvxSearchDialog : public SfxModelessDialog
116 friend class SvxSearchController;
117 friend class SvxSearchDialogWrapper;
118 friend class SvxJSearchOptionsDialog;
120 public:
121 SvxSearchDialog( Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind );
122 ~SvxSearchDialog();
124 virtual sal_Bool Close();
126 // Window
127 virtual void Activate();
129 const SearchAttrItemList* GetSearchItemList() const
130 { return pSearchList; }
131 const SearchAttrItemList* GetReplaceItemList() const
132 { return pReplaceList; }
134 inline sal_Bool HasSearchAttributes() const;
135 inline sal_Bool HasReplaceAttributes() const;
137 PushButton& GetReplaceBtn() { return *m_pReplaceBtn; }
139 sal_Int32 GetTransliterationFlags() const;
141 void SetSaveToModule(bool b);
143 private:
144 VclFrame* m_pSearchFrame;
145 ComboBox* m_pSearchLB;
146 ListBox* m_pSearchTmplLB;
147 FixedText* m_pSearchAttrText;
149 VclFrame* m_pReplaceFrame;
150 ComboBox* m_pReplaceLB;
151 ListBox* m_pReplaceTmplLB;
152 FixedText* m_pReplaceAttrText;
154 PushButton* m_pSearchBtn;
155 PushButton* m_pSearchAllBtn;
156 PushButton* m_pReplaceBtn;
157 PushButton* m_pReplaceAllBtn;
159 VclFrame* m_pComponentFrame;
160 PushButton* m_pSearchComponent1PB;
161 PushButton* m_pSearchComponent2PB;
163 CheckBox* m_pMatchCaseCB;
164 CheckBox* m_pWordBtn;
166 PushButton* m_pCloseBtn;
168 CheckBox* m_pSelectionBtn;
169 CheckBox* m_pBackwardsBtn;
170 CheckBox* m_pRegExpBtn;
171 CheckBox* m_pSimilarityBox;
172 PushButton* m_pSimilarityBtn;
173 CheckBox* m_pLayoutBtn;
174 CheckBox* m_pNotesBtn;
175 CheckBox* m_pJapMatchFullHalfWidthCB;
176 CheckBox* m_pJapOptionsCB;
177 PushButton* m_pJapOptionsBtn;
179 PushButton* m_pAttributeBtn;
180 PushButton* m_pFormatBtn;
181 PushButton* m_pNoFormatBtn;
183 VclContainer* m_pCalcGrid;
184 FixedText* m_pCalcSearchInFT;
185 ListBox* m_pCalcSearchInLB;
186 FixedText* m_pCalcSearchDirFT;
187 RadioButton* m_pRowsBtn;
188 RadioButton* m_pColumnsBtn;
189 CheckBox* m_pAllSheetsCB;
191 SfxBindings& rBindings;
192 sal_Bool bWriter;
193 sal_Bool bSearch;
194 sal_Bool bFormat;
195 sal_uInt16 nOptions;
196 bool bSet;
197 bool bReadOnly;
198 bool bConstruct;
199 sal_uIntPtr nModifyFlag;
200 String aStylesStr;
201 String aLayoutStr;
202 String aLayoutWriterStr;
203 String aLayoutCalcStr;
204 String aCalcStr;
206 std::vector<OUString> aSearchStrings;
207 std::vector<OUString> aReplaceStrings;
209 SearchDlg_Impl* pImpl;
210 SearchAttrItemList* pSearchList;
211 SearchAttrItemList* pReplaceList;
212 SvxSearchItem* pSearchItem;
214 SvxSearchController* pSearchController;
215 SvxSearchController* pOptionsController;
216 SvxSearchController* pFamilyController;
217 SvxSearchController* pSearchSetController;
218 SvxSearchController* pReplaceSetController;
220 mutable sal_Int32 nTransliterationFlags;
222 DECL_LINK( ModifyHdl_Impl, ComboBox* pEdit );
223 DECL_LINK( FlagHdl_Impl, Control* pCtrl );
224 DECL_LINK( CommandHdl_Impl, Button* pBtn );
225 DECL_LINK(TemplateHdl_Impl, void *);
226 DECL_LINK( FocusHdl_Impl, Control* );
227 DECL_LINK(LoseFocusHdl_Impl, void *);
228 DECL_LINK(FormatHdl_Impl, void *);
229 DECL_LINK(NoFormatHdl_Impl, void *);
230 DECL_LINK(AttributeHdl_Impl, void *);
231 DECL_LINK( TimeoutHdl_Impl, Timer* );
233 void Construct_Impl();
234 void InitControls_Impl();
235 void ShowOptionalControls_Impl();
236 void Init_Impl( int bHasItemSet );
237 void InitAttrList_Impl( const SfxItemSet* pSSet,
238 const SfxItemSet* pRSet );
239 void Remember_Impl( const String &rStr,sal_Bool bSearch );
240 void PaintAttrText_Impl();
241 String& BuildAttrText_Impl( String& rStr, sal_Bool bSrchFlag ) const;
243 void TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool );
244 void EnableControls_Impl( const sal_uInt16 nFlags );
245 void EnableControl_Impl( Control* pCtrl );
246 void SetItem_Impl( const SvxSearchItem* pItem );
248 void SetModifyFlag_Impl( const Control* pCtrl );
249 void SaveToModule_Impl();
251 void ApplyTransliterationFlags_Impl( sal_Int32 nSettings );
254 inline sal_Bool SvxSearchDialog::HasSearchAttributes() const
256 sal_Bool bLen = !m_pSearchAttrText->GetText().isEmpty();
257 return ( m_pSearchAttrText->IsEnabled() && bLen );
260 inline sal_Bool SvxSearchDialog::HasReplaceAttributes() const
262 sal_Bool bLen = !m_pReplaceAttrText->GetText().isEmpty();
263 return ( m_pReplaceAttrText->IsEnabled() && bLen );
267 //////////////////////////////////////////////////////////////////////
270 #endif // SV_NODIALOG
271 #endif // NO_SVX_SEARCH
274 #endif
276 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */