diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2022-10-26 17:42:21 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2022-10-27 11:57:32 +0200 |
commit | 885fb902ce7765f04c98cebedf96959007cef05b (patch) | |
tree | 55e48812f2d211bbb97359d8b873048cff96c6ac /svx | |
parent | d5f25f2f78d3852967a6919e215308d129880cf1 (diff) |
tdf#146360 use correct data source to access object properties
For more and detailed info see comment in diff please.
Change-Id: I33d6d4fc46af7f6f854a2708e3ab932bbe6712f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141886
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape3d.cxx | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx index 3e8a495a7a3f..baaf37a4162c 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -26,6 +26,7 @@ #include <svx/svdobj.hxx> #include <svx/svdoashp.hxx> #include <svl/itemset.hxx> +#include <svl/whiter.hxx> #include <svx/xfillit0.hxx> #include <svx/xlineit0.hxx> #include <svx/xsflclit.hxx> @@ -275,6 +276,49 @@ rtl::Reference<SdrObject> EnhancedCustomShape3d::Create3DObject( SfxItemSet aSet( rSdrObjCustomShape.GetMergedItemSet() ); + // tdf#146360 If the ItemSet of the source SdrObject has a parent + // (which means it has a StyleSheet), we need to do some old-style + // 'BurnInStyleSheetAttributes' action. + // That means to set all Items which are set in the StyleSheet + // directly in the ItemSet. + // This is okay here since the 3D SdrObjects created are + // placeholders that get rendered, but never reach the + // surface/the user. If attributes for the source SdrObject + // change, these will be recreated. + // The problem is that while "aSet" still has a ptr to the style's + // ItemSet, this gets lost at the ItemSet of the SdrObject when + // an ItemSet gets set at the 3D SdrObject, like in diverse + // SetMergedItemSet calls below. This leads to fetching the wrong + // (default) FillBitmap in the calls p3DObj->GetMergedItem below + // (which is 32x32 white, that's what you see without the fix). + // This could also be fixed (tried it) by either + // - using rSdrObjCustomShape.GetMergedItem + // - setting the StyleSheet at 3D SdrObjects ASAP (done at caller) + // but both solutions contain the risk to not find all places, so + // it's just more safe to merge the StyleSheet attributes to the + // ItemSet used for the whole creation. + if(nullptr != aSet.GetParent()) + { + SfxWhichIter aIter(aSet); + sal_uInt16 nWhich(aIter.FirstWhich()); + const SfxPoolItem *pItem(nullptr); + + while(nWhich) + { + // this may look at 1st look like doing nothing, but it converts + // items set in parent/style to SfxItemState::SET items in the + // ItemSet (see AttributeProperties::ForceStyleToHardAttributes()) + if(SfxItemState::SET == aSet.GetItemState(nWhich, true, &pItem)) + { + aSet.Put(*pItem); + } + + nWhich = aIter.NextWhich(); + } + + aSet.SetParent(nullptr); + } + //SJ: vertical writing is not required, by removing this item no outliner is created aSet.ClearItem( SDRATTR_TEXTDIRECTION ); |