summaryrefslogtreecommitdiff
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
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.
-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
-rw-r--r--sc/source/filter/excel/xiescher.cxx17
-rw-r--r--sc/source/filter/ftools/fapihelper.cxx11
-rw-r--r--sc/source/filter/inc/fapihelper.hxx2
-rw-r--r--sc/source/filter/inc/xiescher.hxx8
-rw-r--r--udkapi/UnoApi_udkapi.mk3
-rw-r--r--udkapi/com/sun/star/beans/XPropertySet2.idl18
-rw-r--r--vbahelper/source/msforms/vbacontrol.cxx2
11 files changed, 75 insertions, 18 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 )
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 9123142997f5..c6aa20a5a1f8 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -402,13 +402,13 @@ void XclImpDrawObjBase::SetDffData( const DffObjData& rDffObjData, const String&
mbAutoMargin = bAutoMargin;
}
-String XclImpDrawObjBase::GetObjName() const
+OUString XclImpDrawObjBase::GetObjName() const
{
/* #i51348# Always return a non-empty name. Create English
default names depending on the object type. This is not implemented as
virtual functions in derived classes, as class type and object type may
not match. */
- return (maObjName.Len() > 0) ? maObjName : GetObjectManager().GetDefaultObjName( *this );
+ return maObjName.isEmpty() ? GetObjectManager().GetDefaultObjName(*this) : maObjName;
}
const XclObjAnchor* XclImpDrawObjBase::GetAnchor() const
@@ -507,7 +507,7 @@ void XclImpDrawObjBase::PostProcessSdrObject( XclImpDffConverter& rDffConv, SdrO
void XclImpDrawObjBase::ReadName5( XclImpStream& rStrm, sal_uInt16 nNameLen )
{
- maObjName.Erase();
+ maObjName = rtl::OUString();
if( nNameLen > 0 )
{
// name length field is repeated before the name
@@ -1855,7 +1855,6 @@ void XclImpControlHelper::ProcessControl( const XclImpDrawObjBase& rDrawObj ) co
aPropSet.SetBoolProperty( CREATE_OUSTRING( "EnableVisible" ), rDrawObj.IsVisible() );
aPropSet.SetBoolProperty( CREATE_OUSTRING( "Printable" ), rDrawObj.IsPrintable() );
-
// virtual call for type specific processing
DoProcessControl( aPropSet );
}
@@ -2829,7 +2828,7 @@ void XclImpPictureObj::DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal
if( (rStrm.GetNextRecId() == EXC_ID3_IMGDATA) && rStrm.StartNextRecord() )
{
// page background is stored as hidden picture with name "__BkgndObj"
- if( IsHidden() && (GetObjName() == CREATE_STRING( "__BkgndObj" )) )
+ if (IsHidden() && (GetObjName().equalsAscii("__BkgndObj")))
GetPageSettings().ReadImgData( rStrm );
else
maGraphic = XclImpDrawing::ReadImgData( GetRoot(), rStrm );
@@ -2880,12 +2879,12 @@ SdrObject* XclImpPictureObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const
return xSdrObj.release();
}
-String XclImpPictureObj::GetObjName() const
+OUString XclImpPictureObj::GetObjName() const
{
if( IsOcxControl() )
{
- String sName( GetObjectManager().GetOleNameOverride( GetTab(), GetObjId() ) );
- if ( sName.Len() > 0 )
+ OUString sName( GetObjectManager().GetOleNameOverride( GetTab(), GetObjId() ) );
+ if (!sName.isEmpty())
return sName;
}
return XclImpDrawObjBase::GetObjName();
@@ -4167,7 +4166,7 @@ void XclImpObjectManager::ConvertObjects()
// instead use InterpretDirtyCells in ScDocument::CalcAfterLoad.
}
-String XclImpObjectManager::GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const
+OUString XclImpObjectManager::GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const
{
String aDefName;
DefObjNameMap::const_iterator aIt = maDefObjNames.find( rDrawObj.GetObjType() );
diff --git a/sc/source/filter/ftools/fapihelper.cxx b/sc/source/filter/ftools/fapihelper.cxx
index 7aa04dcbadf4..23caa369faa8 100644
--- a/sc/source/filter/ftools/fapihelper.cxx
+++ b/sc/source/filter/ftools/fapihelper.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/lang/XServiceName.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XPropertySet2.hpp>
#include <comphelper/docpasswordhelper.hxx>
#include <comphelper/processfactory.hxx>
#include <tools/urlobj.hxx>
@@ -166,10 +167,20 @@ uno::Sequence< beans::NamedValue > ScfApiHelper::QueryEncryptionDataForMedium( S
// Property sets ==============================================================
+ScfPropertySet::~ScfPropertySet()
+{
+ Reference<beans::XPropertySet2> xPropSet2(mxPropSet, UNO_QUERY);
+ if (xPropSet2.is())
+ xPropSet2->enableChangeListenerNotification(true);
+}
+
void ScfPropertySet::Set( Reference< XPropertySet > xPropSet )
{
mxPropSet = xPropSet;
mxMultiPropSet.set( mxPropSet, UNO_QUERY );
+ Reference<beans::XPropertySet2> xPropSet2(mxPropSet, UNO_QUERY);
+ if (xPropSet2.is())
+ xPropSet2->enableChangeListenerNotification(false);
}
OUString ScfPropertySet::GetServiceName() const
diff --git a/sc/source/filter/inc/fapihelper.hxx b/sc/source/filter/inc/fapihelper.hxx
index a33d411e19bb..f8a338f959b3 100644
--- a/sc/source/filter/inc/fapihelper.hxx
+++ b/sc/source/filter/inc/fapihelper.hxx
@@ -152,6 +152,8 @@ public:
template< typename InterfaceType >
inline explicit ScfPropertySet( ::com::sun::star::uno::Reference< InterfaceType > xInterface ) { Set( xInterface ); }
+ ~ScfPropertySet();
+
/** Sets the passed UNO property set and releases the old UNO property set. */
void Set( XPropertySetRef xPropSet );
/** Queries the passed interface for an XPropertySet and releases the old UNO property set. */
diff --git a/sc/source/filter/inc/xiescher.hxx b/sc/source/filter/inc/xiescher.hxx
index c187e647bced..f1a9d2b27604 100644
--- a/sc/source/filter/inc/xiescher.hxx
+++ b/sc/source/filter/inc/xiescher.hxx
@@ -94,7 +94,7 @@ public:
/** Returns the Excel object type from OBJ record. */
inline sal_uInt16 GetObjType() const { return mnObjType; }
/** Returns the name of this object, may generate a default name. */
- virtual String GetObjName() const;
+ virtual rtl::OUString GetObjName() const;
/** Returns associated macro name, if set, otherwise zero length string. */
inline const String& GetMacroName() const { return maMacroName; }
@@ -192,7 +192,7 @@ private:
sal_uInt16 mnObjType; /// The Excel object type from OBJ record.
sal_uInt32 mnDffShapeId; /// Shape ID from DFF stream.
sal_uInt32 mnDffFlags; /// Shape flags from DFF stream.
- String maObjName; /// Name of the object.
+ rtl::OUString maObjName; /// Name of the object.
String maMacroName; /// Name of an attached macro.
String maHyperlink; /// On-click hyperlink URL.
bool mbHasAnchor; /// true = maAnchor is initialized.
@@ -868,7 +868,7 @@ class XclImpPictureObj : public XclImpRectObj, public XclImpControlHelper
public:
explicit XclImpPictureObj( const XclImpRoot& rRoot );
/** Returns the ObjectName - can use non-obvious lookup for override in the associated vba document module stream**/
- virtual String GetObjName() const;
+ virtual rtl::OUString GetObjName() const;
/** Returns the graphic imported from the IMGDATA record. */
inline const Graphic& GetGraphic() const { return maGraphic; }
@@ -1224,7 +1224,7 @@ public:
void ConvertObjects();
/** Returns the default name for the passed object. */
- String GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const;
+ rtl::OUString GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const;
/** Returns the used area in the sheet with the passed index. */
ScRange GetUsedArea( SCTAB nScTab ) const;
/** Sets the container to receive overridden shape/ctrl names from
diff --git a/udkapi/UnoApi_udkapi.mk b/udkapi/UnoApi_udkapi.mk
index 733e20c32faf..8a57118ae6f1 100644
--- a/udkapi/UnoApi_udkapi.mk
+++ b/udkapi/UnoApi_udkapi.mk
@@ -2,7 +2,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
@@ -159,6 +159,7 @@ $(eval $(call gb_UnoApiTarget_add_idlfiles,udkapi,\
udkapi/com/sun/star/beans/XPropertyChangeListener \
udkapi/com/sun/star/beans/XPropertyContainer \
udkapi/com/sun/star/beans/XPropertySet \
+ udkapi/com/sun/star/beans/XPropertySet2 \
udkapi/com/sun/star/beans/XPropertySetInfo \
udkapi/com/sun/star/beans/XPropertySetInfoChangeListener \
udkapi/com/sun/star/beans/XPropertySetInfoChangeNotifier \
diff --git a/udkapi/com/sun/star/beans/XPropertySet2.idl b/udkapi/com/sun/star/beans/XPropertySet2.idl
new file mode 100644
index 000000000000..e4868bfac808
--- /dev/null
+++ b/udkapi/com/sun/star/beans/XPropertySet2.idl
@@ -0,0 +1,18 @@
+
+#ifndef __com_sun_star_beans_XPropertySet2_idl__
+#define __com_sun_star_beans_XPropertySet2_idl__
+
+#include <com/sun/star/beans/XPropertySet.idl>
+
+module com { module sun { module star { module beans {
+
+interface XPropertySet2: com::sun::star::beans::XPropertySet
+{
+ void enableChangeListenerNotification( [in] boolean bEnable );
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index 8bebe6050d44..c7e2c6ed3641 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -449,7 +449,7 @@ void ScVbaControl::fireEvent( script::ScriptEvent& evt )
uno::Reference< lang::XMultiServiceFactory > xDocFac( m_xModel, uno::UNO_QUERY_THROW );
uno::Reference< document::XCodeNameQuery > xNameQuery( xDocFac->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VBACodeNameProvider")) ), uno::UNO_QUERY_THROW );
uno::Reference< uno::XInterface > xIf( xControlShape->getControl(), uno::UNO_QUERY_THROW );
- evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf );
+ evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf, xIf ); // TODO : FIX THIS!!!
evt.Arguments[ 0 ] = uno::makeAny( aEvt );
xScriptListener->firing( evt );
}