summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2011-08-13 01:04:26 -0400
committerKohei Yoshida <kohei.yoshida@suse.com>2011-08-16 21:22:43 -0400
commit80b1e662777100a7dfd80176a2b528880a838167 (patch)
treefe39ee8773de6282e6e2b468b815eadf4fc7ddca /cppuhelper
parentd2e538a63507aa3310a854d5c1414565efa3a361 (diff)
Added XPropertySet2 to allow disabling of change event notifications.
Sometimes broadcasting changes to the property set on every new value insertion makes no sense especially during import. Turning that off also improves performance especially when inserting millions of property values.
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/inc/cppuhelper/propshlp.hxx11
-rw-r--r--cppuhelper/source/gcc3.map5
-rwxr-xr-xcppuhelper/source/makefile.mk3
-rw-r--r--cppuhelper/source/propshlp.cxx13
4 files changed, 29 insertions, 3 deletions
diff --git a/cppuhelper/inc/cppuhelper/propshlp.hxx b/cppuhelper/inc/cppuhelper/propshlp.hxx
index 89a2fa7dc72f..779eda28fced 100644
--- a/cppuhelper/inc/cppuhelper/propshlp.hxx
+++ b/cppuhelper/inc/cppuhelper/propshlp.hxx
@@ -33,7 +33,7 @@
#include <cppuhelper/interfacecontainer.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySet2.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/beans/XFastPropertySet.hpp>
@@ -350,7 +350,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::XPropertySet2
{
public:
/**
@@ -503,6 +503,11 @@ public:
const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > & Listener )
throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet2
+ 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.
*/
@@ -630,6 +635,8 @@ protected:
*/
OMultiTypeInterfaceContainerHelperInt32 aVetoableLC;
+ bool m_bFireEvent;
+
class Impl;
/** reserved for future use. finally, the future has arrived...
diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map
index 24f4efea5c3d..fd5877bf7bfe 100644
--- a/cppuhelper/source/gcc3.map
+++ b/cppuhelper/source/gcc3.map
@@ -390,3 +390,8 @@ UDK_3.7 { # OOo 3.4
_ZN4cppu18OPropertySetHelper29setDependentFastPropertyValueE?RKN3com3sun4star3uno3AnyE;
} UDK_3.6;
+UDK_3.8 { # LibO 3.5
+global:
+ _ZN4cppu18OPropertySetHelper32enableChangeListenerNotificationEh;
+ _ZThn*_N4cppu18OPropertySetHelper32enableChangeListenerNotificationEh;
+} UDK_3.7;
diff --git a/cppuhelper/source/makefile.mk b/cppuhelper/source/makefile.mk
index f10548282c18..a12a537fdb00 100755
--- a/cppuhelper/source/makefile.mk
+++ b/cppuhelper/source/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -61,6 +61,7 @@ UNOTYPES= \
com.sun.star.beans.XMultiPropertySet \
com.sun.star.beans.XPropertyAccess \
com.sun.star.beans.XPropertySet \
+ com.sun.star.beans.XPropertySet2 \
com.sun.star.bridge.UnoUrlResolver \
com.sun.star.bridge.XUnoUrlResolver \
com.sun.star.connection.SocketPermission \
diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx
index 27d18ad26075..7cb259708d94 100644
--- a/cppuhelper/source/propshlp.cxx
+++ b/cppuhelper/source/propshlp.cxx
@@ -173,6 +173,7 @@ OPropertySetHelper::OPropertySetHelper(
: rBHelper( rBHelper_ ),
aBoundLC( rBHelper_.rMutex ),
aVetoableLC( rBHelper_.rMutex ),
+ m_bFireEvent(true),
m_pReserved( new Impl(false, 0) )
{
}
@@ -182,6 +183,7 @@ OPropertySetHelper::OPropertySetHelper(
: rBHelper( rBHelper_ ),
aBoundLC( rBHelper_.rMutex ),
aVetoableLC( rBHelper_.rMutex ),
+ m_bFireEvent(true),
m_pReserved( new Impl( bIgnoreRuntimeExceptionsWhileFiring, 0 ) )
{
}
@@ -192,6 +194,7 @@ OPropertySetHelper::OPropertySetHelper(
: rBHelper( rBHelper_ ),
aBoundLC( rBHelper_.rMutex ),
aVetoableLC( rBHelper_.rMutex ),
+ m_bFireEvent(true),
m_pReserved(
new Impl( bIgnoreRuntimeExceptionsWhileFiring, i_pFireEvents) )
{
@@ -215,6 +218,7 @@ Any OPropertySetHelper::queryInterface( const ::com::sun::star::uno::Type & rTyp
return ::cppu::queryInterface(
rType,
static_cast< XPropertySet * >( this ),
+ static_cast< XPropertySet2 * >( this ),
static_cast< XMultiPropertySet * >( this ),
static_cast< XFastPropertySet * >( this ) );
}
@@ -626,6 +630,9 @@ void OPropertySetHelper::fire
sal_Bool bVetoable
)
{
+ if (!m_bFireEvent)
+ return;
+
OSL_ENSURE( m_pReserved.get(), "No OPropertySetHelper::Impl" );
if (m_pReserved->m_pFireEvents) {
m_pReserved->m_pFireEvents->fireEvents(
@@ -1029,6 +1036,12 @@ void OPropertySetHelper::firePropertiesChangeEvent(
delete [] pHandles;
}
+void OPropertySetHelper::enableChangeListenerNotification( sal_Bool bEnable )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ m_bFireEvent = bEnable;
+}
+
#ifdef xdvnsdfln
// XPropertyState
PropertyState OPropertySetHelper::getPropertyState( const OUString& PropertyName )