[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - oox/source sc/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 14 11:51:36 UTC 2018


 oox/source/export/drawingml.cxx            |    2 +-
 sc/qa/unit/data/xlsx/testShapeAutofit.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx      |   16 ++++++++++++++++
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 611cc1e609593ed849c760495990578606db7bfe
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Wed Aug 29 19:14:56 2018 +0200
Commit:     Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Fri Sep 14 13:51:11 2018 +0200

    tdf#119562 Fix export of AutoFit property of shapes to XLSX
    
    With this patch the "Resize shape to fit text" property
    (TextAutoGrowHeight) will be exported correctly to XLSX format.
    
    Change-Id: I488ceead452aef9096e7766f957de425c8486f85
    Reviewed-on: https://gerrit.libreoffice.org/59778
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/60304
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 38ff08740de8..eba1e3014f33 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2427,7 +2427,7 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin
             mpFS->singleElementNS(XML_a, XML_prstTxWarp, XML_prst, presetWarp.toUtf8().getStr(),
                 FSEND );
         }
-        if (GetDocumentType() == DOCUMENT_DOCX)
+        if (GetDocumentType() == DOCUMENT_DOCX || GetDocumentType() == DOCUMENT_XLSX)
         {
             bool bTextAutoGrowHeight = false;
             GET(bTextAutoGrowHeight, TextAutoGrowHeight);
diff --git a/sc/qa/unit/data/xlsx/testShapeAutofit.xlsx b/sc/qa/unit/data/xlsx/testShapeAutofit.xlsx
new file mode 100755
index 000000000000..d5742cd1c854
Binary files /dev/null and b/sc/qa/unit/data/xlsx/testShapeAutofit.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 42921737b08a..ea0792f5acee 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -184,6 +184,7 @@ public:
     void testTextUnderlineColorXLSX();
     void testSheetRunParagraphPropertyXLSX();
     void testHiddenShapeXLSX();
+    void testShapeAutofitXLSX();
     void testHyperlinkXLSX();
     void testMoveCellAnchoredShapesODS();
     void testMatrixMultiplicationXLSX();
@@ -295,6 +296,7 @@ public:
     CPPUNIT_TEST(testTextUnderlineColorXLSX);
     CPPUNIT_TEST(testSheetRunParagraphPropertyXLSX);
     CPPUNIT_TEST(testHiddenShapeXLSX);
+    CPPUNIT_TEST(testShapeAutofitXLSX);
     CPPUNIT_TEST(testHyperlinkXLSX);
     CPPUNIT_TEST(testMoveCellAnchoredShapesODS);
     CPPUNIT_TEST(testMatrixMultiplicationXLSX);
@@ -3518,6 +3520,20 @@ void ScExportTest::testHiddenShapeXLSX()
     assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:nvSpPr/xdr:cNvPr", "hidden", "1");
 }
 
+void ScExportTest::testShapeAutofitXLSX()
+{
+    ScDocShellRef xDocSh = loadDoc("testShapeAutofit.", FORMAT_XLSX);
+    CPPUNIT_ASSERT(xDocSh.is());
+
+    xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX);
+    CPPUNIT_ASSERT(pDoc);
+
+    // TextAutoGrowHeight --> "Fit height to text" / "Resize shape to fit text" --> true
+    assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp/xdr:txBody/a:bodyPr/a:spAutoFit", 1);
+    // TextAutoGrowHeight --> "Fit height to text" / "Resize shape to fit text" --> false
+    assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:sp/xdr:txBody/a:bodyPr/a:noAutofit", 1);
+}
+
 void ScExportTest::testHyperlinkXLSX()
 {
     ScDocShellRef xDocSh = loadDoc("hyperlink.", FORMAT_XLSX);


More information about the Libreoffice-commits mailing list