Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


On Tue, Aug 23, 2011 at 07:37:06PM +0200, Stephan Bergmann wrote:

On Aug 23, 2011, at 5:00 PM, Lionel Elie Mamane wrote:


(...) I don't know what to do with queryInterface; since it is not
virtual, I cannot override it in OPropertySetHelper2. The best I
could come up with is something like (in
OPropertySetHelper):

queryInterface *is* virtual (inherited from
com::sun::star::uno::XInterface),

Ah yes, I was looking only at the class definition, and I forgot it is
inherited from the purely abstract interface class anyway...

So, that is solved cleanly.

Now, I face the .map files; there, I'd appreciate some help; I think
I've reverse-engineered enough of the GCC one to get a correct one (at
least, I could do a modicum of testing with GCC), but:

1) Someone that knows better than me should check.

2) for MSVC, I'm rather more disarmed; made some incomplete guesses.

You'll notice I remove:

 ?queryInterface@OPropertySetHelper@cppu@@W3AA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
 ?queryInterface@OPropertySetHelper@cppu@@W7AA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;

That's because those *look* like they are rests from a different
calling convention or something like that, since all other
queryInterface member functions (of the other classes) have only the
@UAA version insted of @W3AA and @W7AA. We shouldn't commit that hunk
until we confirm this is true :) (And it should be in a different git
commit than the rest anyway).

It also seems to me that the msvc_win32_x86_64.map is out of sync: it
has no UDK_3.7, nor UDK_3.8 section; this looks highly suspicious. If
someone is willing to take a look at it and fix it?

-- 
Lionel
diff --git a/comphelper/inc/comphelper/propstate.hxx b/comphelper/inc/comphelper/propstate.hxx
index 2c8f06f..b99f75f 100644
--- a/comphelper/inc/comphelper/propstate.hxx
+++ b/comphelper/inc/comphelper/propstate.hxx
@@ -54,11 +54,11 @@ namespace comphelper
     //= OPropertyStateHelper
     //==================================================================
     /// helper class for implementing property states
-    class COMPHELPER_DLLPUBLIC OPropertyStateHelper :public ::cppu::OPropertySetHelper
+    class COMPHELPER_DLLPUBLIC OPropertyStateHelper :public ::cppu::OPropertySetHelper2
                                                     ,public ::com::sun::star::beans::XPropertyState
     {
     public:
-        OPropertyStateHelper(::cppu::OBroadcastHelper& rBHlp):OPropertySetHelper(rBHlp) { }
+        OPropertyStateHelper(::cppu::OBroadcastHelper& rBHlp):OPropertySetHelper2(rBHlp) { }
         OPropertyStateHelper(::cppu::OBroadcastHelper& rBHlp,
                              ::cppu::IEventNotificationHook *i_pFireEvents);
 
diff --git a/comphelper/source/property/propstate.cxx b/comphelper/source/property/propstate.cxx
index ec621cb..3859f6a 100644
--- a/comphelper/source/property/propstate.cxx
+++ b/comphelper/source/property/propstate.cxx
@@ -57,7 +57,7 @@ namespace comphelper
     //---------------------------------------------------------------------
     ::com::sun::star::uno::Any SAL_CALL OPropertyStateHelper::queryInterface(const  
::com::sun::star::uno::Type& _rType) throw( ::com::sun::star::uno::RuntimeException)
     {
-        ::com::sun::star::uno::Any aReturn = OPropertySetHelper::queryInterface(_rType);
+        ::com::sun::star::uno::Any aReturn = OPropertySetHelper2::queryInterface(_rType);
         // our own ifaces
         if ( !aReturn.hasValue() )
             aReturn = ::cppu::queryInterface(_rType, static_cast< 
::com::sun::star::beans::XPropertyState*>(this));
@@ -82,7 +82,7 @@ namespace comphelper
     OPropertyStateHelper::OPropertyStateHelper(
         ::cppu::OBroadcastHelper& rBHlp,
         ::cppu::IEventNotificationHook *i_pFireEvents)
-        :   ::cppu::OPropertySetHelper(rBHlp, i_pFireEvents) { }
+        :   ::cppu::OPropertySetHelper2(rBHlp, i_pFireEvents) { }
 
     OPropertyStateHelper::~OPropertyStateHelper() {}
 
diff --git a/cppuhelper/inc/cppuhelper/propshlp.hxx b/cppuhelper/inc/cppuhelper/propshlp.hxx
index 670ce03..737aec9 100644
--- a/cppuhelper/inc/cppuhelper/propshlp.hxx
+++ b/cppuhelper/inc/cppuhelper/propshlp.hxx
@@ -351,8 +351,7 @@ public:
  */
 class OPropertySetHelper : public ::com::sun::star::beans::XMultiPropertySet,
                            public ::com::sun::star::beans::XFastPropertySet,
-                           public ::com::sun::star::beans::XPropertySet,
-                           public ::com::sun::star::beans::XPropertySetOption
+                           public ::com::sun::star::beans::XPropertySet
 {
 public:
     /**
@@ -412,7 +411,7 @@ public:
        Only returns a reference to XMultiPropertySet, XFastPropertySet, XPropertySet and
        XEventListener.
      */
-    ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
+    virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type 
& rType )
         throw (::com::sun::star::uno::RuntimeException);
 
     /** eases implementing XTypeProvider::getTypes, returns the types of XMultiPropertySet, 
XFastPropertySet, XPropertySet
@@ -506,10 +505,6 @@ public:
         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener 
& Listener )
         throw(::com::sun::star::uno::RuntimeException);
 
-    // XPropertySetOption
-    virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable )
-        throw(::com::sun::star::uno::RuntimeException);
-
     /**
        The property sequence is created in the call. The interface isn't used after the call.
      */
@@ -637,8 +632,6 @@ protected:
      */
     OMultiTypeInterfaceContainerHelperInt32 aVetoableLC;
 
-    bool m_bFireEvent;
-
     class Impl;
 
     /** reserved for future use. finally, the future has arrived...
@@ -676,6 +669,106 @@ public:
 #pragma warning(pop)
 #endif
 
+/**
+   OPropertySetHelper plus XPropertySetOption
+ */
+class OPropertySetHelper2 : public OPropertySetHelper,
+                            public ::com::sun::star::beans::XPropertySetOption
+{
+public:
+    /**
+       @param rBHelper  this structure contains the basic members of
+                          a broadcaster.
+                          The lifetime must be longer than the lifetime
+                          of this object. Stored in the variable rBHelper.
+     */
+    OPropertySetHelper2( OBroadcastHelper & rBHelper ) SAL_THROW( () )
+    :OPropertySetHelper( rBHelper )
+    {
+    };
+
+    /** Constructor.
+
+        @param rBHelper
+                        this structure contains the basic members of
+                        a broadcaster.
+                          The lifetime must be longer than the lifetime
+                          of this object. Stored in the variable rBHelper.
+
+        @param bIgnoreRuntimeExceptionsWhileFiring
+                        indicates whether occuring RuntimeExceptions will be
+                        ignored when firing notifications (vetoableChange((),
+                        propertyChange()) to listeners.
+                        PropertyVetoExceptions may still be thrown.
+                        This flag is useful in a inter-process scenarios when
+                        remote bridges may break down
+                        (firing DisposedExceptions).
+    */
+    OPropertySetHelper2(
+        OBroadcastHelper & rBHelper, bool bIgnoreRuntimeExceptionsWhileFiring )
+            :OPropertySetHelper( rBHelper,  bIgnoreRuntimeExceptionsWhileFiring )
+    {
+    };
+
+    /** Constructor.
+
+        @param rBHelper
+                        this structure contains the basic members of
+                        a broadcaster.
+                        The lifetime must be longer than the lifetime
+                        of this object. Stored in the variable rBHelper.
+
+        @param i_pFireEvents
+                        additional event notifier
+
+        @param bIgnoreRuntimeExceptionsWhileFiring
+                        indicates whether occuring RuntimeExceptions will be
+                        ignored when firing notifications (vetoableChange((),
+                        propertyChange()) to listeners.
+                        PropertyVetoExceptions may still be thrown.
+                        This flag is useful in a inter-process scenarios when
+                        remote bridges may break down
+                        (firing DisposedExceptions).
+    */
+    OPropertySetHelper2(
+        OBroadcastHelper & rBHelper,
+        IEventNotificationHook *i_pFireEvents,
+        bool bIgnoreRuntimeExceptionsWhileFiring = false)
+            :OPropertySetHelper( rBHelper, i_pFireEvents, bIgnoreRuntimeExceptionsWhileFiring )
+    {
+    };
+
+    // XInterface
+    virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type 
& rType )
+        throw (::com::sun::star::uno::RuntimeException);
+
+    // XPropertySetOption
+    virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable )
+        throw(::com::sun::star::uno::RuntimeException);
+
+
+
+private:
+    OPropertySetHelper2( const OPropertySetHelper & ) SAL_THROW( () );
+    OPropertySetHelper2 &    operator = ( const OPropertySetHelper & ) SAL_THROW( () );
+
+public:
+// Suppress warning about virtual functions but non-virtual destructor:
+#if defined __GNUC__
+#pragma GCC system_header
+#elif defined _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4265)
+#endif
+    /**
+       You must call disposing before destruction.
+     */
+    ~OPropertySetHelper2() SAL_THROW( () );
+};
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+
 } // end namespace cppuhelper
 #endif  //
 
diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map
index fd5877bf..d833357 100644
--- a/cppuhelper/source/gcc3.map
+++ b/cppuhelper/source/gcc3.map
@@ -260,7 +260,6 @@ _ZThn*_N4cppu16OComponentHelper7releaseEv;
 _ZThn*_N4cppu18OPropertySetHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
 _ZThn*_N4cppu18OPropertySetHelper20getFastPropertyValueE?;
 _ZThn*_N4cppu18OPropertySetHelper20setFastPropertyValueE?RKN3com3sun4star3uno3AnyE;
-_ZThn*_N4cppu18OPropertySetHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
 _ZThn*_N4cppu18OPropertySetHelper16getPropertyValueERKN3rtl8OUStringE;
 _ZThn*_N4cppu18OPropertySetHelper16setPropertyValueERKN3rtl8OUStringERKN3com3sun4star3uno3AnyE;
 
_ZThn*_N4cppu18OPropertySetHelper25addPropertyChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XPropertyChangeListenerEEE;
@@ -392,6 +391,10 @@ UDK_3.7 { # OOo 3.4
 
 UDK_3.8 { # LibO 3.5
 global:
-        _ZN4cppu18OPropertySetHelper32enableChangeListenerNotificationEh;
-        _ZThn*_N4cppu18OPropertySetHelper32enableChangeListenerNotificationEh;
+       _ZTVN4cppu19OPropertySetHelper2E;
+       _ZN4cppu19OPropertySetHelper2D2Ev;
+       _ZN4cppu19OPropertySetHelper214queryInterfaceERKN3com3sun4star3uno4TypeE;
+       _ZThn*_N4cppu19OPropertySetHelper214queryInterfaceERKN3com3sun4star3uno4TypeE;
+        _ZN4cppu19OPropertySetHelper232enableChangeListenerNotificationEh;
+        _ZThn*_N4cppu19OPropertySetHelper232enableChangeListenerNotificationEh;
 } UDK_3.7;
diff --git a/cppuhelper/source/msvc_win32_intel.map b/cppuhelper/source/msvc_win32_intel.map
index bd30b1b..28e8afa 100644
--- a/cppuhelper/source/msvc_win32_intel.map
+++ b/cppuhelper/source/msvc_win32_intel.map
@@ -86,8 +86,6 @@ GetVersionInfo;
 ?hasPropertyByName@OPropertyArrayHelper@cppu@@UAAEABVOUString@rtl@@@Z;
 ?init@OPropertyArrayHelper@cppu@@AAEXE@Z;
 ?queryInterface@OPropertySetHelper@cppu@@UAA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
-?queryInterface@OPropertySetHelper@cppu@@W3AA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
-?queryInterface@OPropertySetHelper@cppu@@W7AA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
 
?removePropertiesChangeListener@OPropertySetHelper@cppu@@UAAXABV?$Reference@VXPropertiesChangeListener@beans@star@sun@com@@@uno@star@sun@com@@@Z;
 
?removePropertyChangeListener@OPropertySetHelper@cppu@@UAAXABVOUString@rtl@@ABV?$Reference@VXPropertyChangeListener@beans@star@sun@com@@@uno@star@sun@com@@@Z;
 
?removeVetoableChangeListener@OPropertySetHelper@cppu@@UAAXABVOUString@rtl@@ABV?$Reference@VXVetoableChangeListener@beans@star@sun@com@@@uno@star@sun@com@@@Z;
@@ -287,6 +285,7 @@ UDK_3.7 { # OOo 3.4
 
 UDK_3.8 { # LibO 3.5
     global:
-        ?enableChangeListenerNotification@OPropertySetHelper@cppu@@UAAXE@Z;
-        ??_7OPropertySetHelper@cppu@@6BXPropertySetOption@beans@star@sun@com@@@;
+       ?queryInterface@OPropertySetHelper@cppu@@UAA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
+        ?enableChangeListenerNotification@OPropertySetHelper2@cppu@@UAAXE@Z;
+        ??_7OPropertySetHelper2@cppu@@6BXPropertySetOption@beans@star@sun@com@@@;
 } UDK_3.7;
diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx
index 7878062..8cedaac 100644
--- a/cppuhelper/source/propshlp.cxx
+++ b/cppuhelper/source/propshlp.cxx
@@ -152,11 +152,13 @@ public:
             IEventNotificationHook *i_pFireEvents
         )
         :m_bIgnoreRuntimeExceptionsWhileFiring( i_bIgnoreRuntimeExceptionsWhileFiring )
+        ,m_bFireEvents(true)
         ,m_pFireEvents( i_pFireEvents )
     {
     }
 
     bool m_bIgnoreRuntimeExceptionsWhileFiring;
+    bool m_bFireEvents;
     class IEventNotificationHook * const m_pFireEvents;
 
     ::std::vector< sal_Int32 >  m_handles;
@@ -173,7 +175,6 @@ OPropertySetHelper::OPropertySetHelper(
     : rBHelper( rBHelper_ ),
       aBoundLC( rBHelper_.rMutex ),
       aVetoableLC( rBHelper_.rMutex ),
-      m_bFireEvent(true),
       m_pReserved( new Impl(false, 0) )
 {
 }
@@ -183,7 +184,6 @@ OPropertySetHelper::OPropertySetHelper(
     : rBHelper( rBHelper_ ),
       aBoundLC( rBHelper_.rMutex ),
       aVetoableLC( rBHelper_.rMutex ),
-      m_bFireEvent(true),
       m_pReserved( new Impl( bIgnoreRuntimeExceptionsWhileFiring, 0 ) )
 {
 }
@@ -194,7 +194,6 @@ OPropertySetHelper::OPropertySetHelper(
     : rBHelper( rBHelper_ ),
       aBoundLC( rBHelper_.rMutex ),
       aVetoableLC( rBHelper_.rMutex ),
-      m_bFireEvent(true),
       m_pReserved(
         new Impl( bIgnoreRuntimeExceptionsWhileFiring, i_pFireEvents) )
 {
@@ -206,23 +205,31 @@ OPropertySetHelper::OPropertySetHelper(
 OPropertySetHelper::~OPropertySetHelper() SAL_THROW( () )
 {
 }
+OPropertySetHelper2::~OPropertySetHelper2() SAL_THROW( () )
+{
+}
 
-/**
- * These method is called from queryInterface, if no delegator is set.
- * Otherwise this method is called from the delegator.
- */
-// XAggregation
+// XInterface
 Any OPropertySetHelper::queryInterface( const ::com::sun::star::uno::Type & rType )
     throw (RuntimeException)
 {
     return ::cppu::queryInterface(
         rType,
         static_cast< XPropertySet * >( this ),
-        static_cast< XPropertySetOption * >( this ),
         static_cast< XMultiPropertySet * >( this ),
         static_cast< XFastPropertySet * >( this ) );
 }
 
+Any OPropertySetHelper2::queryInterface( const ::com::sun::star::uno::Type & rType )
+    throw (RuntimeException)
+{
+    Any cnd(cppu::queryInterface(rType, static_cast< XPropertySetOption * >(this)));
+    if ( cnd.hasValue() )
+        return cnd;
+    else
+        return OPropertySetHelper::queryInterface(rType);
+}
+
 /**
  * called from the derivee's XTypeProvider::getTypes implementation
  */
@@ -631,10 +638,11 @@ void OPropertySetHelper::fire
     sal_Bool bVetoable
 )
 {
-    if (!m_bFireEvent)
+    OSL_ENSURE( m_pReserved.get(), "No OPropertySetHelper::Impl" );
+
+    if (! m_pReserved->m_bFireEvents)
         return;
 
-    OSL_ENSURE( m_pReserved.get(), "No OPropertySetHelper::Impl" );
     if (m_pReserved->m_pFireEvents) {
         m_pReserved->m_pFireEvents->fireEvents(
             pnHandles, nHandles, bVetoable,
@@ -1037,10 +1045,10 @@ void OPropertySetHelper::firePropertiesChangeEvent(
     delete [] pHandles;
 }
 
-void OPropertySetHelper::enableChangeListenerNotification( sal_Bool bEnable )
+void OPropertySetHelper2::enableChangeListenerNotification( sal_Bool bEnable )
     throw(::com::sun::star::uno::RuntimeException)
 {
-    m_bFireEvent = bEnable;
+    m_pReserved->m_bFireEvents = bEnable;
 }
 
 #ifdef xdvnsdfln

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.