summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-08-25 08:42:39 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-08-25 18:11:43 +0200
commitc6f25506b02fbd2a087b7e790283921bf8550206 (patch)
treeddf8257b16946884e42b857f3f3661c910e1a529 /svx
parent8befed1f019061cd0b0ef06f6b717f5bc77afdee (diff)
i#114206 sd: unshare shape properties for the same type before insertion
Regression from commit 9bd99c08e8662becdd5ac8b47ef6f953c14e65fc (CWS-TOOLING: integrate CWS os128, 2009-06-03), the problem was that the SvxItemPropertySet was both used to store a property map (information about UNO properties) and also as a descriptor for a not yet inserted shape. The above commit improved performance by sharing a single instance of an SvxItemPropertySet for the same shape types: this works for the property map, but doing the same for property values is problematic. In practice, this eliminates the need for a workaround in oox/, the user-visible problem was that loading a document with smartart, then loading a document with group shapes (but without smartart) and saving it would copy information from the first, closed document (!) to the second document. Just removing the oox/ workaround would make make -C oox -sr CppunitTest_oox_drawingml CPPUNIT_TEST_NAME="testGroupShapeSmartArt testTdf131082" fail, unsharing the descriptor piece makes it pass again. Change-Id: Icdff2108ad0da18ce0ade081b1938dd74bc0ae90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120996 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'svx')
-rw-r--r--svx/source/unodraw/unoshape.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index a6ba615358ed..83e2eeb5304c 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -580,10 +580,10 @@ void SvxShape::ForceMetricTo100th_mm(basegfx::B2DHomMatrix& rB2DHomMatrix) const
}
}
-static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet,
+static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet, SvxItemPropertySetUsrAnys& rAnys,
SfxItemSet& rSet, const uno::Reference< beans::XPropertySet >& xSet, const SfxItemPropertyMap* pMap )
{
- if(!rPropSet.AreThereOwnUsrAnys())
+ if(!rAnys.AreThereOwnUsrAnys())
return;
const SfxItemPropertyMap& rSrc = rPropSet.getPropertyMap();
@@ -593,7 +593,7 @@ static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemProper
const sal_uInt16 nWID = pSrcProp->nWID;
if(SfxItemPool::IsWhich(nWID)
&& (nWID < OWN_ATTR_VALUE_START || nWID > OWN_ATTR_VALUE_END)
- && rPropSet.GetUsrAnyForID(*pSrcProp))
+ && rAnys.GetUsrAnyForID(*pSrcProp))
rSet.Put(rSet.GetPool()->GetDefaultItem(nWID));
}
@@ -601,7 +601,7 @@ static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemProper
{
if(pSrcProp->nWID)
{
- uno::Any* pUsrAny = rPropSet.GetUsrAnyForID(*pSrcProp);
+ uno::Any* pUsrAny = rAnys.GetUsrAnyForID(*pSrcProp);
if(pUsrAny)
{
// search for equivalent entry in pDst
@@ -623,18 +623,18 @@ static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemProper
}
}
}
- const_cast< SvxItemPropertySet& >(rPropSet).ClearAllUsrAny();
+ rAnys.ClearAllUsrAny();
}
void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet)
{
DBG_TESTSOLARMUTEX();
- if(HasSdrObject() && rPropSet.AreThereOwnUsrAnys())
+ if(HasSdrObject() && maUrsAnys.AreThereOwnUsrAnys())
{
SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), svl::Items<SDRATTR_START, SDRATTR_END>);
Reference< beans::XPropertySet > xShape(this);
- SvxItemPropertySet_ObtainSettingsFromPropertySet(rPropSet, aSet, xShape, &mpPropSet->getPropertyMap() );
+ SvxItemPropertySet_ObtainSettingsFromPropertySet(rPropSet, maUrsAnys, aSet, xShape, &mpPropSet->getPropertyMap() );
GetSdrObject()->SetMergedItemSetAndBroadcast(aSet);
@@ -1591,7 +1591,7 @@ void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any&
// support additional properties that we don't know here we
// silently store *all* properties, even if they may be not
// supported after creation.
- mpPropSet->setPropertyValue( pMap, rVal );
+ SvxItemPropertySet::setPropertyValue( pMap, rVal, maUrsAnys );
}
return;
@@ -1762,7 +1762,7 @@ uno::Any SvxShape::_getPropertyValue( const OUString& PropertyName )
if(pMap && pMap->nWID)
// FixMe: see setPropertyValue
- aAny = mpPropSet->getPropertyValue( pMap );
+ aAny = mpPropSet->getPropertyValue( pMap, maUrsAnys );
}
return aAny;