summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/source/export/drawingml.cxx7
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf112312_AutoFitForLegacyShapes.odtbin0 -> 11123 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx12
3 files changed, 18 insertions, 1 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index a5a44cc3e7fe..4adf7a9406b5 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2901,9 +2901,14 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin
if (GetDocumentType() == DOCUMENT_DOCX || GetDocumentType() == DOCUMENT_XLSX)
{
+ // tdf#112312: only custom shapes obey the TextAutoGrowHeight option
bool bTextAutoGrowHeight = false;
- if (GetProperty(rXPropSet, "TextAutoGrowHeight"))
+ uno::Reference<drawing::XShape> xShape(rXIface, uno::UNO_QUERY);
+ auto pSdrObjCustomShape = xShape.is() ? dynamic_cast<SdrObjCustomShape*>(GetSdrObjectFromXShape(xShape)) : nullptr;
+ if (pSdrObjCustomShape && GetProperty(rXPropSet, "TextAutoGrowHeight"))
+ {
mAny >>= bTextAutoGrowHeight;
+ }
mpFS->singleElementNS(XML_a, (bTextAutoGrowHeight ? XML_spAutoFit : XML_noAutofit));
}
if (GetDocumentType() == DOCUMENT_PPTX)
diff --git a/sw/qa/extras/ooxmlexport/data/tdf112312_AutoFitForLegacyShapes.odt b/sw/qa/extras/ooxmlexport/data/tdf112312_AutoFitForLegacyShapes.odt
new file mode 100644
index 000000000000..b5ccb356203e
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf112312_AutoFitForLegacyShapes.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index db5add6d8014..e89522670483 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -1269,6 +1269,18 @@ DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromRightMargin, "tdf133670_test
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2408), nAnchoredWidth);
}
+DECLARE_OOXMLEXPORT_TEST(testAutoFitForLegacyShapes, "tdf112312_AutoFitForLegacyShapes.odt")
+{
+ // tdf#112312: check if noAutoFit is used instead of spAutoFit even if the TextAutoGrowHeight is set
+ xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
+ if (!pXmlDocument)
+ return;
+ assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+ "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:bodyPr/a:noAutofit");
+ assertXPathNoAttribute(pXmlDocument, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+ "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:bodyPr", "a:spAutofit");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */