summaryrefslogtreecommitdiff
path: root/sc
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 /sc
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 'sc')
-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
4 files changed, 25 insertions, 13 deletions
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