[Libreoffice-commits] core.git: 3 commits - comphelper/source include/comphelper include/svtools svtools/source

Stephan Bergmann sbergman at redhat.com
Wed Feb 12 03:03:51 PST 2014


 comphelper/source/property/propertycontainer.cxx |    4 -
 include/comphelper/propertycontainer.hxx         |    8 ---
 include/svtools/toolboxcontroller.hxx            |   34 +++++++++-------
 svtools/source/uno/toolboxcontroller.cxx         |   47 +++++++++--------------
 4 files changed, 43 insertions(+), 50 deletions(-)

New commits:
commit 307684b2c735947e81aa061b8e16fa197fc15857
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Feb 12 12:02:17 2014 +0100

    Clean-up svt::ToolboxController inheritance
    
    ...and fix its XTypeProvider::getTypes
    
    Change-Id: Ic36b17b14da21a29ca5530dd5e2ad03ee3da0782

diff --git a/include/svtools/toolboxcontroller.hxx b/include/svtools/toolboxcontroller.hxx
index 021fe41..1717821 100644
--- a/include/svtools/toolboxcontroller.hxx
+++ b/include/svtools/toolboxcontroller.hxx
@@ -30,7 +30,7 @@
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/util/XUpdatable.hpp>
 #include <com/sun/star/util/XURLTransformer.hpp>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase5.hxx>
 #include <cppuhelper/interfacecontainer.hxx>
 #include <comphelper/broadcasthelper.hxx>
 #include <comphelper/proparrhlp.hxx>
@@ -46,15 +46,17 @@ class ToolBox;
 namespace svt
 {
 
-class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusListener,
-                          public ::com::sun::star::frame::XToolbarController,
-                          public ::com::sun::star::lang::XInitialization,
-                          public ::com::sun::star::util::XUpdatable,
-                          public ::com::sun::star::lang::XComponent,
+typedef cppu::WeakImplHelper5<
+        css::frame::XStatusListener, css::frame::XToolbarController,
+        css::lang::XInitialization, css::util::XUpdatable,
+        css::lang::XComponent >
+    ToolboxController_Base;
+
+class SVT_DLLPUBLIC ToolboxController :
+                          public ToolboxController_Base,
                           public ::comphelper::OMutexAndBroadcastHelper,
                           public ::comphelper::OPropertyContainer,
-                          public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >,
-                          public ::cppu::OWeakObject
+                          public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >
 {
     private:
         sal_Bool  m_bSupportVisible;
@@ -76,6 +78,8 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
         virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
         virtual void SAL_CALL acquire() throw ();
         virtual void SAL_CALL release() throw ();
+        virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes()
+            throw (css::uno::RuntimeException);
 
         // XInitialization
         virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx
index e66d7c5..7b8f9af 100644
--- a/svtools/source/uno/toolboxcontroller.cxx
+++ b/svtools/source/uno/toolboxcontroller.cxx
@@ -54,7 +54,6 @@ ToolboxController::ToolboxController(
     const Reference< XFrame >& xFrame,
     const OUString& aCommandURL ) :
     OPropertyContainer(GetBroadcastHelper())
-    ,   OWeakObject()
     ,   m_bSupportVisible(sal_False)
     ,   m_bInitialized( sal_False )
     ,   m_bDisposed( sal_False )
@@ -81,7 +80,6 @@ ToolboxController::ToolboxController(
 
 ToolboxController::ToolboxController() :
     OPropertyContainer(GetBroadcastHelper())
-    ,   OWeakObject()
     ,   m_bSupportVisible(sal_False)
     ,   m_bInitialized( sal_False )
     ,   m_bDisposed( sal_False )
@@ -137,34 +135,31 @@ Reference< XLayoutManager > ToolboxController::getLayoutManager() const
 Any SAL_CALL ToolboxController::queryInterface( const Type& rType )
 throw ( RuntimeException )
 {
-    Any a = ::cppu::queryInterface(
-                rType ,
-                static_cast< XToolbarController* >( this ),
-                static_cast< XStatusListener* >( this ),
-                static_cast< XEventListener* >( this ),
-                static_cast< XInitialization* >( this ),
-                static_cast< XComponent* >( this ),
-                static_cast< XUpdatable* >( this ));
-    if ( !a.hasValue())
-    {
-        a = ::cppu::queryInterface(rType
-            ,static_cast<XPropertySet*>(this)
-            ,static_cast<XMultiPropertySet*>(this)
-            ,static_cast<XFastPropertySet*>(this));
-        if (!a.hasValue())
-            return OWeakObject::queryInterface( rType );
-    }
-    return a;
+    css::uno::Any a(ToolboxController_Base::queryInterface(rType));
+    return a.hasValue() ? a : OPropertyContainer::queryInterface(rType);
 }
 
 void SAL_CALL ToolboxController::acquire() throw ()
 {
-    OWeakObject::acquire();
+    ToolboxController_Base::acquire();
 }
 
 void SAL_CALL ToolboxController::release() throw ()
 {
-    OWeakObject::release();
+    ToolboxController_Base::release();
+}
+
+css::uno::Sequence<css::uno::Type> ToolboxController::getTypes()
+    throw (css::uno::RuntimeException)
+{
+    css::uno::Sequence<css::uno::Type> s1(ToolboxController_Base::getTypes());
+    css::uno::Sequence<css::uno::Type> s2(OPropertyContainer::getTypes());
+    sal_Int32 n = s1.getLength();
+    s1.realloc(n + s2.getLength());
+    for (sal_Int32 i = 0; i != s2.getLength(); ++i) {
+        s1[n + i] = s2[i];
+    }
+    return s1;
 }
 
 void SAL_CALL ToolboxController::initialize( const Sequence< Any >& aArguments )
commit 435a5e70710c559e261fcb2063782d0b4543bacf
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Feb 12 11:38:01 2014 +0100

    Remove pointless "shizhoubo" comments
    
    Change-Id: I50521b0dab7325313ed5a3303f09a0692d76d19d

diff --git a/include/svtools/toolboxcontroller.hxx b/include/svtools/toolboxcontroller.hxx
index 8f4ad38..021fe41 100644
--- a/include/svtools/toolboxcontroller.hxx
+++ b/include/svtools/toolboxcontroller.hxx
@@ -51,13 +51,13 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
                           public ::com::sun::star::lang::XInitialization,
                           public ::com::sun::star::util::XUpdatable,
                           public ::com::sun::star::lang::XComponent,
-                          public ::comphelper::OMutexAndBroadcastHelper,//shizhoubo
-                          public ::comphelper::OPropertyContainer,//shizhoubo
-                          public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >,//shizhoubo
+                          public ::comphelper::OMutexAndBroadcastHelper,
+                          public ::comphelper::OPropertyContainer,
+                          public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >,
                           public ::cppu::OWeakObject
 {
     private:
-        sal_Bool  m_bSupportVisible; //shizhoubo
+        sal_Bool  m_bSupportVisible;
     public:
         ToolboxController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
                            const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
@@ -101,13 +101,13 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
         virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
-        // OPropertySetHelper //shizhoubo
+        // OPropertySetHelper
         virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue ) throw(com::sun::star::uno::Exception);
         virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& rConvertedValue, com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const com::sun::star::uno::Any& rValue) throw(com::sun::star::lang::IllegalArgumentException);
-        // XPropertySet //shizhoubo
+        // XPropertySet
         virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo>  SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-        // OPropertyArrayUsageHelper //shizhoubo
+        // OPropertyArrayUsageHelper
         virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
 
 
@@ -120,7 +120,7 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
 
     protected:
         bool getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox );
-        void setSupportVisibleProperty(sal_Bool bValue); //shizhoubo
+        void setSupportVisibleProperty(sal_Bool bValue);
         struct Listener
         {
             Listener( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) :
diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx
index 3722c4d..e66d7c5 100644
--- a/svtools/source/uno/toolboxcontroller.cxx
+++ b/svtools/source/uno/toolboxcontroller.cxx
@@ -185,7 +185,6 @@ throw ( Exception, RuntimeException )
     {
         SolarMutexGuard aSolarMutexGuard;
         m_bInitialized = sal_True;
-        //shizhoubo add
         m_bSupportVisible = sal_False;
         PropertyValue aPropValue;
         for ( int i = 0; i < aArguments.getLength(); i++ )
@@ -714,7 +713,6 @@ void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequ
 
 //
 //-------------------------------------------------------------------------
-// XPropertySet by shizhoubo
 com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >  SAL_CALL ToolboxController::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException)
 {
     Reference<XPropertySetInfo>  xInfo( createPropertySetInfo( getInfoHelper() ) );
@@ -725,7 +723,7 @@ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >  SAL_C
 {
         return *const_cast<ToolboxController*>(this)->getArrayHelper();
 }
-//OPropertyArrayUsageHelper by shizhoubo
+
 //------------------------------------------------------------------------------
 ::cppu::IPropertyArrayHelper* ToolboxController::createArrayHelper( ) const
 {
@@ -733,12 +731,12 @@ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >  SAL_C
         describeProperties(aProps);
         return new ::cppu::OPropertyArrayHelper(aProps);
 }
-//shizhoubo for supportsvisiable
+
 void ToolboxController::setSupportVisibleProperty(sal_Bool bValue)
 {
     m_bSupportVisible = bValue;
 }
-//OPropertySetHelper by shizhoubo
+
 sal_Bool SAL_CALL ToolboxController::convertFastPropertyValue( com::sun::star::uno::Any&    aConvertedValue ,
                                              com::sun::star::uno::Any&        aOldValue       ,
                                              sal_Int32                        nHandle         ,
commit f45183d26f45d1e19a474e24e6c9c530808ca35d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Feb 12 10:47:43 2014 +0100

    Unwind comphelper::OPropertyContainer_Base typedef
    
    Change-Id: Ied87e18f8297fb8e85fdbcab38d719664e3ed066

diff --git a/comphelper/source/property/propertycontainer.cxx b/comphelper/source/property/propertycontainer.cxx
index a322ff1..98e9439 100644
--- a/comphelper/source/property/propertycontainer.cxx
+++ b/comphelper/source/property/propertycontainer.cxx
@@ -42,7 +42,7 @@ using namespace ::com::sun::star::beans;
 //==========================================================================
 //--------------------------------------------------------------------------
 OPropertyContainer::OPropertyContainer(::cppu::OBroadcastHelper& _rBHelper)
-    :OPropertyContainer_Base(_rBHelper)
+    :OPropertySetHelper(_rBHelper)
 {
 }
 
@@ -66,7 +66,7 @@ Sequence< Type > SAL_CALL OPropertyContainer::getTypes() throw (RuntimeException
 //--------------------------------------------------------------------------
 void SAL_CALL OPropertyContainer::setFastPropertyValue( sal_Int32 nHandle, const Any& rValue ) throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
 {
-    OPropertyContainer_Base::setFastPropertyValue( nHandle, rValue );
+    OPropertySetHelper::setFastPropertyValue( nHandle, rValue );
 }
 
 //--------------------------------------------------------------------------
diff --git a/include/comphelper/propertycontainer.hxx b/include/comphelper/propertycontainer.hxx
index a594b71..9070a694 100644
--- a/include/comphelper/propertycontainer.hxx
+++ b/include/comphelper/propertycontainer.hxx
@@ -30,10 +30,6 @@ namespace comphelper
 {
 //.........................................................................
 
-//==========================================================================
-//= OPropertyContainer
-//==========================================================================
-typedef ::cppu::OPropertySetHelper OPropertyContainer_Base;
 /** a OPropertySetHelper implementation which is just a simple container for properties represented
     by class members, usually in a derived class.
     <BR>
@@ -42,7 +38,7 @@ typedef ::cppu::OPropertySetHelper OPropertyContainer_Base;
     values which already have the correct type, it's unable to convert, for instance, a long to a short.
 */
 class COMPHELPER_DLLPUBLIC OPropertyContainer
-            :public OPropertyContainer_Base
+            :public cppu::OPropertySetHelper
             ,public OPropertyContainerHelper
 {
 public:
@@ -70,7 +66,7 @@ protected:
                             throw (::com::sun::star::uno::Exception,
                                    std::exception);
 
-    using OPropertyContainer_Base::getFastPropertyValue;
+    using OPropertySetHelper::getFastPropertyValue;
     virtual void SAL_CALL getFastPropertyValue(
                                 ::com::sun::star::uno::Any& rValue,
                                 sal_Int32 nHandle


More information about the Libreoffice-commits mailing list