1f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f6e50924SAndrew Rist * distributed with this work for additional information 6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f6e50924SAndrew Rist * software distributed under the License is distributed on an 15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17f6e50924SAndrew Rist * specific language governing permissions and limitations 18f6e50924SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20f6e50924SAndrew Rist *************************************************************/ 21f6e50924SAndrew Rist 22f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir // include --------------------------------------------------------------- 28cdf0e10cSrcweir #include <vcl/wrkwin.hxx> 29cdf0e10cSrcweir #include <vcl/morebtn.hxx> 30cdf0e10cSrcweir #include <vcl/msgbox.hxx> 31cdf0e10cSrcweir #include <svl/slstitm.hxx> 32cdf0e10cSrcweir #include <svl/itemiter.hxx> 33cdf0e10cSrcweir #include <svl/style.hxx> 34cdf0e10cSrcweir #include <unotools/searchopt.hxx> 35cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 36cdf0e10cSrcweir #include <sfx2/objsh.hxx> 37cdf0e10cSrcweir #include <sfx2/module.hxx> 38cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 39cdf0e10cSrcweir #include <sfx2/basedlgs.hxx> 40cdf0e10cSrcweir #include <svl/cjkoptions.hxx> 41cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 42cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModules.hpp> 43cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp> 44cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp> 45cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 46cdf0e10cSrcweir #include <com/sun/star/frame/XModuleManager.hpp> 47cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 48cdf0e10cSrcweir #include <svl/itempool.hxx> 49cdf0e10cSrcweir #include <svl/intitem.hxx> 50cdf0e10cSrcweir 51cdf0e10cSrcweir #include <sfx2/app.hxx> 52cdf0e10cSrcweir #include <toolkit/unohlp.hxx> 53cdf0e10cSrcweir 54cdf0e10cSrcweir #define _SVX_SRCHDLG_CXX 55cdf0e10cSrcweir #include "svx/srchdlg.hxx" 56cdf0e10cSrcweir 57cdf0e10cSrcweir #include <svx/dialogs.hrc> 58cdf0e10cSrcweir #include <svx/svxitems.hrc> 59cdf0e10cSrcweir #include "srchdlg.hrc" 60cdf0e10cSrcweir 61cdf0e10cSrcweir 62cdf0e10cSrcweir #define ITEMID_SETITEM 0 63cdf0e10cSrcweir 64cdf0e10cSrcweir #include <svl/srchitem.hxx> 65cdf0e10cSrcweir #include <svx/pageitem.hxx> 66cdf0e10cSrcweir #include "srchctrl.hxx" 67cdf0e10cSrcweir #include <svx/dialmgr.hxx> 68cdf0e10cSrcweir #include "svx/dlgutil.hxx" 69cdf0e10cSrcweir #include <editeng/brshitem.hxx> 70cdf0e10cSrcweir #include <tools/resary.hxx> 71cdf0e10cSrcweir #include <svx/svxdlg.hxx> //CHINA001 72cdf0e10cSrcweir 73*9b8096d0SSteve Yin //IAccessibility2 Impplementaton 2009----- 74*9b8096d0SSteve Yin #ifndef _ACCESSIBLESVXFINDREPLACEDIALOG_HXX_ 75*9b8096d0SSteve Yin #include <svx/AccessibleSvxFindReplaceDialog.hxx> 76*9b8096d0SSteve Yin #endif 77*9b8096d0SSteve Yin using namespace com::sun::star::uno; 78*9b8096d0SSteve Yin using namespace com::sun::star::accessibility; 79*9b8096d0SSteve Yin //-----IAccessibility2 Impplementaton 2009 80*9b8096d0SSteve Yin 81cdf0e10cSrcweir #include <sfx2/layout-pre.hxx> 82cdf0e10cSrcweir 83cdf0e10cSrcweir using namespace com::sun::star::i18n; 84cdf0e10cSrcweir using namespace com::sun::star; 85cdf0e10cSrcweir using namespace comphelper; 86cdf0e10cSrcweir 87cdf0e10cSrcweir // ----------------------------------------------------------------------- 88cdf0e10cSrcweir 89cdf0e10cSrcweir #define REMEMBER_SIZE 10 90cdf0e10cSrcweir 91cdf0e10cSrcweir #define MODIFY_SEARCH 0x00000001 92cdf0e10cSrcweir #define MODIFY_REPLACE 0x00000002 93cdf0e10cSrcweir #define MODIFY_WORD 0x00000004 94cdf0e10cSrcweir #define MODIFY_EXACT 0x00000008 95cdf0e10cSrcweir #define MODIFY_BACKWARDS 0x00000010 96cdf0e10cSrcweir #define MODIFY_SELECTION 0x00000020 97cdf0e10cSrcweir #define MODIFY_REGEXP 0x00000040 98cdf0e10cSrcweir #define MODIFY_LAYOUT 0x00000080 99cdf0e10cSrcweir #define MODIFY_SIMILARITY 0x00000100 100cdf0e10cSrcweir #define MODIFY_FORMULAS 0x00000200 101cdf0e10cSrcweir #define MODIFY_VALUES 0x00000400 102cdf0e10cSrcweir #define MODIFY_CALC_NOTES 0x00000800 103cdf0e10cSrcweir #define MODIFY_ROWS 0x00001000 104cdf0e10cSrcweir #define MODIFY_COLUMNS 0x00002000 105cdf0e10cSrcweir #define MODIFY_ALLTABLES 0x00004000 106cdf0e10cSrcweir #define MODIFY_NOTES 0x00008000 107cdf0e10cSrcweir 108cdf0e10cSrcweir SV_IMPL_VARARR(SrchAttrItemList, SearchAttrItem); 109cdf0e10cSrcweir 110cdf0e10cSrcweir //#define NotifyApp( nId ) 111cdf0e10cSrcweir // rBindings.ExecuteSynchron( nId, (const SfxPoolItem**)&pSearchItem, 0L ) 112cdf0e10cSrcweir 113cdf0e10cSrcweir #define GetCheckBoxValue( rBox ) \ 114cdf0e10cSrcweir rBox.IsEnabled() ? rBox.IsChecked() : sal_False 115cdf0e10cSrcweir 116cdf0e10cSrcweir #if ENABLE_LAYOUT 117cdf0e10cSrcweir #undef SVX_RES 118cdf0e10cSrcweir #define SVX_RES(x) #x 119cdf0e10cSrcweir #endif /* ENABLE_LAYOUT */ 120cdf0e10cSrcweir 121cdf0e10cSrcweir struct SearchDlg_Impl 122cdf0e10cSrcweir { 123cdf0e10cSrcweir FixedText aSearchFormats; 124cdf0e10cSrcweir FixedText aReplaceFormats; 125cdf0e10cSrcweir 126cdf0e10cSrcweir sal_Bool bMultiLineEdit : 1, 127cdf0e10cSrcweir bSaveToModule : 1, 128cdf0e10cSrcweir bFocusOnSearch : 1, 129cdf0e10cSrcweir bDeltaCalculated : 1; 130cdf0e10cSrcweir sal_uInt16* pRanges; 131cdf0e10cSrcweir Timer aSelectionTimer; 132cdf0e10cSrcweir 133cdf0e10cSrcweir uno::Reference< frame::XDispatch > xCommand1Dispatch; 134cdf0e10cSrcweir uno::Reference< frame::XDispatch > xCommand2Dispatch; 135cdf0e10cSrcweir util::URL aCommand1URL; 136cdf0e10cSrcweir util::URL aCommand2URL; 137cdf0e10cSrcweir 138cdf0e10cSrcweir #if ENABLE_LAYOUT 139cdf0e10cSrcweir SearchDlg_Impl( layout::Context* pParent ) : 140cdf0e10cSrcweir #else /* !ENABLE_LAYOUT */ 141cdf0e10cSrcweir SearchDlg_Impl( Window* pParent ) : 142cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT */ 143cdf0e10cSrcweir aSearchFormats ( pParent, SVX_RES( FT_SEARCH_FORMATS ) ), 144cdf0e10cSrcweir aReplaceFormats ( pParent, SVX_RES( FT_REPLACE_FORMATS ) ), 145cdf0e10cSrcweir bMultiLineEdit ( sal_False ), 146cdf0e10cSrcweir bSaveToModule ( sal_True ), 147cdf0e10cSrcweir bFocusOnSearch ( sal_True ), 148cdf0e10cSrcweir bDeltaCalculated( sal_False ), 149cdf0e10cSrcweir pRanges ( NULL ) 150cdf0e10cSrcweir { 151cdf0e10cSrcweir aCommand1URL.Complete = aCommand1URL.Main = rtl::OUString::createFromAscii("vnd.sun.search:SearchViaComponent1"); 152cdf0e10cSrcweir aCommand1URL.Protocol = rtl::OUString::createFromAscii("vnd.sun.search:"); 153cdf0e10cSrcweir aCommand1URL.Path = rtl::OUString::createFromAscii("SearchViaComponent1"); 154cdf0e10cSrcweir aCommand2URL.Complete = aCommand2URL.Main = rtl::OUString::createFromAscii("vnd.sun.search:SearchViaComponent2"); 155cdf0e10cSrcweir aCommand2URL.Protocol = rtl::OUString::createFromAscii("vnd.sun.search:"); 156cdf0e10cSrcweir aCommand2URL.Path = rtl::OUString::createFromAscii("SearchViaComponent2"); 157cdf0e10cSrcweir } 158cdf0e10cSrcweir ~SearchDlg_Impl() { delete[] pRanges; } 159cdf0e10cSrcweir }; 160cdf0e10cSrcweir 161cdf0e10cSrcweir // ----------------------------------------------------------------------- 162cdf0e10cSrcweir 163cdf0e10cSrcweir void ListToStrArr_Impl( sal_uInt16 nId, SvStringsDtor& rStrLst, ComboBox& rCBox ) 164cdf0e10cSrcweir { 165cdf0e10cSrcweir SfxStringListItem* pSrchItem = 166cdf0e10cSrcweir (SfxStringListItem*)SFX_APP()->GetItem( nId ); 167cdf0e10cSrcweir List* pLst = pSrchItem ? pSrchItem->GetList() : 0; 168cdf0e10cSrcweir 169cdf0e10cSrcweir if ( pLst ) 170cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < pLst->Count(); ++i ) 171cdf0e10cSrcweir { 172cdf0e10cSrcweir String* pTmp = new String( *(String*)( pLst->GetObject(i) ) ); 173cdf0e10cSrcweir rStrLst.Insert( pTmp, rStrLst.Count() ); 174cdf0e10cSrcweir rCBox.InsertEntry( *pTmp ); 175cdf0e10cSrcweir } 176cdf0e10cSrcweir } 177cdf0e10cSrcweir 178cdf0e10cSrcweir // ----------------------------------------------------------------------- 179cdf0e10cSrcweir 180cdf0e10cSrcweir void StrArrToList_Impl( sal_uInt16 nId, const SvStringsDtor& rStrLst ) 181cdf0e10cSrcweir { 182cdf0e10cSrcweir DBG_ASSERT( rStrLst.Count(), "vorher abpruefen!!" ); 183cdf0e10cSrcweir List aLst; 184cdf0e10cSrcweir 185cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < rStrLst.Count(); ++i ) 186cdf0e10cSrcweir aLst.Insert( rStrLst[ i ], LIST_APPEND ); 187cdf0e10cSrcweir 188cdf0e10cSrcweir SFX_APP()->PutItem( SfxStringListItem( nId, &aLst ) ); 189cdf0e10cSrcweir } 190cdf0e10cSrcweir 191cdf0e10cSrcweir // class SearchAttrItemList ---------------------------------------------- 192cdf0e10cSrcweir 193cdf0e10cSrcweir SearchAttrItemList::SearchAttrItemList( const SearchAttrItemList& rList ) : 194cdf0e10cSrcweir 195cdf0e10cSrcweir SrchAttrItemList( (sal_uInt8)rList.Count() ) 196cdf0e10cSrcweir 197cdf0e10cSrcweir { 198cdf0e10cSrcweir SrchAttrItemList::Insert( &rList, 0 ); 199cdf0e10cSrcweir SearchAttrItem* _pData = (SearchAttrItem*)GetData(); 200cdf0e10cSrcweir 201cdf0e10cSrcweir for ( sal_uInt16 i = Count(); i; --i, ++_pData ) 202cdf0e10cSrcweir if ( !IsInvalidItem( _pData->pItem ) ) 203cdf0e10cSrcweir _pData->pItem = _pData->pItem->Clone(); 204cdf0e10cSrcweir } 205cdf0e10cSrcweir 206cdf0e10cSrcweir // ----------------------------------------------------------------------- 207cdf0e10cSrcweir 208cdf0e10cSrcweir SearchAttrItemList::~SearchAttrItemList() 209cdf0e10cSrcweir { 210cdf0e10cSrcweir Clear(); 211cdf0e10cSrcweir } 212cdf0e10cSrcweir 213cdf0e10cSrcweir // ----------------------------------------------------------------------- 214cdf0e10cSrcweir 215cdf0e10cSrcweir void SearchAttrItemList::Put( const SfxItemSet& rSet ) 216cdf0e10cSrcweir { 217cdf0e10cSrcweir if ( !rSet.Count() ) 218cdf0e10cSrcweir return; 219cdf0e10cSrcweir 220cdf0e10cSrcweir SfxItemPool* pPool = rSet.GetPool(); 221cdf0e10cSrcweir SfxItemIter aIter( rSet ); 222cdf0e10cSrcweir SearchAttrItem aItem; 223cdf0e10cSrcweir const SfxPoolItem* pItem = aIter.GetCurItem(); 224cdf0e10cSrcweir sal_uInt16 nWhich; 225cdf0e10cSrcweir 226cdf0e10cSrcweir while ( sal_True ) 227cdf0e10cSrcweir { 228cdf0e10cSrcweir // nur testen, ob vorhanden ist ? 229cdf0e10cSrcweir if( IsInvalidItem( pItem ) ) 230cdf0e10cSrcweir { 231cdf0e10cSrcweir nWhich = rSet.GetWhichByPos( aIter.GetCurPos() ); 232cdf0e10cSrcweir aItem.pItem = (SfxPoolItem*)pItem; 233cdf0e10cSrcweir } 234cdf0e10cSrcweir else 235cdf0e10cSrcweir { 236cdf0e10cSrcweir nWhich = pItem->Which(); 237cdf0e10cSrcweir aItem.pItem = pItem->Clone(); 238cdf0e10cSrcweir } 239cdf0e10cSrcweir 240cdf0e10cSrcweir aItem.nSlot = pPool->GetSlotId( nWhich ); 241cdf0e10cSrcweir Insert( aItem ); 242cdf0e10cSrcweir 243cdf0e10cSrcweir if ( aIter.IsAtEnd() ) 244cdf0e10cSrcweir break; 245cdf0e10cSrcweir pItem = aIter.NextItem(); 246cdf0e10cSrcweir } 247cdf0e10cSrcweir } 248cdf0e10cSrcweir 249cdf0e10cSrcweir // ----------------------------------------------------------------------- 250cdf0e10cSrcweir 251cdf0e10cSrcweir SfxItemSet& SearchAttrItemList::Get( SfxItemSet& rSet ) 252cdf0e10cSrcweir { 253cdf0e10cSrcweir SfxItemPool* pPool = rSet.GetPool(); 254cdf0e10cSrcweir SearchAttrItem* _pData = (SearchAttrItem*)GetData(); 255cdf0e10cSrcweir 256cdf0e10cSrcweir for ( sal_uInt16 i = Count(); i; --i, ++_pData ) 257cdf0e10cSrcweir if ( IsInvalidItem( _pData->pItem ) ) 258cdf0e10cSrcweir rSet.InvalidateItem( pPool->GetWhich( _pData->nSlot ) ); 259cdf0e10cSrcweir else 260cdf0e10cSrcweir rSet.Put( *_pData->pItem ); 261cdf0e10cSrcweir return rSet; 262cdf0e10cSrcweir } 263cdf0e10cSrcweir 264cdf0e10cSrcweir // ----------------------------------------------------------------------- 265cdf0e10cSrcweir 266cdf0e10cSrcweir void SearchAttrItemList::Clear() 267cdf0e10cSrcweir { 268cdf0e10cSrcweir SearchAttrItem* _pData = (SearchAttrItem*)GetData(); 269cdf0e10cSrcweir 270cdf0e10cSrcweir for ( sal_uInt16 i = Count(); i; --i, ++_pData ) 271cdf0e10cSrcweir if ( !IsInvalidItem( _pData->pItem ) ) 272cdf0e10cSrcweir delete _pData->pItem; 273cdf0e10cSrcweir SrchAttrItemList::Remove( 0, Count() ); 274cdf0e10cSrcweir } 275cdf0e10cSrcweir 276cdf0e10cSrcweir // ----------------------------------------------------------------------- 277cdf0e10cSrcweir 278cdf0e10cSrcweir // l"oscht die Pointer auf die Items 279cdf0e10cSrcweir void SearchAttrItemList::Remove( sal_uInt16 nPos, sal_uInt16 nLen ) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir if ( nPos + nLen > Count() ) 282cdf0e10cSrcweir nLen = Count() - nPos; 283cdf0e10cSrcweir SearchAttrItem* _pData = (SearchAttrItem*)GetData() + nPos; 284cdf0e10cSrcweir 285cdf0e10cSrcweir for ( sal_uInt16 n = nLen; n; --n, ++_pData ) 286cdf0e10cSrcweir if ( !IsInvalidItem( _pData->pItem ) ) 287cdf0e10cSrcweir delete _pData->pItem; 288cdf0e10cSrcweir 289cdf0e10cSrcweir SrchAttrItemList::Remove( nPos, nLen ); 290cdf0e10cSrcweir } 291cdf0e10cSrcweir 292cdf0e10cSrcweir #if ENABLE_LAYOUT 293cdf0e10cSrcweir #undef SfxModelessDialog 294cdf0e10cSrcweir #define SfxModelessDialog(bindings, child, parent, id) SfxDialog (parent, "find-and-replace.xml", id, bindings, child) 295cdf0e10cSrcweir #define SVX_RES_PLAIN(x) ResId (x, DIALOG_MGR ()) 296cdf0e10cSrcweir #define THIS_SVX_RES(x) this, #x 297cdf0e10cSrcweir #else /* !ENABLE_LAYOUT */ 298cdf0e10cSrcweir #define SVX_RES_PLAIN SVX_RES 299cdf0e10cSrcweir #define THIS_SVX_RES SVX_RES 300cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT */ 301cdf0e10cSrcweir 302cdf0e10cSrcweir #undef INI_LIST 303cdf0e10cSrcweir #define INI_LIST() \ 304*9b8096d0SSteve Yin mpDocWin (NULL), \ 305*9b8096d0SSteve Yin mbSuccess (sal_False), \ 306cdf0e10cSrcweir aSearchText ( this, SVX_RES( FT_SEARCH ) ), \ 307cdf0e10cSrcweir aSearchLB ( this, SVX_RES( ED_SEARCH ) ), \ 308cdf0e10cSrcweir aSearchTmplLB ( this, SVX_RES( LB_SEARCH ) ), \ 309cdf0e10cSrcweir aSearchAttrText ( this, SVX_RES( FT_SEARCH_ATTR ) ), \ 310cdf0e10cSrcweir aReplaceText ( this, SVX_RES( FT_REPLACE ) ), \ 311cdf0e10cSrcweir aReplaceLB ( this, SVX_RES( ED_REPLACE ) ), \ 312cdf0e10cSrcweir aReplaceTmplLB ( this, SVX_RES( LB_REPLACE ) ), \ 313cdf0e10cSrcweir aReplaceAttrText( this, SVX_RES( FT_REPLACE_ATTR ) ), \ 314cdf0e10cSrcweir aSearchBtn ( this, SVX_RES( BTN_SEARCH ) ), \ 315cdf0e10cSrcweir aSearchAllBtn ( this, SVX_RES( BTN_SEARCH_ALL ) ), \ 316cdf0e10cSrcweir aSearchCmdLine ( this, SVX_RES( FL_SEARCH_COMMAND ) ), \ 317cdf0e10cSrcweir aReplaceBtn ( this, SVX_RES( BTN_REPLACE ) ), \ 318cdf0e10cSrcweir aReplaceAllBtn ( this, SVX_RES( BTN_REPLACE_ALL ) ), \ 319cdf0e10cSrcweir aSearchComponentFL( this, SVX_RES( FL_SEARCH_COMPONENT ) ), \ 320cdf0e10cSrcweir aSearchComponent1PB( this, SVX_RES( BTN_COMPONENT_1 ) ), \ 321cdf0e10cSrcweir aSearchComponent2PB( this, SVX_RES( BTN_COMPONENT_2 ) ), \ 322cdf0e10cSrcweir aMatchCaseCB ( this, SVX_RES( CB_MATCH_CASE ) ), \ 323cdf0e10cSrcweir aWordBtn ( this, SVX_RES( CB_WHOLE_WORDS ) ), \ 324cdf0e10cSrcweir aButtonsFL ( this, SVX_RES( FL_BUTTONS ) ), \ 325cdf0e10cSrcweir pMoreBtn ( new MoreButton( this, SVX_RES( BTN_MORE ) ) ), \ 326cdf0e10cSrcweir aHelpBtn ( this, SVX_RES( BTN_HELP ) ), \ 327cdf0e10cSrcweir aCloseBtn ( this, SVX_RES( BTN_CLOSE ) ), \ 328cdf0e10cSrcweir aOptionsFL ( this, SVX_RES( FL_OPTIONS ) ), \ 329cdf0e10cSrcweir aSelectionBtn ( this, SVX_RES( CB_SELECTIONS ) ), \ 330cdf0e10cSrcweir aBackwardsBtn ( this, SVX_RES( CB_BACKWARDS ) ), \ 331cdf0e10cSrcweir aRegExpBtn ( this, SVX_RES( CB_REGEXP ) ), \ 332cdf0e10cSrcweir aSimilarityBox ( this, SVX_RES( CB_SIMILARITY) ), \ 333cdf0e10cSrcweir aSimilarityBtn ( this, SVX_RES( PB_SIMILARITY) ), \ 334cdf0e10cSrcweir aLayoutBtn ( this, SVX_RES( CB_LAYOUTS ) ), \ 335cdf0e10cSrcweir aNotesBtn ( this, SVX_RES( CB_NOTES ) ), \ 336cdf0e10cSrcweir aJapMatchFullHalfWidthCB( this, SVX_RES( CB_JAP_MATCH_FULL_HALF_WIDTH ) ),\ 337cdf0e10cSrcweir aJapOptionsCB ( this, SVX_RES( CB_JAP_SOUNDS_LIKE ) ), \ 338cdf0e10cSrcweir aJapOptionsBtn ( this, SVX_RES( PB_JAP_OPTIONS ) ), \ 339cdf0e10cSrcweir aAttributeBtn ( this, SVX_RES( BTN_ATTRIBUTE ) ), \ 340cdf0e10cSrcweir aFormatBtn ( this, SVX_RES( BTN_FORMAT ) ), \ 341cdf0e10cSrcweir aNoFormatBtn ( this, SVX_RES( BTN_NOFORMAT ) ), \ 342cdf0e10cSrcweir aCalcFL ( this, SVX_RES( FL_CALC ) ), \ 343cdf0e10cSrcweir aCalcSearchInFT ( this, SVX_RES( FT_CALC_SEARCHIN ) ), \ 344cdf0e10cSrcweir aCalcSearchInLB ( this, SVX_RES( LB_CALC_SEARCHIN ) ), \ 345cdf0e10cSrcweir aCalcSearchDirFT( this, SVX_RES( FT_CALC_SEARCHDIR ) ), \ 346cdf0e10cSrcweir aRowsBtn ( this, SVX_RES( RB_CALC_ROWS ) ), \ 347cdf0e10cSrcweir aColumnsBtn ( this, SVX_RES( RB_CALC_COLUMNS ) ), \ 348cdf0e10cSrcweir aAllSheetsCB ( this, SVX_RES( CB_ALL_SHEETS ) ), \ 349cdf0e10cSrcweir rBindings ( rBind ), \ 350cdf0e10cSrcweir bWriter ( sal_False ), \ 351cdf0e10cSrcweir bSearch ( sal_True ), \ 352cdf0e10cSrcweir bFormat ( sal_False ), \ 353cdf0e10cSrcweir nOptions ( USHRT_MAX ), \ 354cdf0e10cSrcweir bSet ( sal_False ), \ 355cdf0e10cSrcweir bReadOnly ( sal_False ), \ 356cdf0e10cSrcweir bConstruct ( sal_True ), \ 357cdf0e10cSrcweir nModifyFlag ( 0 ), \ 358cdf0e10cSrcweir aCalcStr ( THIS_SVX_RES( STR_WORDCALC ) ), \ 359cdf0e10cSrcweir pImpl ( NULL ), \ 360cdf0e10cSrcweir pSearchList ( NULL ), \ 361cdf0e10cSrcweir pReplaceList ( new SearchAttrItemList ), \ 362cdf0e10cSrcweir pSearchItem ( NULL ), \ 363cdf0e10cSrcweir pSearchController ( NULL ), \ 364cdf0e10cSrcweir pOptionsController ( NULL ), \ 365cdf0e10cSrcweir pFamilyController ( NULL ), \ 366cdf0e10cSrcweir pSearchSetController ( NULL ), \ 367cdf0e10cSrcweir pReplaceSetController ( NULL ), \ 368cdf0e10cSrcweir nTransliterationFlags ( 0x00000000 ) 369cdf0e10cSrcweir 370cdf0e10cSrcweir // class SvxSearchDialog ------------------------------------------------- 371cdf0e10cSrcweir 372cdf0e10cSrcweir SvxSearchDialog::SvxSearchDialog( Window* pParent, SfxBindings& rBind ) : 373cdf0e10cSrcweir 374cdf0e10cSrcweir SfxModelessDialog( &rBind, NULL, pParent, SVX_RES( RID_SVXDLG_SEARCH ) ), 375cdf0e10cSrcweir 376cdf0e10cSrcweir INI_LIST() 377cdf0e10cSrcweir 378cdf0e10cSrcweir { 379cdf0e10cSrcweir Construct_Impl(); 380cdf0e10cSrcweir } 381cdf0e10cSrcweir 382cdf0e10cSrcweir // ----------------------------------------------------------------------- 383cdf0e10cSrcweir 384cdf0e10cSrcweir SvxSearchDialog::SvxSearchDialog( Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind ) : 385cdf0e10cSrcweir 386cdf0e10cSrcweir SfxModelessDialog( &rBind, pChildWin, pParent, SVX_RES( RID_SVXDLG_SEARCH ) ), 387cdf0e10cSrcweir 388cdf0e10cSrcweir INI_LIST() 389cdf0e10cSrcweir 390cdf0e10cSrcweir { 391cdf0e10cSrcweir Construct_Impl(); 392cdf0e10cSrcweir } 393cdf0e10cSrcweir 394cdf0e10cSrcweir #undef INI_LIST 395cdf0e10cSrcweir #if ENABLE_LAYOUT 396cdf0e10cSrcweir #undef SVX_RES 397cdf0e10cSrcweir #define SVX_RES(x) ResId (x, DIALOG_MGR ()) 398cdf0e10cSrcweir #endif 399cdf0e10cSrcweir 400cdf0e10cSrcweir // ----------------------------------------------------------------------- 401cdf0e10cSrcweir 402cdf0e10cSrcweir SvxSearchDialog::~SvxSearchDialog() 403cdf0e10cSrcweir { 404cdf0e10cSrcweir Hide(); 405cdf0e10cSrcweir 406cdf0e10cSrcweir rBindings.EnterRegistrations(); 407cdf0e10cSrcweir delete pSearchController; 408cdf0e10cSrcweir delete pOptionsController; 409cdf0e10cSrcweir delete pFamilyController; 410cdf0e10cSrcweir delete pSearchSetController; 411cdf0e10cSrcweir delete pReplaceSetController; 412cdf0e10cSrcweir rBindings.LeaveRegistrations(); 413cdf0e10cSrcweir 414cdf0e10cSrcweir delete pSearchItem; 415cdf0e10cSrcweir delete pImpl; 416cdf0e10cSrcweir delete pSearchList; 417cdf0e10cSrcweir delete pReplaceList; 418cdf0e10cSrcweir delete pMoreBtn; 419cdf0e10cSrcweir } 420cdf0e10cSrcweir 421cdf0e10cSrcweir #if ENABLE_LAYOUT 422cdf0e10cSrcweir #undef Window 423cdf0e10cSrcweir #define Window layout::Window 424cdf0e10cSrcweir #endif /* ENABLE_LAYOUT */ 425cdf0e10cSrcweir 426cdf0e10cSrcweir void lcl_MoveDown( Window& rWindow, sal_Int32 nOffset ) 427cdf0e10cSrcweir { 428cdf0e10cSrcweir Point aPos(rWindow.GetPosPixel()); 429cdf0e10cSrcweir aPos.Y() += nOffset; 430cdf0e10cSrcweir rWindow.SetPosPixel(aPos); 431cdf0e10cSrcweir } 432cdf0e10cSrcweir 433cdf0e10cSrcweir void SvxSearchDialog::Construct_Impl() 434cdf0e10cSrcweir { 435cdf0e10cSrcweir #if ENABLE_LAYOUT 436cdf0e10cSrcweir SetHelpId (".uno:SearchDialog"); 437cdf0e10cSrcweir #endif /* ENABLE_LAYOUT */ 438cdf0e10cSrcweir 439cdf0e10cSrcweir // temporary to avoid incompatibility 440cdf0e10cSrcweir pImpl = new SearchDlg_Impl( this ); 441cdf0e10cSrcweir #if !ENABLE_LAYOUT 442cdf0e10cSrcweir pImpl->aSelectionTimer.SetTimeout( 500 ); 443cdf0e10cSrcweir pImpl->aSelectionTimer.SetTimeoutHdl( 444cdf0e10cSrcweir LINK( this, SvxSearchDialog, TimeoutHdl_Impl ) ); 445cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT */ 446cdf0e10cSrcweir EnableControls_Impl( 0 ); 447cdf0e10cSrcweir 448cdf0e10cSrcweir // alten Text des aWordBtn's merken 449cdf0e10cSrcweir aCalcStr += sal_Unicode('#'); 450cdf0e10cSrcweir aCalcStr += aWordBtn.GetText(); 451cdf0e10cSrcweir 452cdf0e10cSrcweir aLayoutStr = SVX_RESSTR( RID_SVXSTR_SEARCH_STYLES ); 453cdf0e10cSrcweir aStylesStr = aLayoutBtn.GetText(); 454cdf0e10cSrcweir 455cdf0e10cSrcweir // gemerkte Such-Strings von der Applikation holen 456cdf0e10cSrcweir ListToStrArr_Impl( SID_SEARCHDLG_SEARCHSTRINGS, 457cdf0e10cSrcweir aSearchStrings, aSearchLB ); 458cdf0e10cSrcweir ListToStrArr_Impl( SID_SEARCHDLG_REPLACESTRINGS, 459cdf0e10cSrcweir aReplaceStrings, aReplaceLB ); 460cdf0e10cSrcweir 461cdf0e10cSrcweir pMoreBtn->SetMoreText( String( SVX_RES( STR_MORE_BTN ) ) ); 462cdf0e10cSrcweir pMoreBtn->SetLessText( String( SVX_RES( STR_LESS_BTN ) ) ); 463cdf0e10cSrcweir 464cdf0e10cSrcweir FreeResource(); 465cdf0e10cSrcweir InitControls_Impl(); 466cdf0e10cSrcweir 467cdf0e10cSrcweir // Attribut-Sets nur einmal im Ctor() besorgen 468cdf0e10cSrcweir const SfxPoolItem* ppArgs[] = { pSearchItem, 0 }; 469cdf0e10cSrcweir const SvxSetItem* pSrchSetItem = 470cdf0e10cSrcweir (const SvxSetItem*) rBindings.GetDispatcher()->Execute( FID_SEARCH_SEARCHSET, SFX_CALLMODE_SLOT, ppArgs ); 471cdf0e10cSrcweir 472cdf0e10cSrcweir if ( pSrchSetItem ) 473cdf0e10cSrcweir InitAttrList_Impl( &pSrchSetItem->GetItemSet(), 0 ); 474cdf0e10cSrcweir 475cdf0e10cSrcweir const SvxSetItem* pReplSetItem = 476cdf0e10cSrcweir (const SvxSetItem*)rBindings.GetDispatcher()->Execute( FID_SEARCH_REPLACESET, SFX_CALLMODE_SLOT, ppArgs ); 477cdf0e10cSrcweir 478cdf0e10cSrcweir if ( pReplSetItem ) 479cdf0e10cSrcweir InitAttrList_Impl( 0, &pReplSetItem->GetItemSet() ); 480cdf0e10cSrcweir 481cdf0e10cSrcweir // Controller erzeugen und gleich aktualisieren 482cdf0e10cSrcweir rBindings.EnterRegistrations(); 483cdf0e10cSrcweir pSearchController = 484cdf0e10cSrcweir new SvxSearchController( SID_SEARCH_ITEM, rBindings, *this ); 485cdf0e10cSrcweir pOptionsController = 486cdf0e10cSrcweir new SvxSearchController( SID_SEARCH_OPTIONS, rBindings, *this ); 487cdf0e10cSrcweir rBindings.LeaveRegistrations(); 488cdf0e10cSrcweir rBindings.GetDispatcher()->Execute( FID_SEARCH_ON, SFX_CALLMODE_SLOT, ppArgs ); 489cdf0e10cSrcweir pImpl->aSelectionTimer.Start(); 490cdf0e10cSrcweir 491cdf0e10cSrcweir 492cdf0e10cSrcweir SvtCJKOptions aCJKOptions; 493cdf0e10cSrcweir if(!aCJKOptions.IsJapaneseFindEnabled()) 494cdf0e10cSrcweir { 495cdf0e10cSrcweir aJapOptionsCB.Check( sal_False ); 496cdf0e10cSrcweir aJapOptionsCB.Hide(); 497cdf0e10cSrcweir aJapOptionsBtn.Hide(); 498cdf0e10cSrcweir } 499cdf0e10cSrcweir if(!aCJKOptions.IsCJKFontEnabled()) 500cdf0e10cSrcweir { 501cdf0e10cSrcweir aJapMatchFullHalfWidthCB.Hide(); 502cdf0e10cSrcweir } 503cdf0e10cSrcweir 504cdf0e10cSrcweir aSimilarityBtn.SetAccessibleRelationLabeledBy(&aSimilarityBox); 505cdf0e10cSrcweir aSimilarityBtn.SetAccessibleRelationMemberOf(&aOptionsFL); 506cdf0e10cSrcweir aJapOptionsBtn.SetAccessibleRelationLabeledBy(&aJapOptionsCB); 507cdf0e10cSrcweir aJapOptionsBtn.SetAccessibleRelationMemberOf(&aOptionsFL); 508cdf0e10cSrcweir aRowsBtn.SetAccessibleRelationMemberOf(&aCalcSearchDirFT); 509cdf0e10cSrcweir aColumnsBtn.SetAccessibleRelationMemberOf(&aCalcSearchDirFT); 510cdf0e10cSrcweir 511cdf0e10cSrcweir //component extension - show component search buttons if the commands 512cdf0e10cSrcweir // vnd.sun.star::SearchViaComponent1 and 2 are supported 513cdf0e10cSrcweir const uno::Reference< frame::XFrame >xFrame = rBindings.GetActiveFrame(); 514cdf0e10cSrcweir const uno::Reference< frame::XDispatchProvider > xDispatchProv(xFrame, uno::UNO_QUERY); 515cdf0e10cSrcweir rtl::OUString sTarget = rtl::OUString::createFromAscii("_self"); 516cdf0e10cSrcweir 517cdf0e10cSrcweir bool bSearchComponent1 = false; 518cdf0e10cSrcweir bool bSearchComponent2 = false; 519cdf0e10cSrcweir if(xDispatchProv.is() && 520cdf0e10cSrcweir (pImpl->xCommand1Dispatch = xDispatchProv->queryDispatch(pImpl->aCommand1URL, sTarget, 0)).is()) 521cdf0e10cSrcweir { 522cdf0e10cSrcweir bSearchComponent1 = true; 523cdf0e10cSrcweir } 524cdf0e10cSrcweir if(xDispatchProv.is() && 525cdf0e10cSrcweir (pImpl->xCommand2Dispatch = xDispatchProv->queryDispatch(pImpl->aCommand2URL, sTarget, 0)).is()) 526cdf0e10cSrcweir { 527cdf0e10cSrcweir bSearchComponent2 = true; 528cdf0e10cSrcweir } 529cdf0e10cSrcweir 530cdf0e10cSrcweir if( bSearchComponent1 || bSearchComponent2 ) 531cdf0e10cSrcweir { 532cdf0e10cSrcweir //get the labels of the FixedLine and the buttons 533cdf0e10cSrcweir // "/org.openoffice.Office.Common/SearchOptions/ComponentSearchGroupLabel 534cdf0e10cSrcweir // "/org.openoffice.Office.Common/SearchOptions/ComponentSearchCommandLabel1 535cdf0e10cSrcweir // "/org.openoffice.Office.Common/SearchOptions/ComponentSearchCommandLabel2 536cdf0e10cSrcweir try 537cdf0e10cSrcweir { 538cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > xMgr = getProcessServiceFactory(); 539cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider(xMgr->createInstance( 540cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider"))), 541cdf0e10cSrcweir uno::UNO_QUERY); 542cdf0e10cSrcweir uno::Sequence< uno::Any > aArgs(1); 543cdf0e10cSrcweir ::rtl::OUString sPath(RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/SearchOptions/")); 544cdf0e10cSrcweir aArgs[0] <<= sPath; 545cdf0e10cSrcweir 546cdf0e10cSrcweir uno::Reference< uno::XInterface > xIFace = xConfigurationProvider->createInstanceWithArguments( 547cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess")), 548cdf0e10cSrcweir aArgs); 549cdf0e10cSrcweir uno::Reference< container::XNameAccess> xDirectAccess(xIFace, uno::UNO_QUERY); 550cdf0e10cSrcweir if(xDirectAccess.is()) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir ::rtl::OUString sTemp; 553cdf0e10cSrcweir ::rtl::OUString sProperty(RTL_CONSTASCII_USTRINGPARAM( "ComponentSearchGroupLabel")); 554cdf0e10cSrcweir uno::Any aRet = xDirectAccess->getByName(sProperty); 555cdf0e10cSrcweir aRet >>= sTemp; 556cdf0e10cSrcweir aSearchComponentFL.SetText( sTemp ); 557cdf0e10cSrcweir aRet = xDirectAccess->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ComponentSearchCommandLabel1"))); 558cdf0e10cSrcweir aRet >>= sTemp; 559cdf0e10cSrcweir aSearchComponent1PB.SetText( sTemp ); 560cdf0e10cSrcweir aRet = xDirectAccess->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ComponentSearchCommandLabel2"))); 561cdf0e10cSrcweir aRet >>= sTemp; 562cdf0e10cSrcweir aSearchComponent2PB.SetText( sTemp ); 563cdf0e10cSrcweir } 564cdf0e10cSrcweir } 565cdf0e10cSrcweir catch(uno::Exception&){} 566cdf0e10cSrcweir 567cdf0e10cSrcweir if(aSearchComponent1PB.GetText().Len() && bSearchComponent1 ) 568cdf0e10cSrcweir { 569cdf0e10cSrcweir aSearchComponentFL.Show(); 570cdf0e10cSrcweir aSearchComponent1PB.Show(); 571cdf0e10cSrcweir } 572cdf0e10cSrcweir if( aSearchComponent2PB.GetText().Len() ) 573cdf0e10cSrcweir { 574cdf0e10cSrcweir if(!aSearchComponent1PB.IsVisible()) 575cdf0e10cSrcweir { 576cdf0e10cSrcweir aSearchComponent2PB.SetPosPixel(aSearchComponent1PB.GetPosPixel()); 577cdf0e10cSrcweir } 578cdf0e10cSrcweir aSearchComponentFL.Show(); 579cdf0e10cSrcweir aSearchComponent2PB.Show(); 580cdf0e10cSrcweir } 581cdf0e10cSrcweir if( aSearchComponentFL.IsVisible() && aSearchComponent1PB.IsVisible() ) 582cdf0e10cSrcweir { 583cdf0e10cSrcweir 584cdf0e10cSrcweir //dialog must be resized 585cdf0e10cSrcweir Size aDlgSize(GetSizePixel()); 586cdf0e10cSrcweir sal_Int32 nOffset = aSearchCmdLine.GetPosPixel().Y() - aSearchAllBtn.GetPosPixel().Y() 587cdf0e10cSrcweir - aButtonsFL.GetPosPixel().Y() + aSearchComponent2PB.GetPosPixel().Y(); 588cdf0e10cSrcweir 589cdf0e10cSrcweir aDlgSize.Height() += nOffset; 590cdf0e10cSrcweir Window* aWindows[] = 591cdf0e10cSrcweir { 592cdf0e10cSrcweir &aOptionsFL, 593cdf0e10cSrcweir &aSelectionBtn, 594cdf0e10cSrcweir &aBackwardsBtn, 595cdf0e10cSrcweir &aRegExpBtn, 596cdf0e10cSrcweir &aSimilarityBox, 597cdf0e10cSrcweir &aSimilarityBtn, 598cdf0e10cSrcweir &aLayoutBtn, 599cdf0e10cSrcweir &aNotesBtn, 600cdf0e10cSrcweir &aJapMatchFullHalfWidthCB, 601cdf0e10cSrcweir &aJapOptionsCB, 602cdf0e10cSrcweir &aJapOptionsBtn, 603cdf0e10cSrcweir &aAttributeBtn, 604cdf0e10cSrcweir &aFormatBtn, 605cdf0e10cSrcweir &aNoFormatBtn, 606cdf0e10cSrcweir &aCalcFL, 607cdf0e10cSrcweir &aCalcSearchInFT, 608cdf0e10cSrcweir &aCalcSearchInLB, 609cdf0e10cSrcweir &aCalcSearchDirFT, 610cdf0e10cSrcweir &aRowsBtn, 611cdf0e10cSrcweir &aColumnsBtn, 612cdf0e10cSrcweir &aAllSheetsCB, 613cdf0e10cSrcweir &aButtonsFL, 614cdf0e10cSrcweir &aHelpBtn, 615cdf0e10cSrcweir &aCloseBtn, 616cdf0e10cSrcweir pMoreBtn, 617cdf0e10cSrcweir 0 618cdf0e10cSrcweir }; 619cdf0e10cSrcweir sal_Int32 nWindow = 0; 620cdf0e10cSrcweir do 621cdf0e10cSrcweir { 622cdf0e10cSrcweir lcl_MoveDown( *aWindows[nWindow], nOffset ); 623cdf0e10cSrcweir } 624cdf0e10cSrcweir while(aWindows[++nWindow]); 625cdf0e10cSrcweir 626cdf0e10cSrcweir SetSizePixel(aDlgSize); 627cdf0e10cSrcweir } 628cdf0e10cSrcweir } 629cdf0e10cSrcweir } 630cdf0e10cSrcweir 631cdf0e10cSrcweir // ----------------------------------------------------------------------- 632cdf0e10cSrcweir 633cdf0e10cSrcweir sal_Bool SvxSearchDialog::Close() 634cdf0e10cSrcweir { 635cdf0e10cSrcweir // remember strings speichern 636cdf0e10cSrcweir if ( aSearchStrings.Count() ) 637cdf0e10cSrcweir StrArrToList_Impl( SID_SEARCHDLG_SEARCHSTRINGS, aSearchStrings ); 638cdf0e10cSrcweir 639cdf0e10cSrcweir if ( aReplaceStrings.Count() ) 640cdf0e10cSrcweir StrArrToList_Impl( SID_SEARCHDLG_REPLACESTRINGS, aReplaceStrings ); 641cdf0e10cSrcweir 642cdf0e10cSrcweir // save settings to configuration 643cdf0e10cSrcweir SvtSearchOptions aOpt; 644cdf0e10cSrcweir aOpt.SetWholeWordsOnly ( aWordBtn .IsChecked() ); 645cdf0e10cSrcweir aOpt.SetBackwards ( aBackwardsBtn .IsChecked() ); 646cdf0e10cSrcweir aOpt.SetUseRegularExpression ( aRegExpBtn .IsChecked() ); 647cdf0e10cSrcweir //aOpt.SetMatchCase ( aMatchCaseCB .IsChecked() ); 648cdf0e10cSrcweir aOpt.SetSearchForStyles ( aLayoutBtn .IsChecked() ); 649cdf0e10cSrcweir aOpt.SetSimilaritySearch ( aSimilarityBox .IsChecked() ); 650cdf0e10cSrcweir //aOpt.SetMatchFullHalfWidthForms ( !aJapMatchFullHalfWidthCB.IsChecked() ); 651cdf0e10cSrcweir aOpt.SetUseAsianOptions ( aJapOptionsCB .IsChecked() ); 652cdf0e10cSrcweir aOpt.SetNotes ( aNotesBtn .IsChecked() ); 653cdf0e10cSrcweir 654cdf0e10cSrcweir const SfxPoolItem* ppArgs[] = { pSearchItem, 0 }; 655cdf0e10cSrcweir rBindings.GetDispatcher()->Execute( FID_SEARCH_OFF, SFX_CALLMODE_SLOT, ppArgs ); 656cdf0e10cSrcweir rBindings.Execute( SID_SEARCH_DLG ); 657cdf0e10cSrcweir 658cdf0e10cSrcweir return sal_True; 659cdf0e10cSrcweir } 660cdf0e10cSrcweir 661cdf0e10cSrcweir // ----------------------------------------------------------------------- 662cdf0e10cSrcweir 663cdf0e10cSrcweir sal_Int32 SvxSearchDialog::GetTransliterationFlags() const 664cdf0e10cSrcweir { 665cdf0e10cSrcweir if (!aMatchCaseCB.IsChecked()) 666cdf0e10cSrcweir nTransliterationFlags |= TransliterationModules_IGNORE_CASE; 667cdf0e10cSrcweir else 668cdf0e10cSrcweir nTransliterationFlags &= ~TransliterationModules_IGNORE_CASE; 669cdf0e10cSrcweir if ( !aJapMatchFullHalfWidthCB.IsChecked()) 670cdf0e10cSrcweir nTransliterationFlags |= TransliterationModules_IGNORE_WIDTH; 671cdf0e10cSrcweir else 672cdf0e10cSrcweir nTransliterationFlags &= ~TransliterationModules_IGNORE_WIDTH; 673cdf0e10cSrcweir return nTransliterationFlags; 674cdf0e10cSrcweir } 675cdf0e10cSrcweir 676cdf0e10cSrcweir // ----------------------------------------------------------------------- 677cdf0e10cSrcweir 678cdf0e10cSrcweir void SvxSearchDialog::ApplyTransliterationFlags_Impl( sal_Int32 nSettings ) 679cdf0e10cSrcweir { 680cdf0e10cSrcweir nTransliterationFlags = nSettings; 681cdf0e10cSrcweir sal_Bool bVal = 0 != (nSettings & TransliterationModules_IGNORE_CASE); 682cdf0e10cSrcweir aMatchCaseCB .Check(!bVal ); 683cdf0e10cSrcweir bVal = 0 != (nSettings & TransliterationModules_IGNORE_WIDTH); 684cdf0e10cSrcweir aJapMatchFullHalfWidthCB.Check( !bVal ); 685cdf0e10cSrcweir } 686cdf0e10cSrcweir 687cdf0e10cSrcweir // ----------------------------------------------------------------------- 688cdf0e10cSrcweir 689cdf0e10cSrcweir void SvxSearchDialog::Activate() 690cdf0e10cSrcweir { 691cdf0e10cSrcweir // apply possible transliteration changes of the SvxSearchItem member 692cdf0e10cSrcweir DBG_ASSERT( pSearchItem, "SearchItem missing" ); 693cdf0e10cSrcweir if (pSearchItem) 694cdf0e10cSrcweir { 695cdf0e10cSrcweir aMatchCaseCB .Check( pSearchItem->GetExact() ); 696cdf0e10cSrcweir aJapMatchFullHalfWidthCB.Check( !pSearchItem->IsMatchFullHalfWidthForms() ); 697cdf0e10cSrcweir } 698cdf0e10cSrcweir } 699cdf0e10cSrcweir 700cdf0e10cSrcweir // ----------------------------------------------------------------------- 701cdf0e10cSrcweir 702cdf0e10cSrcweir void SvxSearchDialog::InitControls_Impl() 703cdf0e10cSrcweir { 704cdf0e10cSrcweir // CaseSensitives AutoComplete 705cdf0e10cSrcweir aSearchLB.EnableAutocomplete( sal_True, sal_True ); 706cdf0e10cSrcweir aSearchLB.Show(); 707cdf0e10cSrcweir aReplaceLB.EnableAutocomplete( sal_True, sal_True ); 708cdf0e10cSrcweir aReplaceLB.Show(); 709cdf0e10cSrcweir 710cdf0e10cSrcweir aFormatBtn.Disable(); 711cdf0e10cSrcweir aAttributeBtn.Disable(); 712cdf0e10cSrcweir 713cdf0e10cSrcweir aSearchLB.SetModifyHdl( LINK( this, SvxSearchDialog, ModifyHdl_Impl ) ); 714cdf0e10cSrcweir aReplaceLB.SetModifyHdl( LINK( this, SvxSearchDialog, ModifyHdl_Impl ) ); 715cdf0e10cSrcweir 716cdf0e10cSrcweir Link aLink = LINK( this, SvxSearchDialog, FocusHdl_Impl ); 717cdf0e10cSrcweir aSearchLB.SetGetFocusHdl( aLink ); 718cdf0e10cSrcweir pImpl->aSearchFormats.SetGetFocusHdl( aLink ); 719cdf0e10cSrcweir 720cdf0e10cSrcweir aReplaceLB.SetGetFocusHdl( aLink ); 721cdf0e10cSrcweir pImpl->aReplaceFormats.SetGetFocusHdl( aLink ); 722cdf0e10cSrcweir 723cdf0e10cSrcweir aLink = LINK( this, SvxSearchDialog, LoseFocusHdl_Impl ); 724cdf0e10cSrcweir aSearchLB.SetLoseFocusHdl( aLink ); 725cdf0e10cSrcweir aReplaceLB.SetLoseFocusHdl( aLink ); 726cdf0e10cSrcweir 727cdf0e10cSrcweir aSearchTmplLB.SetLoseFocusHdl( aLink ); 728cdf0e10cSrcweir aReplaceTmplLB.SetLoseFocusHdl( aLink ); 729cdf0e10cSrcweir 730cdf0e10cSrcweir aLink = LINK( this, SvxSearchDialog, CommandHdl_Impl ); 731cdf0e10cSrcweir aSearchBtn.SetClickHdl( aLink ); 732cdf0e10cSrcweir aSearchAllBtn.SetClickHdl( aLink ); 733cdf0e10cSrcweir aReplaceBtn.SetClickHdl( aLink ); 734cdf0e10cSrcweir aReplaceAllBtn.SetClickHdl( aLink ); 735cdf0e10cSrcweir aCloseBtn.SetClickHdl( aLink ); 736cdf0e10cSrcweir aSimilarityBtn.SetClickHdl( aLink ); 737cdf0e10cSrcweir aJapOptionsBtn.SetClickHdl( aLink ); 738cdf0e10cSrcweir aSearchComponent1PB.SetClickHdl( aLink ); 739cdf0e10cSrcweir aSearchComponent2PB.SetClickHdl( aLink ); 740cdf0e10cSrcweir 741cdf0e10cSrcweir aLink = LINK( this, SvxSearchDialog, FlagHdl_Impl ); 742cdf0e10cSrcweir aWordBtn.SetClickHdl( aLink ); 743cdf0e10cSrcweir aSelectionBtn.SetClickHdl( aLink ); 744cdf0e10cSrcweir aMatchCaseCB.SetClickHdl( aLink ); 745cdf0e10cSrcweir aRegExpBtn.SetClickHdl( aLink ); 746cdf0e10cSrcweir aBackwardsBtn.SetClickHdl( aLink ); 747cdf0e10cSrcweir aNotesBtn.SetClickHdl( aLink ); 748cdf0e10cSrcweir aSimilarityBox.SetClickHdl( aLink ); 749cdf0e10cSrcweir aJapOptionsCB.SetClickHdl( aLink ); 750cdf0e10cSrcweir aJapMatchFullHalfWidthCB.SetClickHdl( aLink ); 751cdf0e10cSrcweir 752cdf0e10cSrcweir aLayoutBtn.SetClickHdl( LINK( this, SvxSearchDialog, TemplateHdl_Impl ) ); 753cdf0e10cSrcweir aFormatBtn.SetClickHdl( LINK( this, SvxSearchDialog, FormatHdl_Impl ) ); 754cdf0e10cSrcweir aNoFormatBtn.SetClickHdl( 755cdf0e10cSrcweir LINK( this, SvxSearchDialog, NoFormatHdl_Impl ) ); 756cdf0e10cSrcweir aAttributeBtn.SetClickHdl( 757cdf0e10cSrcweir LINK( this, SvxSearchDialog, AttributeHdl_Impl ) ); 758cdf0e10cSrcweir 759cdf0e10cSrcweir // check if buttontext is to wide 760cdf0e10cSrcweir long nTxtW = Max( pMoreBtn->GetCtrlTextWidth( pMoreBtn->GetMoreText() ), 761cdf0e10cSrcweir pMoreBtn->GetCtrlTextWidth( pMoreBtn->GetLessText() ) ); 762cdf0e10cSrcweir nTxtW += ( pMoreBtn->GetTextHeight() * 2 ); // add image size + offset 763cdf0e10cSrcweir long nBtnW = pMoreBtn->GetSizePixel().Width(); 764cdf0e10cSrcweir if ( nTxtW > nBtnW ) 765cdf0e10cSrcweir { 766cdf0e10cSrcweir // broaden the button 767cdf0e10cSrcweir const long nMinDelta = 10; 768cdf0e10cSrcweir long nDelta = Max( nTxtW - nBtnW, nMinDelta ); 769cdf0e10cSrcweir Size aNewSize = pMoreBtn->GetSizePixel(); 770cdf0e10cSrcweir aNewSize.Width() += nDelta; 771cdf0e10cSrcweir pMoreBtn->SetSizePixel( aNewSize ); 772cdf0e10cSrcweir } 773cdf0e10cSrcweir } 774cdf0e10cSrcweir 775cdf0e10cSrcweir // ----------------------------------------------------------------------- 776cdf0e10cSrcweir 777cdf0e10cSrcweir void SvxSearchDialog::CalculateDelta_Impl() 778cdf0e10cSrcweir { 779cdf0e10cSrcweir DBG_ASSERT( pSearchItem, "no search item" ); 780cdf0e10cSrcweir 781cdf0e10cSrcweir bool bDrawApp = false; 782cdf0e10cSrcweir bool bCalcApp = false; 783cdf0e10cSrcweir bool bWriterApp = false; 784cdf0e10cSrcweir bool bImpressApp = false; 785cdf0e10cSrcweir const uno::Reference< frame::XFrame > xFrame = rBindings.GetActiveFrame(); 786cdf0e10cSrcweir uno::Reference< frame::XModuleManager > xModuleManager( 787cdf0e10cSrcweir ::comphelper::getProcessServiceFactory()->createInstance( 788cdf0e10cSrcweir DEFINE_CONST_UNICODE("com.sun.star.frame.ModuleManager") ), uno::UNO_QUERY ); 789cdf0e10cSrcweir if ( xModuleManager.is() ) 790cdf0e10cSrcweir { 791cdf0e10cSrcweir try 792cdf0e10cSrcweir { 793cdf0e10cSrcweir ::rtl::OUString aModuleIdentifier = xModuleManager->identify( xFrame ); 794cdf0e10cSrcweir bCalcApp = aModuleIdentifier.equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" ); 795cdf0e10cSrcweir bDrawApp = aModuleIdentifier.equalsAscii( "com.sun.star.drawing.DrawingDocument" ); 796cdf0e10cSrcweir bImpressApp = aModuleIdentifier.equalsAscii( "com.sun.star.presentation.PresentationDocument" ); 797cdf0e10cSrcweir bWriterApp = aModuleIdentifier.equalsAscii( "com.sun.star.text.TextDocument" ); 798cdf0e10cSrcweir } 799cdf0e10cSrcweir catch ( uno::Exception& ) 800cdf0e10cSrcweir { 801cdf0e10cSrcweir } 802cdf0e10cSrcweir } 803cdf0e10cSrcweir 804cdf0e10cSrcweir if ( pImpl->bDeltaCalculated ) 805cdf0e10cSrcweir return; 806cdf0e10cSrcweir else 807cdf0e10cSrcweir pImpl->bDeltaCalculated = sal_True; 808cdf0e10cSrcweir 809cdf0e10cSrcweir sal_uIntPtr nDelta = 187, nOffset = 0; 810cdf0e10cSrcweir SvtCJKOptions aCJKOptions; 811cdf0e10cSrcweir 812cdf0e10cSrcweir pMoreBtn->AddWindow( &aOptionsFL ); 813cdf0e10cSrcweir if ( !bDrawApp ) 814cdf0e10cSrcweir pMoreBtn->AddWindow( &aLayoutBtn ); 815cdf0e10cSrcweir if ( bWriterApp ) 816cdf0e10cSrcweir pMoreBtn->AddWindow( &aNotesBtn ); 817cdf0e10cSrcweir else 818cdf0e10cSrcweir { 819cdf0e10cSrcweir aNotesBtn.Hide(); 820cdf0e10cSrcweir nOffset = !bDrawApp ? 13 : 0; 821cdf0e10cSrcweir } 822cdf0e10cSrcweir pMoreBtn->AddWindow( &aBackwardsBtn ); 823cdf0e10cSrcweir if ( !bDrawApp ) 824cdf0e10cSrcweir pMoreBtn->AddWindow( &aRegExpBtn ); 825cdf0e10cSrcweir pMoreBtn->AddWindow( &aSimilarityBox ); 826cdf0e10cSrcweir pMoreBtn->AddWindow( &aSimilarityBtn ); 827cdf0e10cSrcweir pMoreBtn->AddWindow( &aSelectionBtn ); 828cdf0e10cSrcweir 829cdf0e10cSrcweir if ( aCJKOptions.IsCJKFontEnabled() ) 830cdf0e10cSrcweir pMoreBtn->AddWindow( &aJapMatchFullHalfWidthCB ); 831cdf0e10cSrcweir else 832cdf0e10cSrcweir nOffset += 13; 833cdf0e10cSrcweir if ( aCJKOptions.IsJapaneseFindEnabled() ) 834cdf0e10cSrcweir { 835cdf0e10cSrcweir pMoreBtn->AddWindow( &aJapOptionsCB ); 836cdf0e10cSrcweir pMoreBtn->AddWindow( &aJapOptionsBtn ); 837cdf0e10cSrcweir } 838cdf0e10cSrcweir else 839cdf0e10cSrcweir nOffset += 17; 840cdf0e10cSrcweir 841cdf0e10cSrcweir if ( bWriter ) 842cdf0e10cSrcweir { 843cdf0e10cSrcweir pMoreBtn->AddWindow( &aAttributeBtn ); 844cdf0e10cSrcweir pMoreBtn->AddWindow( &aFormatBtn ); 845cdf0e10cSrcweir pMoreBtn->AddWindow( &aNoFormatBtn ); 846cdf0e10cSrcweir } 847cdf0e10cSrcweir 848cdf0e10cSrcweir if (bDrawApp || bImpressApp) 849cdf0e10cSrcweir { 850cdf0e10cSrcweir // "Find All" button is hidden--align "Find" vertically to the 851cdf0e10cSrcweir // search listbox 852cdf0e10cSrcweir Point aNewPt(aSearchBtn.GetPosPixel()); 853cdf0e10cSrcweir const Size aBtnSz(aSearchBtn.GetSizePixel()); 854cdf0e10cSrcweir const Size aLBSz(aSearchLB.GetSizePixel()); 855cdf0e10cSrcweir const int nOff((aLBSz.Height() - aBtnSz.Height()) / 2); 856cdf0e10cSrcweir aNewPt.Y() = aSearchLB.GetPosPixel().Y() + nOff; 857cdf0e10cSrcweir aSearchBtn.SetPosPixel(aNewPt); 858cdf0e10cSrcweir } 859cdf0e10cSrcweir 860cdf0e10cSrcweir if ( bDrawApp ) 861cdf0e10cSrcweir { 862cdf0e10cSrcweir // Draw App: "Regular expressions" and "Search for Styles" check boxes are hidden 863cdf0e10cSrcweir // so align the other buttons 864cdf0e10cSrcweir const long nAppFontHeight = 13; // checkbox height + space between in APPFONT 865cdf0e10cSrcweir long nH = LogicToPixel( Size( 0, nAppFontHeight ), MAP_APPFONT ).Height(); 866cdf0e10cSrcweir 867cdf0e10cSrcweir Point aNewPos = aSimilarityBox.GetPosPixel(); 868cdf0e10cSrcweir aNewPos.Y() -= nH; 869cdf0e10cSrcweir aSimilarityBox.SetPosPixel( aNewPos ); 870cdf0e10cSrcweir aNewPos = aSimilarityBtn.GetPosPixel(); 871cdf0e10cSrcweir aNewPos.Y() -= nH; 872cdf0e10cSrcweir aSimilarityBtn.SetPosPixel( aNewPos ); 873cdf0e10cSrcweir nH *= 3; 874cdf0e10cSrcweir nOffset += ( 3 * nAppFontHeight ); 875cdf0e10cSrcweir if ( aCJKOptions.IsCJKFontEnabled() ) 876cdf0e10cSrcweir { 877cdf0e10cSrcweir aNewPos = aJapMatchFullHalfWidthCB.GetPosPixel(); 878cdf0e10cSrcweir aNewPos.Y() -= nH; 879cdf0e10cSrcweir aJapMatchFullHalfWidthCB.SetPosPixel( aNewPos ); 880cdf0e10cSrcweir } 881cdf0e10cSrcweir if ( aCJKOptions.IsJapaneseFindEnabled() ) 882cdf0e10cSrcweir { 883cdf0e10cSrcweir aNewPos = aJapOptionsCB.GetPosPixel(); 884cdf0e10cSrcweir aNewPos.Y() -= nH; 885cdf0e10cSrcweir aJapOptionsCB.SetPosPixel( aNewPos ); 886cdf0e10cSrcweir aNewPos = aJapOptionsBtn.GetPosPixel(); 887cdf0e10cSrcweir aNewPos.Y() -= nH; 888cdf0e10cSrcweir aJapOptionsBtn.SetPosPixel( aNewPos ); 889cdf0e10cSrcweir } 890cdf0e10cSrcweir } 891cdf0e10cSrcweir 892cdf0e10cSrcweir if ( bCalcApp || bImpressApp ) 893cdf0e10cSrcweir { 894cdf0e10cSrcweir Window* pWins[] = 895cdf0e10cSrcweir { 896cdf0e10cSrcweir &aCalcFL, &aCalcSearchInFT, &aCalcSearchInLB, &aCalcSearchDirFT, 897cdf0e10cSrcweir &aRowsBtn, &aColumnsBtn, &aAllSheetsCB, &aJapMatchFullHalfWidthCB, 898cdf0e10cSrcweir &aJapOptionsCB, &aJapOptionsBtn 899cdf0e10cSrcweir }; 900cdf0e10cSrcweir Window** pCurrent = pWins; 901cdf0e10cSrcweir sal_uInt32 i = 0; 902cdf0e10cSrcweir const sal_uInt32 nCalcCtrlCount = 7; 903cdf0e10cSrcweir if ( nOffset > 0 ) 904cdf0e10cSrcweir { 905cdf0e10cSrcweir long nH = LogicToPixel( Size( 0, nOffset ), MAP_APPFONT ).Height(); 906cdf0e10cSrcweir for ( i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) 907cdf0e10cSrcweir { 908cdf0e10cSrcweir if ( ( bCalcApp && i < nCalcCtrlCount ) 909cdf0e10cSrcweir || ( i == nCalcCtrlCount && aCJKOptions.IsCJKFontEnabled() ) 910cdf0e10cSrcweir || ( i > nCalcCtrlCount && aCJKOptions.IsJapaneseFindEnabled() ) ) 911cdf0e10cSrcweir { 912cdf0e10cSrcweir Point aNewPos = (*pCurrent)->GetPosPixel(); 913cdf0e10cSrcweir aNewPos.Y() -= nH; 914cdf0e10cSrcweir (*pCurrent)->SetPosPixel( aNewPos ); 915cdf0e10cSrcweir } 916cdf0e10cSrcweir } 917cdf0e10cSrcweir } 918cdf0e10cSrcweir 919cdf0e10cSrcweir if ( bCalcApp) 920cdf0e10cSrcweir { 921cdf0e10cSrcweir pCurrent = pWins; 922cdf0e10cSrcweir for ( i = 0; i < nCalcCtrlCount; ++i, ++pCurrent ) 923cdf0e10cSrcweir pMoreBtn->AddWindow( *pCurrent ); 924cdf0e10cSrcweir } 925cdf0e10cSrcweir else 926cdf0e10cSrcweir nOffset += 64; 927cdf0e10cSrcweir } 928cdf0e10cSrcweir else 929cdf0e10cSrcweir nOffset += 64; 930cdf0e10cSrcweir 931cdf0e10cSrcweir pMoreBtn->SetDelta( nDelta - nOffset ); 932cdf0e10cSrcweir pMoreBtn->Show(); 933cdf0e10cSrcweir pMoreBtn->Enable(); 934cdf0e10cSrcweir } 935cdf0e10cSrcweir 936cdf0e10cSrcweir #if ENABLE_LAYOUT 937cdf0e10cSrcweir #undef Window 938cdf0e10cSrcweir #define Window ::Window 939cdf0e10cSrcweir #endif /* ENABLE_LAYOUT */ 940cdf0e10cSrcweir 941cdf0e10cSrcweir // ----------------------------------------------------------------------- 942cdf0e10cSrcweir 943cdf0e10cSrcweir void SvxSearchDialog::Init_Impl( int bSearchPattern ) 944cdf0e10cSrcweir { 945cdf0e10cSrcweir DBG_ASSERT( pSearchItem, "SearchItem == 0" ); 946cdf0e10cSrcweir bWriter = ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_WRITER ); 947cdf0e10cSrcweir 948cdf0e10cSrcweir pImpl->bMultiLineEdit = sal_False; 949cdf0e10cSrcweir 950cdf0e10cSrcweir if ( !pImpl->bMultiLineEdit ) 951cdf0e10cSrcweir { 952cdf0e10cSrcweir pImpl->aSearchFormats.Hide(); 953cdf0e10cSrcweir aSearchAttrText.Show(); 954cdf0e10cSrcweir pImpl->aReplaceFormats.Hide(); 955cdf0e10cSrcweir aReplaceAttrText.Show(); 956cdf0e10cSrcweir } 957cdf0e10cSrcweir else 958cdf0e10cSrcweir { 959cdf0e10cSrcweir String aText = aSearchAttrText.GetText(); 960cdf0e10cSrcweir aSearchAttrText.Hide(); 961cdf0e10cSrcweir 962cdf0e10cSrcweir if ( aText.Len() ) 963cdf0e10cSrcweir pImpl->aSearchFormats.SetText( aText ); 964cdf0e10cSrcweir pImpl->aSearchFormats.Show(); 965cdf0e10cSrcweir aText = aReplaceAttrText.GetText(); 966cdf0e10cSrcweir aReplaceAttrText.Hide(); 967cdf0e10cSrcweir 968cdf0e10cSrcweir if ( aText.Len() ) 969cdf0e10cSrcweir pImpl->aReplaceFormats.SetText( aText ); 970cdf0e10cSrcweir pImpl->aReplaceFormats.Show(); 971cdf0e10cSrcweir } 972cdf0e10cSrcweir 973cdf0e10cSrcweir if ( ( nModifyFlag & MODIFY_WORD ) == 0 ) 974cdf0e10cSrcweir aWordBtn.Check( pSearchItem->GetWordOnly() ); 975cdf0e10cSrcweir if ( ( nModifyFlag & MODIFY_EXACT ) == 0 ) 976cdf0e10cSrcweir aMatchCaseCB.Check( pSearchItem->GetExact() ); 977cdf0e10cSrcweir if ( ( nModifyFlag & MODIFY_BACKWARDS ) == 0 ) 978cdf0e10cSrcweir aBackwardsBtn.Check( pSearchItem->GetBackward() ); 979cdf0e10cSrcweir if ( ( nModifyFlag & MODIFY_NOTES ) == 0 ) 980cdf0e10cSrcweir aNotesBtn.Check( pSearchItem->GetNotes() ); 981cdf0e10cSrcweir if ( ( nModifyFlag & MODIFY_SELECTION ) == 0 ) 982cdf0e10cSrcweir aSelectionBtn.Check( pSearchItem->GetSelection() ); 983cdf0e10cSrcweir if ( ( nModifyFlag & MODIFY_REGEXP ) == 0 ) 984cdf0e10cSrcweir aRegExpBtn.Check( pSearchItem->GetRegExp() ); 985cdf0e10cSrcweir if ( ( nModifyFlag & MODIFY_LAYOUT ) == 0 ) 986cdf0e10cSrcweir aLayoutBtn.Check( pSearchItem->GetPattern() ); 987cdf0e10cSrcweir if (aNotesBtn.IsChecked()) 988cdf0e10cSrcweir aLayoutBtn.Disable(); 989cdf0e10cSrcweir aSimilarityBox.Check( pSearchItem->IsLevenshtein() ); 990cdf0e10cSrcweir if( aJapOptionsCB.IsVisible() ) 991cdf0e10cSrcweir aJapOptionsCB.Check( pSearchItem->IsUseAsianOptions() ); 992cdf0e10cSrcweir ApplyTransliterationFlags_Impl( pSearchItem->GetTransliterationFlags() ); 993cdf0e10cSrcweir 994cdf0e10cSrcweir CalculateDelta_Impl(); 995cdf0e10cSrcweir 996cdf0e10cSrcweir bool bDraw = sal_False; 997cdf0e10cSrcweir if ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_CALC ) 998cdf0e10cSrcweir { 999cdf0e10cSrcweir Link aLink = LINK( this, SvxSearchDialog, FlagHdl_Impl ); 1000cdf0e10cSrcweir aCalcSearchInLB.SetSelectHdl( aLink ); 1001cdf0e10cSrcweir aRowsBtn.SetClickHdl( aLink ); 1002cdf0e10cSrcweir aColumnsBtn.SetClickHdl( aLink ); 1003cdf0e10cSrcweir aAllSheetsCB.SetClickHdl( aLink ); 1004cdf0e10cSrcweir 1005cdf0e10cSrcweir switch ( pSearchItem->GetCellType() ) 1006cdf0e10cSrcweir { 1007cdf0e10cSrcweir case SVX_SEARCHIN_FORMULA: 1008cdf0e10cSrcweir if ( ( nModifyFlag & MODIFY_FORMULAS ) == 0 ) 1009cdf0e10cSrcweir aCalcSearchInLB.SelectEntryPos( SVX_SEARCHIN_FORMULA ); 1010cdf0e10cSrcweir break; 1011cdf0e10cSrcweir 1012cdf0e10cSrcweir case SVX_SEARCHIN_VALUE: 1013cdf0e10cSrcweir if ( ( nModifyFlag & MODIFY_VALUES ) == 0 ) 1014cdf0e10cSrcweir aCalcSearchInLB.SelectEntryPos( SVX_SEARCHIN_VALUE ); 1015cdf0e10cSrcweir break; 1016cdf0e10cSrcweir 1017cdf0e10cSrcweir case SVX_SEARCHIN_NOTE: 1018cdf0e10cSrcweir if ( ( nModifyFlag & MODIFY_CALC_NOTES ) == 0 ) 1019cdf0e10cSrcweir aCalcSearchInLB.SelectEntryPos( SVX_SEARCHIN_NOTE ); 1020cdf0e10cSrcweir break; 1021cdf0e10cSrcweir } 1022cdf0e10cSrcweir aWordBtn.SetText( aCalcStr.GetToken( 0, '#' ) ); 1023cdf0e10cSrcweir 1024cdf0e10cSrcweir if ( pSearchItem->GetRowDirection() && 1025cdf0e10cSrcweir ( nModifyFlag & MODIFY_ROWS ) == 0 ) 1026cdf0e10cSrcweir aRowsBtn.Check(); 1027cdf0e10cSrcweir else if ( !pSearchItem->GetRowDirection() && 1028cdf0e10cSrcweir ( nModifyFlag & MODIFY_COLUMNS ) == 0 ) 1029cdf0e10cSrcweir aColumnsBtn.Check(); 1030cdf0e10cSrcweir 1031cdf0e10cSrcweir if ( ( nModifyFlag & MODIFY_ALLTABLES ) == 0 ) 1032cdf0e10cSrcweir aAllSheetsCB.Check( pSearchItem->IsAllTables() ); 1033cdf0e10cSrcweir 1034cdf0e10cSrcweir // nur im Writer Suche nach Formatierung 1035cdf0e10cSrcweir aFormatBtn.Hide(); 1036cdf0e10cSrcweir aNoFormatBtn.Hide(); 1037cdf0e10cSrcweir aAttributeBtn.Hide(); 1038cdf0e10cSrcweir } 1039cdf0e10cSrcweir else 1040cdf0e10cSrcweir { 1041cdf0e10cSrcweir aWordBtn.SetText( aCalcStr.GetToken( 1, '#' ) ); 1042cdf0e10cSrcweir 1043cdf0e10cSrcweir if ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_DRAW ) 1044cdf0e10cSrcweir { 1045cdf0e10cSrcweir aSearchAllBtn.Hide(); 1046cdf0e10cSrcweir 1047cdf0e10cSrcweir aRegExpBtn.Hide(); 1048cdf0e10cSrcweir aLayoutBtn.Hide(); 1049cdf0e10cSrcweir 1050cdf0e10cSrcweir // nur im Writer Suche nach Formatierung 1051cdf0e10cSrcweir aFormatBtn.Hide(); 1052cdf0e10cSrcweir aNoFormatBtn.Hide(); 1053cdf0e10cSrcweir aAttributeBtn.Hide(); 1054cdf0e10cSrcweir bDraw = sal_True; 1055cdf0e10cSrcweir } 1056cdf0e10cSrcweir else 1057cdf0e10cSrcweir { 1058cdf0e10cSrcweir if ( !pSearchList ) 1059cdf0e10cSrcweir { 1060cdf0e10cSrcweir // Attribut-Sets besorgen, wenn noch nicht geschehen 1061cdf0e10cSrcweir const SfxPoolItem* ppArgs[] = { pSearchItem, 0 }; 1062cdf0e10cSrcweir const SvxSetItem* pSrchSetItem = 1063cdf0e10cSrcweir (const SvxSetItem*)rBindings.GetDispatcher()->Execute( FID_SEARCH_SEARCHSET, SFX_CALLMODE_SLOT, ppArgs ); 1064cdf0e10cSrcweir 1065cdf0e10cSrcweir if ( pSrchSetItem ) 1066cdf0e10cSrcweir InitAttrList_Impl( &pSrchSetItem->GetItemSet(), 0 ); 1067cdf0e10cSrcweir 1068cdf0e10cSrcweir const SvxSetItem* pReplSetItem = 1069cdf0e10cSrcweir (const SvxSetItem*)rBindings.GetDispatcher()->Execute( FID_SEARCH_REPLACESET, SFX_CALLMODE_SLOT, ppArgs ); 1070cdf0e10cSrcweir 1071cdf0e10cSrcweir if ( pReplSetItem ) 1072cdf0e10cSrcweir InitAttrList_Impl( 0, &pReplSetItem->GetItemSet() ); 1073cdf0e10cSrcweir } 1074cdf0e10cSrcweir /* 1075cdf0e10cSrcweir aFormatBtn.Show(); 1076cdf0e10cSrcweir aNoFormatBtn.Show(); 1077cdf0e10cSrcweir aAttributeBtn.Show(); 1078cdf0e10cSrcweir */ 1079cdf0e10cSrcweir } 1080cdf0e10cSrcweir // pMoreBtn->SetState( sal_False ); 1081cdf0e10cSrcweir // pMoreBtn->Hide(); 1082cdf0e10cSrcweir } 1083cdf0e10cSrcweir 1084cdf0e10cSrcweir if ( 0 && !bDraw ) //!!!!! 1085cdf0e10cSrcweir { 1086cdf0e10cSrcweir aRegExpBtn.Show(); 1087cdf0e10cSrcweir aLayoutBtn.Show(); 1088cdf0e10cSrcweir } 1089cdf0e10cSrcweir 1090cdf0e10cSrcweir // "Ahnlichkeitssuche? 1091cdf0e10cSrcweir if ( ( nModifyFlag & MODIFY_SIMILARITY ) == 0 ) 1092cdf0e10cSrcweir aSimilarityBox.Check( pSearchItem->IsLevenshtein() ); 1093cdf0e10cSrcweir bSet = sal_True; 1094cdf0e10cSrcweir 1095cdf0e10cSrcweir pImpl->bSaveToModule = sal_False; 1096cdf0e10cSrcweir FlagHdl_Impl( &aSimilarityBox ); 1097cdf0e10cSrcweir FlagHdl_Impl( &aJapOptionsCB ); 1098cdf0e10cSrcweir pImpl->bSaveToModule = sal_True; 1099cdf0e10cSrcweir 1100cdf0e10cSrcweir bool bDisableSearch = sal_False; 1101cdf0e10cSrcweir SfxViewShell* pViewShell = SfxViewShell::Current(); 1102cdf0e10cSrcweir 1103cdf0e10cSrcweir if ( pViewShell ) 1104cdf0e10cSrcweir { 1105cdf0e10cSrcweir sal_Bool bText = !bSearchPattern; 1106cdf0e10cSrcweir 1107cdf0e10cSrcweir if ( pViewShell->HasSelection( bText ) ) 1108cdf0e10cSrcweir EnableControl_Impl( &aSelectionBtn ); 1109cdf0e10cSrcweir else 1110cdf0e10cSrcweir { 1111cdf0e10cSrcweir aSelectionBtn.Check( sal_False ); 1112cdf0e10cSrcweir aSelectionBtn.Disable(); 1113cdf0e10cSrcweir } 1114cdf0e10cSrcweir } 1115cdf0e10cSrcweir 1116cdf0e10cSrcweir // Patternsuche und es wurden keine AttrSets "ubergeben 1117cdf0e10cSrcweir if ( bSearchPattern ) 1118cdf0e10cSrcweir { 1119cdf0e10cSrcweir SfxObjectShell* pShell = SfxObjectShell::Current(); 1120cdf0e10cSrcweir 1121cdf0e10cSrcweir if ( pShell && pShell->GetStyleSheetPool() ) 1122cdf0e10cSrcweir { 1123cdf0e10cSrcweir // Vorlagen beschaffen 1124cdf0e10cSrcweir aSearchTmplLB .Clear(); 1125cdf0e10cSrcweir aReplaceTmplLB.Clear(); 1126cdf0e10cSrcweir SfxStyleSheetBasePool* pStylePool = pShell->GetStyleSheetPool(); 1127cdf0e10cSrcweir pStylePool->SetSearchMask( pSearchItem->GetFamily(), 1128cdf0e10cSrcweir SFXSTYLEBIT_ALL ); 1129cdf0e10cSrcweir SfxStyleSheetBase* pBase = pStylePool->First(); 1130cdf0e10cSrcweir 1131cdf0e10cSrcweir while ( pBase ) 1132cdf0e10cSrcweir { 1133cdf0e10cSrcweir if ( pBase->IsUsed() ) 1134cdf0e10cSrcweir aSearchTmplLB.InsertEntry( pBase->GetName() ); 1135cdf0e10cSrcweir aReplaceTmplLB.InsertEntry( pBase->GetName() ); 1136cdf0e10cSrcweir pBase = pStylePool->Next(); 1137cdf0e10cSrcweir } 1138cdf0e10cSrcweir aSearchTmplLB.SelectEntry( pSearchItem->GetSearchString() ); 1139cdf0e10cSrcweir aReplaceTmplLB.SelectEntry( pSearchItem->GetReplaceString() ); 1140cdf0e10cSrcweir 1141cdf0e10cSrcweir } 1142cdf0e10cSrcweir aSearchTmplLB.Show(); 1143cdf0e10cSrcweir 1144cdf0e10cSrcweir if ( bConstruct ) 1145cdf0e10cSrcweir // nur nach dem Erzeugen den Fokus grappen 1146cdf0e10cSrcweir aSearchTmplLB.GrabFocus(); 1147cdf0e10cSrcweir aReplaceTmplLB.Show(); 1148cdf0e10cSrcweir aSearchLB.Hide(); 1149cdf0e10cSrcweir aReplaceLB.Hide(); 1150cdf0e10cSrcweir 1151cdf0e10cSrcweir aWordBtn.Disable(); 1152cdf0e10cSrcweir aRegExpBtn.Disable(); 1153cdf0e10cSrcweir aMatchCaseCB.Disable(); 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir bDisableSearch = !aSearchTmplLB.GetEntryCount(); 1156cdf0e10cSrcweir } 1157cdf0e10cSrcweir else 1158cdf0e10cSrcweir { 1159cdf0e10cSrcweir bool bSetSearch = ( ( nModifyFlag & MODIFY_SEARCH ) == 0 ); 1160cdf0e10cSrcweir bool bSetReplace = ( ( nModifyFlag & MODIFY_REPLACE ) == 0 ); 1161cdf0e10cSrcweir 1162cdf0e10cSrcweir if ( pSearchItem->GetSearchString().Len() && bSetSearch ) 1163cdf0e10cSrcweir aSearchLB.SetText( pSearchItem->GetSearchString() ); 1164cdf0e10cSrcweir else if ( aSearchStrings.Count() ) 1165cdf0e10cSrcweir { 1166cdf0e10cSrcweir bool bAttributes = 1167cdf0e10cSrcweir ( ( pSearchList && pSearchList->Count() ) || 1168cdf0e10cSrcweir ( pReplaceList && pReplaceList->Count() ) ); 1169cdf0e10cSrcweir 1170cdf0e10cSrcweir if ( bSetSearch && !bAttributes ) 1171cdf0e10cSrcweir aSearchLB.SetText( *aSearchStrings[ 0 ] ); 1172cdf0e10cSrcweir 1173cdf0e10cSrcweir String aReplaceTxt = pSearchItem->GetReplaceString(); 1174cdf0e10cSrcweir 1175cdf0e10cSrcweir if ( aReplaceStrings.Count() ) 1176cdf0e10cSrcweir aReplaceTxt = *aReplaceStrings[ 0 ]; 1177cdf0e10cSrcweir 1178cdf0e10cSrcweir if ( bSetReplace && !bAttributes ) 1179cdf0e10cSrcweir aReplaceLB.SetText( aReplaceTxt ); 1180cdf0e10cSrcweir } 1181cdf0e10cSrcweir aSearchLB.Show(); 1182cdf0e10cSrcweir 1183cdf0e10cSrcweir if ( bConstruct ) 1184cdf0e10cSrcweir // nur nach dem Erzeugen den Fokus grappen 1185cdf0e10cSrcweir aSearchLB.GrabFocus(); 1186cdf0e10cSrcweir aReplaceLB.Show(); 1187cdf0e10cSrcweir aSearchTmplLB.Hide(); 1188cdf0e10cSrcweir aReplaceTmplLB.Hide(); 1189cdf0e10cSrcweir 1190cdf0e10cSrcweir EnableControl_Impl( &aRegExpBtn ); 1191cdf0e10cSrcweir EnableControl_Impl( &aMatchCaseCB ); 1192cdf0e10cSrcweir 1193cdf0e10cSrcweir if ( aRegExpBtn.IsChecked() ) 1194cdf0e10cSrcweir aWordBtn.Disable(); 1195cdf0e10cSrcweir else 1196cdf0e10cSrcweir EnableControl_Impl( &aWordBtn ); 1197cdf0e10cSrcweir 1198cdf0e10cSrcweir String aSrchAttrTxt; 1199cdf0e10cSrcweir 1200cdf0e10cSrcweir if ( pImpl->bMultiLineEdit ) 1201cdf0e10cSrcweir aSrchAttrTxt = pImpl->aSearchFormats.GetText(); 1202cdf0e10cSrcweir else 1203cdf0e10cSrcweir aSrchAttrTxt = aSearchAttrText.GetText(); 1204cdf0e10cSrcweir 1205cdf0e10cSrcweir bDisableSearch = !aSearchLB.GetText().Len() && !aSrchAttrTxt.Len(); 1206cdf0e10cSrcweir } 1207cdf0e10cSrcweir FocusHdl_Impl( &aSearchLB ); 1208cdf0e10cSrcweir 1209cdf0e10cSrcweir if ( bDisableSearch ) 1210cdf0e10cSrcweir { 1211cdf0e10cSrcweir aSearchBtn.Disable(); 1212cdf0e10cSrcweir aSearchAllBtn.Disable(); 1213cdf0e10cSrcweir aReplaceBtn.Disable(); 1214cdf0e10cSrcweir aReplaceAllBtn.Disable(); 1215cdf0e10cSrcweir aSearchComponentFL.Enable(sal_False); 1216cdf0e10cSrcweir aSearchComponent1PB.Enable(sal_False); 1217cdf0e10cSrcweir aSearchComponent2PB.Enable(sal_False); 1218cdf0e10cSrcweir } 1219cdf0e10cSrcweir else 1220cdf0e10cSrcweir { 1221cdf0e10cSrcweir EnableControl_Impl( &aSearchBtn ); 1222cdf0e10cSrcweir EnableControl_Impl( &aReplaceBtn ); 1223cdf0e10cSrcweir if (!bWriter || (bWriter && !aNotesBtn.IsChecked())) 1224cdf0e10cSrcweir { 1225cdf0e10cSrcweir EnableControl_Impl( &aSearchAllBtn ); 1226cdf0e10cSrcweir EnableControl_Impl( &aReplaceAllBtn ); 1227cdf0e10cSrcweir } 1228cdf0e10cSrcweir if (bWriter && pSearchItem->GetNotes()) 1229cdf0e10cSrcweir { 1230cdf0e10cSrcweir aSearchAllBtn.Disable(); 1231cdf0e10cSrcweir aReplaceAllBtn.Disable(); 1232cdf0e10cSrcweir } 1233cdf0e10cSrcweir } 1234cdf0e10cSrcweir 1235cdf0e10cSrcweir if ( ( !pImpl->bMultiLineEdit && aSearchAttrText.GetText().Len() ) || 1236cdf0e10cSrcweir ( pImpl->bMultiLineEdit && pImpl->aSearchFormats.GetText().Len() ) ) 1237cdf0e10cSrcweir EnableControl_Impl( &aNoFormatBtn ); 1238cdf0e10cSrcweir else 1239cdf0e10cSrcweir aNoFormatBtn.Disable(); 1240cdf0e10cSrcweir 1241cdf0e10cSrcweir if ( !pSearchList ) 1242cdf0e10cSrcweir { 1243cdf0e10cSrcweir aAttributeBtn.Disable(); 1244cdf0e10cSrcweir aFormatBtn.Disable(); 1245cdf0e10cSrcweir } 1246cdf0e10cSrcweir 1247cdf0e10cSrcweir if ( aLayoutBtn.IsChecked() ) 1248cdf0e10cSrcweir { 1249cdf0e10cSrcweir pImpl->bSaveToModule = sal_False; 1250cdf0e10cSrcweir TemplateHdl_Impl( &aLayoutBtn ); 1251cdf0e10cSrcweir pImpl->bSaveToModule = sal_True; 1252cdf0e10cSrcweir } 1253cdf0e10cSrcweir } 1254cdf0e10cSrcweir 1255cdf0e10cSrcweir // ----------------------------------------------------------------------- 1256cdf0e10cSrcweir 1257cdf0e10cSrcweir void SvxSearchDialog::InitAttrList_Impl( const SfxItemSet* pSSet, 1258cdf0e10cSrcweir const SfxItemSet* pRSet ) 1259cdf0e10cSrcweir { 1260cdf0e10cSrcweir if ( !pSSet && !pRSet ) 1261cdf0e10cSrcweir return; 1262cdf0e10cSrcweir 1263cdf0e10cSrcweir if ( !pImpl->pRanges && pSSet ) 1264cdf0e10cSrcweir { 1265cdf0e10cSrcweir sal_sSize nCnt = 0; 1266cdf0e10cSrcweir const sal_uInt16* pPtr = pSSet->GetRanges(); 1267cdf0e10cSrcweir const sal_uInt16* pTmp = pPtr; 1268cdf0e10cSrcweir 1269cdf0e10cSrcweir while( *pPtr ) 1270cdf0e10cSrcweir { 1271cdf0e10cSrcweir nCnt += ( *(pPtr+1) - *pPtr ) + 1; 1272cdf0e10cSrcweir pPtr += 2; 1273cdf0e10cSrcweir } 1274cdf0e10cSrcweir nCnt = pPtr - pTmp + 1; 1275cdf0e10cSrcweir pImpl->pRanges = new sal_uInt16[nCnt]; 1276cdf0e10cSrcweir memcpy( pImpl->pRanges, pTmp, sizeof(sal_uInt16) * nCnt ); 1277cdf0e10cSrcweir } 1278cdf0e10cSrcweir 1279cdf0e10cSrcweir // sorge daf"ur, das die Texte der Attribute richtig stehen 1280cdf0e10cSrcweir String aDesc; 1281cdf0e10cSrcweir 1282cdf0e10cSrcweir if ( pSSet ) 1283cdf0e10cSrcweir { 1284cdf0e10cSrcweir delete pSearchList; 1285cdf0e10cSrcweir pSearchList = new SearchAttrItemList; 1286cdf0e10cSrcweir 1287cdf0e10cSrcweir if ( pSSet->Count() ) 1288cdf0e10cSrcweir { 1289cdf0e10cSrcweir pSearchList->Put( *pSSet ); 1290cdf0e10cSrcweir 1291cdf0e10cSrcweir if ( !pImpl->bMultiLineEdit ) 1292cdf0e10cSrcweir aSearchAttrText.SetText( BuildAttrText_Impl( aDesc, sal_True ) ); 1293cdf0e10cSrcweir else 1294cdf0e10cSrcweir pImpl->aSearchFormats.SetText( BuildAttrText_Impl( aDesc, sal_True ) ); 1295cdf0e10cSrcweir 1296cdf0e10cSrcweir if ( aDesc.Len() ) 1297cdf0e10cSrcweir bFormat |= sal_True; 1298cdf0e10cSrcweir } 1299cdf0e10cSrcweir } 1300cdf0e10cSrcweir 1301cdf0e10cSrcweir if ( pRSet ) 1302cdf0e10cSrcweir { 1303cdf0e10cSrcweir delete pReplaceList; 1304cdf0e10cSrcweir pReplaceList = new SearchAttrItemList; 1305cdf0e10cSrcweir 1306cdf0e10cSrcweir if ( pRSet->Count() ) 1307cdf0e10cSrcweir { 1308cdf0e10cSrcweir pReplaceList->Put( *pRSet ); 1309cdf0e10cSrcweir 1310cdf0e10cSrcweir if ( !pImpl->bMultiLineEdit ) 1311cdf0e10cSrcweir aReplaceAttrText.SetText( BuildAttrText_Impl( aDesc, sal_False ) ); 1312cdf0e10cSrcweir else 1313cdf0e10cSrcweir pImpl->aReplaceFormats.SetText( BuildAttrText_Impl( aDesc, sal_False ) ); 1314cdf0e10cSrcweir 1315cdf0e10cSrcweir if ( aDesc.Len() ) 1316cdf0e10cSrcweir bFormat |= sal_True; 1317cdf0e10cSrcweir } 1318cdf0e10cSrcweir } 1319cdf0e10cSrcweir } 1320cdf0e10cSrcweir 1321cdf0e10cSrcweir // ----------------------------------------------------------------------- 1322cdf0e10cSrcweir 1323cdf0e10cSrcweir IMPL_LINK( SvxSearchDialog, FlagHdl_Impl, Control *, pCtrl ) 1324cdf0e10cSrcweir { 1325cdf0e10cSrcweir if ( pCtrl && !bSet ) 1326cdf0e10cSrcweir SetModifyFlag_Impl( pCtrl ); 1327cdf0e10cSrcweir else 1328cdf0e10cSrcweir bSet = sal_False; 1329cdf0e10cSrcweir 1330cdf0e10cSrcweir if ( pCtrl == &aSimilarityBox ) 1331cdf0e10cSrcweir { 1332cdf0e10cSrcweir sal_Bool bIsChecked = aSimilarityBox.IsChecked(); 1333cdf0e10cSrcweir 1334cdf0e10cSrcweir if ( bIsChecked ) 1335cdf0e10cSrcweir { 1336cdf0e10cSrcweir aSimilarityBtn.Enable(); 1337cdf0e10cSrcweir aRegExpBtn.Check( sal_False ); 1338cdf0e10cSrcweir aRegExpBtn.Disable(); 1339cdf0e10cSrcweir EnableControl_Impl( &aWordBtn ); 1340cdf0e10cSrcweir 1341cdf0e10cSrcweir if ( aLayoutBtn.IsChecked() ) 1342cdf0e10cSrcweir { 1343cdf0e10cSrcweir EnableControl_Impl( &aMatchCaseCB ); 1344cdf0e10cSrcweir aLayoutBtn.Check( sal_False ); 1345cdf0e10cSrcweir } 1346cdf0e10cSrcweir aRegExpBtn.Disable(); 1347cdf0e10cSrcweir aLayoutBtn.Disable(); 1348cdf0e10cSrcweir aFormatBtn.Disable(); 1349cdf0e10cSrcweir aNoFormatBtn.Disable(); 1350cdf0e10cSrcweir aAttributeBtn.Disable(); 1351cdf0e10cSrcweir } 1352cdf0e10cSrcweir else 1353cdf0e10cSrcweir { 1354cdf0e10cSrcweir EnableControl_Impl( &aRegExpBtn ); 1355cdf0e10cSrcweir if (!aNotesBtn.IsChecked()) 1356cdf0e10cSrcweir EnableControl_Impl( &aLayoutBtn ); 1357cdf0e10cSrcweir EnableControl_Impl( &aFormatBtn ); 1358cdf0e10cSrcweir EnableControl_Impl( &aAttributeBtn ); 1359cdf0e10cSrcweir aSimilarityBtn.Disable(); 1360cdf0e10cSrcweir } 1361cdf0e10cSrcweir pSearchItem->SetLevenshtein( bIsChecked ); 1362cdf0e10cSrcweir } 1363cdf0e10cSrcweir else 1364cdf0e10cSrcweir if ( pCtrl == &aNotesBtn) 1365cdf0e10cSrcweir { 1366cdf0e10cSrcweir if (aNotesBtn.IsChecked()) 1367cdf0e10cSrcweir { 1368cdf0e10cSrcweir aLayoutBtn.Disable(); 1369cdf0e10cSrcweir aSearchAllBtn.Disable(); 1370cdf0e10cSrcweir aReplaceAllBtn.Disable(); 1371cdf0e10cSrcweir } 1372cdf0e10cSrcweir else 1373cdf0e10cSrcweir { 1374cdf0e10cSrcweir EnableControl_Impl( &aLayoutBtn ); 1375cdf0e10cSrcweir ModifyHdl_Impl( &aSearchLB ); 1376cdf0e10cSrcweir } 1377cdf0e10cSrcweir } 1378cdf0e10cSrcweir else 1379cdf0e10cSrcweir { 1380cdf0e10cSrcweir if ( aLayoutBtn.IsChecked() && !bFormat ) 1381cdf0e10cSrcweir { 1382cdf0e10cSrcweir aWordBtn.Check( sal_False ); 1383cdf0e10cSrcweir aWordBtn.Disable(); 1384cdf0e10cSrcweir aRegExpBtn.Check( sal_False ); 1385cdf0e10cSrcweir aRegExpBtn.Disable(); 1386cdf0e10cSrcweir aMatchCaseCB.Check( sal_False ); 1387cdf0e10cSrcweir aMatchCaseCB.Disable(); 1388cdf0e10cSrcweir aNotesBtn.Disable(); 1389cdf0e10cSrcweir 1390cdf0e10cSrcweir if ( aSearchTmplLB.GetEntryCount() ) 1391cdf0e10cSrcweir { 1392cdf0e10cSrcweir EnableControl_Impl( &aSearchBtn ); 1393cdf0e10cSrcweir EnableControl_Impl( &aSearchAllBtn ); 1394cdf0e10cSrcweir EnableControl_Impl( &aReplaceBtn ); 1395cdf0e10cSrcweir EnableControl_Impl( &aReplaceAllBtn ); 1396cdf0e10cSrcweir } 1397cdf0e10cSrcweir } 1398cdf0e10cSrcweir else 1399cdf0e10cSrcweir { 1400cdf0e10cSrcweir EnableControl_Impl( &aRegExpBtn ); 1401cdf0e10cSrcweir EnableControl_Impl( &aMatchCaseCB ); 1402cdf0e10cSrcweir EnableControl_Impl( &aNotesBtn ); 1403cdf0e10cSrcweir 1404cdf0e10cSrcweir if ( aRegExpBtn.IsChecked() ) 1405cdf0e10cSrcweir { 1406cdf0e10cSrcweir aWordBtn.Check( sal_False ); 1407cdf0e10cSrcweir aWordBtn.Disable(); 1408cdf0e10cSrcweir aSimilarityBox.Disable(); 1409cdf0e10cSrcweir aSimilarityBtn.Disable(); 1410cdf0e10cSrcweir } 1411cdf0e10cSrcweir else 1412cdf0e10cSrcweir { 1413cdf0e10cSrcweir EnableControl_Impl( &aWordBtn ); 1414cdf0e10cSrcweir EnableControl_Impl( &aSimilarityBox ); 1415cdf0e10cSrcweir } 1416cdf0e10cSrcweir 1417cdf0e10cSrcweir // Such-String vorhanden? dann Buttons enablen 1418cdf0e10cSrcweir bSet = sal_True; 1419cdf0e10cSrcweir ModifyHdl_Impl( &aSearchLB ); 1420cdf0e10cSrcweir } 1421cdf0e10cSrcweir } 1422cdf0e10cSrcweir 1423cdf0e10cSrcweir if ( &aAllSheetsCB == pCtrl ) 1424cdf0e10cSrcweir { 1425cdf0e10cSrcweir if ( aAllSheetsCB.IsChecked() ) 1426cdf0e10cSrcweir aSearchAllBtn.Disable(); 1427cdf0e10cSrcweir else 1428cdf0e10cSrcweir { 1429cdf0e10cSrcweir bSet = sal_True; 1430cdf0e10cSrcweir ModifyHdl_Impl( &aSearchLB ); 1431cdf0e10cSrcweir } 1432cdf0e10cSrcweir } 1433cdf0e10cSrcweir 1434cdf0e10cSrcweir if ( &aJapOptionsCB == pCtrl ) 1435cdf0e10cSrcweir { 1436cdf0e10cSrcweir sal_Bool bEnableJapOpt = aJapOptionsCB.IsChecked(); 1437cdf0e10cSrcweir aMatchCaseCB .Enable(!bEnableJapOpt ); 1438cdf0e10cSrcweir aJapMatchFullHalfWidthCB.Enable(!bEnableJapOpt ); 1439cdf0e10cSrcweir aJapOptionsBtn .Enable( bEnableJapOpt ); 1440cdf0e10cSrcweir } 1441cdf0e10cSrcweir 1442cdf0e10cSrcweir if ( pImpl->bSaveToModule ) 1443cdf0e10cSrcweir SaveToModule_Impl(); 1444cdf0e10cSrcweir return 0; 1445cdf0e10cSrcweir } 1446cdf0e10cSrcweir 1447cdf0e10cSrcweir // ----------------------------------------------------------------------- 1448cdf0e10cSrcweir 1449cdf0e10cSrcweir IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn ) 1450cdf0e10cSrcweir { 1451cdf0e10cSrcweir bool bInclusive = ( aLayoutBtn.GetText() == aLayoutStr ); 1452cdf0e10cSrcweir 1453cdf0e10cSrcweir if ( ( pBtn == &aSearchBtn ) || 1454cdf0e10cSrcweir ( pBtn == &aSearchAllBtn ) || 1455cdf0e10cSrcweir ( pBtn == &aReplaceBtn ) || 1456cdf0e10cSrcweir ( pBtn == &aReplaceAllBtn ) ) 1457cdf0e10cSrcweir { 1458cdf0e10cSrcweir if ( aLayoutBtn.IsChecked() && !bInclusive ) 1459cdf0e10cSrcweir { 1460cdf0e10cSrcweir pSearchItem->SetSearchString ( aSearchTmplLB.GetSelectEntry() ); 1461cdf0e10cSrcweir pSearchItem->SetReplaceString( aReplaceTmplLB.GetSelectEntry() ); 1462cdf0e10cSrcweir } 1463cdf0e10cSrcweir else 1464cdf0e10cSrcweir { 1465cdf0e10cSrcweir pSearchItem->SetSearchString ( aSearchLB.GetText() ); 1466cdf0e10cSrcweir pSearchItem->SetReplaceString( aReplaceLB.GetText() ); 1467cdf0e10cSrcweir 1468cdf0e10cSrcweir if ( pBtn == &aReplaceBtn ) 1469cdf0e10cSrcweir Remember_Impl( aReplaceLB.GetText(), sal_False ); 1470cdf0e10cSrcweir else 1471cdf0e10cSrcweir { 1472cdf0e10cSrcweir Remember_Impl( aSearchLB.GetText(), sal_True ); 1473cdf0e10cSrcweir 1474cdf0e10cSrcweir if ( pBtn == &aReplaceAllBtn ) 1475cdf0e10cSrcweir Remember_Impl( aReplaceLB.GetText(), sal_False ); 1476cdf0e10cSrcweir } 1477cdf0e10cSrcweir } 1478cdf0e10cSrcweir 1479cdf0e10cSrcweir pSearchItem->SetRegExp( sal_False ); 1480cdf0e10cSrcweir pSearchItem->SetLevenshtein( sal_False ); 1481cdf0e10cSrcweir if (GetCheckBoxValue( aRegExpBtn )) 1482cdf0e10cSrcweir pSearchItem->SetRegExp( sal_True ); 1483cdf0e10cSrcweir else if (GetCheckBoxValue( aSimilarityBox )) 1484cdf0e10cSrcweir pSearchItem->SetLevenshtein( sal_True ); 1485cdf0e10cSrcweir 1486cdf0e10cSrcweir pSearchItem->SetWordOnly( GetCheckBoxValue( aWordBtn ) ); 1487cdf0e10cSrcweir pSearchItem->SetBackward( GetCheckBoxValue( aBackwardsBtn ) ); 1488cdf0e10cSrcweir pSearchItem->SetNotes( GetCheckBoxValue( aNotesBtn ) ); 1489cdf0e10cSrcweir pSearchItem->SetPattern( GetCheckBoxValue( aLayoutBtn ) ); 1490cdf0e10cSrcweir pSearchItem->SetSelection( GetCheckBoxValue( aSelectionBtn ) ); 1491cdf0e10cSrcweir 1492cdf0e10cSrcweir pSearchItem->SetUseAsianOptions( GetCheckBoxValue( aJapOptionsCB ) ); 1493cdf0e10cSrcweir sal_Int32 nFlags = GetTransliterationFlags(); 1494cdf0e10cSrcweir if( !pSearchItem->IsUseAsianOptions()) 1495cdf0e10cSrcweir nFlags &= (TransliterationModules_IGNORE_CASE | 1496cdf0e10cSrcweir TransliterationModules_IGNORE_WIDTH ); 1497cdf0e10cSrcweir pSearchItem->SetTransliterationFlags( nFlags ); 1498cdf0e10cSrcweir 1499cdf0e10cSrcweir if ( !bWriter ) 1500cdf0e10cSrcweir { 1501cdf0e10cSrcweir if ( aCalcSearchInLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) 1502cdf0e10cSrcweir pSearchItem->SetCellType( aCalcSearchInLB.GetSelectEntryPos() ); 1503cdf0e10cSrcweir 1504cdf0e10cSrcweir pSearchItem->SetRowDirection( aRowsBtn.IsChecked() ); 1505cdf0e10cSrcweir pSearchItem->SetAllTables( aAllSheetsCB.IsChecked() ); 1506cdf0e10cSrcweir } 1507cdf0e10cSrcweir 1508cdf0e10cSrcweir if ( pBtn == &aSearchBtn ) 1509cdf0e10cSrcweir pSearchItem->SetCommand( SVX_SEARCHCMD_FIND ); 1510cdf0e10cSrcweir else if ( pBtn == &aSearchAllBtn ) 1511cdf0e10cSrcweir pSearchItem->SetCommand( SVX_SEARCHCMD_FIND_ALL ); 1512cdf0e10cSrcweir else if ( pBtn == &aReplaceBtn ) 1513cdf0e10cSrcweir pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE ); 1514cdf0e10cSrcweir else if ( pBtn == &aReplaceAllBtn ) 1515cdf0e10cSrcweir pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE_ALL ); 1516cdf0e10cSrcweir 1517cdf0e10cSrcweir // wenn nach Vorlagen gesucht wird, dann Format-Listen l"oschen 1518cdf0e10cSrcweir if ( !bFormat && pSearchItem->GetPattern() ) 1519cdf0e10cSrcweir { 1520cdf0e10cSrcweir if ( pSearchList ) 1521cdf0e10cSrcweir pSearchList->Clear(); 1522cdf0e10cSrcweir 1523cdf0e10cSrcweir if ( pReplaceList ) 1524cdf0e10cSrcweir pReplaceList->Clear(); 1525cdf0e10cSrcweir } 1526cdf0e10cSrcweir nModifyFlag = 0; 1527cdf0e10cSrcweir const SfxPoolItem* ppArgs[] = { pSearchItem, 0 }; 1528cdf0e10cSrcweir rBindings.ExecuteSynchron( FID_SEARCH_NOW, ppArgs, 0L ); 1529cdf0e10cSrcweir } 1530cdf0e10cSrcweir else if ( pBtn == &aCloseBtn ) 1531cdf0e10cSrcweir { 1532cdf0e10cSrcweir if ( !aLayoutBtn.IsChecked() || bInclusive ) 1533cdf0e10cSrcweir { 1534cdf0e10cSrcweir String aStr( aSearchLB.GetText() ); 1535cdf0e10cSrcweir 1536cdf0e10cSrcweir if ( aStr.Len() ) 1537cdf0e10cSrcweir Remember_Impl( aStr, sal_True ); 1538cdf0e10cSrcweir aStr = aReplaceLB.GetText(); 1539cdf0e10cSrcweir 1540cdf0e10cSrcweir if ( aStr.Len() ) 1541cdf0e10cSrcweir Remember_Impl( aStr, sal_False ); 1542cdf0e10cSrcweir } 1543cdf0e10cSrcweir SaveToModule_Impl(); 1544cdf0e10cSrcweir Close(); 1545cdf0e10cSrcweir } 1546cdf0e10cSrcweir else if ( pBtn == &aSimilarityBtn ) 1547cdf0e10cSrcweir { 1548cdf0e10cSrcweir //CHINA001 SvxSearchSimilarityDialog* pDlg = 1549cdf0e10cSrcweir //CHINA001 new SvxSearchSimilarityDialog( this, 1550cdf0e10cSrcweir //CHINA001 pSearchItem->IsLEVRelaxed(), 1551cdf0e10cSrcweir //CHINA001 pSearchItem->GetLEVOther(), 1552cdf0e10cSrcweir //CHINA001 pSearchItem->GetLEVShorter(), 1553cdf0e10cSrcweir //CHINA001 pSearchItem->GetLEVLonger() ); 1554cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 1555cdf0e10cSrcweir if(pFact) 1556cdf0e10cSrcweir { 1557cdf0e10cSrcweir AbstractSvxSearchSimilarityDialog* pDlg = pFact->CreateSvxSearchSimilarityDialog( LAYOUT_THIS_WINDOW (this), 1558cdf0e10cSrcweir pSearchItem->IsLEVRelaxed(), 1559cdf0e10cSrcweir pSearchItem->GetLEVOther(), 1560cdf0e10cSrcweir pSearchItem->GetLEVShorter(), 1561cdf0e10cSrcweir pSearchItem->GetLEVLonger() ); 1562cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 1563cdf0e10cSrcweir if ( pDlg && pDlg->Execute() == RET_OK ) 1564cdf0e10cSrcweir { 1565cdf0e10cSrcweir pSearchItem->SetLEVRelaxed( pDlg->IsRelaxed() ); 1566cdf0e10cSrcweir pSearchItem->SetLEVOther( pDlg->GetOther() ); 1567cdf0e10cSrcweir pSearchItem->SetLEVShorter( pDlg->GetShorter() ); 1568cdf0e10cSrcweir pSearchItem->SetLEVLonger( pDlg->GetLonger() ); 1569cdf0e10cSrcweir SaveToModule_Impl(); 1570cdf0e10cSrcweir } 1571cdf0e10cSrcweir delete pDlg; 1572cdf0e10cSrcweir } 1573cdf0e10cSrcweir } 1574cdf0e10cSrcweir else if ( pBtn == &aJapOptionsBtn ) 1575cdf0e10cSrcweir { 1576cdf0e10cSrcweir SfxItemSet aSet( SFX_APP()->GetPool() ); 1577cdf0e10cSrcweir pSearchItem->SetTransliterationFlags( GetTransliterationFlags() ); 1578cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 1579cdf0e10cSrcweir if(pFact) 1580cdf0e10cSrcweir { 1581cdf0e10cSrcweir AbstractSvxJSearchOptionsDialog* aDlg = pFact->CreateSvxJSearchOptionsDialog( LAYOUT_THIS_WINDOW (this), aSet, 1582cdf0e10cSrcweir pSearchItem->GetTransliterationFlags() ); 1583cdf0e10cSrcweir DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001 1584cdf0e10cSrcweir int nRet = aDlg->Execute(); //CHINA001 int nRet = aDlg.Execute(); 1585cdf0e10cSrcweir if (RET_OK == nRet) //! true only if FillItemSet of SvxJSearchOptionsPage returns true 1586cdf0e10cSrcweir { 1587cdf0e10cSrcweir sal_Int32 nFlags = aDlg->GetTransliterationFlags(); //CHINA001 sal_Int32 nFlags = aDlg.GetTransliterationFlags(); 1588cdf0e10cSrcweir pSearchItem->SetTransliterationFlags( nFlags ); 1589cdf0e10cSrcweir ApplyTransliterationFlags_Impl( nFlags ); 1590cdf0e10cSrcweir } 1591cdf0e10cSrcweir delete aDlg; //add for CHINA001 1592cdf0e10cSrcweir } 1593cdf0e10cSrcweir } 1594cdf0e10cSrcweir else if(pBtn == &aSearchComponent1PB || pBtn == &aSearchComponent2PB ) 1595cdf0e10cSrcweir { 1596cdf0e10cSrcweir uno::Sequence < beans::PropertyValue > aArgs(2); 1597cdf0e10cSrcweir beans::PropertyValue* pArgs = aArgs.getArray(); 1598cdf0e10cSrcweir pArgs[0].Name = ::rtl::OUString::createFromAscii("SearchString"); 1599cdf0e10cSrcweir pArgs[0].Value <<= ::rtl::OUString(aSearchLB.GetText()); 1600cdf0e10cSrcweir pArgs[1].Name = ::rtl::OUString::createFromAscii("ParentWindow"); 1601cdf0e10cSrcweir pArgs[1].Value <<= VCLUnoHelper::GetInterface( LAYOUT_THIS_WINDOW (this) ); 1602cdf0e10cSrcweir if(pBtn == &aSearchComponent1PB) 1603cdf0e10cSrcweir { 1604cdf0e10cSrcweir if ( pImpl->xCommand1Dispatch.is() ) 1605cdf0e10cSrcweir pImpl->xCommand1Dispatch->dispatch(pImpl->aCommand1URL, aArgs); 1606cdf0e10cSrcweir } 1607cdf0e10cSrcweir else 1608cdf0e10cSrcweir { 1609cdf0e10cSrcweir if ( pImpl->xCommand2Dispatch.is() ) 1610cdf0e10cSrcweir pImpl->xCommand2Dispatch->dispatch(pImpl->aCommand2URL, aArgs); 1611cdf0e10cSrcweir } 1612cdf0e10cSrcweir } 1613cdf0e10cSrcweir 1614cdf0e10cSrcweir return 0; 1615cdf0e10cSrcweir } 1616cdf0e10cSrcweir 1617cdf0e10cSrcweir // ----------------------------------------------------------------------- 1618cdf0e10cSrcweir 1619cdf0e10cSrcweir IMPL_LINK( SvxSearchDialog, ModifyHdl_Impl, ComboBox *, pEd ) 1620cdf0e10cSrcweir { 1621cdf0e10cSrcweir if ( !bSet ) 1622cdf0e10cSrcweir SetModifyFlag_Impl( pEd ); 1623cdf0e10cSrcweir else 1624cdf0e10cSrcweir bSet = sal_False; 1625cdf0e10cSrcweir 1626cdf0e10cSrcweir if ( pEd == &aSearchLB || pEd == &aReplaceLB ) 1627cdf0e10cSrcweir { 1628cdf0e10cSrcweir xub_StrLen nLBTxtLen = aSearchLB.GetText().Len(), nTxtLen; 1629cdf0e10cSrcweir 1630cdf0e10cSrcweir if ( !pImpl->bMultiLineEdit ) 1631cdf0e10cSrcweir nTxtLen = aSearchAttrText.GetText().Len(); 1632cdf0e10cSrcweir else 1633cdf0e10cSrcweir nTxtLen = pImpl->aSearchFormats.GetText().Len(); 1634cdf0e10cSrcweir 1635cdf0e10cSrcweir if ( nLBTxtLen || nTxtLen ) 1636cdf0e10cSrcweir { 1637cdf0e10cSrcweir EnableControl_Impl( &aSearchBtn ); 1638cdf0e10cSrcweir EnableControl_Impl( &aReplaceBtn ); 1639cdf0e10cSrcweir if (!bWriter || (bWriter && !aNotesBtn.IsChecked())) 1640cdf0e10cSrcweir { 1641cdf0e10cSrcweir EnableControl_Impl( &aSearchAllBtn ); 1642cdf0e10cSrcweir EnableControl_Impl( &aReplaceAllBtn ); 1643cdf0e10cSrcweir } 1644cdf0e10cSrcweir } 1645cdf0e10cSrcweir else 1646cdf0e10cSrcweir { 1647cdf0e10cSrcweir aSearchComponentFL.Enable(sal_False); 1648cdf0e10cSrcweir aSearchComponent1PB.Enable(sal_False); 1649cdf0e10cSrcweir aSearchComponent2PB.Enable(sal_False); 1650cdf0e10cSrcweir aSearchBtn.Disable(); 1651cdf0e10cSrcweir aSearchAllBtn.Disable(); 1652cdf0e10cSrcweir aReplaceBtn.Disable(); 1653cdf0e10cSrcweir aReplaceAllBtn.Disable(); 1654cdf0e10cSrcweir } 1655cdf0e10cSrcweir } 1656cdf0e10cSrcweir return 0; 1657cdf0e10cSrcweir } 1658cdf0e10cSrcweir 1659cdf0e10cSrcweir // ----------------------------------------------------------------------- 1660cdf0e10cSrcweir 1661cdf0e10cSrcweir IMPL_LINK( SvxSearchDialog, TemplateHdl_Impl, Button *, EMPTYARG ) 1662cdf0e10cSrcweir { 1663cdf0e10cSrcweir if ( pImpl->bSaveToModule ) 1664cdf0e10cSrcweir SaveToModule_Impl(); 1665cdf0e10cSrcweir 1666cdf0e10cSrcweir if ( bFormat ) 1667cdf0e10cSrcweir return 0; 1668cdf0e10cSrcweir String sDesc; 1669cdf0e10cSrcweir 1670cdf0e10cSrcweir if ( aLayoutBtn.IsChecked() ) 1671cdf0e10cSrcweir { 1672cdf0e10cSrcweir if ( !pFamilyController ) 1673cdf0e10cSrcweir { 1674cdf0e10cSrcweir sal_uInt16 nId = 0; 1675cdf0e10cSrcweir 1676cdf0e10cSrcweir // Vorlagen-Controller enablen 1677cdf0e10cSrcweir switch ( pSearchItem->GetFamily() ) 1678cdf0e10cSrcweir { 1679cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR: 1680cdf0e10cSrcweir nId = SID_STYLE_FAMILY1; break; 1681cdf0e10cSrcweir 1682cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA: 1683cdf0e10cSrcweir nId = SID_STYLE_FAMILY2; break; 1684cdf0e10cSrcweir 1685cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME: 1686cdf0e10cSrcweir nId = SID_STYLE_FAMILY3; break; 1687cdf0e10cSrcweir 1688cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE: 1689cdf0e10cSrcweir nId = SID_STYLE_FAMILY4; break; 1690cdf0e10cSrcweir 1691cdf0e10cSrcweir case SFX_STYLE_FAMILY_ALL: 1692cdf0e10cSrcweir break; 1693cdf0e10cSrcweir 1694cdf0e10cSrcweir default: 1695cdf0e10cSrcweir DBG_ERROR( "StyleSheetFamily wurde geaendert?" ); 1696cdf0e10cSrcweir } 1697cdf0e10cSrcweir 1698cdf0e10cSrcweir rBindings.EnterRegistrations(); 1699cdf0e10cSrcweir pFamilyController = 1700cdf0e10cSrcweir new SvxSearchController( nId, rBindings, *this ); 1701cdf0e10cSrcweir rBindings.LeaveRegistrations(); 1702cdf0e10cSrcweir aSearchTmplLB.Clear(); 1703cdf0e10cSrcweir aReplaceTmplLB.Clear(); 1704cdf0e10cSrcweir 1705cdf0e10cSrcweir aSearchTmplLB.Show(); 1706cdf0e10cSrcweir aReplaceTmplLB.Show(); 1707cdf0e10cSrcweir aSearchLB.Hide(); 1708cdf0e10cSrcweir aReplaceLB.Hide(); 1709cdf0e10cSrcweir 1710cdf0e10cSrcweir if ( !pImpl->bMultiLineEdit ) 1711cdf0e10cSrcweir { 1712cdf0e10cSrcweir aSearchAttrText.SetText( sDesc ); 1713cdf0e10cSrcweir aReplaceAttrText.SetText( sDesc ); 1714cdf0e10cSrcweir } 1715cdf0e10cSrcweir else 1716cdf0e10cSrcweir { 1717cdf0e10cSrcweir pImpl->aSearchFormats.SetText( sDesc ); 1718cdf0e10cSrcweir pImpl->aReplaceFormats.SetText( sDesc ); 1719cdf0e10cSrcweir } 1720cdf0e10cSrcweir } 1721cdf0e10cSrcweir aFormatBtn.Disable(); 1722cdf0e10cSrcweir aNoFormatBtn.Disable(); 1723cdf0e10cSrcweir aAttributeBtn.Disable(); 1724cdf0e10cSrcweir aSimilarityBox.Disable(); 1725cdf0e10cSrcweir aSimilarityBtn.Disable(); 1726cdf0e10cSrcweir } 1727cdf0e10cSrcweir else 1728cdf0e10cSrcweir { 1729cdf0e10cSrcweir // Vorlagen-Controller disablen 1730cdf0e10cSrcweir rBindings.EnterRegistrations(); 1731cdf0e10cSrcweir DELETEZ( pFamilyController ); 1732cdf0e10cSrcweir rBindings.LeaveRegistrations(); 1733cdf0e10cSrcweir 1734cdf0e10cSrcweir aSearchLB.Show(); 1735cdf0e10cSrcweir aReplaceLB.Show(); 1736cdf0e10cSrcweir aSearchTmplLB.Hide(); 1737cdf0e10cSrcweir aReplaceTmplLB.Hide(); 1738cdf0e10cSrcweir 1739cdf0e10cSrcweir if ( !pImpl->bMultiLineEdit ) 1740cdf0e10cSrcweir { 1741cdf0e10cSrcweir aSearchAttrText.SetText( BuildAttrText_Impl( sDesc, sal_True ) ); 1742cdf0e10cSrcweir aReplaceAttrText.SetText( BuildAttrText_Impl( sDesc, sal_False ) ); 1743cdf0e10cSrcweir } 1744cdf0e10cSrcweir else 1745cdf0e10cSrcweir { 1746cdf0e10cSrcweir pImpl->aSearchFormats.SetText( BuildAttrText_Impl( sDesc, sal_True ) ); 1747cdf0e10cSrcweir pImpl->aReplaceFormats.SetText( BuildAttrText_Impl( sDesc, sal_False ) ); 1748cdf0e10cSrcweir } 1749cdf0e10cSrcweir 1750cdf0e10cSrcweir EnableControl_Impl( &aFormatBtn ); 1751cdf0e10cSrcweir EnableControl_Impl( &aAttributeBtn ); 1752cdf0e10cSrcweir EnableControl_Impl( &aSimilarityBox ); 1753cdf0e10cSrcweir 1754cdf0e10cSrcweir FocusHdl_Impl( bSearch ? &aSearchLB : &aReplaceLB ); 1755cdf0e10cSrcweir } 1756cdf0e10cSrcweir bSet = sal_True; 1757cdf0e10cSrcweir pImpl->bSaveToModule = sal_False; 1758cdf0e10cSrcweir FlagHdl_Impl( &aLayoutBtn ); 1759cdf0e10cSrcweir pImpl->bSaveToModule = sal_True; 1760cdf0e10cSrcweir return 0; 1761cdf0e10cSrcweir } 1762cdf0e10cSrcweir 1763cdf0e10cSrcweir // ----------------------------------------------------------------------- 1764cdf0e10cSrcweir 1765cdf0e10cSrcweir void SvxSearchDialog::Remember_Impl( const String &rStr,sal_Bool _bSearch ) 1766cdf0e10cSrcweir { 1767cdf0e10cSrcweir if ( !rStr.Len() ) 1768cdf0e10cSrcweir return; 1769cdf0e10cSrcweir 1770cdf0e10cSrcweir SvStringsDtor* pArr = _bSearch ? &aSearchStrings : &aReplaceStrings; 1771cdf0e10cSrcweir ComboBox* pListBox = _bSearch ? &aSearchLB : &aReplaceLB; 1772cdf0e10cSrcweir 1773cdf0e10cSrcweir // identische Strings ignorieren 1774cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < pArr->Count(); ++i ) 1775cdf0e10cSrcweir { 1776cdf0e10cSrcweir if ( COMPARE_EQUAL == (*pArr)[i]->CompareTo( rStr ) ) 1777cdf0e10cSrcweir return; 1778cdf0e10cSrcweir } 1779cdf0e10cSrcweir 1780cdf0e10cSrcweir // bei maximaler Belegung "altesten Eintrag l"oschen (ListBox und Array) 1781cdf0e10cSrcweir String* pInsStr; 1782cdf0e10cSrcweir 1783cdf0e10cSrcweir if ( pArr->Count() >= REMEMBER_SIZE ) 1784cdf0e10cSrcweir { 1785cdf0e10cSrcweir pInsStr = (*pArr)[REMEMBER_SIZE - 1]; 1786cdf0e10cSrcweir pListBox->RemoveEntry( sal_uInt16(REMEMBER_SIZE - 1) ); 1787cdf0e10cSrcweir pArr->Remove( REMEMBER_SIZE - 1 ); 1788cdf0e10cSrcweir *pInsStr = rStr; 1789cdf0e10cSrcweir } 1790cdf0e10cSrcweir else 1791cdf0e10cSrcweir pInsStr = new String( rStr ); 1792cdf0e10cSrcweir 1793cdf0e10cSrcweir pArr->Insert( pInsStr, 0 ); 1794cdf0e10cSrcweir pListBox->InsertEntry( *pInsStr, 0 ); 1795cdf0e10cSrcweir } 1796cdf0e10cSrcweir 1797cdf0e10cSrcweir // ----------------------------------------------------------------------- 1798cdf0e10cSrcweir 1799cdf0e10cSrcweir void SvxSearchDialog::TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool ) 1800cdf0e10cSrcweir { 1801cdf0e10cSrcweir // SetUpdateMode( sal_False ); 1802cdf0e10cSrcweir String aOldSrch( aSearchTmplLB .GetSelectEntry() ); 1803cdf0e10cSrcweir String aOldRepl( aReplaceTmplLB.GetSelectEntry() ); 1804cdf0e10cSrcweir aSearchTmplLB .Clear(); 1805cdf0e10cSrcweir aReplaceTmplLB.Clear(); 1806cdf0e10cSrcweir rPool.SetSearchMask( pSearchItem->GetFamily(), SFXSTYLEBIT_ALL ); 1807cdf0e10cSrcweir aSearchTmplLB.SetUpdateMode( sal_False ); 1808cdf0e10cSrcweir aReplaceTmplLB.SetUpdateMode( sal_False ); 1809cdf0e10cSrcweir SfxStyleSheetBase* pBase = rPool.First(); 1810cdf0e10cSrcweir 1811cdf0e10cSrcweir while ( pBase ) 1812cdf0e10cSrcweir { 1813cdf0e10cSrcweir if ( pBase->IsUsed() ) 1814cdf0e10cSrcweir aSearchTmplLB.InsertEntry( pBase->GetName() ); 1815cdf0e10cSrcweir aReplaceTmplLB.InsertEntry( pBase->GetName() ); 1816cdf0e10cSrcweir pBase = rPool.Next(); 1817cdf0e10cSrcweir } 1818cdf0e10cSrcweir aSearchTmplLB.SetUpdateMode( sal_True ); 1819cdf0e10cSrcweir aReplaceTmplLB.SetUpdateMode( sal_True ); 1820cdf0e10cSrcweir aSearchTmplLB.SelectEntryPos(0); 1821cdf0e10cSrcweir 1822cdf0e10cSrcweir if ( aOldSrch.Len() ) 1823cdf0e10cSrcweir aSearchTmplLB .SelectEntry( aOldSrch ); 1824cdf0e10cSrcweir aReplaceTmplLB.SelectEntryPos(0); 1825cdf0e10cSrcweir 1826cdf0e10cSrcweir if ( aOldRepl.Len() ) 1827cdf0e10cSrcweir aReplaceTmplLB.SelectEntry( aOldRepl ); 1828cdf0e10cSrcweir 1829cdf0e10cSrcweir if ( aSearchTmplLB.GetEntryCount() ) 1830cdf0e10cSrcweir { 1831cdf0e10cSrcweir EnableControl_Impl( &aSearchBtn ); 1832cdf0e10cSrcweir EnableControl_Impl( &aSearchAllBtn ); 1833cdf0e10cSrcweir EnableControl_Impl( &aReplaceBtn ); 1834cdf0e10cSrcweir EnableControl_Impl( &aReplaceAllBtn ); 1835cdf0e10cSrcweir } 1836cdf0e10cSrcweir // FlagHdl_Impl(0); 1837cdf0e10cSrcweir // SetUpdateMode( sal_True ); 1838cdf0e10cSrcweir } 1839cdf0e10cSrcweir 1840cdf0e10cSrcweir // ----------------------------------------------------------------------- 1841cdf0e10cSrcweir 1842cdf0e10cSrcweir void SvxSearchDialog::EnableControls_Impl( const sal_uInt16 nFlags ) 1843cdf0e10cSrcweir { 1844cdf0e10cSrcweir if ( nFlags == nOptions ) 1845cdf0e10cSrcweir return; 1846cdf0e10cSrcweir else 1847cdf0e10cSrcweir nOptions = nFlags; 1848cdf0e10cSrcweir 1849cdf0e10cSrcweir if ( !nOptions ) 1850cdf0e10cSrcweir { 1851cdf0e10cSrcweir if ( IsVisible() ) 1852cdf0e10cSrcweir { 1853cdf0e10cSrcweir Hide(); 1854cdf0e10cSrcweir return; 1855cdf0e10cSrcweir } 1856cdf0e10cSrcweir } 1857cdf0e10cSrcweir else if ( !IsVisible() ) 1858cdf0e10cSrcweir Show(); 1859cdf0e10cSrcweir bool bNoSearch = sal_True; 1860cdf0e10cSrcweir 1861cdf0e10cSrcweir sal_Bool bEnableSearch = ( SEARCH_OPTIONS_SEARCH & nOptions ) != 0; 1862cdf0e10cSrcweir aSearchBtn.Enable(bEnableSearch); 1863cdf0e10cSrcweir 1864cdf0e10cSrcweir if( bEnableSearch ) 1865cdf0e10cSrcweir bNoSearch = sal_False; 1866cdf0e10cSrcweir 1867cdf0e10cSrcweir 1868cdf0e10cSrcweir if ( ( SEARCH_OPTIONS_SEARCH_ALL & nOptions ) != 0 ) 1869cdf0e10cSrcweir { 1870cdf0e10cSrcweir aSearchAllBtn.Enable(); 1871cdf0e10cSrcweir bNoSearch = sal_False; 1872cdf0e10cSrcweir } 1873cdf0e10cSrcweir else 1874cdf0e10cSrcweir aSearchAllBtn.Disable(); 1875cdf0e10cSrcweir if ( ( SEARCH_OPTIONS_REPLACE & nOptions ) != 0 ) 1876cdf0e10cSrcweir { 1877cdf0e10cSrcweir aReplaceBtn.Enable(); 1878cdf0e10cSrcweir aReplaceText.Enable(); 1879cdf0e10cSrcweir aReplaceLB.Enable(); 1880cdf0e10cSrcweir aReplaceTmplLB.Enable(); 1881cdf0e10cSrcweir bNoSearch = sal_False; 1882cdf0e10cSrcweir } 1883cdf0e10cSrcweir else 1884cdf0e10cSrcweir { 1885cdf0e10cSrcweir aReplaceBtn.Disable(); 1886cdf0e10cSrcweir aReplaceText.Disable(); 1887cdf0e10cSrcweir aReplaceLB.Disable(); 1888cdf0e10cSrcweir aReplaceTmplLB.Disable(); 1889cdf0e10cSrcweir } 1890cdf0e10cSrcweir if ( ( SEARCH_OPTIONS_REPLACE_ALL & nOptions ) != 0 ) 1891cdf0e10cSrcweir { 1892cdf0e10cSrcweir aReplaceAllBtn.Enable(); 1893cdf0e10cSrcweir bNoSearch = sal_False; 1894cdf0e10cSrcweir } 1895cdf0e10cSrcweir else 1896cdf0e10cSrcweir aReplaceAllBtn.Disable(); 1897cdf0e10cSrcweir aSearchComponentFL.Enable(!bNoSearch); 1898cdf0e10cSrcweir aSearchComponent1PB.Enable(!bNoSearch); 1899cdf0e10cSrcweir aSearchComponent2PB.Enable(!bNoSearch); 1900cdf0e10cSrcweir aSearchBtn.Enable( !bNoSearch ); 1901cdf0e10cSrcweir aSearchText.Enable( !bNoSearch ); 1902cdf0e10cSrcweir aSearchLB.Enable( !bNoSearch ); 1903cdf0e10cSrcweir 1904cdf0e10cSrcweir if ( ( SEARCH_OPTIONS_WHOLE_WORDS & nOptions ) != 0 ) 1905cdf0e10cSrcweir aWordBtn.Enable(); 1906cdf0e10cSrcweir else 1907cdf0e10cSrcweir aWordBtn.Disable(); 1908cdf0e10cSrcweir if ( ( SEARCH_OPTIONS_BACKWARDS & nOptions ) != 0 ) 1909cdf0e10cSrcweir aBackwardsBtn.Enable(); 1910cdf0e10cSrcweir else 1911cdf0e10cSrcweir aBackwardsBtn.Disable(); 1912cdf0e10cSrcweir //!if ( ( SEARCH_OPTIONS_NOTES & nOptions ) != 0 ) 1913cdf0e10cSrcweir aNotesBtn.Enable(); 1914cdf0e10cSrcweir //!else 1915cdf0e10cSrcweir //! aNotesBtn.Disable(); 1916cdf0e10cSrcweir if ( ( SEARCH_OPTIONS_REG_EXP & nOptions ) != 0 ) 1917cdf0e10cSrcweir aRegExpBtn.Enable(); 1918cdf0e10cSrcweir else 1919cdf0e10cSrcweir aRegExpBtn.Disable(); 1920cdf0e10cSrcweir if ( ( SEARCH_OPTIONS_EXACT & nOptions ) != 0 ) 1921cdf0e10cSrcweir aMatchCaseCB.Enable(); 1922cdf0e10cSrcweir else 1923cdf0e10cSrcweir aMatchCaseCB.Disable(); 1924cdf0e10cSrcweir if ( ( SEARCH_OPTIONS_SELECTION & nOptions ) != 0 ) 1925cdf0e10cSrcweir aSelectionBtn.Enable(); 1926cdf0e10cSrcweir else 1927cdf0e10cSrcweir aSelectionBtn.Disable(); 1928cdf0e10cSrcweir if ( ( SEARCH_OPTIONS_FAMILIES & nOptions ) != 0 ) 1929cdf0e10cSrcweir aLayoutBtn.Enable(); 1930cdf0e10cSrcweir else 1931cdf0e10cSrcweir aLayoutBtn.Disable(); 1932cdf0e10cSrcweir if ( ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0 ) 1933cdf0e10cSrcweir { 1934cdf0e10cSrcweir aAttributeBtn.Enable(); 1935cdf0e10cSrcweir aFormatBtn.Enable(); 1936cdf0e10cSrcweir aNoFormatBtn.Enable(); 1937cdf0e10cSrcweir } 1938cdf0e10cSrcweir else 1939cdf0e10cSrcweir { 1940cdf0e10cSrcweir aAttributeBtn.Disable(); 1941cdf0e10cSrcweir aFormatBtn.Disable(); 1942cdf0e10cSrcweir aNoFormatBtn.Disable(); 1943cdf0e10cSrcweir } 1944cdf0e10cSrcweir /* 1945cdf0e10cSrcweir if ( ( SEARCH_OPTIONS_MORE & nOptions ) != 0 && 1946cdf0e10cSrcweir pSearchItem && pSearchItem->GetAppFlag() == SVX_SEARCHAPP_CALC ) 1947cdf0e10cSrcweir pMoreBtn->Enable(); 1948cdf0e10cSrcweir else 1949cdf0e10cSrcweir { 1950cdf0e10cSrcweir pMoreBtn->SetState( sal_False ); 1951cdf0e10cSrcweir pMoreBtn->Disable(); 1952cdf0e10cSrcweir } 1953cdf0e10cSrcweir */ 1954cdf0e10cSrcweir if ( ( SEARCH_OPTIONS_SIMILARITY & nOptions ) != 0 ) 1955cdf0e10cSrcweir { 1956cdf0e10cSrcweir aSimilarityBox.Enable(); 1957cdf0e10cSrcweir aSimilarityBtn.Enable(); 1958cdf0e10cSrcweir } 1959cdf0e10cSrcweir else 1960cdf0e10cSrcweir { 1961cdf0e10cSrcweir aSimilarityBox.Disable(); 1962cdf0e10cSrcweir aSimilarityBtn.Disable(); 1963cdf0e10cSrcweir } 1964cdf0e10cSrcweir 1965cdf0e10cSrcweir if ( pSearchItem ) 1966cdf0e10cSrcweir Init_Impl( pSearchItem->GetPattern() && 1967cdf0e10cSrcweir ( !pSearchList || !pSearchList->Count() ) ); 1968cdf0e10cSrcweir } 1969cdf0e10cSrcweir 1970cdf0e10cSrcweir // ----------------------------------------------------------------------- 1971cdf0e10cSrcweir 1972cdf0e10cSrcweir void SvxSearchDialog::EnableControl_Impl( Control* pCtrl ) 1973cdf0e10cSrcweir { 1974cdf0e10cSrcweir if ( &aSearchBtn == pCtrl && ( SEARCH_OPTIONS_SEARCH & nOptions ) != 0 ) 1975cdf0e10cSrcweir { 1976cdf0e10cSrcweir aSearchComponentFL.Enable(); 1977cdf0e10cSrcweir aSearchComponent1PB.Enable(); 1978cdf0e10cSrcweir aSearchComponent2PB.Enable(); 1979cdf0e10cSrcweir aSearchBtn.Enable(); 1980cdf0e10cSrcweir return; 1981cdf0e10cSrcweir } 1982cdf0e10cSrcweir if ( &aSearchAllBtn == pCtrl && 1983cdf0e10cSrcweir ( SEARCH_OPTIONS_SEARCH_ALL & nOptions ) != 0 ) 1984cdf0e10cSrcweir { 1985cdf0e10cSrcweir aSearchAllBtn.Enable( ( bWriter || !aAllSheetsCB.IsChecked() ) ); 1986cdf0e10cSrcweir return; 1987cdf0e10cSrcweir } 1988cdf0e10cSrcweir if ( &aReplaceBtn == pCtrl && ( SEARCH_OPTIONS_REPLACE & nOptions ) != 0 ) 1989cdf0e10cSrcweir { 1990cdf0e10cSrcweir aReplaceBtn.Enable(); 1991cdf0e10cSrcweir return; 1992cdf0e10cSrcweir } 1993cdf0e10cSrcweir if ( &aReplaceAllBtn == pCtrl && 1994cdf0e10cSrcweir ( SEARCH_OPTIONS_REPLACE_ALL & nOptions ) != 0 ) 1995cdf0e10cSrcweir { 1996cdf0e10cSrcweir aReplaceAllBtn.Enable(); 1997cdf0e10cSrcweir return; 1998cdf0e10cSrcweir } 1999cdf0e10cSrcweir if ( &aWordBtn == pCtrl && ( SEARCH_OPTIONS_WHOLE_WORDS & nOptions ) != 0 ) 2000cdf0e10cSrcweir { 2001cdf0e10cSrcweir aWordBtn.Enable(); 2002cdf0e10cSrcweir return; 2003cdf0e10cSrcweir } 2004cdf0e10cSrcweir if ( &aBackwardsBtn == pCtrl && ( SEARCH_OPTIONS_BACKWARDS & nOptions ) != 0 ) 2005cdf0e10cSrcweir { 2006cdf0e10cSrcweir aBackwardsBtn.Enable(); 2007cdf0e10cSrcweir return; 2008cdf0e10cSrcweir } 2009cdf0e10cSrcweir if ( &aNotesBtn == pCtrl /*! && ( SEARCH_OPTIONS_NOTES & nOptions ) != 0 */ ) 2010cdf0e10cSrcweir { 2011cdf0e10cSrcweir aNotesBtn.Enable(); 2012cdf0e10cSrcweir return; 2013cdf0e10cSrcweir } 2014cdf0e10cSrcweir if ( &aRegExpBtn == pCtrl && ( SEARCH_OPTIONS_REG_EXP & nOptions ) != 0 2015cdf0e10cSrcweir && !aSimilarityBox.IsChecked()) 2016cdf0e10cSrcweir { 2017cdf0e10cSrcweir aRegExpBtn.Enable(); 2018cdf0e10cSrcweir return; 2019cdf0e10cSrcweir } 2020cdf0e10cSrcweir if ( &aMatchCaseCB == pCtrl && ( SEARCH_OPTIONS_EXACT & nOptions ) != 0 ) 2021cdf0e10cSrcweir { 2022cdf0e10cSrcweir if (!aJapOptionsCB.IsChecked()) 2023cdf0e10cSrcweir aMatchCaseCB.Enable(); 2024cdf0e10cSrcweir return; 2025cdf0e10cSrcweir } 2026cdf0e10cSrcweir if ( &aSelectionBtn == pCtrl && ( SEARCH_OPTIONS_SELECTION & nOptions ) != 0 ) 2027cdf0e10cSrcweir { 2028cdf0e10cSrcweir aSelectionBtn.Enable(); 2029cdf0e10cSrcweir return; 2030cdf0e10cSrcweir } 2031cdf0e10cSrcweir if ( &aLayoutBtn == pCtrl && ( SEARCH_OPTIONS_FAMILIES & nOptions ) != 0 ) 2032cdf0e10cSrcweir { 2033cdf0e10cSrcweir aLayoutBtn.Enable(); 2034cdf0e10cSrcweir return; 2035cdf0e10cSrcweir } 2036cdf0e10cSrcweir if ( &aAttributeBtn == pCtrl 2037cdf0e10cSrcweir && ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0 2038cdf0e10cSrcweir && pSearchList ) 2039cdf0e10cSrcweir { 2040cdf0e10cSrcweir aAttributeBtn.Enable( pImpl->bFocusOnSearch ); 2041cdf0e10cSrcweir } 2042cdf0e10cSrcweir if ( &aFormatBtn == pCtrl && ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0 ) 2043cdf0e10cSrcweir { 2044cdf0e10cSrcweir aFormatBtn.Enable(); 2045cdf0e10cSrcweir return; 2046cdf0e10cSrcweir } 2047cdf0e10cSrcweir if ( &aNoFormatBtn == pCtrl && ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0 ) 2048cdf0e10cSrcweir { 2049cdf0e10cSrcweir aNoFormatBtn.Enable(); 2050cdf0e10cSrcweir return; 2051cdf0e10cSrcweir } 2052cdf0e10cSrcweir if ( &aSimilarityBox == pCtrl && 2053cdf0e10cSrcweir ( SEARCH_OPTIONS_SIMILARITY & nOptions ) != 0 ) 2054cdf0e10cSrcweir { 2055cdf0e10cSrcweir aSimilarityBox.Enable(); 2056cdf0e10cSrcweir 2057cdf0e10cSrcweir if ( aSimilarityBox.IsChecked() ) 2058cdf0e10cSrcweir aSimilarityBtn.Enable(); 2059cdf0e10cSrcweir } 2060cdf0e10cSrcweir } 2061cdf0e10cSrcweir 2062cdf0e10cSrcweir // ----------------------------------------------------------------------- 2063cdf0e10cSrcweir 2064cdf0e10cSrcweir void SvxSearchDialog::SetItem_Impl( const SvxSearchItem* pItem ) 2065cdf0e10cSrcweir { 2066cdf0e10cSrcweir if ( pItem ) 2067cdf0e10cSrcweir { 2068cdf0e10cSrcweir delete pSearchItem; 2069cdf0e10cSrcweir pSearchItem = (SvxSearchItem*)pItem->Clone(); 2070cdf0e10cSrcweir Init_Impl( pSearchItem->GetPattern() && 2071cdf0e10cSrcweir ( !pSearchList || !pSearchList->Count() ) ); 2072cdf0e10cSrcweir } 2073cdf0e10cSrcweir } 2074cdf0e10cSrcweir 2075cdf0e10cSrcweir // ----------------------------------------------------------------------- 2076cdf0e10cSrcweir 2077cdf0e10cSrcweir IMPL_LINK( SvxSearchDialog, FocusHdl_Impl, Control *, pCtrl ) 2078cdf0e10cSrcweir { 2079cdf0e10cSrcweir xub_StrLen nTxtLen; 2080cdf0e10cSrcweir 2081cdf0e10cSrcweir if ( !pImpl->bMultiLineEdit ) 2082cdf0e10cSrcweir nTxtLen = aSearchAttrText.GetText().Len(); 2083cdf0e10cSrcweir else 2084cdf0e10cSrcweir nTxtLen = pImpl->aSearchFormats.GetText().Len(); 2085cdf0e10cSrcweir 2086cdf0e10cSrcweir if ( pCtrl == &aSearchLB || pCtrl == &pImpl->aSearchFormats ) 2087cdf0e10cSrcweir { 2088cdf0e10cSrcweir if ( pCtrl->HasChildPathFocus() ) 2089cdf0e10cSrcweir pImpl->bFocusOnSearch = sal_True; 2090cdf0e10cSrcweir pCtrl = &aSearchLB; 2091cdf0e10cSrcweir bSearch = sal_True; 2092cdf0e10cSrcweir 2093cdf0e10cSrcweir if( nTxtLen ) 2094cdf0e10cSrcweir EnableControl_Impl( &aNoFormatBtn ); 2095cdf0e10cSrcweir else 2096cdf0e10cSrcweir aNoFormatBtn.Disable(); 2097cdf0e10cSrcweir EnableControl_Impl( &aAttributeBtn ); 2098cdf0e10cSrcweir } 2099cdf0e10cSrcweir else 2100cdf0e10cSrcweir { 2101cdf0e10cSrcweir pImpl->bFocusOnSearch = sal_False; 2102cdf0e10cSrcweir pCtrl = &aReplaceLB; 2103cdf0e10cSrcweir bSearch = sal_False; 2104cdf0e10cSrcweir 2105cdf0e10cSrcweir if ( ( !pImpl->bMultiLineEdit && aReplaceAttrText.GetText().Len() ) || 2106cdf0e10cSrcweir ( pImpl->bMultiLineEdit && pImpl->aReplaceFormats.GetText().Len() ) ) 2107cdf0e10cSrcweir EnableControl_Impl( &aNoFormatBtn ); 2108cdf0e10cSrcweir else 2109cdf0e10cSrcweir aNoFormatBtn.Disable(); 2110cdf0e10cSrcweir aAttributeBtn.Disable(); 2111cdf0e10cSrcweir } 2112cdf0e10cSrcweir bSet = sal_True; 2113cdf0e10cSrcweir 2114cdf0e10cSrcweir aSearchLB.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) ); 2115cdf0e10cSrcweir 2116cdf0e10cSrcweir ModifyHdl_Impl( (ComboBox*)pCtrl ); 2117cdf0e10cSrcweir 2118cdf0e10cSrcweir aLayoutBtn.SetText( bFormat && nTxtLen ? aLayoutStr : aStylesStr ); 2119cdf0e10cSrcweir return 0; 2120cdf0e10cSrcweir } 2121cdf0e10cSrcweir 2122cdf0e10cSrcweir // ----------------------------------------------------------------------- 2123cdf0e10cSrcweir 2124cdf0e10cSrcweir IMPL_LINK( SvxSearchDialog, LoseFocusHdl_Impl, Control *, EMPTYARG ) 2125cdf0e10cSrcweir { 2126cdf0e10cSrcweir SaveToModule_Impl(); 2127cdf0e10cSrcweir return 0; 2128cdf0e10cSrcweir } 2129cdf0e10cSrcweir 2130cdf0e10cSrcweir // ----------------------------------------------------------------------- 2131cdf0e10cSrcweir 2132cdf0e10cSrcweir IMPL_LINK( SvxSearchDialog, FormatHdl_Impl, Button *, EMPTYARG ) 2133cdf0e10cSrcweir { 2134cdf0e10cSrcweir SfxObjectShell* pSh = SfxObjectShell::Current(); 2135cdf0e10cSrcweir 2136cdf0e10cSrcweir DBG_ASSERT( pSh, "no DocShell" ); 2137cdf0e10cSrcweir 2138cdf0e10cSrcweir if ( !pSh || !pImpl->pRanges ) 2139cdf0e10cSrcweir return 0; 2140cdf0e10cSrcweir 2141cdf0e10cSrcweir sal_sSize nCnt = 0; 2142cdf0e10cSrcweir const sal_uInt16* pPtr = pImpl->pRanges; 2143cdf0e10cSrcweir const sal_uInt16* pTmp = pPtr; 2144cdf0e10cSrcweir 2145cdf0e10cSrcweir while( *pTmp ) 2146cdf0e10cSrcweir pTmp++; 2147cdf0e10cSrcweir nCnt = pTmp - pPtr + 7; 2148cdf0e10cSrcweir sal_uInt16* pWhRanges = new sal_uInt16[nCnt]; 2149cdf0e10cSrcweir sal_uInt16 nPos = 0; 2150cdf0e10cSrcweir 2151cdf0e10cSrcweir while( *pPtr ) 2152cdf0e10cSrcweir { 2153cdf0e10cSrcweir pWhRanges[nPos++] = *pPtr++; 2154cdf0e10cSrcweir } 2155cdf0e10cSrcweir 2156cdf0e10cSrcweir pWhRanges[nPos++] = SID_ATTR_PARA_MODEL; 2157cdf0e10cSrcweir pWhRanges[nPos++] = SID_ATTR_PARA_MODEL; 2158cdf0e10cSrcweir 2159cdf0e10cSrcweir sal_uInt16 nBrushWhich = pSh->GetPool().GetWhich(SID_ATTR_BRUSH); 2160cdf0e10cSrcweir pWhRanges[nPos++] = nBrushWhich; 2161cdf0e10cSrcweir pWhRanges[nPos++] = nBrushWhich; 2162cdf0e10cSrcweir pWhRanges[nPos++] = SID_PARA_BACKGRND_DESTINATION; 2163cdf0e10cSrcweir pWhRanges[nPos++] = SID_PARA_BACKGRND_DESTINATION; 2164cdf0e10cSrcweir pWhRanges[nPos] = 0; 2165cdf0e10cSrcweir SfxItemPool& rPool = pSh->GetPool(); 2166cdf0e10cSrcweir SfxItemSet aSet( rPool, pWhRanges ); 2167cdf0e10cSrcweir String aTxt; 2168cdf0e10cSrcweir 2169cdf0e10cSrcweir aSet.InvalidateAllItems(); 2170cdf0e10cSrcweir aSet.Put(SvxBrushItem(nBrushWhich)); 2171cdf0e10cSrcweir aSet.Put(SfxUInt16Item(SID_PARA_BACKGRND_DESTINATION, PARA_DEST_CHAR)); 2172cdf0e10cSrcweir 2173cdf0e10cSrcweir if ( bSearch ) 2174cdf0e10cSrcweir { 2175cdf0e10cSrcweir aTxt = SVX_RESSTR( RID_SVXSTR_SEARCH ); 2176cdf0e10cSrcweir pSearchList->Get( aSet ); 2177cdf0e10cSrcweir } 2178cdf0e10cSrcweir else 2179cdf0e10cSrcweir { 2180cdf0e10cSrcweir aTxt = SVX_RESSTR( RID_SVXSTR_REPLACE ); 2181cdf0e10cSrcweir pReplaceList->Get( aSet ); 2182cdf0e10cSrcweir } 2183cdf0e10cSrcweir aSet.DisableItem(SID_ATTR_PARA_MODEL); 2184cdf0e10cSrcweir aSet.DisableItem(rPool.GetWhich(SID_ATTR_PARA_PAGEBREAK)); 2185cdf0e10cSrcweir aSet.DisableItem(rPool.GetWhich(SID_ATTR_PARA_KEEP)); 2186cdf0e10cSrcweir 2187cdf0e10cSrcweir //CHINA001 SvxSearchFormatDialog* pDlg = new SvxSearchFormatDialog( this, aSet ); 2188cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 2189cdf0e10cSrcweir if(pFact) 2190cdf0e10cSrcweir { 2191cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateTabItemDialog( LAYOUT_THIS_WINDOW (this), aSet, RID_SVXDLG_SEARCHFORMAT ); 2192cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 2193cdf0e10cSrcweir aTxt.Insert( pDlg->GetText(), 0 ); 2194cdf0e10cSrcweir pDlg->SetText( aTxt ); 2195cdf0e10cSrcweir 2196cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 2197cdf0e10cSrcweir { 2198cdf0e10cSrcweir DBG_ASSERT( pDlg->GetOutputItemSet(), "invalid Output-Set" ); 2199cdf0e10cSrcweir SfxItemSet aOutSet( *pDlg->GetOutputItemSet() ); 2200cdf0e10cSrcweir 2201cdf0e10cSrcweir SearchAttrItemList* pList = bSearch ? pSearchList : pReplaceList; 2202cdf0e10cSrcweir 2203cdf0e10cSrcweir SearchAttrItem* pAItem; 2204cdf0e10cSrcweir const SfxPoolItem* pItem; 2205cdf0e10cSrcweir for( sal_uInt16 n = 0; n < pList->Count(); ++n ) 2206cdf0e10cSrcweir if( !IsInvalidItem( (pAItem = &pList->GetObject(n))->pItem ) && 2207cdf0e10cSrcweir SFX_ITEM_SET == aOutSet.GetItemState( 2208cdf0e10cSrcweir pAItem->pItem->Which(), sal_False, &pItem ) ) 2209cdf0e10cSrcweir { 2210cdf0e10cSrcweir delete pAItem->pItem; 2211cdf0e10cSrcweir pAItem->pItem = pItem->Clone(); 2212cdf0e10cSrcweir aOutSet.ClearItem( pAItem->pItem->Which() ); 2213cdf0e10cSrcweir } 2214cdf0e10cSrcweir 2215cdf0e10cSrcweir if( aOutSet.Count() ) 2216cdf0e10cSrcweir pList->Put( aOutSet ); 2217cdf0e10cSrcweir 2218cdf0e10cSrcweir PaintAttrText_Impl(); // AttributText in GroupBox setzen 2219cdf0e10cSrcweir } 2220cdf0e10cSrcweir delete pDlg; 2221cdf0e10cSrcweir } 2222cdf0e10cSrcweir delete[] pWhRanges; 2223cdf0e10cSrcweir return 0; 2224cdf0e10cSrcweir } 2225cdf0e10cSrcweir 2226cdf0e10cSrcweir // ----------------------------------------------------------------------- 2227cdf0e10cSrcweir 2228cdf0e10cSrcweir IMPL_LINK( SvxSearchDialog, NoFormatHdl_Impl, Button *, EMPTYARG ) 2229cdf0e10cSrcweir { 2230cdf0e10cSrcweir aLayoutBtn.SetText( aStylesStr ); 2231cdf0e10cSrcweir bFormat = sal_False; 2232cdf0e10cSrcweir aLayoutBtn.Check( sal_False ); 2233cdf0e10cSrcweir 2234cdf0e10cSrcweir if ( bSearch ) 2235cdf0e10cSrcweir { 2236cdf0e10cSrcweir if ( !pImpl->bMultiLineEdit ) 2237cdf0e10cSrcweir aSearchAttrText.SetText( String() ); 2238cdf0e10cSrcweir else 2239cdf0e10cSrcweir pImpl->aSearchFormats.SetText( String() ); 2240cdf0e10cSrcweir pSearchList->Clear(); 2241cdf0e10cSrcweir } 2242cdf0e10cSrcweir else 2243cdf0e10cSrcweir { 2244cdf0e10cSrcweir if ( !pImpl->bMultiLineEdit ) 2245cdf0e10cSrcweir aReplaceAttrText.SetText( String() ); 2246cdf0e10cSrcweir else 2247cdf0e10cSrcweir pImpl->aReplaceFormats.SetText( String() ); 2248cdf0e10cSrcweir pReplaceList->Clear(); 2249cdf0e10cSrcweir } 2250cdf0e10cSrcweir pImpl->bSaveToModule = sal_False; 2251cdf0e10cSrcweir TemplateHdl_Impl( &aLayoutBtn ); 2252cdf0e10cSrcweir pImpl->bSaveToModule = sal_True; 2253cdf0e10cSrcweir aNoFormatBtn.Disable(); 2254cdf0e10cSrcweir return 0; 2255cdf0e10cSrcweir } 2256cdf0e10cSrcweir 2257cdf0e10cSrcweir // ----------------------------------------------------------------------- 2258cdf0e10cSrcweir 2259cdf0e10cSrcweir IMPL_LINK( SvxSearchDialog, AttributeHdl_Impl, Button *, EMPTYARG ) 2260cdf0e10cSrcweir { 2261cdf0e10cSrcweir if ( !pSearchList || !pImpl->pRanges ) 2262cdf0e10cSrcweir return 0; 2263cdf0e10cSrcweir 2264cdf0e10cSrcweir //CHINA001 SvxSearchAttributeDialog* pDlg = new SvxSearchAttributeDialog( this, *pSearchList, pImpl->pRanges ); 2265cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 2266cdf0e10cSrcweir if(pFact) 2267cdf0e10cSrcweir { 2268cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateSvxSearchAttributeDialog( LAYOUT_THIS_WINDOW (this), *pSearchList, pImpl->pRanges ); 2269cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 2270cdf0e10cSrcweir pDlg->Execute(); 2271cdf0e10cSrcweir delete pDlg; 2272cdf0e10cSrcweir } 2273cdf0e10cSrcweir PaintAttrText_Impl(); 2274cdf0e10cSrcweir return 0; 2275cdf0e10cSrcweir } 2276cdf0e10cSrcweir 2277cdf0e10cSrcweir // ----------------------------------------------------------------------- 2278cdf0e10cSrcweir 2279cdf0e10cSrcweir IMPL_LINK( SvxSearchDialog, TimeoutHdl_Impl, Timer *, pTimer ) 2280cdf0e10cSrcweir { 2281cdf0e10cSrcweir SfxViewShell* pViewShell = SfxViewShell::Current(); 2282cdf0e10cSrcweir 2283cdf0e10cSrcweir if ( pViewShell ) 2284cdf0e10cSrcweir { 2285cdf0e10cSrcweir if ( pViewShell->HasSelection( aSearchLB.IsVisible() ) ) 2286cdf0e10cSrcweir EnableControl_Impl( &aSelectionBtn ); 2287cdf0e10cSrcweir else 2288cdf0e10cSrcweir { 2289cdf0e10cSrcweir aSelectionBtn.Check( sal_False ); 2290cdf0e10cSrcweir aSelectionBtn.Disable(); 2291cdf0e10cSrcweir } 2292cdf0e10cSrcweir } 2293cdf0e10cSrcweir 2294cdf0e10cSrcweir pTimer->Start(); 2295cdf0e10cSrcweir return 0; 2296cdf0e10cSrcweir } 2297cdf0e10cSrcweir 2298cdf0e10cSrcweir // ----------------------------------------------------------------------- 2299cdf0e10cSrcweir 2300cdf0e10cSrcweir void SvxSearchDialog::GetSearchItems( SfxItemSet& rSet ) 2301cdf0e10cSrcweir { 2302cdf0e10cSrcweir xub_StrLen nLen; 2303cdf0e10cSrcweir 2304cdf0e10cSrcweir if ( !pImpl->bMultiLineEdit ) 2305cdf0e10cSrcweir nLen = aSearchAttrText.GetText().Len(); 2306cdf0e10cSrcweir else 2307cdf0e10cSrcweir nLen = pImpl->aSearchFormats.GetText().Len(); 2308cdf0e10cSrcweir 2309cdf0e10cSrcweir if ( nLen && pSearchList ) 2310cdf0e10cSrcweir pSearchList->Get( rSet ); 2311cdf0e10cSrcweir } 2312cdf0e10cSrcweir 2313cdf0e10cSrcweir // ----------------------------------------------------------------------- 2314cdf0e10cSrcweir 2315cdf0e10cSrcweir void SvxSearchDialog::GetReplaceItems( SfxItemSet& rSet ) 2316cdf0e10cSrcweir { 2317cdf0e10cSrcweir xub_StrLen nLen; 2318cdf0e10cSrcweir 2319cdf0e10cSrcweir if ( !pImpl->bMultiLineEdit ) 2320cdf0e10cSrcweir nLen = aReplaceAttrText.GetText().Len(); 2321cdf0e10cSrcweir else 2322cdf0e10cSrcweir nLen = pImpl->aReplaceFormats.GetText().Len(); 2323cdf0e10cSrcweir 2324cdf0e10cSrcweir if ( nLen && pReplaceList ) 2325cdf0e10cSrcweir pReplaceList->Get( rSet ); 2326cdf0e10cSrcweir } 2327cdf0e10cSrcweir 2328cdf0e10cSrcweir // ----------------------------------------------------------------------- 2329cdf0e10cSrcweir 2330cdf0e10cSrcweir String& SvxSearchDialog::BuildAttrText_Impl( String& rStr, 2331cdf0e10cSrcweir sal_Bool bSrchFlag ) const 2332cdf0e10cSrcweir { 2333cdf0e10cSrcweir if ( rStr.Len() ) 2334cdf0e10cSrcweir rStr.Erase(); 2335cdf0e10cSrcweir 2336cdf0e10cSrcweir SfxObjectShell* pSh = SfxObjectShell::Current(); 2337cdf0e10cSrcweir DBG_ASSERT( pSh, "no DocShell" ); 2338cdf0e10cSrcweir 2339cdf0e10cSrcweir if ( !pSh ) 2340cdf0e10cSrcweir return rStr; 2341cdf0e10cSrcweir 2342cdf0e10cSrcweir SfxItemPool& rPool = pSh->GetPool(); 2343cdf0e10cSrcweir SearchAttrItemList* pList = bSrchFlag ? pSearchList : pReplaceList; 2344cdf0e10cSrcweir 2345cdf0e10cSrcweir if ( !pList ) 2346cdf0e10cSrcweir return rStr; 2347cdf0e10cSrcweir 2348cdf0e10cSrcweir // Metrik abfragen 2349cdf0e10cSrcweir SfxMapUnit eMapUnit = SFX_MAPUNIT_CM; 2350cdf0e10cSrcweir FieldUnit eFieldUnit = pSh->GetModule()->GetFieldUnit(); 2351cdf0e10cSrcweir switch ( eFieldUnit ) 2352cdf0e10cSrcweir { 2353cdf0e10cSrcweir case FUNIT_MM: eMapUnit = SFX_MAPUNIT_MM; break; 2354cdf0e10cSrcweir case FUNIT_CM: 2355cdf0e10cSrcweir case FUNIT_M: 2356cdf0e10cSrcweir case FUNIT_KM: eMapUnit = SFX_MAPUNIT_CM; break; 2357cdf0e10cSrcweir case FUNIT_TWIP: eMapUnit = SFX_MAPUNIT_TWIP; break; 2358cdf0e10cSrcweir case FUNIT_POINT: 2359cdf0e10cSrcweir case FUNIT_PICA: eMapUnit = SFX_MAPUNIT_POINT; break; 2360cdf0e10cSrcweir case FUNIT_INCH: 2361cdf0e10cSrcweir case FUNIT_FOOT: 2362cdf0e10cSrcweir case FUNIT_MILE: eMapUnit = SFX_MAPUNIT_INCH; break; 2363cdf0e10cSrcweir case FUNIT_100TH_MM: eMapUnit = SFX_MAPUNIT_100TH_MM; break; 2364cdf0e10cSrcweir default: ;//prevent warning 2365cdf0e10cSrcweir } 2366cdf0e10cSrcweir 2367cdf0e10cSrcweir ResStringArray aAttrNames( SVX_RES( RID_ATTR_NAMES ) ); 2368cdf0e10cSrcweir 2369cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < pList->Count(); ++i ) 2370cdf0e10cSrcweir { 2371cdf0e10cSrcweir const SearchAttrItem& rItem = pList->GetObject(i); 2372cdf0e10cSrcweir 2373cdf0e10cSrcweir if ( rStr.Len() ) 2374cdf0e10cSrcweir rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); 2375cdf0e10cSrcweir 2376cdf0e10cSrcweir if ( !IsInvalidItem( rItem.pItem ) ) 2377cdf0e10cSrcweir { 2378cdf0e10cSrcweir String aStr; 2379cdf0e10cSrcweir rPool.GetPresentation( *rItem.pItem, 2380cdf0e10cSrcweir SFX_ITEM_PRESENTATION_COMPLETE, 2381cdf0e10cSrcweir eMapUnit, aStr ); 2382cdf0e10cSrcweir rStr += aStr; 2383cdf0e10cSrcweir } 2384cdf0e10cSrcweir else if ( rItem.nSlot == SID_ATTR_BRUSH_CHAR ) 2385cdf0e10cSrcweir { 2386cdf0e10cSrcweir //Sonderbehandlung fuer Zeichenhintergrund 2387cdf0e10cSrcweir rStr += SVX_RESSTR( RID_SVXITEMS_BRUSH_CHAR ); 2388cdf0e10cSrcweir } 2389cdf0e10cSrcweir else 2390cdf0e10cSrcweir { 2391cdf0e10cSrcweir sal_uInt32 nId = aAttrNames.FindIndex( rItem.nSlot ); 2392cdf0e10cSrcweir if ( RESARRAY_INDEX_NOTFOUND != nId ) 2393cdf0e10cSrcweir rStr += aAttrNames.GetString( nId ); 2394cdf0e10cSrcweir } 2395cdf0e10cSrcweir } 2396cdf0e10cSrcweir return rStr; 2397cdf0e10cSrcweir } 2398cdf0e10cSrcweir 2399cdf0e10cSrcweir // ----------------------------------------------------------------------- 2400cdf0e10cSrcweir 2401cdf0e10cSrcweir void SvxSearchDialog::PaintAttrText_Impl() 2402cdf0e10cSrcweir { 2403cdf0e10cSrcweir String aDesc; 2404cdf0e10cSrcweir BuildAttrText_Impl( aDesc, bSearch ); 2405cdf0e10cSrcweir 2406cdf0e10cSrcweir if ( !bFormat && aDesc.Len() ) 2407cdf0e10cSrcweir bFormat = sal_True; 2408cdf0e10cSrcweir 2409cdf0e10cSrcweir if ( bSearch ) 2410cdf0e10cSrcweir { 2411cdf0e10cSrcweir if ( !pImpl->bMultiLineEdit ) 2412cdf0e10cSrcweir aSearchAttrText.SetText( aDesc ); 2413cdf0e10cSrcweir else 2414cdf0e10cSrcweir pImpl->aSearchFormats.SetText( aDesc ); 2415cdf0e10cSrcweir FocusHdl_Impl( &aSearchLB ); 2416cdf0e10cSrcweir } 2417cdf0e10cSrcweir else 2418cdf0e10cSrcweir { 2419cdf0e10cSrcweir if ( !pImpl->bMultiLineEdit ) 2420cdf0e10cSrcweir aReplaceAttrText.SetText( aDesc ); 2421cdf0e10cSrcweir else 2422cdf0e10cSrcweir pImpl->aReplaceFormats.SetText( aDesc ); 2423cdf0e10cSrcweir FocusHdl_Impl( &aReplaceLB ); 2424cdf0e10cSrcweir } 2425cdf0e10cSrcweir } 2426cdf0e10cSrcweir 2427cdf0e10cSrcweir // ----------------------------------------------------------------------- 2428cdf0e10cSrcweir 2429cdf0e10cSrcweir void SvxSearchDialog::SetModifyFlag_Impl( const Control* pCtrl ) 2430cdf0e10cSrcweir { 2431cdf0e10cSrcweir if ( &aSearchLB == (ComboBox*)pCtrl ) 2432cdf0e10cSrcweir nModifyFlag |= MODIFY_SEARCH; 2433cdf0e10cSrcweir else if ( &aReplaceLB == (ComboBox*)pCtrl ) 2434cdf0e10cSrcweir nModifyFlag |= MODIFY_REPLACE; 2435cdf0e10cSrcweir else if ( &aWordBtn == (CheckBox*)pCtrl ) 2436cdf0e10cSrcweir nModifyFlag |= MODIFY_WORD; 2437cdf0e10cSrcweir else if ( &aMatchCaseCB == (CheckBox*)pCtrl ) 2438cdf0e10cSrcweir nModifyFlag |= MODIFY_EXACT; 2439cdf0e10cSrcweir else if ( &aBackwardsBtn == (CheckBox*)pCtrl ) 2440cdf0e10cSrcweir nModifyFlag |= MODIFY_BACKWARDS; 2441cdf0e10cSrcweir else if ( &aNotesBtn == (CheckBox*)pCtrl ) 2442cdf0e10cSrcweir nModifyFlag |= MODIFY_NOTES; 2443cdf0e10cSrcweir else if ( &aSelectionBtn == (CheckBox*)pCtrl ) 2444cdf0e10cSrcweir nModifyFlag |= MODIFY_SELECTION; 2445cdf0e10cSrcweir else if ( &aRegExpBtn == (CheckBox*)pCtrl ) 2446cdf0e10cSrcweir nModifyFlag |= MODIFY_REGEXP; 2447cdf0e10cSrcweir else if ( &aLayoutBtn == (CheckBox*)pCtrl ) 2448cdf0e10cSrcweir nModifyFlag |= MODIFY_LAYOUT; 2449cdf0e10cSrcweir else if ( &aSimilarityBox == (CheckBox*)pCtrl ) 2450cdf0e10cSrcweir nModifyFlag |= MODIFY_SIMILARITY; 2451cdf0e10cSrcweir else if ( &aCalcSearchInLB == (ListBox*)pCtrl ) 2452cdf0e10cSrcweir { 2453cdf0e10cSrcweir nModifyFlag |= MODIFY_FORMULAS; 2454cdf0e10cSrcweir nModifyFlag |= MODIFY_VALUES; 2455cdf0e10cSrcweir nModifyFlag |= MODIFY_CALC_NOTES; 2456cdf0e10cSrcweir } 2457cdf0e10cSrcweir else if ( &aRowsBtn == (RadioButton*)pCtrl ) 2458cdf0e10cSrcweir nModifyFlag |= MODIFY_ROWS; 2459cdf0e10cSrcweir else if ( &aColumnsBtn == (RadioButton*)pCtrl ) 2460cdf0e10cSrcweir nModifyFlag |= MODIFY_COLUMNS; 2461cdf0e10cSrcweir else if ( &aAllSheetsCB == (CheckBox*)pCtrl ) 2462cdf0e10cSrcweir nModifyFlag |= MODIFY_ALLTABLES; 2463cdf0e10cSrcweir } 2464cdf0e10cSrcweir 2465cdf0e10cSrcweir // ----------------------------------------------------------------------- 2466cdf0e10cSrcweir 2467cdf0e10cSrcweir void SvxSearchDialog::SaveToModule_Impl() 2468cdf0e10cSrcweir { 2469cdf0e10cSrcweir if ( !pSearchItem ) 2470cdf0e10cSrcweir return; 2471cdf0e10cSrcweir 2472cdf0e10cSrcweir if ( aLayoutBtn.IsChecked() ) 2473cdf0e10cSrcweir { 2474cdf0e10cSrcweir pSearchItem->SetSearchString ( aSearchTmplLB.GetSelectEntry() ); 2475cdf0e10cSrcweir pSearchItem->SetReplaceString( aReplaceTmplLB.GetSelectEntry() ); 2476cdf0e10cSrcweir } 2477cdf0e10cSrcweir else 2478cdf0e10cSrcweir { 2479cdf0e10cSrcweir pSearchItem->SetSearchString ( aSearchLB.GetText() ); 2480cdf0e10cSrcweir pSearchItem->SetReplaceString( aReplaceLB.GetText() ); 2481cdf0e10cSrcweir Remember_Impl( aSearchLB.GetText(), sal_True ); 2482cdf0e10cSrcweir } 2483cdf0e10cSrcweir 2484cdf0e10cSrcweir pSearchItem->SetRegExp( sal_False ); 2485cdf0e10cSrcweir pSearchItem->SetLevenshtein( sal_False ); 2486cdf0e10cSrcweir if (GetCheckBoxValue( aRegExpBtn )) 2487cdf0e10cSrcweir pSearchItem->SetRegExp( sal_True ); 2488cdf0e10cSrcweir else if (GetCheckBoxValue( aSimilarityBox )) 2489cdf0e10cSrcweir pSearchItem->SetLevenshtein( sal_True ); 2490cdf0e10cSrcweir 2491cdf0e10cSrcweir pSearchItem->SetWordOnly( GetCheckBoxValue( aWordBtn ) ); 2492cdf0e10cSrcweir pSearchItem->SetBackward( GetCheckBoxValue( aBackwardsBtn ) ); 2493cdf0e10cSrcweir pSearchItem->SetNotes( GetCheckBoxValue( aNotesBtn ) ); 2494cdf0e10cSrcweir pSearchItem->SetPattern( GetCheckBoxValue( aLayoutBtn ) ); 2495cdf0e10cSrcweir pSearchItem->SetSelection( GetCheckBoxValue( aSelectionBtn ) ); 2496cdf0e10cSrcweir 2497cdf0e10cSrcweir pSearchItem->SetUseAsianOptions( GetCheckBoxValue( aJapOptionsCB ) ); 2498cdf0e10cSrcweir sal_Int32 nFlags = GetTransliterationFlags(); 2499cdf0e10cSrcweir if( !pSearchItem->IsUseAsianOptions()) 2500cdf0e10cSrcweir nFlags &= (TransliterationModules_IGNORE_CASE | 2501cdf0e10cSrcweir TransliterationModules_IGNORE_WIDTH ); 2502cdf0e10cSrcweir pSearchItem->SetTransliterationFlags( nFlags ); 2503cdf0e10cSrcweir 2504cdf0e10cSrcweir if ( !bWriter ) 2505cdf0e10cSrcweir { 2506cdf0e10cSrcweir if ( aCalcSearchInLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) 2507cdf0e10cSrcweir pSearchItem->SetCellType( aCalcSearchInLB.GetSelectEntryPos() ); 2508cdf0e10cSrcweir 2509cdf0e10cSrcweir pSearchItem->SetRowDirection( aRowsBtn.IsChecked() ); 2510cdf0e10cSrcweir pSearchItem->SetAllTables( aAllSheetsCB.IsChecked() ); 2511cdf0e10cSrcweir } 2512cdf0e10cSrcweir 2513cdf0e10cSrcweir pSearchItem->SetCommand( SVX_SEARCHCMD_FIND ); 2514cdf0e10cSrcweir nModifyFlag = 0; 2515cdf0e10cSrcweir const SfxPoolItem* ppArgs[] = { pSearchItem, 0 }; 2516cdf0e10cSrcweir rBindings.GetDispatcher()->Execute( SID_SEARCH_ITEM, SFX_CALLMODE_SLOT, ppArgs ); 2517cdf0e10cSrcweir } 2518cdf0e10cSrcweir 2519*9b8096d0SSteve Yin //IAccessible2 Implementation 2009----- 2520*9b8096d0SSteve Yin ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > 2521*9b8096d0SSteve Yin SvxSearchDialog::GetComponentInterface( sal_Bool bCreate ) 2522*9b8096d0SSteve Yin { 2523*9b8096d0SSteve Yin ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer 2524*9b8096d0SSteve Yin (Window::GetComponentInterface(false)); 2525*9b8096d0SSteve Yin if ( !xPeer.is() && bCreate ) 2526*9b8096d0SSteve Yin { 2527*9b8096d0SSteve Yin ::com::sun::star::awt::XWindowPeer* mxPeer = new VCLXSvxFindReplaceDialog(this); 2528*9b8096d0SSteve Yin SetComponentInterface(mxPeer); 2529*9b8096d0SSteve Yin return mxPeer; 2530*9b8096d0SSteve Yin } 2531*9b8096d0SSteve Yin else 2532*9b8096d0SSteve Yin return xPeer; 2533*9b8096d0SSteve Yin } 2534*9b8096d0SSteve Yin //-----IAccessible2 Implementation 2009 2535*9b8096d0SSteve Yin 2536cdf0e10cSrcweir // class SvxSearchDialogWrapper ------------------------------------------ 2537cdf0e10cSrcweir 2538cdf0e10cSrcweir SFX_IMPL_CHILDWINDOW(SvxSearchDialogWrapper, SID_SEARCH_DLG); 2539cdf0e10cSrcweir 2540cdf0e10cSrcweir // ----------------------------------------------------------------------- 2541cdf0e10cSrcweir 2542cdf0e10cSrcweir SvxSearchDialogWrapper::SvxSearchDialogWrapper( Window* _pParent, sal_uInt16 nId, 2543cdf0e10cSrcweir SfxBindings* pBindings, 2544cdf0e10cSrcweir SfxChildWinInfo* pInfo ) 2545cdf0e10cSrcweir : SfxChildWindow( _pParent, nId ) 2546cdf0e10cSrcweir , dialog (new SvxSearchDialog (_pParent, this, *pBindings)) 2547cdf0e10cSrcweir { 2548cdf0e10cSrcweir pWindow = LAYOUT_THIS_WINDOW (dialog); 2549cdf0e10cSrcweir dialog->Initialize( pInfo ); 2550cdf0e10cSrcweir 2551cdf0e10cSrcweir pBindings->Update( SID_SEARCH_ITEM ); 2552cdf0e10cSrcweir pBindings->Update( SID_SEARCH_OPTIONS ); 2553cdf0e10cSrcweir pBindings->Update( SID_SEARCH_SEARCHSET ); 2554cdf0e10cSrcweir pBindings->Update( SID_SEARCH_REPLACESET ); 2555cdf0e10cSrcweir eChildAlignment = SFX_ALIGN_NOALIGNMENT; 2556cdf0e10cSrcweir dialog->bConstruct = sal_False; 2557cdf0e10cSrcweir } 2558cdf0e10cSrcweir 2559cdf0e10cSrcweir SvxSearchDialogWrapper::~SvxSearchDialogWrapper () 2560cdf0e10cSrcweir { 2561cdf0e10cSrcweir #if ENABLE_LAYOUT 2562cdf0e10cSrcweir delete dialog; 2563cdf0e10cSrcweir pWindow = 0; 2564cdf0e10cSrcweir #endif /* ENABLE_LAYOUT */ 2565cdf0e10cSrcweir } 2566cdf0e10cSrcweir 2567cdf0e10cSrcweir SvxSearchDialog *SvxSearchDialogWrapper::getDialog () 2568cdf0e10cSrcweir { 2569cdf0e10cSrcweir return dialog; 2570cdf0e10cSrcweir } 2571cdf0e10cSrcweir 2572cdf0e10cSrcweir // ----------------------------------------------------------------------- 2573cdf0e10cSrcweir 2574cdf0e10cSrcweir SfxChildWinInfo SvxSearchDialogWrapper::GetInfo() const 2575cdf0e10cSrcweir { 2576cdf0e10cSrcweir SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); 2577cdf0e10cSrcweir aInfo.bVisible = sal_False; 2578cdf0e10cSrcweir return aInfo; 2579cdf0e10cSrcweir } 2580cdf0e10cSrcweir 2581