[PATCH] fdo#64451 Add "Find All" to the Find bar.

Andrzej J.R. Hunt (via Code Review) gerrit at gerrit.libreoffice.org
Thu May 23 12:45:52 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4016

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/16/4016/1

fdo#64451 Add "Find All" to the Find bar.

Change-Id: I7a5f2881d2aa77f2d5c6c302c8eac1162b194bcf
---
M basctl/uiconfig/basicide/toolbar/findbar.xml
M officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
M officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
M sc/uiconfig/scalc/toolbar/findbar.xml
M sd/uiconfig/sdraw/toolbar/findbar.xml
M sd/uiconfig/simpress/toolbar/findbar.xml
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/sglobal/toolbar/findbar.xml
M sw/uiconfig/sweb/toolbar/findbar.xml
M sw/uiconfig/swriter/toolbar/findbar.xml
M sw/uiconfig/swxform/toolbar/findbar.xml
14 files changed, 190 insertions(+), 2 deletions(-)



diff --git a/basctl/uiconfig/basicide/toolbar/findbar.xml b/basctl/uiconfig/basicide/toolbar/findbar.xml
index 57aec06..a7cb693 100644
--- a/basctl/uiconfig/basicide/toolbar/findbar.xml
+++ b/basctl/uiconfig/basicide/toolbar/findbar.xml
@@ -22,6 +22,7 @@
   <toolbar:toolbaritem xlink:href=".uno:FindText"/>
   <toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
   <toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
+  <toolbar:toolbaritem xlink:href=".uno:FindAll"/>
   <toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
   <toolbar:toolbarseparator/>
   <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index 64fa7b0..c4961d8 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -440,6 +440,17 @@
           <value>com.sun.star.svx.MatchCaseToolboxController</value>
         </prop>
       </node>
+      <node oor:name="com.sun.star.svx.FindAllToolboxController" oor:op="replace">
+        <prop oor:name="Command">
+          <value>.uno:FindAll</value>
+        </prop>
+        <prop oor:name="Module">
+          <value/>
+        </prop>
+        <prop oor:name="Controller">
+          <value>com.sun.star.svx.FindAllToolboxController</value>
+        </prop>
+      </node>
       <node oor:name="c4" oor:op="replace" install:module="reportbuilder">
         <prop oor:name="Command">
           <value>.uno:FontColor</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 74fbeeb..94e4929 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -1483,6 +1483,11 @@
           <value xml:lang="en-US">Match Case</value>
         </prop>
       </node>
+      <node oor:name=".uno:FindAll" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Find All</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>
diff --git a/sc/uiconfig/scalc/toolbar/findbar.xml b/sc/uiconfig/scalc/toolbar/findbar.xml
index f8052a1..a3c5c0f 100644
--- a/sc/uiconfig/scalc/toolbar/findbar.xml
+++ b/sc/uiconfig/scalc/toolbar/findbar.xml
@@ -23,6 +23,7 @@
   <toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
   <toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
   <toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
+  <toolbar:toolbaritem xlink:href=".uno:FindAll"/>
   <toolbar:toolbarseparator/>
   <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
 </toolbar:toolbar>
diff --git a/sd/uiconfig/sdraw/toolbar/findbar.xml b/sd/uiconfig/sdraw/toolbar/findbar.xml
index f8052a1..4e8ec6b 100644
--- a/sd/uiconfig/sdraw/toolbar/findbar.xml
+++ b/sd/uiconfig/sdraw/toolbar/findbar.xml
@@ -22,6 +22,7 @@
   <toolbar:toolbaritem xlink:href=".uno:FindText"/>
   <toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
   <toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
+  <toolbar:toolbaritem xlink:href=".uno:FindAll"/>
   <toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
   <toolbar:toolbarseparator/>
   <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
diff --git a/sd/uiconfig/simpress/toolbar/findbar.xml b/sd/uiconfig/simpress/toolbar/findbar.xml
index f8052a1..4e8ec6b 100644
--- a/sd/uiconfig/simpress/toolbar/findbar.xml
+++ b/sd/uiconfig/simpress/toolbar/findbar.xml
@@ -22,6 +22,7 @@
   <toolbar:toolbaritem xlink:href=".uno:FindText"/>
   <toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
   <toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
+  <toolbar:toolbaritem xlink:href=".uno:FindAll"/>
   <toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
   <toolbar:toolbarseparator/>
   <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx
index b68b4b5..ab3693c 100644
--- a/svx/inc/tbunosearchcontrollers.hxx
+++ b/svx/inc/tbunosearchcontrollers.hxx
@@ -257,6 +257,43 @@
     CheckBox* m_pMatchCaseControl;
 };
 
+class FindAllToolboxController   : public svt::ToolboxController,
+                                      public css::lang::XServiceInfo
+{
+public:
+    FindAllToolboxController( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+    ~FindAllToolboxController();
+
+    // 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 OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException );
+    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException );
+    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException );
+
+    static OUString getImplementationName_Static( ) throw()
+    {
+        return OUString( "com.sun.star.svx.FindAllToolboxController" );
+    }
+
+    static css::uno::Sequence< 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 );
+};
+
 // protocol handler for "vnd.sun.star.findbar:*" URLs
 // The dispatch object will be used for shortcut commands for findbar
 class FindbarDispatcher : public css::lang::XServiceInfo,
@@ -310,6 +347,7 @@
 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 MatchCaseToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
+css::uno::Reference< css::uno::XInterface > SAL_CALL FindAllToolboxController_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 5270b07..dcb3206 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -31,6 +31,7 @@
 #include <com/sun/star/util/URL.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
 
+#include <svl/srchitem.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <vcl/toolbox.hxx>
 #include <vcl/svapp.hxx>
@@ -40,6 +41,7 @@
 namespace svx
 {
 
+static const char SEARCHITEM_COMMAND[] = "SearchItem.Command";
 static const char SEARCHITEM_SEARCHSTRING[] = "SearchItem.SearchString";
 static const char SEARCHITEM_SEARCHBACKWARD[] = "SearchItem.Backward";
 static const char SEARCHITEM_SEARCHFLAGS[] = "SearchItem.SearchFlags";
@@ -58,7 +60,8 @@
 void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
                          const css::uno::Reference< css::frame::XFrame >& xFrame,
                          const ToolBox* pToolBox,
-                         const sal_Bool aSearchBackwards = false )
+                         const sal_Bool aSearchBackwards = false,
+                         const sal_Bool aFindAll = false )
 {
     css::uno::Reference< css::util::XURLTransformer > xURLTransformer( css::util::URLTransformer::create( rxContext ) );
     css::util::URL aURL;
@@ -87,7 +90,7 @@
         }
     }
 
-    css::uno::Sequence< css::beans::PropertyValue > lArgs(4);
+    css::uno::Sequence< css::beans::PropertyValue > lArgs(5);
     lArgs[0].Name = OUString(SEARCHITEM_SEARCHSTRING);
     lArgs[0].Value <<= sFindText;
     lArgs[1].Name = OUString(SEARCHITEM_SEARCHBACKWARD);
@@ -97,6 +100,9 @@
     lArgs[3].Name = OUString(SEARCHITEM_TRANSLITERATEFLAGS);
     lArgs[3].Value <<= (sal_Int32)(!aMatchCase ?
         com::sun::star::i18n::TransliterationModules_IGNORE_CASE : 0);
+    lArgs[4].Name = OUString(SEARCHITEM_COMMAND);
+    lArgs[4].Value <<= (sal_Int16)(aFindAll ?
+        SVX_SEARCHCMD_FIND_ALL : SVX_SEARCHCMD_FIND );
 
     css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY);
     if ( xDispatchProvider.is() )
@@ -726,6 +732,109 @@
 }
 
 //-----------------------------------------------------------------------------------------------------------
+// class FindAllToolboxController
+
+FindAllToolboxController::FindAllToolboxController( const css::uno::Reference< css::uno::XComponentContext > & rxContext )
+    : svt::ToolboxController( rxContext,
+            css::uno::Reference< css::frame::XFrame >(),
+            OUString( COMMAND_EXITSEARCH ) )
+{
+}
+
+FindAllToolboxController::~FindAllToolboxController()
+{
+}
+
+// XInterface
+css::uno::Any SAL_CALL FindAllToolboxController::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 FindAllToolboxController::acquire() throw ()
+{
+    ToolboxController::acquire();
+}
+
+void SAL_CALL FindAllToolboxController::release() throw ()
+{
+    ToolboxController::release();
+}
+
+// XServiceInfo
+OUString SAL_CALL FindAllToolboxController::getImplementationName() throw( css::uno::RuntimeException )
+{
+    return getImplementationName_Static( );
+}
+
+
+sal_Bool SAL_CALL FindAllToolboxController::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException )
+{
+    const css::uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
+    const OUString * pArray = aSNL.getConstArray();
+
+    for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+        if( pArray[i] == ServiceName )
+            return true;
+
+    return false;
+
+}
+
+css::uno::Sequence< OUString > SAL_CALL FindAllToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException )
+{
+    return getSupportedServiceNames_Static();
+}
+
+css::uno::Sequence< OUString > FindAllToolboxController::getSupportedServiceNames_Static() throw()
+{
+    css::uno::Sequence< OUString > aSNS( 1 );
+    aSNS.getArray()[0] = OUString("com.sun.star.frame.ToolbarController");
+    return aSNS;
+}
+
+// XComponent
+void SAL_CALL FindAllToolboxController::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 FindAllToolboxController::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 FindAllToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException )
+{
+    if ( m_bDisposed )
+        throw css::lang::DisposedException();
+
+    Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
+    ToolBox* pToolBox = (ToolBox*)pWindow;
+
+    impl_executeSearch(m_xContext, m_xFrame, pToolBox, false, true);
+}
+
+// XStatusListener
+void SAL_CALL FindAllToolboxController::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::uno::XComponentContext > & rxContext )
@@ -1028,6 +1137,13 @@
         new MatchCaseToolboxController( comphelper::getComponentContext(rSMgr) ) );
 }
 
+css::uno::Reference< css::uno::XInterface > SAL_CALL FindAllToolboxController_createInstance(
+    const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
+{
+    return static_cast< cppu::OWeakObject * >(
+        new FindAllToolboxController( comphelper::getComponentContext(rSMgr) ) );
+}
+
 css::uno::Reference< css::uno::XInterface > SAL_CALL ExitFindbarToolboxController_createInstance(
     const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
 {
diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx
index ada6692..605f092 100644
--- a/svx/source/unodraw/unoctabl.cxx
+++ b/svx/source/unodraw/unoctabl.cxx
@@ -315,6 +315,13 @@
                 svx::MatchCaseToolboxController_createInstance,
                 svx::MatchCaseToolboxController::getSupportedServiceNames_Static() );
         }
+        else if ( svx::FindAllToolboxController::getImplementationName_Static().equalsAscii( pImplName ) )
+        {
+            xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+                svx::FindAllToolboxController::getImplementationName_Static(),
+                svx::FindAllToolboxController_createInstance,
+                svx::FindAllToolboxController::getSupportedServiceNames_Static() );
+        }
         else if ( svx::ExitSearchToolboxController::getImplementationName_Static().equalsAscii( pImplName ) )
         {
             xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
diff --git a/svx/util/svx.component b/svx/util/svx.component
index 458e2ad..943a38a 100644
--- a/svx/util/svx.component
+++ b/svx/util/svx.component
@@ -61,6 +61,9 @@
   <implementation name="com.sun.star.svx.MatchCaseToolboxController">
     <service name="com.sun.star.frame.ToolbarController"/>
   </implementation>
+  <implementation name="com.sun.star.svx.FindAllToolboxController">
+    <service name="com.sun.star.frame.ToolbarController"/>
+  </implementation>
   <implementation name="com.sun.star.svx.FontHeightToolBoxController">
     <service name="com.sun.star.frame.ToolbarController"/>
   </implementation>
diff --git a/sw/uiconfig/sglobal/toolbar/findbar.xml b/sw/uiconfig/sglobal/toolbar/findbar.xml
index f8052a1..4e8ec6b 100644
--- a/sw/uiconfig/sglobal/toolbar/findbar.xml
+++ b/sw/uiconfig/sglobal/toolbar/findbar.xml
@@ -22,6 +22,7 @@
   <toolbar:toolbaritem xlink:href=".uno:FindText"/>
   <toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
   <toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
+  <toolbar:toolbaritem xlink:href=".uno:FindAll"/>
   <toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
   <toolbar:toolbarseparator/>
   <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
diff --git a/sw/uiconfig/sweb/toolbar/findbar.xml b/sw/uiconfig/sweb/toolbar/findbar.xml
index f8052a1..4e8ec6b 100644
--- a/sw/uiconfig/sweb/toolbar/findbar.xml
+++ b/sw/uiconfig/sweb/toolbar/findbar.xml
@@ -22,6 +22,7 @@
   <toolbar:toolbaritem xlink:href=".uno:FindText"/>
   <toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
   <toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
+  <toolbar:toolbaritem xlink:href=".uno:FindAll"/>
   <toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
   <toolbar:toolbarseparator/>
   <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
diff --git a/sw/uiconfig/swriter/toolbar/findbar.xml b/sw/uiconfig/swriter/toolbar/findbar.xml
index f8052a1..4e8ec6b 100644
--- a/sw/uiconfig/swriter/toolbar/findbar.xml
+++ b/sw/uiconfig/swriter/toolbar/findbar.xml
@@ -22,6 +22,7 @@
   <toolbar:toolbaritem xlink:href=".uno:FindText"/>
   <toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
   <toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
+  <toolbar:toolbaritem xlink:href=".uno:FindAll"/>
   <toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
   <toolbar:toolbarseparator/>
   <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
diff --git a/sw/uiconfig/swxform/toolbar/findbar.xml b/sw/uiconfig/swxform/toolbar/findbar.xml
index f8052a1..4e8ec6b 100644
--- a/sw/uiconfig/swxform/toolbar/findbar.xml
+++ b/sw/uiconfig/swxform/toolbar/findbar.xml
@@ -22,6 +22,7 @@
   <toolbar:toolbaritem xlink:href=".uno:FindText"/>
   <toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
   <toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
+  <toolbar:toolbaritem xlink:href=".uno:FindAll"/>
   <toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
   <toolbar:toolbarseparator/>
   <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>

-- 
To view, visit https://gerrit.libreoffice.org/4016
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7a5f2881d2aa77f2d5c6c302c8eac1162b194bcf
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Andrzej J.R. Hunt <andrzej at ahunt.org>



More information about the LibreOffice mailing list