[PATCH] Change in core[libreoffice-4-0]: add close option to findbar in Writer
Joren De Cuyper (via Code Review)
gerrit at gerrit.libreoffice.org
Fri Jan 18 14:29:59 PST 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/1758
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/58/1758/1
add close option to findbar in Writer
Change-Id: Ie42da7ecc7f3cb59bb6f1fb798e72a6862eb1f67
Reviewed-on: https://gerrit.libreoffice.org/1557
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
---
A icon-themes/galaxy/cmd/lc_exitsearch.png
M officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
M officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
M svx/inc/tbunosearchcontrollers.hxx
M svx/source/tbxctrls/tbunosearchcontrollers.cxx
M svx/source/unodraw/unoctabl.cxx
M svx/util/svx.component
M sw/uiconfig/swriter/toolbar/findbar.xml
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
new file mode 100644
index 0000000..18958f3
--- /dev/null
+++ b/icon-themes/galaxy/cmd/lc_exitsearch.png
Binary files differ
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index a60dd09..fe27c05 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 b8973b0..ac67696 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 47a1d00..87f9756 100644
--- a/svx/inc/tbunosearchcontrollers.hxx
+++ b/svx/inc/tbunosearchcontrollers.hxx
@@ -135,6 +135,48 @@
};
+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 @@
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 c4bfc5c..af98217 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -47,6 +47,7 @@
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 @@
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 )
{
}
@@ -597,6 +598,120 @@
// XStatusListener
void SAL_CALL UpDownSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException )
+{
+ SolarMutexGuard aSolarMutexGuard;
+ 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 )
@@ -749,7 +864,6 @@
}
}
}
-
}
}
@@ -782,6 +896,12 @@
return *new UpDownSearchToolboxController( 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 72bb162..2bfc7db 100644
--- a/svx/source/unodraw/unoctabl.cxx
+++ b/svx/source/unodraw/unoctabl.cxx
@@ -306,6 +306,13 @@
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 084994c..ea9f39c 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 cca79d9..7bf51e7 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>
--
To view, visit https://gerrit.libreoffice.org/1758
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie42da7ecc7f3cb59bb6f1fb798e72a6862eb1f67
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Joren De Cuyper <joren.libreoffice at telenet.be>
Gerrit-Reviewer: Caolán McNamara <caolanm at redhat.com>
More information about the LibreOffice
mailing list