Better, Faster, Freer

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: i386 ]
Version: HEAD ]

001 /*************************************************************************
002  *
003  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004  * 
005  * Copyright 2008 by Sun Microsystems, Inc.
006  *
007  * OpenOffice.org - a multi-platform office productivity suite
008  *
009  * $RCSfile: srchdlg.cxx,v $
010  * $Revision: 1.46 $
011  *
012  * This file is part of OpenOffice.org.
013  *
014  * OpenOffice.org is free software: you can redistribute it and/or modify
015  * it under the terms of the GNU Lesser General Public License version 3
016  * only, as published by the Free Software Foundation.
017  *
018  * OpenOffice.org is distributed in the hope that it will be useful,
019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
021  * GNU Lesser General Public License version 3 for more details
022  * (a copy is included in the LICENSE file that accompanied this code).
023  *
024  * You should have received a copy of the GNU Lesser General Public License
025  * version 3 along with OpenOffice.org.  If not, see
026  * <http://www.openoffice.org/license.html>
027  * for a copy of the LGPLv3 License.
028  *
029  ************************************************************************/
030 
031 // MARKER(update_precomp.py): autogen include statement, do not remove
032 #include "precompiled_svx.hxx"
033 
034 // include ---------------------------------------------------------------
035 #include <vcl/wrkwin.hxx>
036 #include <vcl/morebtn.hxx>
037 #include <vcl/msgbox.hxx>
038 #include <svtools/slstitm.hxx>
039 #include <svtools/itemiter.hxx>
040 #include <svtools/style.hxx>
041 #include <svtools/searchopt.hxx>
042 #include <sfx2/dispatch.hxx>
043 #include <sfx2/objsh.hxx>
044 #include <sfx2/module.hxx>
045 #include <sfx2/viewsh.hxx>
046 #include <sfx2/basedlgs.hxx>
047 #include <svtools/cjkoptions.hxx>
048 #include <com/sun/star/container/XNameAccess.hpp>
049 #include <com/sun/star/i18n/TransliterationModules.hpp>
050 #include <com/sun/star/frame/XDispatch.hpp>
051 #include <com/sun/star/frame/XDispatchProvider.hpp>
052 #include <com/sun/star/beans/PropertyValue.hpp>
053 #include <com/sun/star/frame/XModuleManager.hpp>
054 #include <comphelper/processfactory.hxx>
055 
056 #include <sfx2/app.hxx>
057 #include <toolkit/unohlp.hxx>
058 
059 #define _SVX_SRCHDLG_CXX
060 #include "srchdlg.hxx"
061 
062 #include <svx/dialogs.hrc>
063 #include <svx/svxitems.hrc>
064 #include "srchdlg.hrc"
065 
066 
067 #define ITEMID_SETITEM          0
068 
069 #include <sfx2/srchitem.hxx>
070 #include <svx/pageitem.hxx>
071 #include "srchctrl.hxx"
072 //CHINA001 #include "srchxtra.hxx"
073 #include <svx/dialmgr.hxx>
074 #include "dlgutil.hxx"
075 #include <optjsearch.hxx>
076 #include <svx/brshitem.hxx>
077 #include "backgrnd.hxx"
078 
079 #include <svx/svxdlg.hxx> //CHINA001
080 
081 using namespace com::sun::star::i18n;
082 using namespace com::sun::star;
083 using namespace comphelper;
084 // -----------------------------------------------------------------------
085 
086 #define REMEMBER_SIZE           10
087 
088 #define MODIFY_SEARCH           0x00000001
089 #define MODIFY_REPLACE          0x00000002
090 #define MODIFY_WORD                     0x00000004
091 #define MODIFY_EXACT            0x00000008
092 #define MODIFY_BACKWARDS        0x00000010
093 #define MODIFY_SELECTION        0x00000020
094 #define MODIFY_REGEXP           0x00000040
095 #define MODIFY_LAYOUT           0x00000080
096 #define MODIFY_SIMILARITY       0x00000100
097 #define MODIFY_FORMULAS         0x00000200
098 #define MODIFY_VALUES           0x00000400
099 #define MODIFY_NOTES            0x00000800
100 #define MODIFY_ROWS                     0x00001000
101 #define MODIFY_COLUMNS          0x00002000
102 #define MODIFY_ALLTABLES        0x00004000
103 
104 SV_IMPL_VARARR(SrchAttrItemList, SearchAttrItem);
105 
106 //#define NotifyApp( nId )
107 //    rBindings.ExecuteSynchron( nId, (const SfxPoolItem**)&pSearchItem, 0L )
108 
109 #define GetCheckBoxValue( rBox )                                                                \
110         rBox.IsEnabled() ? rBox.IsChecked() : FALSE
111 
112 struct SearchDlg_Impl
113 {
114         FixedText       aSearchFormats;
115         FixedText       aReplaceFormats;
116 
117     BOOL        bMultiLineEdit   : 1,
118                 bSaveToModule    : 1,
119                 bFocusOnSearch   : 1,
120                 bDeltaCalculated : 1;
121         USHORT*         pRanges;
122         Timer           aSelectionTimer;
123 
124     uno::Reference< frame::XDispatch > xCommand1Dispatch;
125     uno::Reference< frame::XDispatch > xCommand2Dispatch;
126     util::URL   aCommand1URL;
127     util::URL   aCommand2URL;
128 
129     SearchDlg_Impl( Window* pParent ) :
130         aSearchFormats  ( pParent, SVX_RES( FT_SEARCH_FORMATS ) ),
131         aReplaceFormats ( pParent, SVX_RES( FT_REPLACE_FORMATS ) ),
132         bMultiLineEdit  ( FALSE ),
133         bSaveToModule   ( TRUE ),
134         bFocusOnSearch  ( TRUE ),
135         bDeltaCalculated( FALSE ),
136         pRanges         ( NULL )
137         {
138             aCommand1URL.Complete = aCommand1URL.Main = rtl::OUString::createFromAscii("vnd.sun.search:SearchViaComponent1");
139             aCommand1URL.Protocol = rtl::OUString::createFromAscii("vnd.sun.search:");
140             aCommand1URL.Path = rtl::OUString::createFromAscii("SearchViaComponent1");
141             aCommand2URL.Complete = aCommand2URL.Main = rtl::OUString::createFromAscii("vnd.sun.search:SearchViaComponent2");
142             aCommand2URL.Protocol = rtl::OUString::createFromAscii("vnd.sun.search:");
143             aCommand2URL.Path = rtl::OUString::createFromAscii("SearchViaComponent2");
144         }
145         ~SearchDlg_Impl() { delete[] pRanges; }
146 };
147 
148 // -----------------------------------------------------------------------
149 
150 void ListToStrArr_Impl( USHORT nId, SvStringsDtor& rStrLst, ComboBox& rCBox )
151 {
152         SfxStringListItem* pSrchItem =
153                 (SfxStringListItem*)SFX_APP()->GetItem( nId );
154         List* pLst = pSrchItem ? pSrchItem->GetList() : 0;
155 
156         if ( pLst )
157                 for ( USHORT i = 0; i < pLst->Count(); ++i )
158                 {
159                         String* pTmp = new String( *(String*)( pLst->GetObject(i) ) );
160                         rStrLst.Insert( pTmp, rStrLst.Count() );
161                         rCBox.InsertEntry( *pTmp );
162                 }
163 }
164 
165 // -----------------------------------------------------------------------
166 
167 void StrArrToList_Impl( USHORT nId, const SvStringsDtor& rStrLst )
168 {
169         DBG_ASSERT( rStrLst.Count(), "vorher abpruefen!!" );
170         List aLst;
171 
172         for ( USHORT i = 0; i < rStrLst.Count(); ++i )
173                 aLst.Insert( rStrLst[ i ], LIST_APPEND );
174 
175         SFX_APP()->PutItem( SfxStringListItem( nId, &aLst ) );
176 }
177 
178 // class SearchAttrItemList ----------------------------------------------
179 
180 SearchAttrItemList::SearchAttrItemList( const SearchAttrItemList& rList ) :
181 
182         SrchAttrItemList( (BYTE)rList.Count() )
183 
184 {
185         SrchAttrItemList::Insert( &rList, 0 );
186     SearchAttrItem* _pData = (SearchAttrItem*)GetData();
187 
188     for ( USHORT i = Count(); i; --i, ++_pData )
189         if ( !IsInvalidItem( _pData->pItem ) )
190             _pData->pItem = _pData->pItem->Clone();
191 }
192 
193 // -----------------------------------------------------------------------
194 
195 SearchAttrItemList::~SearchAttrItemList()
196 {
197         Clear();
198 }
199 
200 // -----------------------------------------------------------------------
201 
202 void SearchAttrItemList::Put( const SfxItemSet& rSet )
203 {
204         if ( !rSet.Count() )
205                 return;
206 
207         SfxItemPool* pPool = rSet.GetPool();
208         SfxItemIter aIter( rSet );
209         SearchAttrItem aItem;
210         const SfxPoolItem* pItem = aIter.GetCurItem();
211         USHORT nWhich;
212 
213         while ( TRUE )
214         {
215                 // nur testen, ob vorhanden ist ?
216                 if( IsInvalidItem( pItem ) )
217                 {
218                         nWhich = rSet.GetWhichByPos( aIter.GetCurPos() );
219                         aItem.pItem = (SfxPoolItem*)pItem;
220                 }
221                 else
222                 {
223                         nWhich = pItem->Which();
224                         aItem.pItem = pItem->Clone();
225                 }
226 
227                 aItem.nSlot = pPool->GetSlotId( nWhich );
228                 Insert( aItem );
229 
230                 if ( aIter.IsAtEnd() )
231                         break;
232                 pItem = aIter.NextItem();
233         }
234 }
235 
236 // -----------------------------------------------------------------------
237 
238 SfxItemSet& SearchAttrItemList::Get( SfxItemSet& rSet )
239 {
240         SfxItemPool* pPool = rSet.GetPool();
241     SearchAttrItem* _pData = (SearchAttrItem*)GetData();
242 
243     for ( USHORT i = Count(); i; --i, ++_pData )
244         if ( IsInvalidItem( _pData->pItem ) )
245             rSet.InvalidateItem( pPool->GetWhich( _pData->nSlot ) );
246                 else
247             rSet.Put( *_pData->pItem );
248         return rSet;
249 }
250 
251 // -----------------------------------------------------------------------
252 
253 void SearchAttrItemList::Clear()
254 {
255     SearchAttrItem* _pData = (SearchAttrItem*)GetData();
256 
257     for ( USHORT i = Count(); i; --i, ++_pData )
258         if ( !IsInvalidItem( _pData->pItem ) )
259             delete _pData->pItem;
260         SrchAttrItemList::Remove( 0, Count() );
261 }
262 
263 // -----------------------------------------------------------------------
264 
265 // l"oscht die Pointer auf die Items
266 void SearchAttrItemList::Remove( USHORT nPos, USHORT nLen )
267 {
268         if ( nPos + nLen > Count() )
269                 nLen = Count() - nPos;
270     SearchAttrItem* _pData = (SearchAttrItem*)GetData() + nPos;
271 
272     for ( USHORT n = nLen; n; --n, ++_pData )
273         if ( !IsInvalidItem( _pData->pItem ) )
274             delete _pData->pItem;
275 
276         SrchAttrItemList::Remove( nPos, nLen );
277 }
278 
279 /* //CHINA001
280 // class SvxJSearchOptionsDialog -----------------------------------------
281 
282 SvxJSearchOptionsDialog::SvxJSearchOptionsDialog(
283                         Window *pParent,
284                         const SfxItemSet& rOptionsSet, USHORT nUniqueId, INT32 nInitialFlags ) :
285         SfxSingleTabDialog      ( pParent, rOptionsSet, RID_SVXPAGE_JSEARCH_OPTIONS ),
286         nInitialTlFlags( nInitialFlags )
287 {
288         pPage = (SvxJSearchOptionsPage *)
289                                         SvxJSearchOptionsPage::Create( this, rOptionsSet );
290         SetTabPage( pPage );    //! implicitly calls pPage->Reset(...)!
291         pPage->EnableSaveOptions( FALSE );
292 }
293 
294 
295 SvxJSearchOptionsDialog::~SvxJSearchOptionsDialog()
296 {
297         // pPage will be implicitly destroyed by the
298         // SfxSingleTabDialog destructor
299 }
300 
301 
302 void SvxJSearchOptionsDialog::Activate()
303 {
304         pPage->SetTransliterationFlags( nInitialTlFlags );
305 }
306 
307 
308 INT32 SvxJSearchOptionsDialog::GetTransliterationFlags() const
309 {
310         return pPage->GetTransliterationFlags();
311 }
312 
313 
314 void SvxJSearchOptionsDialog::SetTransliterationFlags( INT32 nSettings )
315 {
316         pPage->SetTransliterationFlags( nSettings );
317 }
318 */ //CHINA001
319 #ifdef INI_LIST
320 #undef INI_LIST
321 #endif
322 #define INI_LIST() \
323         aSearchText     ( this, SVX_RES( FT_SEARCH ) ),                                                 \
324         aSearchLB               ( this, SVX_RES( ED_SEARCH ) ),                                                 \
325         aSearchTmplLB   ( this, SVX_RES( LB_SEARCH ) ),                                                 \
326         aSearchAttrText ( this, SVX_RES( FT_SEARCH_ATTR ) ),                                            \
327         aReplaceText    ( this, SVX_RES( FT_REPLACE ) ),                                                        \
328         aReplaceLB              ( this, SVX_RES( ED_REPLACE ) ),                                                        \
329         aReplaceTmplLB  ( this, SVX_RES( LB_REPLACE ) ),                                                        \
330         aReplaceAttrText( this, SVX_RES( FT_REPLACE_ATTR ) ),                                           \
331     aSearchBtn      ( this, SVX_RES( BTN_SEARCH ) ),                          \
332         aSearchAllBtn   ( this, SVX_RES( BTN_SEARCH_ALL ) ),                                            \
333     aSearchCmdLine  ( this, SVX_RES( FL_SEARCH_COMMAND ) ),                   \
334     aReplaceBtn     ( this, SVX_RES( BTN_REPLACE ) ),                         \
335     aReplaceAllBtn  ( this, SVX_RES( BTN_REPLACE_ALL ) ),                     \
336     aSearchComponentFL( this, SVX_RES( FL_SEARCH_COMPONENT ) ), \
337     aSearchComponent1PB( this, SVX_RES( BTN_COMPONENT_1 ) ), \
338     aSearchComponent2PB( this, SVX_RES( BTN_COMPONENT_2 ) ), \
339     aMatchCaseCB    ( this, SVX_RES( CB_MATCH_CASE ) ),                       \
340     aWordBtn        ( this, SVX_RES( CB_WHOLE_WORDS ) ),                      \
341     aButtonsFL      ( this, SVX_RES( FL_BUTTONS ) ),                          \
342     pMoreBtn        ( new MoreButton( this, SVX_RES( BTN_MORE ) ) ),          \
343     aHelpBtn        ( this, SVX_RES( BTN_HELP ) ),                            \
344     aCloseBtn       ( this, SVX_RES( BTN_CLOSE ) ),                           \
345     aOptionsFL      ( this, SVX_RES( FL_OPTIONS ) ),                          \
346     aSelectionBtn   ( this, SVX_RES( CB_SELECTIONS ) ),                       \
347     aBackwardsBtn   ( this, SVX_RES( CB_BACKWARDS ) ),                        \
348     aRegExpBtn      ( this, SVX_RES( CB_REGEXP ) ),                           \
349     aSimilarityBox  ( this, SVX_RES( CB_SIMILARITY) ),                        \
350     aSimilarityBtn  ( this, SVX_RES( PB_SIMILARITY) ),                        \
351     aLayoutBtn      ( this, SVX_RES( CB_LAYOUTS ) ),                          \
352     aJapMatchFullHalfWidthCB( this, SVX_RES( CB_JAP_MATCH_FULL_HALF_WIDTH ) ),\
353     aJapOptionsCB   ( this, SVX_RES( CB_JAP_SOUNDS_LIKE ) ),                  \
354     aJapOptionsBtn  ( this, SVX_RES( PB_JAP_OPTIONS ) ),                      \
355     aAttributeBtn   ( this, SVX_RES( BTN_ATTRIBUTE ) ),                       \
356         aFormatBtn              ( this, SVX_RES( BTN_FORMAT ) ),                                                        \
357         aNoFormatBtn    ( this, SVX_RES( BTN_NOFORMAT ) ),                                              \
358     aCalcFL         ( this, SVX_RES( FL_CALC ) ),                             \
359     aCalcSearchInFT ( this, SVX_RES( FT_CALC_SEARCHIN ) ),                    \
360     aCalcSearchInLB ( this, SVX_RES( LB_CALC_SEARCHIN ) ),                    \
361     aCalcSearchDirFT( this, SVX_RES( FT_CALC_SEARCHDIR ) ),                   \
362     aRowsBtn        ( this, SVX_RES( RB_CALC_ROWS ) ),                        \
363     aColumnsBtn     ( this, SVX_RES( RB_CALC_COLUMNS ) ),                     \
364     aAllSheetsCB    ( this, SVX_RES( CB_ALL_SHEETS ) ),                       \
365     rBindings       ( rBind ),                                              \
366     bWriter         ( FALSE ),                                              \
367     bSearch         ( TRUE ),                                               \
368         bFormat                 ( FALSE ),                                                                                              \
369         nOptions                ( USHRT_MAX ),                                                                                  \
370         bSet                    ( FALSE ),                                                                                              \
371         bReadOnly               ( FALSE ),                                                                                              \
372         bConstruct              ( TRUE ),                                                                                               \
373         nModifyFlag             ( 0 ),                                                                                                  \
374     aCalcStr        ( SVX_RES( STR_WORDCALC ) ),                              \
375     pImpl           ( NULL ),                                               \
376         pSearchList     ( NULL ),                                                                                               \
377         pReplaceList    ( NULL ),                                                                                               \
378         pSearchItem     ( NULL ),                                                                                               \
379         pSearchController               ( NULL ),                                                                               \
380         pOptionsController              ( NULL ),                                                                               \
381         pFamilyController               ( NULL ),                                                                               \
382         pSearchSetController    ( NULL ),                                                                               \
383         pReplaceSetController   ( NULL ),                                                                               \
384         nTransliterationFlags   ( 0x00000000 )
385 
386 // class SvxSearchDialog -------------------------------------------------
387 
388 SvxSearchDialog::SvxSearchDialog( Window* pParent, SfxBindings& rBind ) :
389 
390         SfxModelessDialog( &rBind, NULL, pParent, SVX_RES( RID_SVXDLG_SEARCH ) ),
391 
392         INI_LIST()
393 
394 {
395         Construct_Impl();
396 }
397 
398 // -----------------------------------------------------------------------
399 
400 SvxSearchDialog::SvxSearchDialog( Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind ) :
401 
402         SfxModelessDialog( &rBind, pChildWin, pParent, SVX_RES( RID_SVXDLG_SEARCH ) ),
403 
404         INI_LIST()
405 
406 {
407         Construct_Impl();
408 }
409 
410 #undef INI_LIST
411 
412 // -----------------------------------------------------------------------
413 
414 SvxSearchDialog::~SvxSearchDialog()
415 {
416         Hide();
417 
418         rBindings.EnterRegistrations();
419         delete pSearchController;
420         delete pOptionsController;
421         delete pFamilyController;
422         delete pSearchSetController;
423         delete pReplaceSetController;
424         rBindings.LeaveRegistrations();
425 
426         delete pSearchItem;
427         delete pImpl;
428         delete pSearchList;
429         delete pReplaceList;
430         delete pMoreBtn;
431 }
432 
433 // -----------------------------------------------------------------------
434 void lcl_MoveDown( Window& rWindow, sal_Int32 nOffset )
435 {
436     Point aPos(rWindow.GetPosPixel());
437     aPos.Y() += nOffset;
438     rWindow.SetPosPixel(aPos);
439 }
440 
441 void SvxSearchDialog::Construct_Impl()
442 {
443         // temporary to avoid incompatibility
444         pImpl = new SearchDlg_Impl( this );
445         pImpl->aSelectionTimer.SetTimeout( 500 );
446         pImpl->aSelectionTimer.SetTimeoutHdl(
447                 LINK( this, SvxSearchDialog, TimeoutHdl_Impl ) );
448 
449         EnableControls_Impl( 0 );
450 
451         // alten Text des aWordBtn's merken
452         ( aCalcStr += sal_Unicode('#') ) += aWordBtn.GetText();
453 
454         aLayoutStr = SVX_RESSTR( RID_SVXSTR_SEARCH_STYLES );
455         aStylesStr = aLayoutBtn.GetText();
456 
457         // gemerkte Such-Strings von der Applikation holen
458         ListToStrArr_Impl( SID_SEARCHDLG_SEARCHSTRINGS,
459                                            aSearchStrings, aSearchLB    );
460         ListToStrArr_Impl( SID_SEARCHDLG_REPLACESTRINGS,
461                                            aReplaceStrings, aReplaceLB  );
462 
463     pMoreBtn->SetMoreText( String( SVX_RES( STR_MORE_BTN ) ) );
464     pMoreBtn->SetLessText( String( SVX_RES( STR_LESS_BTN ) ) );
465 
466     FreeResource();
467         InitControls_Impl();
468 
469         // Attribut-Sets nur einmal im Ctor() besorgen
470     const SfxPoolItem* ppArgs[] = { pSearchItem, 0 };
471         const SvxSetItem* pSrchSetItem =
472         (const SvxSetItem*) rBindings.GetDispatcher()->Execute( FID_SEARCH_SEARCHSET, SFX_CALLMODE_SLOT, ppArgs );
473 
474         if ( pSrchSetItem )
475                 InitAttrList_Impl( &pSrchSetItem->GetItemSet(), 0 );
476 
477         const SvxSetItem* pReplSetItem =
478         (const SvxSetItem*)rBindings.GetDispatcher()->Execute( FID_SEARCH_REPLACESET, SFX_CALLMODE_SLOT, ppArgs );
479 
480         if ( pReplSetItem )
481                 InitAttrList_Impl( 0, &pReplSetItem->GetItemSet() );
482 
483         // Controller erzeugen und gleich aktualisieren
484         rBindings.EnterRegistrations();
485         pSearchController =
486                 new SvxSearchController( SID_SEARCH_ITEM, rBindings, *this );
487         pOptionsController =
488                 new SvxSearchController( SID_SEARCH_OPTIONS, rBindings, *this );
489         rBindings.LeaveRegistrations();
490     rBindings.GetDispatcher()->Execute( FID_SEARCH_ON, SFX_CALLMODE_SLOT, ppArgs );
491         pImpl->aSelectionTimer.Start();
492 
493 
494     SvtCJKOptions aCJKOptions;
495     if(!aCJKOptions.IsJapaneseFindEnabled())
496     {
497         aJapOptionsCB.Check( FALSE );
498         aJapOptionsCB.Hide();
499         aJapOptionsBtn.Hide();
500     }
501     if(!aCJKOptions.IsCJKFontEnabled())
502     {
503         aJapMatchFullHalfWidthCB.Hide();
504     }
505     //component extension - show component search buttons if the commands
506     // vnd.sun.star::SearchViaComponent1 and 2 are supported
507     const uno::Reference< frame::XFrame >xFrame = rBindings.GetActiveFrame();
508     const uno::Reference< frame::XDispatchProvider > xDispatchProv(xFrame, uno::UNO_QUERY);
509     rtl::OUString sTarget = rtl::OUString::createFromAscii("_self");
510 
511     bool bSearchComponent1 = false;
512     bool bSearchComponent2 = false;
513     if(xDispatchProv.is() &&
514             (pImpl->xCommand1Dispatch = xDispatchProv->queryDispatch(pImpl->aCommand1URL, sTarget, 0)).is())
515     {
516         bSearchComponent1 = true;
517     }
518     if(xDispatchProv.is() &&
519             (pImpl->xCommand2Dispatch = xDispatchProv->queryDispatch(pImpl->aCommand2URL, sTarget, 0)).is())
520     {
521         bSearchComponent2 = true;
522     }
523 
524     if( bSearchComponent1 || bSearchComponent2 )
525     {
526         //get the labels of the FixedLine and the buttons
527         // "/org.openoffice.Office.Common/SearchOptions/ComponentSearchGroupLabel
528         // "/org.openoffice.Office.Common/SearchOptions/ComponentSearchCommandLabel1
529         // "/org.openoffice.Office.Common/SearchOptions/ComponentSearchCommandLabel2
530         try
531         {
532             uno::Reference< lang::XMultiServiceFactory >  xMgr = getProcessServiceFactory();
533             uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider(xMgr->createInstance(
534                     ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider"))),
535                     uno::UNO_QUERY);
536             uno::Sequence< uno::Any > aArgs(1);
537             ::rtl::OUString sPath(RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/SearchOptions/"));
538             aArgs[0] <<= sPath;
539 
540             uno::Reference< uno::XInterface > xIFace = xConfigurationProvider->createInstanceWithArguments(
541                         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess")),
542                         aArgs);
543             uno::Reference< container::XNameAccess> xDirectAccess(xIFace, uno::UNO_QUERY);
544             if(xDirectAccess.is())
545             {
546                 ::rtl::OUString sTemp;
547                 ::rtl::OUString sProperty(RTL_CONSTASCII_USTRINGPARAM( "ComponentSearchGroupLabel"));
548                 uno::Any aRet = xDirectAccess->getByName(sProperty);
549                 aRet >>= sTemp;
550                 aSearchComponentFL.SetText( sTemp );
551                 aRet = xDirectAccess->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ComponentSearchCommandLabel1")));
552                 aRet >>= sTemp;
553                 aSearchComponent1PB.SetText( sTemp );
554                 aRet = xDirectAccess->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ComponentSearchCommandLabel2")));
555                 aRet >>= sTemp;
556                 aSearchComponent2PB.SetText( sTemp );
557             }
558         }
559         catch(uno::Exception&){}
560         
561         if(aSearchComponent1PB.GetText().Len() && bSearchComponent1 )
562         {
563             aSearchComponentFL.Show();
564             aSearchComponent1PB.Show();
565         }
566         if( aSearchComponent2PB.GetText().Len() )
567         {
568             if(!aSearchComponent1PB.IsVisible())
569             {
570                 aSearchComponent2PB.SetPosPixel(aSearchComponent1PB.GetPosPixel());
571             }
572             aSearchComponentFL.Show();
573             aSearchComponent2PB.Show();
574         }
575         if( aSearchComponentFL.IsVisible() && aSearchComponent1PB.IsVisible() )
576         {        
577         
578             //dialog must be resized
579             Size aDlgSize(GetSizePixel());
580             sal_Int32 nOffset = aSearchCmdLine.GetPosPixel().Y() - aSearchAllBtn.GetPosPixel().Y()
581                 - aButtonsFL.GetPosPixel().Y() + aSearchComponent2PB.GetPosPixel().Y();
582 
583             aDlgSize.Height() += nOffset;
584             Window* aWindows[] =
585             {
586                 &aOptionsFL,
587                 &aSelectionBtn,
588                 &aBackwardsBtn,
589                 &aRegExpBtn,
590                 &aSimilarityBox,
591                 &aSimilarityBtn,
592                 &aLayoutBtn,
593                 &aJapMatchFullHalfWidthCB,
594                 &aJapOptionsCB,
595                 &aJapOptionsBtn,
596                 &aAttributeBtn,
597                 &aFormatBtn,
598                 &aNoFormatBtn,
599                 &aCalcFL,
600                 &aCalcSearchInFT,
601                 &aCalcSearchInLB,
602                 &aCalcSearchDirFT,
603                 &aRowsBtn,
604                 &aColumnsBtn,
605                 &aAllSheetsCB,
606                 &aButtonsFL,
607                 &aHelpBtn,
608                 &aCloseBtn,
609                 pMoreBtn,
610                 0
611             };
612             sal_Int32 nWindow = 0;
613             do
614             {
615                 lcl_MoveDown( *aWindows[nWindow], nOffset );
616             }
617             while(aWindows[++nWindow]);
618 
619             SetSizePixel(aDlgSize);
620         }
621     }
622 }
623 
624 // -----------------------------------------------------------------------
625 
626 BOOL SvxSearchDialog::Close()
627 {
628         // remember strings speichern
629         if ( aSearchStrings.Count() )