diff options
author | Balazs Varga <balazs.varga.extern@allotropia.de> | 2024-12-04 14:09:25 +0100 |
---|---|---|
committer | Balazs Varga <balazs.varga.extern@allotropia.de> | 2024-12-05 09:05:46 +0100 |
commit | 293d03e6803be57af7a3948e358e7ed9f8545c13 (patch) | |
tree | 42176cb45e7ac70b958c6189ff2e2aaa16481c16 /oox/source | |
parent | 9b4cbd876b5eba07bfb00bc4eeef1b179b37fbb6 (diff) |
tdf#160487 - PPTX export: fix "Fit height to text"
attribute of drawing objects (placeholders)
Export spAutoFit attribute correctly to ooxml.
Change-Id: I57e5b21bd6c407bdb5d1b36b3c3674249fbd2f59
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177798
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/export/drawingml.cxx | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 18334ad0516a..d3bc81b08b26 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -4305,9 +4305,27 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo } else { - // tdf#127030: Only custom shapes obey the TextAutoGrowHeight option. + bool bAutoGrowHeightEnabled = false; + const SdrObject* pObj = xShape.is() ? SdrObject::getSdrObjectFromXShape(xShape) : nullptr; + if (pObj) + { + switch (pObj->GetObjIdentifier()) + { + case SdrObjKind::NONE: + case SdrObjKind::Text: + case SdrObjKind::TitleText: + case SdrObjKind::OutlineText: + case SdrObjKind::Caption: + case SdrObjKind::CustomShape: + bAutoGrowHeightEnabled = true; + break; + default: + bAutoGrowHeightEnabled = false; + } + } + bool bTextAutoGrowHeight = false; - if (dynamic_cast<SvxCustomShape*>(rXIface.get()) && GetProperty(rXPropSet, u"TextAutoGrowHeight"_ustr)) + if (bAutoGrowHeightEnabled && GetProperty(rXPropSet, u"TextAutoGrowHeight"_ustr)) mAny >>= bTextAutoGrowHeight; mpFS->singleElementNS(XML_a, (bTextAutoGrowHeight ? XML_spAutoFit : XML_noAutofit)); } |