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& 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(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)); } diff --git a/sd/qa/unit/data/pptx/tdf160487.pptx b/sd/qa/unit/data/pptx/tdf160487.pptx new file mode 100644 index 000000000000..ac0f3fb553d1 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf160487.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml4.cxx b/sd/qa/unit/export-tests-ooxml4.cxx index 9513b3ae5e61..55f1b5d5de2d 100644 --- a/sd/qa/unit/export-tests-ooxml4.cxx +++ b/sd/qa/unit/export-tests-ooxml4.cxx @@ -1263,6 +1263,16 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf163483_export_math_fallback) "id", cNvPr_id); } +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testPlaceHolderFitHeightToText) +{ + createSdImpressDoc("pptx/tdf160487.pptx"); + saveAndReload(u"Impress Office Open XML"_ustr); + uno::Reference xShape(getShapeFromPage(1, 0)); + bool bTextAutoGrowHeight = false; + xShape->getPropertyValue(u"TextAutoGrowHeight"_ustr) >>= bTextAutoGrowHeight; + CPPUNIT_ASSERT_MESSAGE("PlaceHolder Fit height to text should be true.", bTextAutoGrowHeight); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */