diff options
author | jorendc <joren.libreoffice@telenet.be> | 2013-01-07 00:05:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-01-16 14:10:18 +0000 |
commit | cb701be950ebb7fbbc48a0b6e031915eb9c0d68e (patch) | |
tree | c16184f216eeeb61a9991f835cead18bcfe54f7e | |
parent | 33b05d5de716707e54ae09afe88a7e02c63e388d (diff) |
add close option to findbar in Writer
Change-Id: Ie42da7ecc7f3cb59bb6f1fb798e72a6862eb1f67
Reviewed-on: https://gerrit.libreoffice.org/1557
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | icon-themes/galaxy/cmd/lc_exitsearch.png | bin | 0 -> 1119 bytes | |||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu | 11 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 8 | ||||
-rw-r--r-- | svx/inc/tbunosearchcontrollers.hxx | 43 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbunosearchcontrollers.cxx | 124 | ||||
-rw-r--r-- | svx/source/unodraw/unoctabl.cxx | 7 | ||||
-rw-r--r-- | svx/util/svx.component | 3 | ||||
-rw-r--r-- | sw/uiconfig/swriter/toolbar/findbar.xml | 1 |
8 files changed, 195 insertions, 2 deletions
diff --git a/icon-themes/galaxy/cmd/lc_exitsearch.png b/icon-themes/galaxy/cmd/lc_exitsearch.png Binary files differnew file mode 100644 index 000000000000..18958f3de99d --- /dev/null +++ b/icon-themes/galaxy/cmd/lc_exitsearch.png diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu index a60dd09115fb..fe27c053317a 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu @@ -396,6 +396,17 @@ <value>com.sun.star.svx.DownSearchToolboxController</value> </prop> </node> + <node oor:name="com.sun.star.svx.ExitFindbarToolboxController" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:ExitSearch</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.svx.ExitFindbarToolboxController</value> + </prop> + </node> <node oor:name="com.sun.star.svx.UpSearchToolboxController" oor:op="replace"> <prop oor:name="Command"> <value>.uno:UpSearch</value> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 42188b60de65..bbdf997ff5a3 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -1471,6 +1471,14 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:ExitSearch" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Exit Search</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> <node oor:name="vnd.sun.star.findbar:FocusToFindbar" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">~Find...</value> diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx index 47a1d00a8f7a..87f975698fd3 100644 --- a/svx/inc/tbunosearchcontrollers.hxx +++ b/svx/inc/tbunosearchcontrollers.hxx @@ -135,6 +135,48 @@ private: }; +class ExitSearchToolboxController : public svt::ToolboxController, + public css::lang::XServiceInfo +{ +public: + enum Type { EXIT }; + + ExitSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager, Type eType ); + ~ExitSearchToolboxController(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + + static ::rtl::OUString getImplementationName_Static( ) throw() + { + return ::rtl::OUString( "com.sun.star.svx.ExitFindbarToolboxController" ); + } + + static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + + // XComponent + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException ); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ); + +private: + Type meType; +}; + class UpDownSearchToolboxController : public svt::ToolboxController, public css::lang::XServiceInfo { @@ -231,6 +273,7 @@ private: css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); css::uno::Reference< css::uno::XInterface > SAL_CALL DownSearchToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); +css::uno::Reference< css::uno::XInterface > SAL_CALL ExitFindbarToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); } diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 9cda39023530..af48a732c589 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -47,6 +47,7 @@ static const char COMMAND_EXECUTESEARCH[] = ".uno:ExecuteSearch"; static const char COMMAND_FINDTEXT[] = ".uno:FindText"; static const char COMMAND_DOWNSEARCH[] = ".uno:DownSearch"; static const char COMMAND_UPSEARCH[] = ".uno:UpSearch"; +static const char COMMAND_EXITSEARCH[] = ".uno:ExitSearch"; static const char COMMAND_APPENDSEARCHHISTORY[] = "AppendSearchHistory"; static const sal_Int32 REMEMBER_SIZE = 10; @@ -477,7 +478,7 @@ IMPL_LINK_NOARG(FindTextToolbarController, EditModifyHdl) UpDownSearchToolboxController::UpDownSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager, Type eType ) : svt::ToolboxController( rServiceManager, css::uno::Reference< css::frame::XFrame >(), - (eType == UP) ? rtl::OUString( COMMAND_UPSEARCH ): rtl::OUString( COMMAND_DOWNSEARCH ) ), + (eType == UP) ? rtl::OUString( COMMAND_UPSEARCH ): rtl::OUString( COMMAND_DOWNSEARCH ) ), meType( eType ) { } @@ -602,6 +603,120 @@ void SAL_CALL UpDownSearchToolboxController::statusChanged( const css::frame::Fe if ( m_bDisposed ) return; } +//----------------------------------------------------------------------------------------------------------- +// class ExitSearchToolboxController + +ExitSearchToolboxController::ExitSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager, Type eType ) + : svt::ToolboxController( rServiceManager, + css::uno::Reference< css::frame::XFrame >(), + rtl::OUString( COMMAND_EXITSEARCH ) ), + meType( eType ) +{ +} + +ExitSearchToolboxController::~ExitSearchToolboxController() +{ +} + +// XInterface +css::uno::Any SAL_CALL ExitSearchToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ) +{ + css::uno::Any a = ToolboxController::queryInterface( aType ); + if ( a.hasValue() ) + return a; + + return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); +} + +void SAL_CALL ExitSearchToolboxController::acquire() throw () +{ + ToolboxController::acquire(); +} + +void SAL_CALL ExitSearchToolboxController::release() throw () +{ + ToolboxController::release(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL ExitSearchToolboxController::getImplementationName() throw( css::uno::RuntimeException ) +{ + return getImplementationName_Static( ); +} + + +sal_Bool SAL_CALL ExitSearchToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) +{ + const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString * pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; + +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL ExitSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +css::uno::Sequence< ::rtl::OUString > ExitSearchToolboxController::getSupportedServiceNames_Static() throw() +{ + css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS.getArray()[0] = ::rtl::OUString("com.sun.star.frame.ToolbarController"); + return aSNS; +} + +// XComponent +void SAL_CALL ExitSearchToolboxController::dispose() throw ( css::uno::RuntimeException ) +{ + SolarMutexGuard aSolarMutexGuard; + + SearchToolbarControllersManager::createControllersManager().freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + + svt::ToolboxController::dispose(); +} + +// XInitialization +void SAL_CALL ExitSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ) +{ + svt::ToolboxController::initialize( aArguments ); + SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); +} + +// XToolbarController +void SAL_CALL ExitSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException ) +{ + Window *pFocusWindow = Application::GetFocusWindow(); + if ( pFocusWindow ) + pFocusWindow->GrabFocusToDocument(); + + // hide the findbar + css::uno::Reference< css::beans::XPropertySet > xPropSet(m_xFrame, css::uno::UNO_QUERY); + if (xPropSet.is()) + { + css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; + css::uno::Any aValue = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ); + aValue >>= xLayoutManager; + if (xLayoutManager.is()) + { + const ::rtl::OUString sResourceURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/findbar" ) ); + xLayoutManager->hideElement( sResourceURL ); + xLayoutManager->destroyElement( sResourceURL ); + } + } +} + +// XStatusListener +void SAL_CALL ExitSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException ) +{ + SolarMutexGuard aSolarMutexGuard; + if ( m_bDisposed ) + return; +} //----------------------------------------------------------------------------------------------------------- // class FindbarDispatcher @@ -749,7 +864,6 @@ void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css } } } - } } @@ -787,6 +901,12 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_c rSMgr, UpDownSearchToolboxController::UP ) ); } +css::uno::Reference< css::uno::XInterface > SAL_CALL ExitFindbarToolboxController_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +{ + return *new ExitSearchToolboxController( rSMgr, ExitSearchToolboxController::EXIT ); +} + css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) { diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index 72bb16210313..2bfc7db866c1 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -306,6 +306,13 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svx_component_getFactory ( svx::UpSearchToolboxController_createInstance, svx::UpDownSearchToolboxController::getSupportedServiceNames_Static() ); } + else if ( svx::ExitSearchToolboxController::getImplementationName_Static().equalsAscii( pImplName ) ) + { + xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + svx::ExitSearchToolboxController::getImplementationName_Static(), + svx::ExitFindbarToolboxController_createInstance, + svx::ExitSearchToolboxController::getSupportedServiceNames_Static() ); + } else if ( svx::FindbarDispatcher::getImplementationName_Static().equalsAscii( pImplName ) ) { xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), diff --git a/svx/util/svx.component b/svx/util/svx.component index 084994c0d0ad..ea9f39cdd074 100644 --- a/svx/util/svx.component +++ b/svx/util/svx.component @@ -64,4 +64,7 @@ <implementation name="com.sun.star.svx.UpSearchToolboxController"> <service name="com.sun.star.frame.ToolbarController"/> </implementation> + <implementation name="com.sun.star.svx.ExitFindbarToolboxController"> + <service name="com.sun.star.frame.ToolbarController"/> + </implementation> </component> diff --git a/sw/uiconfig/swriter/toolbar/findbar.xml b/sw/uiconfig/swriter/toolbar/findbar.xml index cca79d99c412..7bf51e71d004 100644 --- a/sw/uiconfig/swriter/toolbar/findbar.xml +++ b/sw/uiconfig/swriter/toolbar/findbar.xml @@ -21,6 +21,7 @@ <toolbar:toolbaritem xlink:href=".uno:FindText"/> <toolbar:toolbaritem xlink:href=".uno:DownSearch"/> <toolbar:toolbaritem xlink:href=".uno:UpSearch"/> + <toolbar:toolbaritem xlink:href=".uno:ExitSearch"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/> </toolbar:toolbar> |