summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-02-21 14:00:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-02-21 15:12:29 +0100
commitd39f886ea541f71a09d1d7140c77852b01c847f0 (patch)
tree506dfb5867bec821456e09593e38d9d7ac88859d
parente4aaf59f4801431d5bdd1aa6e18d2aa8eba39f1c (diff)
speed up SvxShape::_setPropertyValue
by using the Properties related code to create an SfxItemSet with the correct ranges, instead of creating an empty SfxItemSet and updating it. Shaves 2% off the load time of a large chart. Change-Id: Ia1f8527fa52ab5b8c70e13e1e2ab8c8f25739b2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130270 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/svx/sdr/properties/defaultproperties.hxx2
-rw-r--r--include/svx/sdr/properties/properties.hxx2
-rw-r--r--svx/inc/sdr/properties/emptyproperties.hxx3
-rw-r--r--svx/inc/sdr/properties/groupproperties.hxx3
-rw-r--r--svx/inc/sdr/properties/pageproperties.hxx3
-rw-r--r--svx/source/sdr/properties/emptyproperties.cxx6
-rw-r--r--svx/source/sdr/properties/groupproperties.cxx5
-rw-r--r--svx/source/sdr/properties/pageproperties.cxx5
-rw-r--r--svx/source/unodraw/unoshape.cxx6
9 files changed, 29 insertions, 6 deletions
diff --git a/include/svx/sdr/properties/defaultproperties.hxx b/include/svx/sdr/properties/defaultproperties.hxx
index 09999c0ad66b..bae37df2753a 100644
--- a/include/svx/sdr/properties/defaultproperties.hxx
+++ b/include/svx/sdr/properties/defaultproperties.hxx
@@ -41,7 +41,7 @@ namespace sdr::properties
mutable std::optional<SfxItemSet> mxItemSet;
// create a new object specific itemset with object specific ranges.
- virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool);
+ virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) override;
// Test changeability for a single item. If an implementation wants to prevent
// changing an item it should override this method.
diff --git a/include/svx/sdr/properties/properties.hxx b/include/svx/sdr/properties/properties.hxx
index e100e8e778c3..d793753c6a39 100644
--- a/include/svx/sdr/properties/properties.hxx
+++ b/include/svx/sdr/properties/properties.hxx
@@ -92,6 +92,8 @@ namespace sdr::properties
// destructor
virtual ~BaseProperties();
+ virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) = 0;
+
// Clone() operator, normally just calls the local copy constructor,
// see above.
virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const = 0;
diff --git a/svx/inc/sdr/properties/emptyproperties.hxx b/svx/inc/sdr/properties/emptyproperties.hxx
index 974bfd90a21d..f51c97a01ff9 100644
--- a/svx/inc/sdr/properties/emptyproperties.hxx
+++ b/svx/inc/sdr/properties/emptyproperties.hxx
@@ -39,6 +39,9 @@ namespace sdr::properties
// Clone() operator, normally just calls the local copy constructor
virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const override;
+ // create a new object specific itemset with object specific ranges.
+ virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) override;
+
// get itemset
virtual const SfxItemSet& GetObjectItemSet() const override;
diff --git a/svx/inc/sdr/properties/groupproperties.hxx b/svx/inc/sdr/properties/groupproperties.hxx
index a5798440f983..40e944eb572a 100644
--- a/svx/inc/sdr/properties/groupproperties.hxx
+++ b/svx/inc/sdr/properties/groupproperties.hxx
@@ -37,6 +37,9 @@ namespace sdr::properties
// destructor
virtual ~GroupProperties() override;
+ // create a new object specific itemset with object specific ranges.
+ virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) override;
+
// Clone() operator, normally just calls the local copy constructor
virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const override;
diff --git a/svx/inc/sdr/properties/pageproperties.hxx b/svx/inc/sdr/properties/pageproperties.hxx
index d0f633a80e16..acd1d919f24e 100644
--- a/svx/inc/sdr/properties/pageproperties.hxx
+++ b/svx/inc/sdr/properties/pageproperties.hxx
@@ -41,6 +41,9 @@ namespace sdr::properties
// destructor
virtual ~PageProperties() override;
+ // create a new object specific itemset with object specific ranges.
+ virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) override;
+
// Clone() operator, normally just calls the local copy constructor
virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const override;
diff --git a/svx/source/sdr/properties/emptyproperties.cxx b/svx/source/sdr/properties/emptyproperties.cxx
index d358955987f4..1cad150b22a7 100644
--- a/svx/source/sdr/properties/emptyproperties.cxx
+++ b/svx/source/sdr/properties/emptyproperties.cxx
@@ -42,6 +42,12 @@ namespace sdr::properties
abort();
}
+ SfxItemSet EmptyProperties::CreateObjectSpecificItemSet(SfxItemPool&)
+ {
+ assert(!"EmptyProperties::CreateObjectSpecificItemSet() should never be called");
+ abort();
+ }
+
void EmptyProperties::SetObjectItem(const SfxPoolItem& /*rItem*/)
{
assert(!"EmptyProperties::SetObjectItem() should never be called");
diff --git a/svx/source/sdr/properties/groupproperties.cxx b/svx/source/sdr/properties/groupproperties.cxx
index 011d252702e0..d0662d37f4e8 100644
--- a/svx/source/sdr/properties/groupproperties.cxx
+++ b/svx/source/sdr/properties/groupproperties.cxx
@@ -46,6 +46,11 @@ namespace sdr::properties
return std::unique_ptr<BaseProperties>(new GroupProperties(rObj));
}
+ SfxItemSet GroupProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return SfxItemSet(rPool);
+ }
+
const SfxItemSet& GroupProperties::GetObjectItemSet() const
{
assert(!"GroupProperties::GetObjectItemSet() should never be called");
diff --git a/svx/source/sdr/properties/pageproperties.cxx b/svx/source/sdr/properties/pageproperties.cxx
index fbbf212c85f1..af43229a1a63 100644
--- a/svx/source/sdr/properties/pageproperties.cxx
+++ b/svx/source/sdr/properties/pageproperties.cxx
@@ -47,6 +47,11 @@ namespace sdr::properties
return std::unique_ptr<BaseProperties>(new PageProperties(*this, rObj));
}
+ SfxItemSet PageProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return SfxItemSet(rPool);
+ }
+
// get itemset. Override here to allow creating the empty itemset
// without asserting
const SfxItemSet& PageProperties::GetObjectItemSet() const
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 3936af09616e..86c2cb74af5f 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -1626,11 +1626,7 @@ void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any&
{
if( !mpImpl->mxItemSet )
{
- mpImpl->mxItemSet.emplace( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), pMap->nWID, pMap->nWID );
- }
- else
- {
- mpImpl->mxItemSet->MergeRange(pMap->nWID, pMap->nWID);
+ mpImpl->mxItemSet.emplace( GetSdrObject()->GetProperties().CreateObjectSpecificItemSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool() ) );
}
pSet = &*mpImpl->mxItemSet;
}