[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - oox/source sw/qa
Regényi Balázs (via logerrit)
logerrit at kemper.freedesktop.org
Sun Sep 13 19:47:02 UTC 2020
oox/source/export/drawingml.cxx | 7 +++++
sw/qa/extras/ooxmlexport/data/tdf112312_AutoFitForLegacyShapes.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 12 ++++++++++
3 files changed, 18 insertions(+), 1 deletion(-)
New commits:
commit 162d7d3ba448f5b53d4ca8b70b22a298e8ea2166
Author: Regényi Balázs <regenyi.balazs+gerrit at gmail.com>
AuthorDate: Thu Jun 25 15:15:46 2020 +0200
Commit: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Sun Sep 13 21:46:27 2020 +0200
tdf#112312 DOCX legacy shape export: keep fixed size
Classical/legacy shapes lost their fixed size when exporting them with the
option "Resize shape to fit text" because they do not have the ability to
resize to content.
Co-authored-by: Szabolcs Tóth
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97127
Tested-by: Jenkins
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit cab956c480eb4f619580285c7b9a15b9e6d9b780)
Change-Id: Idd84dea040f9607d0d498e591601a8648a605a2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102569
Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 9ef07ec5ef5d..b80b33134566 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2831,9 +2831,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
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf112312_AutoFitForLegacyShapes.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index c9833e045f0a..ea46e10deac7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -1244,6 +1244,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
+ xmlDocPtr 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: */
More information about the Libreoffice-commits
mailing list