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>
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
BIN
sd/qa/unit/data/pptx/tdf160487.pptx
Normal file
BIN
sd/qa/unit/data/pptx/tdf160487.pptx
Normal file
Binary file not shown.
@@ -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<beans::XPropertySet> 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: */
|
||||
|
Reference in New Issue
Block a user