[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 3 commits - framework/inc framework/source

Thorsten Behrens Thorsten.Behrens at CIB.de
Wed Jun 1 15:00:42 UTC 2016


 framework/inc/dispatch/interceptionhelper.hxx    |    4 --
 framework/source/dispatch/interceptionhelper.cxx |   43 ++++++++---------------
 2 files changed, 16 insertions(+), 31 deletions(-)

New commits:
commit 7283f2e2ddb7a2b7dac2d2a2417a1de866eb7124
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date:   Fri May 20 16:48:00 2016 +0200

    framework: last dispatchInterceptor gets asked first
    
    Align implementation with API contract as spelled out in
    offapi/com/sun/star/frame/XDispatchProviderInterception.idl -
    no idea why this change happenend in 2003:
    
    Date: Fri Apr 4 16:16:05 2003 +0000
    INTEGRATION: CWS fwk01 (1.1.72); FILE MERGED
    2003/04/01 12:40:09 as 1.1.72.1: #107642# change order of used interception objects
    
    At any rate, with this change extensions actually get a chance to
    see dispatch requests first, and process/ignore at will.
    
    Change-Id: I58876150ee6d67e592f41b3e82a9ffc314e091a3
    Reviewed-on: https://gerrit.libreoffice.org/25215
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 08cf2fd01064306eef7fdbb5b62320947c4d1089)

diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx
index 4935e3d..6e5ff13 100644
--- a/framework/source/dispatch/interceptionhelper.cxx
+++ b/framework/source/dispatch/interceptionhelper.cxx
@@ -136,20 +136,19 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css:
 
     // b) OK - there is at least one interceptor already registered.
     //    It's slave and it's master must be valid references ...
-    //    because we created it. But we have to look for the static bool which
-    //    regulate direction of using of interceptor objects!
+    //    because we created it.
 
-    //     insert it behind any other existing interceptor - means at the end of our list.
+    // insert it before any other existing interceptor - means at the beginning of our list.
     else
     {
-        css::uno::Reference< css::frame::XDispatchProvider >            xMasterD = m_lInterceptionRegs.rbegin()->xInterceptor;
-        css::uno::Reference< css::frame::XDispatchProviderInterceptor > xMasterI (xMasterD, css::uno::UNO_QUERY);
+        css::uno::Reference< css::frame::XDispatchProvider >            xSlaveD = m_lInterceptionRegs.begin()->xInterceptor;
+        css::uno::Reference< css::frame::XDispatchProviderInterceptor > xSlaveI (xSlaveD , css::uno::UNO_QUERY);
 
-        xInterceptor->setMasterDispatchProvider(xMasterD          );
-        xInterceptor->setSlaveDispatchProvider (m_xSlave          );
-        xMasterI->setSlaveDispatchProvider     (aInfo.xInterceptor);
+        xInterceptor->setMasterDispatchProvider(xThis             );
+        xInterceptor->setSlaveDispatchProvider (xSlaveD           );
+        xSlaveI->setMasterDispatchProvider     (aInfo.xInterceptor);
 
-        m_lInterceptionRegs.push_back(aInfo);
+        m_lInterceptionRegs.push_front(aInfo);
     }
 
     css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
commit c87170c8d3c206722a5b2bb2c2eb826abac06608
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date:   Wed Mar 2 15:28:36 2016 +0100

    framework: avoid excessive queryDispatch calls
    
    Make better use of the css::frame::XInterceptorInfo interface, to avoid
    calling queryDispatch() pointlessly on interfaces that have explicitely
    opted out. Since that already broadcasts which urls we're interested in
    - so just don't bother calling entries who are not matching.
    
    Change-Id: Id5e780568fd60c38f4cee4ee800d747d65a31dae
    Reviewed-on: https://gerrit.libreoffice.org/25214
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 27b6cdb5ab5af33dbba561923c8db81e144c88b9)

diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx
index ca438ac..4935e3d 100644
--- a/framework/source/dispatch/interceptionhelper.cxx
+++ b/framework/source/dispatch/interceptionhelper.cxx
@@ -52,16 +52,23 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryD
         xInterceptor = pIt->xInterceptor;
 
     // b) No match by registration - but a valid interceptor list.
-    //    Use first interceptor everytimes.
-    //    Note: it doesn't matter, which direction this helper implementation use to ask interceptor objects.
-    //    Using of member m_aInterceptorList will starts at the beginning everytimes.
-    //    It depends from the filling operation, in which direction it works really!
+    //    Find first interceptor w/o pattern, so we need to query it
     if (!xInterceptor.is() && m_lInterceptionRegs.size()>0)
     {
-        pIt          = m_lInterceptionRegs.begin();
-        xInterceptor = pIt->xInterceptor;
+        InterceptorList::const_iterator pIt2;
+        for (pIt2=m_lInterceptionRegs.begin(); pIt2!=m_lInterceptionRegs.end(); ++pIt2)
+        {
+            if (!pIt2->lURLPattern.getLength())
+            {
+                // no pattern -> need to ask this guy!
+                xInterceptor = pIt2->xInterceptor;
+                break;
+            }
+        }
+        // if we didn't find any non-pattern interceptor, there's no-one
+        // registered for this command url (we already searched for matching
+        // patterns above)
     }
-
     // c) No registered interceptor => use our direct slave.
     //    This helper exist by design and must be valid everytimes ...
     //    But to be more feature proof - we should check that .-)
commit 6f99f4f201e3bd9216d5ec46934473ba1ab0850c
Author: shubhamtibra <shubh.tibra at gmail.com>
Date:   Sat Jan 16 21:50:24 2016 +0530

    tdf#96949 Remove global static variable m_bPreferrFirstInterceptor and unused code
    
    Remove global static variable "m_bPreferrFirstInterceptor" which is always true,
    and remove the ifs where it is false.
    
    Change-Id: I54dcea7a6010c825a66020ec3f7448bb32d120b8
    Reviewed-on: https://gerrit.libreoffice.org/21519
    Reviewed-by: jan iversen <jani at documentfoundation.org>
    Tested-by: jan iversen <jani at documentfoundation.org>
    (cherry picked from commit 5d4f1f6f630d4382679087a4fb0da364c9c9692b)

diff --git a/framework/inc/dispatch/interceptionhelper.hxx b/framework/inc/dispatch/interceptionhelper.hxx
index e032017..cfbfd96 100644
--- a/framework/inc/dispatch/interceptionhelper.hxx
+++ b/framework/inc/dispatch/interceptionhelper.hxx
@@ -143,10 +143,6 @@ class InterceptionHelper : public  ::cppu::WeakImplHelper3<
         /** @short contains all registered interceptor objects. */
         InterceptorList m_lInterceptionRegs;
 
-        /** @short it regulates, which interceptor is used first.
-                   The last or the first registered one. */
-        static bool m_bPreferrFirstInterceptor;
-
     // native interface
 
     public:
diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx
index 49ff66c..ca438ac 100644
--- a/framework/source/dispatch/interceptionhelper.cxx
+++ b/framework/source/dispatch/interceptionhelper.cxx
@@ -25,8 +25,6 @@
 
 namespace framework{
 
-bool InterceptionHelper::m_bPreferrFirstInterceptor = true;
-
 InterceptionHelper::InterceptionHelper(const css::uno::Reference< css::frame::XFrame >&            xOwner,
                                        const css::uno::Reference< css::frame::XDispatchProvider >& xSlave)
     : m_xOwnerWeak  (xOwner                       )
@@ -134,9 +132,8 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css:
     //    because we created it. But we have to look for the static bool which
     //    regulate direction of using of interceptor objects!
 
-    // b1) If "m_bPreferrFirstInterceptor" is set to true, we have to
     //     insert it behind any other existing interceptor - means at the end of our list.
-    else if (m_bPreferrFirstInterceptor)
+    else
     {
         css::uno::Reference< css::frame::XDispatchProvider >            xMasterD = m_lInterceptionRegs.rbegin()->xInterceptor;
         css::uno::Reference< css::frame::XDispatchProviderInterceptor > xMasterI (xMasterD, css::uno::UNO_QUERY);
@@ -148,20 +145,6 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css:
         m_lInterceptionRegs.push_back(aInfo);
     }
 
-    // b2) If "m_bPreferrFirstInterceptor" is set to false, we have to
-    //     insert it before any other existing interceptor - means at the beginning of our list.
-    else
-    {
-        css::uno::Reference< css::frame::XDispatchProvider >            xSlaveD = m_lInterceptionRegs.begin()->xInterceptor;
-        css::uno::Reference< css::frame::XDispatchProviderInterceptor > xSlaveI (xSlaveD , css::uno::UNO_QUERY);
-
-        xInterceptor->setMasterDispatchProvider(xThis             );
-        xInterceptor->setSlaveDispatchProvider (xSlaveD           );
-        xSlaveI->setMasterDispatchProvider     (aInfo.xInterceptor);
-
-        m_lInterceptionRegs.push_front(aInfo);
-    }
-
     css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
 
     aWriteLock.clear();


More information about the Libreoffice-commits mailing list