LCOV - code coverage report
Current view: top level - libreoffice/svx/inc - tbunosearchcontrollers.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 6 0.0 %
Date: 2012-12-27 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef __TBUNOSEARCHCONTROLLERS_HXX_
      21             : #define __TBUNOSEARCHCONTROLLERS_HXX_
      22             : 
      23             : #include <com/sun/star/beans/PropertyValue.hpp>
      24             : #include <com/sun/star/frame/DispatchDescriptor.hpp>
      25             : #include <com/sun/star/frame/XDispatch.hpp>
      26             : #include <com/sun/star/frame/XDispatchHelper.hpp>
      27             : #include <com/sun/star/frame/XDispatchProvider.hpp>
      28             : #include <com/sun/star/frame/XStatusListener.hpp>
      29             : #include <com/sun/star/lang/XServiceInfo.hpp>
      30             : #include <com/sun/star/lang/XInitialization.hpp>
      31             : 
      32             : #include <comphelper/sequenceasvector.hxx>
      33             : #include <cppuhelper/implbase1.hxx>
      34             : #include <cppuhelper/weak.hxx>
      35             : #include <svtools/toolboxcontroller.hxx>
      36             : #include <vcl/combobox.hxx>
      37             : #include <vcl/window.hxx>
      38             : 
      39             : #include <map>
      40             : #include <vector>
      41             : 
      42             : namespace svx
      43             : {
      44             : 
      45             : class FindTextFieldControl : public ComboBox
      46             : {
      47             : public:
      48             :     FindTextFieldControl( Window* pParent, WinBits nStyle,
      49             :         css::uno::Reference< css::frame::XFrame >& xFrame,
      50             :         css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
      51             :     virtual ~FindTextFieldControl();
      52             : 
      53             :     virtual long PreNotify( NotifyEvent& rNEvt );
      54             : 
      55             :     void Remember_Impl(const String& rStr);
      56             :     void SetTextToSelected_Impl();
      57             : 
      58             : private:
      59             : 
      60             :     css::uno::Reference< css::frame::XFrame > m_xFrame;
      61             :     css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceManager;
      62             : };
      63             : 
      64             : class SearchToolbarControllersManager
      65             : {
      66             : public:
      67             : 
      68             :     SearchToolbarControllersManager();
      69             :     ~SearchToolbarControllersManager();
      70             : 
      71             :     static SearchToolbarControllersManager& createControllersManager();
      72             : 
      73             :     void registryController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL );
      74             :     void freeController ( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL );
      75             :     css::uno::Reference< css::frame::XStatusListener > findController( const css::uno::Reference< css::frame::XFrame >& xFrame, const ::rtl::OUString& sCommandURL );
      76             : 
      77             :     void saveSearchHistory(const FindTextFieldControl* m_pFindTextFieldControl);
      78             :     void loadSearchHistory(FindTextFieldControl* m_pFindTextFieldControl);
      79             : 
      80             : private:
      81             : 
      82             :     typedef ::comphelper::SequenceAsVector< css::beans::PropertyValue > SearchToolbarControllersVec;
      83             :     typedef ::std::map< css::uno::Reference< css::frame::XFrame >, SearchToolbarControllersVec > SearchToolbarControllersMap;
      84             :     SearchToolbarControllersMap aSearchToolbarControllersMap;
      85             :     std::vector<rtl::OUString> m_aSearchStrings;
      86             : 
      87             : };
      88             : 
      89             : class FindTextToolbarController : public svt::ToolboxController,
      90             :                                   public css::lang::XServiceInfo
      91             : {
      92             : public:
      93             : 
      94             :     FindTextToolbarController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager );
      95             :     ~FindTextToolbarController();
      96             : 
      97             :     // XInterface
      98             :     virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException );
      99             :     virtual void SAL_CALL acquire() throw ();
     100             :     virtual void SAL_CALL release() throw ();
     101             : 
     102             :     // XServiceInfo
     103             :     virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException );
     104             :     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException );
     105             :     virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException );
     106             : 
     107           0 :     static ::rtl::OUString getImplementationName_Static() throw()
     108             :     {
     109           0 :         return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svx.FindTextToolboxController" ));
     110             :     }
     111             : 
     112             :     static ::com::sun::star::uno::Sequence< ::rtl::OUString >  getSupportedServiceNames_Static() throw();
     113             : 
     114             :     // XComponent
     115             :     virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException );
     116             : 
     117             :     // XInitialization
     118             :     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException );
     119             : 
     120             :     // XToolbarController
     121             :     virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException);
     122             :     virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException );
     123             : 
     124             :     // XStatusListener
     125             :     virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) throw ( css::uno::RuntimeException );
     126             : 
     127             :     DECL_LINK(EditModifyHdl, void*);
     128             : 
     129             : private:
     130             : 
     131             :     FindTextFieldControl* m_pFindTextFieldControl;
     132             : 
     133             :     sal_uInt16 m_nDownSearchId; // item position of findbar
     134             :     sal_uInt16 m_nUpSearchId;   // item position of findbar
     135             : 
     136             : };
     137             : 
     138             : class UpDownSearchToolboxController : public svt::ToolboxController,
     139             :                                       public css::lang::XServiceInfo
     140             : {
     141             : public:
     142             :     enum Type { UP, DOWN };
     143             : 
     144             :     UpDownSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager, Type eType );
     145             :     ~UpDownSearchToolboxController();
     146             : 
     147             :     // XInterface
     148             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException );
     149             :     virtual void SAL_CALL acquire() throw ();
     150             :     virtual void SAL_CALL release() throw ();
     151             : 
     152             :     // XServiceInfo
     153             :     virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException );
     154             :     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException );
     155             :     virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException );
     156             : 
     157           0 :     static ::rtl::OUString getImplementationName_Static( Type eType ) throw()
     158             :     {
     159             :         return eType == UP? ::rtl::OUString( "com.sun.star.svx.UpSearchToolboxController" ) :
     160           0 :                             ::rtl::OUString( "com.sun.star.svx.DownSearchToolboxController" );
     161             :     }
     162             : 
     163             :     static css::uno::Sequence< ::rtl::OUString >  getSupportedServiceNames_Static() throw();
     164             : 
     165             :     // XComponent
     166             :     virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException );
     167             : 
     168             :     // XInitialization
     169             :     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException);
     170             : 
     171             :     // XToolbarController
     172             :     virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException );
     173             : 
     174             :     // XStatusListener
     175             :     virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException );
     176             : 
     177             : private:
     178             :     Type meType;
     179             : };
     180             : 
     181             : // protocol handler for "vnd.sun.star.findbar:*" URLs
     182             : // The dispatch object will be used for shortcut commands for findbar
     183             : class FindbarDispatcher : public css::lang::XServiceInfo,
     184             :                           public css::lang::XInitialization,
     185             :                           public css::frame::XDispatchProvider,
     186             :                           public css::frame::XDispatch,
     187             :                           public ::cppu::OWeakObject
     188             : {
     189             : public:
     190             : 
     191             :     FindbarDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
     192             :     virtual ~FindbarDispatcher();
     193             : 
     194             :     // XInterface
     195             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException );
     196             :     virtual void SAL_CALL acquire() throw();
     197             :     virtual void SAL_CALL release() throw();
     198             : 
     199             :     // XServiceInfo
     200             :     virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException );
     201             :     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException );
     202             :     virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException );
     203             : 
     204           0 :     static ::rtl::OUString getImplementationName_Static() throw()
     205             :     {
     206           0 :         return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.Impl.FindbarDispatcher" ));
     207             :     }
     208             : 
     209             :     static css::uno::Sequence< ::rtl::OUString >  getSupportedServiceNames_Static() throw();
     210             : 
     211             :     // XInitialization
     212             :     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException );
     213             : 
     214             :     // XDispatchProvider
     215             :     virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL, const ::rtl::OUString& sTargetFrameName , sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException );
     216             :     virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions    ) throw( css::uno::RuntimeException );
     217             : 
     218             :     // XDispatch
     219             :     virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException );
     220             :     virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException );
     221             :     virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException );
     222             : 
     223             : private:
     224             : 
     225             :     css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
     226             :     css::uno::Reference< css::frame::XFrame > m_xFrame;
     227             : 
     228             : };
     229             : 
     230             : // createInstance
     231             : css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
     232             : css::uno::Reference< css::uno::XInterface > SAL_CALL DownSearchToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
     233             : css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
     234             : css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
     235             : 
     236             : }
     237             : 
     238             : #endif // __TBUNOSEARCHCONTROLLERS_HXX_
     239             : 
     240             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10