LCOV - code coverage report
Current view: top level - svx/source/tbxctrls - tbunosearchcontrollers.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 38 399 9.5 %
Date: 2012-08-25 Functions: 12 68 17.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 14 630 2.2 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "tbunosearchcontrollers.hxx"
      31                 :            : #include <svx/dialogs.hrc>
      32                 :            : #include <svx/dialmgr.hxx>
      33                 :            : 
      34                 :            : #include <comphelper/componentcontext.hxx>
      35                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      36                 :            : #include <com/sun/star/frame/XLayoutManager.hpp>
      37                 :            : #include <com/sun/star/text/XTextRange.hpp>
      38                 :            : #include <com/sun/star/ui/XUIElement.hpp>
      39                 :            : #include <com/sun/star/util/URL.hpp>
      40                 :            : #include <com/sun/star/util/URLTransformer.hpp>
      41                 :            : 
      42                 :            : #include <toolkit/helper/vclunohelper.hxx>
      43                 :            : #include <vcl/toolbox.hxx>
      44                 :            : #include <vcl/svapp.hxx>
      45                 :            : #include <osl/mutex.hxx>
      46                 :            : #include <rtl/instance.hxx>
      47                 :            : 
      48                 :            : namespace svx
      49                 :            : {
      50                 :            : 
      51                 :            : static const char SEARCHITEM_SEARCHSTRING[] = "SearchItem.SearchString";
      52                 :            : static const char SEARCHITEM_SEARCHBACKWARD[] = "SearchItem.Backward";
      53                 :            : static const char SEARCHITEM_SEARCHFLAGS[] = "SearchItem.SearchFlags";
      54                 :            : 
      55                 :            : static const char COMMAND_EXECUTESEARCH[] = ".uno:ExecuteSearch";
      56                 :            : static const char COMMAND_FINDTEXT[] = ".uno:FindText";
      57                 :            : static const char COMMAND_DOWNSEARCH[] = ".uno:DownSearch";
      58                 :            : static const char COMMAND_UPSEARCH[] = ".uno:UpSearch";
      59                 :            : static const char COMMAND_APPENDSEARCHHISTORY[] = "AppendSearchHistory";
      60                 :            : 
      61                 :            : static const sal_Int32       REMEMBER_SIZE = 10;
      62                 :            : 
      63                 :          0 : void impl_executeSearch( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr, const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Sequence< css::beans::PropertyValue >& lArgs )
      64                 :            : {
      65 [ #  # ][ #  # ]:          0 :     css::uno::Reference< css::util::XURLTransformer > xURLTransformer( css::util::URLTransformer::create(::comphelper::ComponentContext(rSMgr).getUNOContext()) );
         [ #  # ][ #  # ]
      66                 :          0 :     css::util::URL aURL;
      67                 :          0 :     aURL.Complete = rtl::OUString(COMMAND_EXECUTESEARCH);
      68 [ #  # ][ #  # ]:          0 :     xURLTransformer->parseStrict(aURL);
      69                 :            : 
      70         [ #  # ]:          0 :     css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY);
      71         [ #  # ]:          0 :     if ( xDispatchProvider.is() )
      72                 :            :     {
      73 [ #  # ][ #  # ]:          0 :         css::uno::Reference< css::frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 );
      74 [ #  # ][ #  # ]:          0 :         if ( xDispatch.is() && !aURL.Complete.isEmpty() )
                 [ #  # ]
      75 [ #  # ][ #  # ]:          0 :             xDispatch->dispatch( aURL, lArgs );
      76                 :          0 :     }
      77                 :          0 : }
      78                 :            : 
      79                 :          0 : FindTextFieldControl::FindTextFieldControl( Window* pParent, WinBits nStyle,
      80                 :            :     css::uno::Reference< css::frame::XFrame >& xFrame,
      81                 :            :     css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager) :
      82                 :            :     ComboBox( pParent, nStyle ),
      83                 :            :     m_xFrame(xFrame),
      84                 :            :     m_xServiceManager(xServiceManager),
      85                 :          0 :     m_bToClearTextField(sal_True)
      86                 :            : {
      87         [ #  # ]:          0 :     InitControls_Impl();
      88                 :          0 : }
      89                 :            : 
      90                 :          0 : FindTextFieldControl::~FindTextFieldControl()
      91                 :            : {
      92         [ #  # ]:          0 : }
      93                 :            : 
      94                 :          0 : void FindTextFieldControl::InitControls_Impl()
      95                 :            : {
      96 [ #  # ][ #  # ]:          0 :     SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_FIND ) );
         [ #  # ][ #  # ]
      97                 :          0 :     SetControlForeground(GetSettings().GetStyleSettings().GetDisableColor());
      98                 :            : 
      99                 :          0 :     EnableAutocomplete(sal_True, sal_True);
     100                 :          0 : }
     101                 :            : 
     102                 :          0 : void FindTextFieldControl::Remember_Impl(const String& rStr)
     103                 :            : {
     104                 :          0 :     sal_uInt16 nCount = GetEntryCount();
     105                 :            : 
     106         [ #  # ]:          0 :     for (sal_uInt16 i=0; i<nCount; ++i)
     107                 :            :     {
     108 [ #  # ][ #  # ]:          0 :         if ( rStr == GetEntry(i))
     109                 :          0 :             return;
     110                 :            :     }
     111                 :            : 
     112         [ #  # ]:          0 :     if (nCount == REMEMBER_SIZE)
     113                 :          0 :         RemoveEntry(REMEMBER_SIZE-1);
     114                 :            : 
     115                 :          0 :     InsertEntry(rStr, 0);
     116                 :            : }
     117                 :            : 
     118                 :          0 : void FindTextFieldControl::SetTextToSelected_Impl()
     119                 :            : {
     120                 :          0 :     OUString aString;
     121                 :            : 
     122                 :            :     try
     123                 :            :     {
     124 [ #  # ][ #  # ]:          0 :         css::uno::Reference<css::frame::XController> xController(m_xFrame->getController(), css::uno::UNO_QUERY_THROW);
                 [ #  # ]
     125 [ #  # ][ #  # ]:          0 :         css::uno::Reference<css::frame::XModel> xModel(xController->getModel(), css::uno::UNO_QUERY_THROW);
                 [ #  # ]
     126 [ #  # ][ #  # ]:          0 :         css::uno::Reference<css::container::XIndexAccess> xIndexAccess(xModel->getCurrentSelection(), css::uno::UNO_QUERY_THROW);
                 [ #  # ]
     127 [ #  # ][ #  # ]:          0 :         if (xIndexAccess->getCount() > 0)
                 [ #  # ]
     128                 :            :         {
     129 [ #  # ][ #  # ]:          0 :             css::uno::Reference<css::text::XTextRange> xTextRange(xIndexAccess->getByIndex(0), css::uno::UNO_QUERY_THROW);
                 [ #  # ]
     130 [ #  # ][ #  # ]:          0 :             aString = xTextRange->getString();
     131                 :          0 :         }
     132                 :            :     }
     133         [ #  # ]:          0 :     catch ( ... )
     134                 :            :     {
     135                 :            :     }
     136                 :            : 
     137         [ #  # ]:          0 :     if ( aString.getLength() != 0 )
     138                 :            :     {
     139 [ #  # ][ #  # ]:          0 :         SetText( aString );
                 [ #  # ]
     140                 :          0 :         m_bToClearTextField = sal_False;
     141                 :          0 :     }
     142                 :          0 : }
     143                 :            : 
     144                 :          0 : void FindTextFieldControl::Modify()
     145                 :            : {
     146                 :          0 :     ComboBox::Modify();
     147                 :            : 
     148                 :          0 :     SetControlForeground( GetSettings().GetStyleSettings().GetWindowTextColor() );
     149                 :          0 : }
     150                 :            : 
     151                 :          0 : long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt )
     152                 :            : {
     153                 :          0 :     long nRet= ComboBox::PreNotify( rNEvt );
     154                 :            : 
     155   [ #  #  #  # ]:          0 :     switch ( rNEvt.GetType() )
     156                 :            :     {
     157                 :            :         case EVENT_KEYINPUT:
     158                 :            :         {
     159                 :          0 :             const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
     160                 :          0 :             sal_Bool bShift = pKeyEvent->GetKeyCode().IsShift();
     161                 :          0 :             sal_Bool bMod1 = pKeyEvent->GetKeyCode().IsMod1();
     162                 :          0 :             sal_uInt16 nCode = pKeyEvent->GetKeyCode().GetCode();
     163                 :            : 
     164         [ #  # ]:          0 :             if ( KEY_ESCAPE == nCode )
     165                 :            :             {
     166                 :          0 :                 nRet = 1;
     167         [ #  # ]:          0 :                 GrabFocusToDocument();
     168                 :            : 
     169                 :            :                 // hide the findbar
     170         [ #  # ]:          0 :                 css::uno::Reference< css::beans::XPropertySet > xPropSet(m_xFrame, css::uno::UNO_QUERY);
     171         [ #  # ]:          0 :                 if (xPropSet.is())
     172                 :            :                 {
     173                 :          0 :                     css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
     174 [ #  # ][ #  # ]:          0 :                     css::uno::Any aValue = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) );
                 [ #  # ]
     175         [ #  # ]:          0 :                     aValue >>= xLayoutManager;
     176         [ #  # ]:          0 :                     if (xLayoutManager.is())
     177                 :            :                     {
     178         [ #  # ]:          0 :                         const ::rtl::OUString sResourceURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/findbar" ) );
     179 [ #  # ][ #  # ]:          0 :                         xLayoutManager->hideElement( sResourceURL );
     180 [ #  # ][ #  # ]:          0 :                         xLayoutManager->destroyElement( sResourceURL );
     181                 :          0 :                     }
     182                 :          0 :                 }
     183                 :            :             }
     184                 :            : 
     185 [ #  # ][ #  # ]:          0 :             if ( KEY_RETURN == nCode || (bMod1 && (KEY_G == nCode)) || (KEY_F3 == nCode) )
         [ #  # ][ #  # ]
     186                 :            :             {
     187 [ #  # ][ #  # ]:          0 :                 Remember_Impl(GetText());
                 [ #  # ]
     188                 :            : 
     189 [ #  # ][ #  # ]:          0 :                 ::rtl::OUString sFindText = GetText();
                 [ #  # ]
     190         [ #  # ]:          0 :                 css::uno::Sequence< css::beans::PropertyValue > lArgs(3);
     191                 :            : 
     192         [ #  # ]:          0 :                 lArgs[0].Name = rtl::OUString(SEARCHITEM_SEARCHSTRING);
     193 [ #  # ][ #  # ]:          0 :                 lArgs[0].Value <<= sFindText;
     194                 :            : 
     195         [ #  # ]:          0 :                 lArgs[1].Name = rtl::OUString(SEARCHITEM_SEARCHBACKWARD);
     196         [ #  # ]:          0 :                 if (bShift)
     197 [ #  # ][ #  # ]:          0 :                     lArgs[1].Value <<= sal_True;
     198                 :            :                 else
     199 [ #  # ][ #  # ]:          0 :                     lArgs[1].Value <<= sal_False;
     200                 :            : 
     201         [ #  # ]:          0 :                 lArgs[2].Name = rtl::OUString(SEARCHITEM_SEARCHFLAGS);
     202 [ #  # ][ #  # ]:          0 :                 lArgs[2].Value <<= (sal_Int32)0;
     203                 :            : 
     204         [ #  # ]:          0 :                 impl_executeSearch(m_xServiceManager, m_xFrame, lArgs);
     205         [ #  # ]:          0 :                 nRet = 1;
     206                 :            :             }
     207                 :          0 :             break;
     208                 :            :         }
     209                 :            : 
     210                 :            :         case EVENT_GETFOCUS:
     211         [ #  # ]:          0 :             if ( m_bToClearTextField )
     212                 :            :             {
     213 [ #  # ][ #  # ]:          0 :                 SetText( OUString() );
                 [ #  # ]
     214                 :          0 :                 m_bToClearTextField = sal_False;
     215                 :            :             }
     216         [ #  # ]:          0 :             SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
     217                 :          0 :             break;
     218                 :            : 
     219                 :            :         case EVENT_LOSEFOCUS:
     220         [ #  # ]:          0 :             if ( GetText().Len() == 0 )
     221                 :            :             {
     222 [ #  # ][ #  # ]:          0 :                 SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_FIND ) );
         [ #  # ][ #  # ]
     223                 :          0 :                 SetControlForeground(GetSettings().GetStyleSettings().GetDisableColor());
     224                 :          0 :                 m_bToClearTextField = sal_True;
     225                 :            :             }
     226                 :          0 :             break;
     227                 :            :     }
     228                 :            : 
     229                 :          0 :     return nRet;
     230                 :            : }
     231                 :            : 
     232                 :            : 
     233                 :            : //-----------------------------------------------------------------------------------------------------------
     234                 :            : // SearchToolbarControllersManager
     235                 :            : 
     236         [ #  # ]:          0 : SearchToolbarControllersManager::SearchToolbarControllersManager()
     237                 :            : {
     238                 :          0 : }
     239                 :            : 
     240                 :          0 : SearchToolbarControllersManager::~SearchToolbarControllersManager()
     241                 :            : {
     242                 :          0 : }
     243                 :            : 
     244                 :            : namespace
     245                 :            : {
     246                 :            :     class theSearchToolbarControllersManager
     247                 :            :         : public rtl::Static<SearchToolbarControllersManager,
     248                 :            :             theSearchToolbarControllersManager>
     249                 :            :     {
     250                 :            :     };
     251                 :            : }
     252                 :            : 
     253                 :          0 : SearchToolbarControllersManager& SearchToolbarControllersManager::createControllersManager()
     254                 :            : {
     255                 :          0 :     return theSearchToolbarControllersManager::get();
     256                 :            : }
     257                 :            : 
     258                 :          0 : void SearchToolbarControllersManager::saveSearchHistory(const FindTextFieldControl* pFindTextFieldControl)
     259                 :            : {
     260                 :          0 :     sal_uInt16 nECount( pFindTextFieldControl->GetEntryCount() );
     261                 :          0 :     m_aSearchStrings.resize( nECount );
     262         [ #  # ]:          0 :     for( sal_uInt16 i=0; i<nECount; ++i )
     263                 :            :     {
     264         [ #  # ]:          0 :         m_aSearchStrings[i] = pFindTextFieldControl->GetEntry(i);
     265                 :            :     }
     266                 :          0 : }
     267                 :            : 
     268                 :          0 : void SearchToolbarControllersManager::loadSearchHistory(FindTextFieldControl* pFindTextFieldControl)
     269                 :            : {
     270         [ #  # ]:          0 :     for( sal_uInt16 i=0; i<m_aSearchStrings.size(); ++i )
     271                 :            :     {
     272         [ #  # ]:          0 :         pFindTextFieldControl->InsertEntry(m_aSearchStrings[i],i);
     273                 :            :     }
     274                 :          0 : }
     275                 :            : 
     276                 :          0 : void SearchToolbarControllersManager::registryController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL )
     277                 :            : {
     278         [ #  # ]:          0 :     SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame);
     279         [ #  # ]:          0 :     if (pIt == aSearchToolbarControllersMap.end())
     280                 :            :     {
     281         [ #  # ]:          0 :         SearchToolbarControllersVec lControllers(1);
     282                 :          0 :         lControllers[0].Name = sCommandURL;
     283         [ #  # ]:          0 :         lControllers[0].Value <<= xStatusListener;
     284 [ #  # ][ #  # ]:          0 :         aSearchToolbarControllersMap.insert(SearchToolbarControllersMap::value_type(xFrame, lControllers));
                 [ #  # ]
     285                 :            :     }
     286                 :            :     else
     287                 :            :     {
     288                 :          0 :         sal_Int32 nSize = pIt->second.size();
     289         [ #  # ]:          0 :         for (sal_Int32 i=0; i<nSize; ++i)
     290                 :            :         {
     291         [ #  # ]:          0 :             if (pIt->second[i].Name.equals(sCommandURL))
     292                 :          0 :                 return;
     293                 :            :         }
     294                 :            : 
     295         [ #  # ]:          0 :         pIt->second.resize(nSize+1);
     296                 :          0 :         pIt->second[nSize].Name = sCommandURL;
     297         [ #  # ]:          0 :         pIt->second[nSize].Value <<= xStatusListener;
     298                 :            :     }
     299                 :            : }
     300                 :            : 
     301                 :          0 : void SearchToolbarControllersManager::freeController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& /*xStatusListener*/, const ::rtl::OUString& sCommandURL )
     302                 :            : {
     303         [ #  # ]:          0 :     SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame);
     304         [ #  # ]:          0 :     if (pIt != aSearchToolbarControllersMap.end())
     305                 :            :     {
     306 [ #  # ][ #  # ]:          0 :         for (SearchToolbarControllersVec::iterator pItCtrl=pIt->second.begin(); pItCtrl!=pIt->second.end(); ++pItCtrl)
     307                 :            :         {
     308         [ #  # ]:          0 :             if (pItCtrl->Name.equals(sCommandURL))
     309                 :            :             {
     310         [ #  # ]:          0 :                 pIt->second.erase(pItCtrl);
     311                 :          0 :                 break;
     312                 :            :             }
     313                 :            :         }
     314                 :            : 
     315         [ #  # ]:          0 :         if (pIt->second.empty())
     316         [ #  # ]:          0 :             aSearchToolbarControllersMap.erase(pIt);
     317                 :            :     }
     318                 :          0 : }
     319                 :            : 
     320                 :          0 : css::uno::Reference< css::frame::XStatusListener > SearchToolbarControllersManager::findController( const css::uno::Reference< css::frame::XFrame >& xFrame, const ::rtl::OUString& sCommandURL )
     321                 :            : {
     322                 :          0 :     css::uno::Reference< css::frame::XStatusListener > xStatusListener;
     323                 :            : 
     324         [ #  # ]:          0 :     SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame);
     325         [ #  # ]:          0 :     if (pIt != aSearchToolbarControllersMap.end())
     326                 :            :     {
     327 [ #  # ][ #  # ]:          0 :         for (SearchToolbarControllersVec::iterator pItCtrl =pIt->second.begin(); pItCtrl != pIt->second.end(); ++pItCtrl)
     328                 :            :         {
     329         [ #  # ]:          0 :             if (pItCtrl->Name.equals(sCommandURL))
     330                 :            :             {
     331         [ #  # ]:          0 :                 pItCtrl->Value >>= xStatusListener;
     332                 :          0 :                 break;
     333                 :            :             }
     334                 :            :         }
     335                 :            :     }
     336                 :            : 
     337                 :          0 :     return xStatusListener;
     338                 :            : }
     339                 :            : 
     340                 :            : //-----------------------------------------------------------------------------------------------------------
     341                 :            : // FindTextToolbarController
     342                 :            : 
     343                 :          0 : FindTextToolbarController::FindTextToolbarController( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager )
     344                 :            :     :svt::ToolboxController( rServiceManager,
     345                 :            :     css::uno::Reference< css::frame::XFrame >(),
     346         [ #  # ]:          0 :     rtl::OUString(COMMAND_FINDTEXT) )
     347                 :            : {
     348                 :          0 : }
     349                 :            : 
     350                 :          0 : FindTextToolbarController::~FindTextToolbarController()
     351                 :            : {
     352         [ #  # ]:          0 : }
     353                 :            : 
     354                 :            : // XInterface
     355                 :          0 : css::uno::Any SAL_CALL FindTextToolbarController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException )
     356                 :            : {
     357         [ #  # ]:          0 :     css::uno::Any a = ToolboxController::queryInterface( aType );
     358         [ #  # ]:          0 :     if ( a.hasValue() )
     359                 :          0 :         return a;
     360                 :            : 
     361         [ #  # ]:          0 :     return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) );
     362                 :            : }
     363                 :            : 
     364                 :          0 : void SAL_CALL FindTextToolbarController::acquire() throw ()
     365                 :            : {
     366                 :          0 :     ToolboxController::acquire();
     367                 :          0 : }
     368                 :            : 
     369                 :          0 : void SAL_CALL FindTextToolbarController::release() throw ()
     370                 :            : {
     371                 :          0 :     ToolboxController::release();
     372                 :          0 : }
     373                 :            : 
     374                 :            : // XServiceInfo
     375                 :          0 : ::rtl::OUString SAL_CALL FindTextToolbarController::getImplementationName() throw( css::uno::RuntimeException )
     376                 :            : {
     377                 :          0 :     return getImplementationName_Static();
     378                 :            : }
     379                 :            : 
     380                 :          0 : sal_Bool SAL_CALL FindTextToolbarController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException )
     381                 :            : {
     382         [ #  # ]:          0 :     const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() );
     383                 :          0 :     const ::rtl::OUString * pArray = aSNL.getConstArray();
     384                 :            : 
     385         [ #  # ]:          0 :     for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
     386         [ #  # ]:          0 :         if( pArray[i] == ServiceName )
     387                 :          0 :             return true;
     388                 :            : 
     389         [ #  # ]:          0 :     return false;
     390                 :            : }
     391                 :            : 
     392                 :          0 : css::uno::Sequence< ::rtl::OUString > SAL_CALL FindTextToolbarController::getSupportedServiceNames() throw( css::uno::RuntimeException )
     393                 :            : {
     394                 :          0 :     return getSupportedServiceNames_Static();
     395                 :            : }
     396                 :            : 
     397                 :          0 : css::uno::Sequence< ::rtl::OUString >  FindTextToolbarController::getSupportedServiceNames_Static() throw()
     398                 :            : {
     399                 :          0 :     css::uno::Sequence< ::rtl::OUString > aSNS( 1 );
     400 [ #  # ][ #  # ]:          0 :     aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) );
     401                 :          0 :     return aSNS;
     402                 :            : }
     403                 :            : 
     404                 :            : // XComponent
     405                 :          0 : void SAL_CALL FindTextToolbarController::dispose() throw ( css::uno::RuntimeException )
     406                 :            : {
     407         [ #  # ]:          0 :     SolarMutexGuard aSolarMutexGuard;
     408                 :            : 
     409 [ #  # ][ #  # ]:          0 :     SearchToolbarControllersManager::createControllersManager().freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
                 [ #  # ]
     410                 :            : 
     411         [ #  # ]:          0 :     svt::ToolboxController::dispose();
     412 [ #  # ][ #  # ]:          0 :     SearchToolbarControllersManager::createControllersManager().saveSearchHistory(m_pFindTextFieldControl);
     413 [ #  # ][ #  # ]:          0 :     delete m_pFindTextFieldControl;
     414         [ #  # ]:          0 :     m_pFindTextFieldControl = 0;
     415                 :          0 : }
     416                 :            : 
     417                 :            : // XInitialization
     418                 :          0 : void SAL_CALL FindTextToolbarController::initialize( const css::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException)
     419                 :            : {
     420                 :          0 :     svt::ToolboxController::initialize(aArguments);
     421                 :            : 
     422         [ #  # ]:          0 :     Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
     423                 :          0 :     ToolBox* pToolBox = (ToolBox*)pWindow;
     424         [ #  # ]:          0 :     if ( pToolBox )
     425                 :            :     {
     426                 :          0 :         sal_uInt16 nItemCount = pToolBox->GetItemCount();
     427         [ #  # ]:          0 :         for ( sal_uInt16 i=0; i<nItemCount; ++i )
     428                 :            :         {
     429 [ #  # ][ #  # ]:          0 :             ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i);
     430         [ #  # ]:          0 :             if ( sItemCommand == COMMAND_DOWNSEARCH )
     431                 :          0 :                 m_nDownSearchId = i;
     432         [ #  # ]:          0 :             else if ( sItemCommand == COMMAND_UPSEARCH )
     433                 :          0 :                 m_nUpSearchId = i;
     434                 :          0 :         }
     435                 :            :     }
     436                 :            : 
     437 [ #  # ][ #  # ]:          0 :     SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
     438                 :          0 : }
     439                 :            : 
     440                 :            : // XToolbarController
     441                 :          0 : void SAL_CALL FindTextToolbarController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException )
     442                 :            : {
     443                 :          0 : }
     444                 :            : 
     445                 :          0 : css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException )
     446                 :            : {
     447                 :          0 :     css::uno::Reference< css::awt::XWindow > xItemWindow;
     448                 :            : 
     449                 :          0 :     css::uno::Reference< css::awt::XWindow > xParent( Parent );
     450         [ #  # ]:          0 :     Window* pParent = VCLUnoHelper::GetWindow( xParent );
     451         [ #  # ]:          0 :     if ( pParent )
     452                 :            :     {
     453                 :          0 :         ToolBox* pToolbar =  ( ToolBox* )pParent;
     454 [ #  # ][ #  # ]:          0 :         m_pFindTextFieldControl = new FindTextFieldControl( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xServiceManager );
     455                 :            : 
     456         [ #  # ]:          0 :         Size aSize(250, m_pFindTextFieldControl->GetTextHeight() + 200);
     457         [ #  # ]:          0 :         m_pFindTextFieldControl->SetSizePixel( aSize );
     458 [ #  # ][ #  # ]:          0 :         m_pFindTextFieldControl->SetModifyHdl(LINK(this, FindTextToolbarController, EditModifyHdl));
     459 [ #  # ][ #  # ]:          0 :         SearchToolbarControllersManager::createControllersManager().loadSearchHistory(m_pFindTextFieldControl);
     460                 :            :     }
     461 [ #  # ][ #  # ]:          0 :     xItemWindow = VCLUnoHelper::GetInterface( m_pFindTextFieldControl );
     462                 :            : 
     463                 :          0 :     return xItemWindow;
     464                 :            : }
     465                 :            : 
     466                 :            : // XStatusListener
     467                 :          0 : void SAL_CALL FindTextToolbarController::statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException )
     468                 :            : {
     469         [ #  # ]:          0 :     SolarMutexGuard aSolarMutexGuard;
     470         [ #  # ]:          0 :     if ( m_bDisposed )
     471                 :          0 :         return;
     472                 :            : 
     473                 :          0 :     ::rtl::OUString aFeatureURL = rEvent.FeatureURL.Complete;
     474         [ #  # ]:          0 :     if ( aFeatureURL == "AppendSearchHistory" )
     475                 :            :     {
     476 [ #  # ][ #  # ]:          0 :         m_pFindTextFieldControl->Remember_Impl(m_pFindTextFieldControl->GetText());
                 [ #  # ]
     477 [ #  # ][ #  # ]:          0 :     }
     478                 :            : }
     479                 :            : 
     480                 :          0 : IMPL_LINK_NOARG(FindTextToolbarController, EditModifyHdl)
     481                 :            : {
     482                 :            :     // enable or disable item DownSearch/UpSearch of findbar
     483         [ #  # ]:          0 :     Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
     484                 :          0 :     ToolBox* pToolBox = (ToolBox*)pWindow;
     485 [ #  # ][ #  # ]:          0 :     if ( pToolBox && m_pFindTextFieldControl )
     486                 :            :     {
     487         [ #  # ]:          0 :         if (m_pFindTextFieldControl->GetText().Len()>0)
     488                 :            :         {
     489         [ #  # ]:          0 :             if ( !pToolBox->IsItemEnabled(m_nDownSearchId) )
     490                 :          0 :                 pToolBox->EnableItem(m_nDownSearchId, sal_True);
     491         [ #  # ]:          0 :             if ( !pToolBox->IsItemEnabled(m_nUpSearchId) )
     492                 :          0 :                 pToolBox->EnableItem(m_nUpSearchId, sal_True);
     493                 :            :         }
     494                 :            :         else
     495                 :            :         {
     496         [ #  # ]:          0 :             if ( pToolBox->IsItemEnabled(m_nDownSearchId) )
     497                 :          0 :                 pToolBox->EnableItem(m_nDownSearchId, sal_False);
     498         [ #  # ]:          0 :             if ( pToolBox->IsItemEnabled(m_nUpSearchId) )
     499                 :          0 :                 pToolBox->EnableItem(m_nUpSearchId, sal_False);
     500                 :            :         }
     501                 :            :     }
     502                 :            : 
     503                 :          0 :     return 0;
     504                 :            : }
     505                 :            : 
     506                 :            : //-----------------------------------------------------------------------------------------------------------
     507                 :            : // class UpDownSearchToolboxController
     508                 :            : 
     509                 :          0 : UpDownSearchToolboxController::UpDownSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager, Type eType )
     510                 :            :     : svt::ToolboxController( rServiceManager,
     511                 :            :             css::uno::Reference< css::frame::XFrame >(),
     512                 :            :             (eType == UP) ? rtl::OUString( COMMAND_UPSEARCH ): rtl::OUString( COMMAND_DOWNSEARCH ) ),
     513 [ #  # ][ #  # ]:          0 :       meType( eType )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     514                 :            : {
     515                 :          0 : }
     516                 :            : 
     517                 :          0 : UpDownSearchToolboxController::~UpDownSearchToolboxController()
     518                 :            : {
     519         [ #  # ]:          0 : }
     520                 :            : 
     521                 :            : // XInterface
     522                 :          0 : css::uno::Any SAL_CALL UpDownSearchToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException )
     523                 :            : {
     524         [ #  # ]:          0 :     css::uno::Any a = ToolboxController::queryInterface( aType );
     525         [ #  # ]:          0 :     if ( a.hasValue() )
     526                 :          0 :         return a;
     527                 :            : 
     528         [ #  # ]:          0 :     return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) );
     529                 :            : }
     530                 :            : 
     531                 :          0 : void SAL_CALL UpDownSearchToolboxController::acquire() throw ()
     532                 :            : {
     533                 :          0 :     ToolboxController::acquire();
     534                 :          0 : }
     535                 :            : 
     536                 :          0 : void SAL_CALL UpDownSearchToolboxController::release() throw ()
     537                 :            : {
     538                 :          0 :     ToolboxController::release();
     539                 :          0 : }
     540                 :            : 
     541                 :            : // XServiceInfo
     542                 :          0 : ::rtl::OUString SAL_CALL UpDownSearchToolboxController::getImplementationName() throw( css::uno::RuntimeException )
     543                 :            : {
     544                 :          0 :     return getImplementationName_Static( meType );
     545                 :            : }
     546                 :            : 
     547                 :          0 : sal_Bool SAL_CALL UpDownSearchToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException )
     548                 :            : {
     549         [ #  # ]:          0 :     const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() );
     550                 :          0 :     const ::rtl::OUString * pArray = aSNL.getConstArray();
     551                 :            : 
     552         [ #  # ]:          0 :     for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
     553         [ #  # ]:          0 :         if( pArray[i] == ServiceName )
     554                 :          0 :             return true;
     555                 :            : 
     556         [ #  # ]:          0 :     return false;
     557                 :            : }
     558                 :            : 
     559                 :          0 : css::uno::Sequence< ::rtl::OUString > SAL_CALL UpDownSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException )
     560                 :            : {
     561                 :          0 :     return getSupportedServiceNames_Static();
     562                 :            : }
     563                 :            : 
     564                 :          0 : css::uno::Sequence< ::rtl::OUString > UpDownSearchToolboxController::getSupportedServiceNames_Static() throw()
     565                 :            : {
     566                 :          0 :     css::uno::Sequence< ::rtl::OUString > aSNS( 1 );
     567         [ #  # ]:          0 :     aSNS.getArray()[0] = ::rtl::OUString("com.sun.star.frame.ToolbarController");
     568                 :          0 :     return aSNS;
     569                 :            : }
     570                 :            : 
     571                 :            : // XComponent
     572                 :          0 : void SAL_CALL UpDownSearchToolboxController::dispose() throw ( css::uno::RuntimeException )
     573                 :            : {
     574         [ #  # ]:          0 :     SolarMutexGuard aSolarMutexGuard;
     575                 :            : 
     576 [ #  # ][ #  # ]:          0 :     SearchToolbarControllersManager::createControllersManager().freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
                 [ #  # ]
     577                 :            : 
     578 [ #  # ][ #  # ]:          0 :     svt::ToolboxController::dispose();
     579                 :          0 : }
     580                 :            : 
     581                 :            : // XInitialization
     582                 :          0 : void SAL_CALL UpDownSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException )
     583                 :            : {
     584                 :          0 :     svt::ToolboxController::initialize( aArguments );
     585 [ #  # ][ #  # ]:          0 :     SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
     586                 :          0 : }
     587                 :            : 
     588                 :            : // XToolbarController
     589                 :          0 : void SAL_CALL UpDownSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException )
     590                 :            : {
     591         [ #  # ]:          0 :     if ( m_bDisposed )
     592         [ #  # ]:          0 :         throw css::lang::DisposedException();
     593                 :            : 
     594                 :          0 :     ::rtl::OUString sFindText;
     595 [ #  # ][ #  # ]:          0 :     Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
     596                 :          0 :     ToolBox* pToolBox = (ToolBox*)pWindow;
     597         [ #  # ]:          0 :     if ( pToolBox )
     598                 :            :     {
     599         [ #  # ]:          0 :         sal_uInt16 nItemCount = pToolBox->GetItemCount();
     600         [ #  # ]:          0 :         for ( sal_uInt16 i=0; i<nItemCount; ++i )
     601                 :            :         {
     602 [ #  # ][ #  # ]:          0 :             ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i);
     603         [ #  # ]:          0 :             if ( sItemCommand == COMMAND_FINDTEXT )
     604                 :            :             {
     605         [ #  # ]:          0 :                 Window* pItemWin = pToolBox->GetItemWindow(i);
     606         [ #  # ]:          0 :                 if (pItemWin)
     607 [ #  # ][ #  # ]:          0 :                     sFindText = pItemWin->GetText();
                 [ #  # ]
     608                 :            :                 break;
     609                 :            :             }
     610         [ #  # ]:          0 :         }
     611                 :            :     }
     612                 :            : 
     613         [ #  # ]:          0 :     css::uno::Sequence< css::beans::PropertyValue > lArgs(3);
     614         [ #  # ]:          0 :     lArgs[0].Name = rtl::OUString(SEARCHITEM_SEARCHSTRING);
     615 [ #  # ][ #  # ]:          0 :     lArgs[0].Value <<= sFindText;
     616         [ #  # ]:          0 :     lArgs[1].Name = rtl::OUString(SEARCHITEM_SEARCHBACKWARD);
     617 [ #  # ][ #  # ]:          0 :     lArgs[1].Value <<= sal_Bool( meType == UP );
     618         [ #  # ]:          0 :     lArgs[2].Name = rtl::OUString(SEARCHITEM_SEARCHFLAGS);
     619 [ #  # ][ #  # ]:          0 :     lArgs[2].Value <<= (sal_Int32)0;
     620                 :            : 
     621         [ #  # ]:          0 :     impl_executeSearch(m_xServiceManager, m_xFrame, lArgs);
     622                 :            : 
     623         [ #  # ]:          0 :     css::frame::FeatureStateEvent aEvent;
     624                 :          0 :     aEvent.FeatureURL.Complete = rtl::OUString(COMMAND_APPENDSEARCHHISTORY);
     625 [ #  # ][ #  # ]:          0 :     css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager().findController(m_xFrame, COMMAND_FINDTEXT);
     626         [ #  # ]:          0 :     if (xStatusListener.is())
     627 [ #  # ][ #  # ]:          0 :         xStatusListener->statusChanged( aEvent );
         [ #  # ][ #  # ]
     628                 :          0 : }
     629                 :            : 
     630                 :            : // XStatusListener
     631                 :          0 : void SAL_CALL UpDownSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException )
     632                 :            : {
     633         [ #  # ]:          0 :     SolarMutexGuard aSolarMutexGuard;
     634         [ #  # ]:          0 :     if ( m_bDisposed )
     635 [ #  # ][ #  # ]:          0 :         return;
     636                 :            : }
     637                 :            : 
     638                 :            : //-----------------------------------------------------------------------------------------------------------
     639                 :            : // class FindbarDispatcher
     640                 :            : 
     641                 :          4 : FindbarDispatcher::FindbarDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory)
     642                 :          4 :     : m_xFactory( xFactory )
     643                 :            : {
     644                 :          4 : }
     645                 :            : 
     646         [ +  - ]:          4 : FindbarDispatcher::~FindbarDispatcher()
     647                 :            : {
     648         [ +  - ]:          4 :     m_xFactory = NULL;
     649         [ +  - ]:          4 :     m_xFrame = NULL;
     650         [ -  + ]:          8 : }
     651                 :            : 
     652                 :            : // XInterface
     653                 :          8 : css::uno::Any SAL_CALL FindbarDispatcher::queryInterface( const css::uno::Type& aType ) throw( css::uno::RuntimeException )
     654                 :            : {
     655                 :            :     css::uno::Any aReturn( ::cppu::queryInterface( aType,
     656                 :            :         static_cast< css::lang::XServiceInfo* >(this),
     657                 :            :         static_cast< css::lang::XInitialization* >(this),
     658                 :            :         static_cast< css::frame::XDispatchProvider* >(this),
     659         [ +  - ]:          8 :         static_cast< css::frame::XDispatch* >(this)) );
     660                 :            : 
     661         [ +  - ]:          8 :     if ( aReturn.hasValue() )
     662                 :          8 :         return aReturn;
     663                 :            : 
     664         [ #  # ]:          8 :     return OWeakObject::queryInterface( aType );
     665                 :            : }
     666                 :            : 
     667                 :         56 : void SAL_CALL FindbarDispatcher::acquire() throw()
     668                 :            : {
     669                 :         56 :     OWeakObject::acquire();
     670                 :         56 : }
     671                 :            : 
     672                 :         56 : void SAL_CALL FindbarDispatcher::release() throw()
     673                 :            : {
     674                 :         56 :     OWeakObject::release();
     675                 :         56 : }
     676                 :            : 
     677                 :            : // XServiceInfo
     678                 :          0 : ::rtl::OUString SAL_CALL FindbarDispatcher::getImplementationName() throw( css::uno::RuntimeException )
     679                 :            : {
     680                 :          0 :     return getImplementationName_Static();
     681                 :            : }
     682                 :            : 
     683                 :          0 : sal_Bool SAL_CALL FindbarDispatcher::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException )
     684                 :            : {
     685                 :            :     return (
     686                 :          0 :         ServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.comp.svx.FindbarDispatcher")) ||
     687                 :          0 :         ServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.frame.ProtocolHandler"))
     688   [ #  #  #  # ]:          0 :         );
     689                 :            : }
     690                 :            : 
     691                 :          0 : css::uno::Sequence< ::rtl::OUString > SAL_CALL FindbarDispatcher::getSupportedServiceNames() throw( css::uno::RuntimeException )
     692                 :            : {
     693                 :          0 :     return getSupportedServiceNames_Static();
     694                 :            : }
     695                 :            : 
     696                 :          2 : css::uno::Sequence< ::rtl::OUString >  FindbarDispatcher::getSupportedServiceNames_Static() throw()
     697                 :            : {
     698                 :          2 :     css::uno::Sequence< ::rtl::OUString > aSNS( 2 );
     699 [ +  - ][ +  - ]:          2 :     aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FindbarDispatcher" ));
     700 [ +  - ][ +  - ]:          2 :     aSNS.getArray()[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ProtocolHandler" ));
     701                 :          2 :     return aSNS;
     702                 :            : }
     703                 :            : 
     704                 :            : // XInitialization
     705                 :          4 : void SAL_CALL FindbarDispatcher::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException )
     706                 :            : {
     707         [ +  - ]:          4 :     if ( aArguments.getLength() )
     708                 :          4 :         aArguments[0] >>= m_xFrame;
     709                 :          4 : }
     710                 :            : 
     711                 :            : // XDispatchProvider
     712                 :          4 : css::uno::Reference< css::frame::XDispatch > SAL_CALL FindbarDispatcher::queryDispatch( const css::util::URL& aURL, const ::rtl::OUString& /*sTargetFrameName*/, sal_Int32 /*nSearchFlags*/ ) throw( css::uno::RuntimeException )
     713                 :            : {
     714                 :          4 :     css::uno::Reference< css::frame::XDispatch > xDispatch;
     715                 :            : 
     716         [ +  - ]:          4 :     if ( aURL.Protocol == "vnd.sun.star.findbar:" )
     717         [ +  - ]:          4 :         xDispatch = this;
     718                 :            : 
     719                 :          4 :     return xDispatch;
     720                 :            : }
     721                 :            : 
     722                 :          0 : css::uno::Sequence < css::uno::Reference< css::frame::XDispatch > > SAL_CALL FindbarDispatcher::queryDispatches( const css::uno::Sequence < css::frame::DispatchDescriptor >& seqDescripts ) throw( css::uno::RuntimeException )
     723                 :            : {
     724                 :          0 :     sal_Int32 nCount = seqDescripts.getLength();
     725                 :          0 :     css::uno::Sequence < css::uno::Reference < XDispatch > > lDispatcher( nCount );
     726                 :            : 
     727         [ #  # ]:          0 :     for( sal_Int32 i=0; i<nCount; ++i )
     728 [ #  # ][ #  # ]:          0 :         lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL, seqDescripts[i].FrameName, seqDescripts[i].SearchFlags );
                 [ #  # ]
     729                 :            : 
     730                 :          0 :     return lDispatcher;
     731                 :            : }
     732                 :            : 
     733                 :            : // XDispatch
     734                 :          0 : void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css::uno::Sequence < css::beans::PropertyValue >& /*lArgs*/ ) throw( css::uno::RuntimeException )
     735                 :            : {
     736                 :            :     //vnd.sun.star.findbar:FocusToFindbar  - set cursor to the FindTextFieldControl of the findbar
     737         [ #  # ]:          0 :     if ( aURL.Path == "FocusToFindbar" )
     738                 :            :     {
     739         [ #  # ]:          0 :         css::uno::Reference< css::beans::XPropertySet > xPropSet(m_xFrame, css::uno::UNO_QUERY);
     740         [ #  # ]:          0 :         if(!xPropSet.is())
     741                 :            :             return;
     742                 :            : 
     743                 :          0 :         css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
     744 [ #  # ][ #  # ]:          0 :         css::uno::Any aValue = xPropSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )) );
                 [ #  # ]
     745         [ #  # ]:          0 :         aValue >>= xLayoutManager;
     746         [ #  # ]:          0 :         if (!xLayoutManager.is())
     747                 :            :             return;
     748                 :            : 
     749         [ #  # ]:          0 :         const ::rtl::OUString sResourceURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/findbar" ) );
     750 [ #  # ][ #  # ]:          0 :         css::uno::Reference< css::ui::XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL);
     751         [ #  # ]:          0 :         if (!xUIElement.is())
     752                 :            :         {
     753                 :            :             // show the findbar if necessary
     754 [ #  # ][ #  # ]:          0 :             xLayoutManager->createElement( sResourceURL );
     755 [ #  # ][ #  # ]:          0 :             xLayoutManager->showElement( sResourceURL );
     756 [ #  # ][ #  # ]:          0 :             xUIElement = xLayoutManager->getElement( sResourceURL );
                 [ #  # ]
     757         [ #  # ]:          0 :             if ( !xUIElement.is() )
     758                 :            :                 return;
     759                 :            :         }
     760                 :            : 
     761 [ #  # ][ #  # ]:          0 :         css::uno::Reference< css::awt::XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY);
                 [ #  # ]
     762         [ #  # ]:          0 :         Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
     763                 :          0 :         ToolBox* pToolBox = (ToolBox*)pWindow;
     764         [ #  # ]:          0 :         if ( pToolBox )
     765                 :            :         {
     766         [ #  # ]:          0 :             sal_uInt16 nItemCount = pToolBox->GetItemCount();
     767         [ #  # ]:          0 :             for ( sal_uInt16 i=0; i<nItemCount; ++i )
     768                 :            :             {
     769 [ #  # ][ #  # ]:          0 :                 ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i);
     770         [ #  # ]:          0 :                 if ( sItemCommand == COMMAND_FINDTEXT )
     771                 :            :                 {
     772         [ #  # ]:          0 :                     Window* pItemWin = pToolBox->GetItemWindow( i );
     773         [ #  # ]:          0 :                     if ( pItemWin )
     774                 :            :                     {
     775         [ #  # ]:          0 :                         FindTextFieldControl* pFindTextFieldControl = dynamic_cast<FindTextFieldControl*>(pItemWin);
     776         [ #  # ]:          0 :                         if ( pFindTextFieldControl )
     777         [ #  # ]:          0 :                             pFindTextFieldControl->SetTextToSelected_Impl();
     778         [ #  # ]:          0 :                         pItemWin->GrabFocus();
     779                 :            :                         return;
     780                 :            :                     }
     781                 :            :                 }
     782         [ #  # ]:          0 :             }
     783 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     784                 :            : 
     785                 :            :     }
     786                 :            : }
     787                 :            : 
     788                 :         10 : void SAL_CALL FindbarDispatcher::addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& /*xControl*/, const css::util::URL& /*aURL*/ ) throw ( css::uno::RuntimeException )
     789                 :            : {
     790                 :         10 : }
     791                 :            : 
     792                 :         14 : void SAL_CALL FindbarDispatcher::removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& /*xControl*/, const css::util::URL& /*aURL*/ ) throw ( css::uno::RuntimeException )
     793                 :            : {
     794                 :         14 : }
     795                 :            : 
     796                 :            : //-----------------------------------------------------------------------------------------------------------
     797                 :            : // create Instance
     798                 :            : 
     799                 :          0 : css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_createInstance(
     800                 :            :     const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
     801                 :            : {
     802         [ #  # ]:          0 :     return *new FindTextToolbarController( rSMgr );
     803                 :            : }
     804                 :            : 
     805                 :          0 : css::uno::Reference< css::uno::XInterface > SAL_CALL DownSearchToolboxController_createInstance(
     806                 :            :     const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
     807                 :            : {
     808         [ #  # ]:          0 :     return *new UpDownSearchToolboxController( rSMgr, UpDownSearchToolboxController::DOWN );
     809                 :            : }
     810                 :            : 
     811                 :          0 : css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_createInstance(
     812                 :            :     const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
     813                 :            : {
     814         [ #  # ]:          0 :     return *new UpDownSearchToolboxController( rSMgr, UpDownSearchToolboxController::UP );
     815                 :            : }
     816                 :            : 
     817                 :          4 : css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance(
     818                 :            :     const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
     819                 :            : {
     820         [ +  - ]:          4 :     return *new FindbarDispatcher( rSMgr );
     821                 :            : }
     822                 :            : 
     823                 :            : //-----------------------------------------------------------------------------------------------------------
     824                 :            : }
     825                 :            : 
     826                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10