1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _SVX_SRCHDLG_HXX 24 #define _SVX_SRCHDLG_HXX 25 26 // include --------------------------------------------------------------- 27 28 29 #include <svtools/stdctrl.hxx> 30 #include <vcl/combobox.hxx> 31 #include <vcl/edit.hxx> 32 #include <vcl/lstbox.hxx> 33 #include <vcl/button.hxx> 34 #include <vcl/group.hxx> 35 #include <vcl/fixed.hxx> 36 #include <vcl/dialog.hxx> 37 #include <sfx2/childwin.hxx> 38 #include <sfx2/basedlgs.hxx> 39 #include <svl/svarray.hxx> 40 #define _SVSTDARR_STRINGSDTOR 41 #include <svl/svstdarr.hxx> 42 #include <svtools/svmedit.hxx> 43 #include <svl/srchdefs.hxx> 44 #include "svx/svxdllapi.h" 45 46 47 // forward --------------------------------------------------------------- 48 49 class SvxSearchItem; 50 class MoreButton; 51 class SfxStyleSheetBasePool; 52 class SvxJSearchOptionsPage; 53 class SvxSearchController; 54 55 struct SearchDlg_Impl; 56 57 #ifndef NO_SVX_SEARCH 58 59 // struct SearchAttrItem ------------------------------------------------- 60 61 struct SearchAttrItem 62 { 63 sal_uInt16 nSlot; 64 SfxPoolItem* pItem; 65 }; 66 67 // class SearchAttrItemList ---------------------------------------------- 68 69 SV_DECL_VARARR_VISIBILITY(SrchAttrItemList, SearchAttrItem, 8, 8, SVX_DLLPUBLIC) 70 71 class SVX_DLLPUBLIC SearchAttrItemList : private SrchAttrItemList 72 { 73 public: 74 SearchAttrItemList() {} 75 SearchAttrItemList( const SearchAttrItemList& rList ); 76 ~SearchAttrItemList(); 77 78 void Put( const SfxItemSet& rSet ); 79 SfxItemSet& Get( SfxItemSet& rSet ); 80 void Clear(); 81 sal_uInt16 Count() const { return SrchAttrItemList::Count(); } 82 SearchAttrItem& operator[](sal_uInt16 nPos) const 83 { return SrchAttrItemList::operator[]( nPos ); } 84 SearchAttrItem& GetObject( sal_uInt16 nPos ) const 85 { return SrchAttrItemList::GetObject( nPos ); } 86 87 // der Pointer auf das Item wird nicht kopiert!!! (also nicht l"oschen) 88 void Insert( const SearchAttrItem& rItem ) 89 { SrchAttrItemList::Insert( rItem, SrchAttrItemList::Count() ); } 90 // l"oscht die Pointer auf die Items 91 void Remove( sal_uInt16 nPos, sal_uInt16 nLen = 1 ); 92 }; 93 94 #ifndef SV_NODIALOG 95 96 // class SvxSearchDialogWrapper ------------------------------------------ 97 98 #include <sfx2/layout.hxx> 99 #include <sfx2/layout-pre.hxx> 100 101 class SvxSearchDialog; 102 class SVX_DLLPUBLIC SvxSearchDialogWrapper : public SfxChildWindow 103 { 104 SvxSearchDialog *dialog; 105 public: 106 SvxSearchDialogWrapper( Window*pParent, sal_uInt16 nId, 107 SfxBindings* pBindings, SfxChildWinInfo* pInfo ); 108 109 ~SvxSearchDialogWrapper (); 110 SvxSearchDialog *getDialog (); 111 SFX_DECL_CHILDWINDOW(SvxSearchDialogWrapper); 112 }; 113 114 // class SvxSearchDialog ------------------------------------------------- 115 116 /* 117 {k:\svx\prototyp\dialog\svx/srchdlg.hxx} 118 119 [Beschreibung] 120 In diesem Modeless-Dialog werden die Attribute einer Suche eingestellt 121 und damit eine Suche gestartet. Es sind mehrere Sucharten 122 ( Suchen, Alle suchen, Ersetzen, Alle ersetzen ) m"oglich. 123 124 [Items] 125 <SvxSearchItem><SID_ATTR_SEARCH> 126 */ 127 128 class SvxSearchDialog : public SfxModelessDialog 129 { 130 friend class SvxSearchController; 131 friend class SvxSearchDialogWrapper; 132 friend class SvxJSearchOptionsDialog; 133 134 public: 135 SvxSearchDialog( Window* pParent, SfxBindings& rBind ); 136 SvxSearchDialog( Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind ); 137 ~SvxSearchDialog(); 138 139 virtual sal_Bool Close(); 140 141 // Window 142 virtual void Activate(); 143 144 void GetSearchItems( SfxItemSet& rSet ); 145 void GetReplaceItems( SfxItemSet& rSet ); 146 147 const SearchAttrItemList* GetSearchItemList() const 148 { return pSearchList; } 149 const SearchAttrItemList* GetReplaceItemList() const 150 { return pReplaceList; } 151 152 inline sal_Bool HasSearchAttributes() const; 153 inline sal_Bool HasReplaceAttributes() const; 154 155 PushButton& GetReplaceBtn() { return aReplaceBtn; } 156 157 sal_Int32 GetTransliterationFlags() const; 158 //IAccessibility2 Impplementaton 2009----- 159 void SetDocWin( Window* pDocWin ) { mpDocWin = pDocWin; } 160 Window* GetDocWin() { return mpDocWin; } 161 void SetSrchFlag( sal_Bool bSuccess = sal_False ) { mbSuccess = bSuccess; } 162 sal_Bool GetSrchFlag() { return mbSuccess; } 163 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > 164 GetComponentInterface( sal_Bool bCreate ); 165 //-----IAccessibility2 Impplementaton 2009 166 private: 167 //IAccessibility2 Impplementaton 2009----- 168 Window* mpDocWin; 169 sal_Bool mbSuccess; 170 //-----IAccessibility2 Impplementaton 2009 171 FixedText aSearchText; 172 ComboBox aSearchLB; 173 ListBox aSearchTmplLB; 174 FixedInfo aSearchAttrText; 175 176 FixedText aReplaceText; 177 ComboBox aReplaceLB; 178 ListBox aReplaceTmplLB; 179 FixedInfo aReplaceAttrText; 180 181 PushButton aSearchBtn; 182 PushButton aSearchAllBtn; 183 FixedLine aSearchCmdLine; 184 PushButton aReplaceBtn; 185 PushButton aReplaceAllBtn; 186 187 FixedLine aSearchComponentFL; 188 PushButton aSearchComponent1PB; 189 PushButton aSearchComponent2PB; 190 191 CheckBox aMatchCaseCB; 192 CheckBox aWordBtn; 193 194 FixedLine aButtonsFL; 195 MoreButton* pMoreBtn; 196 HelpButton aHelpBtn; 197 CancelButton aCloseBtn; 198 199 FixedLine aOptionsFL; 200 CheckBox aSelectionBtn; 201 CheckBox aBackwardsBtn; 202 CheckBox aRegExpBtn; 203 CheckBox aSimilarityBox; 204 PushButton aSimilarityBtn; 205 CheckBox aLayoutBtn; 206 CheckBox aNotesBtn; 207 CheckBox aJapMatchFullHalfWidthCB; 208 CheckBox aJapOptionsCB; 209 PushButton aJapOptionsBtn; 210 211 PushButton aAttributeBtn; 212 PushButton aFormatBtn; 213 PushButton aNoFormatBtn; 214 215 FixedLine aCalcFL; 216 FixedText aCalcSearchInFT; 217 ListBox aCalcSearchInLB; 218 FixedText aCalcSearchDirFT; 219 RadioButton aRowsBtn; 220 RadioButton aColumnsBtn; 221 CheckBox aAllSheetsCB; 222 223 SfxBindings& rBindings; 224 sal_Bool bWriter; 225 sal_Bool bSearch; 226 sal_Bool bFormat; 227 sal_uInt16 nOptions; 228 FASTBOOL bSet; 229 FASTBOOL bReadOnly; 230 FASTBOOL bConstruct; 231 sal_uIntPtr nModifyFlag; 232 String aStylesStr; 233 String aLayoutStr; 234 LocalizedString aCalcStr; 235 236 SvStringsDtor aSearchStrings; 237 SvStringsDtor aReplaceStrings; 238 239 SearchDlg_Impl* pImpl; 240 SearchAttrItemList* pSearchList; 241 SearchAttrItemList* pReplaceList; 242 SvxSearchItem* pSearchItem; 243 244 SvxSearchController* pSearchController; 245 SvxSearchController* pOptionsController; 246 SvxSearchController* pFamilyController; 247 SvxSearchController* pSearchSetController; 248 SvxSearchController* pReplaceSetController; 249 250 mutable sal_Int32 nTransliterationFlags; 251 252 #ifdef _SVX_SRCHDLG_CXX 253 DECL_LINK( ModifyHdl_Impl, ComboBox* pEdit ); 254 DECL_LINK( FlagHdl_Impl, Control* pCtrl ); 255 DECL_LINK( CommandHdl_Impl, Button* pBtn ); 256 DECL_LINK( TemplateHdl_Impl, Button* ); 257 DECL_LINK( FocusHdl_Impl, Control* ); 258 DECL_LINK( LoseFocusHdl_Impl, Control* ); 259 DECL_LINK( FormatHdl_Impl, Button* ); 260 DECL_LINK( NoFormatHdl_Impl, Button* ); 261 DECL_LINK( AttributeHdl_Impl, Button* ); 262 DECL_LINK( TimeoutHdl_Impl, Timer* ); 263 264 void Construct_Impl(); 265 void InitControls_Impl(); 266 void CalculateDelta_Impl(); 267 void Init_Impl( int bHasItemSet ); 268 void InitAttrList_Impl( const SfxItemSet* pSSet, 269 const SfxItemSet* pRSet ); 270 void Remember_Impl( const String &rStr,sal_Bool bSearch ); 271 void PaintAttrText_Impl(); 272 String& BuildAttrText_Impl( String& rStr, sal_Bool bSrchFlag ) const; 273 274 void TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool ); 275 void EnableControls_Impl( const sal_uInt16 nFlags ); 276 void EnableControl_Impl( Control* pCtrl ); 277 void SetItem_Impl( const SvxSearchItem* pItem ); 278 279 void SetModifyFlag_Impl( const Control* pCtrl ); 280 void SaveToModule_Impl(); 281 282 void ApplyTransliterationFlags_Impl( sal_Int32 nSettings ); 283 #endif 284 }; 285 286 #include <sfx2/layout-post.hxx> 287 288 inline sal_Bool SvxSearchDialog::HasSearchAttributes() const 289 { 290 int bLen = aSearchAttrText.GetText().Len(); 291 return ( aSearchAttrText.IsEnabled() && bLen ); 292 } 293 294 inline sal_Bool SvxSearchDialog::HasReplaceAttributes() const 295 { 296 int bLen = aReplaceAttrText.GetText().Len(); 297 return ( aReplaceAttrText.IsEnabled() && bLen ); 298 } 299 300 301 ////////////////////////////////////////////////////////////////////// 302 303 304 #endif // SV_NODIALOG 305 #endif // NO_SVX_SEARCH 306 307 308 #endif 309 310