summaryrefslogtreecommitdiff
path: root/sd
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 /sd
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 'sd')
-rw-r--r--sd/qa/unit/export-tests-ooxml1.cxx6
-rw-r--r--sd/source/ui/unoidl/unopback.cxx10
-rw-r--r--sd/source/ui/unoidl/unopback.hxx2
3 files changed, 10 insertions, 8 deletions
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index b191cc62ee76..e2a3f04d2467 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -371,7 +371,7 @@ void SdOOXMLExportTest1::testBnc870233_2()
{
const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(0));
CPPUNIT_ASSERT(pObjGroup);
- const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->GetObj(0));
+ const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->GetObj(1));
checkFontAttributes<Color, SvxColorItem>(pObj, Color(0x0000ff), EE_CHAR_COLOR);
}
@@ -379,7 +379,7 @@ void SdOOXMLExportTest1::testBnc870233_2()
{
const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(1));
CPPUNIT_ASSERT(pObjGroup);
- const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->GetObj(0));
+ const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->GetObj(1));
checkFontAttributes<Color, SvxColorItem>( pObj, Color(0x1F497D), EE_CHAR_COLOR );
}
@@ -387,7 +387,7 @@ void SdOOXMLExportTest1::testBnc870233_2()
{
const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(2));
CPPUNIT_ASSERT(pObjGroup);
- const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->GetObj(0));
+ const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->GetObj(1));
checkFontAttributes<Color, SvxColorItem>(pObj, Color(0xffffff), EE_CHAR_COLOR);
}
diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx
index 646f6db0cb44..5f3911edaf0b 100644
--- a/sd/source/ui/unoidl/unopback.cxx
+++ b/sd/source/ui/unoidl/unopback.cxx
@@ -98,11 +98,11 @@ void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet )
mpSet = std::make_unique<SfxItemSet>( *rSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST> );
- if( mpPropSet->AreThereOwnUsrAnys() )
+ if( maUsrAnys.AreThereOwnUsrAnys() )
{
for( const auto pProp : mpPropSet->getPropertyMap().getPropertyEntries() )
{
- uno::Any* pAny = mpPropSet->GetUsrAnyForID( *pProp );
+ uno::Any* pAny = maUsrAnys.GetUsrAnyForID( *pProp );
if( pAny )
{
const OUString & aPropertyName = pProp->aName;
@@ -235,7 +235,7 @@ void SAL_CALL SdUnoPageBackground::setPropertyValue( const OUString& aPropertyNa
else
{
if(pEntry->nWID)
- mpPropSet->setPropertyValue( pEntry, aValue );
+ SvxItemPropertySet::setPropertyValue( pEntry, aValue, maUsrAnys );
}
}
@@ -284,7 +284,7 @@ uno::Any SAL_CALL SdUnoPageBackground::getPropertyValue( const OUString& Propert
else
{
if(pEntry->nWID)
- aAny = mpPropSet->getPropertyValue( pEntry );
+ aAny = mpPropSet->getPropertyValue( pEntry, maUsrAnys );
}
return aAny;
}
@@ -333,7 +333,7 @@ beans::PropertyState SAL_CALL SdUnoPageBackground::getPropertyState( const OUStr
}
else
{
- if( nullptr == mpPropSet->GetUsrAnyForID(*pEntry) )
+ if( nullptr == maUsrAnys.GetUsrAnyForID(*pEntry) )
return beans::PropertyState_DEFAULT_VALUE;
else
return beans::PropertyState_DIRECT_VALUE;
diff --git a/sd/source/ui/unoidl/unopback.hxx b/sd/source/ui/unoidl/unopback.hxx
index cf7bc235773c..c70cc2fea4eb 100644
--- a/sd/source/ui/unoidl/unopback.hxx
+++ b/sd/source/ui/unoidl/unopback.hxx
@@ -31,6 +31,7 @@
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/implbase.hxx>
+#include <editeng/unoipset.hxx>
class SdDrawDocument;
class SdrModel;
@@ -48,6 +49,7 @@ class SdUnoPageBackground final : public ::cppu::WeakImplHelper<
public SfxListener
{
const SvxItemPropertySet* mpPropSet;
+ SvxItemPropertySetUsrAnys maUsrAnys;
std::unique_ptr<SfxItemSet> mpSet;
SdrModel* mpDoc;