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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Sep 11 08:36:41 UTC 2018


 sw/qa/extras/layout/data/tdf117188.docx |binary
 sw/qa/extras/layout/layout.cxx          |   23 +++++++++++++++++++++++
 xmloff/source/draw/ximpshap.cxx         |   14 +++++++++-----
 3 files changed, 32 insertions(+), 5 deletions(-)

New commits:
commit ea0e3b2d657c1d3183e16d72f9b7188a048deabe
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Sep 10 17:07:47 2018 +0300
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Sep 11 10:36:20 2018 +0200

    tdf#109229: Set "TextBox" prop before filling textbox-related props
    
    Otherwise those properties aren't set, and defaults are used
    
    Change-Id: Ib6671c019ff652ec5b59d9cbbf02a4e536a17817
    Reviewed-on: https://gerrit.libreoffice.org/60267
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit c3422cd205d8da852f5c310b5f08028d6c4c5eb4)
    Reviewed-on: https://gerrit.libreoffice.org/60299
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/sw/qa/extras/layout/data/tdf117188.docx b/sw/qa/extras/layout/data/tdf117188.docx
new file mode 100644
index 000000000000..418f665ae7dc
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf117188.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index f94239b266e8..09154a2a9045 100755
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -28,6 +28,7 @@ public:
     void testTdf109077();
     void testTdf109137();
     void testTdf118058();
+    void testTdf117188();
 
     CPPUNIT_TEST_SUITE(SwLayoutWriter);
     CPPUNIT_TEST(testTdf116830);
@@ -41,6 +42,7 @@ public:
     CPPUNIT_TEST(testTdf109077);
     CPPUNIT_TEST(testTdf109137);
     CPPUNIT_TEST(testTdf118058);
+    CPPUNIT_TEST(testTdf117188);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -237,6 +239,27 @@ void SwLayoutWriter::testTdf118058()
     pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
 }
 
+void SwLayoutWriter::testTdf117188()
+{
+    createDoc("tdf117188.docx");
+    uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+    utl::TempFile aTempFile;
+    aTempFile.EnableKillingFile();
+    uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence({
+        { "FilterName", uno::Any(OUString("writer8")) },
+    }));
+    xStorable->storeToURL(aTempFile.GetURL(), aDescriptor);
+    loadURL(aTempFile.GetURL(), "tdf117188.odt");
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    OUString sWidth = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "width");
+    OUString sHeight = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "height");
+    // The text box must have zero border distances
+    assertXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/prtBounds", "left", "0");
+    assertXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/prtBounds", "top", "0");
+    assertXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/prtBounds", "width", sWidth);
+    assertXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/prtBounds", "height", sHeight);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 3d74d57f0853..44218ceb0e25 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -695,6 +695,15 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */)
                 }
             }
 
+            // Writer shapes: if this one has a TextBox, set it here. We need to do it before
+            // pDocStyle->FillPropertySet, because setting some properties depend on the format
+            // having RES_CNTNT attribute (e.g., UNO_NAME_TEXT_(LEFT|RIGHT|UPPER|LOWER)DIST; see
+            // SwTextBoxHelper::syncProperty, which indirectly calls SwTextBoxHelper::isTextBox)
+            uno::Reference<beans::XPropertySetInfo> xPropertySetInfo
+                = xPropSet->getPropertySetInfo();
+            if (xPropertySetInfo->hasPropertyByName("TextBox"))
+                xPropSet->setPropertyValue("TextBox", uno::makeAny(mbTextBox));
+
             // if this is an auto style, set its properties
             if(bAutoStyle && pDocStyle)
             {
@@ -702,11 +711,6 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */)
                 pDocStyle->FillPropertySet(xPropSet);
             }
 
-            // Writer shapes: if this one has a TextBox, set it here.
-            uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropSet->getPropertySetInfo();
-            if (xPropertySetInfo->hasPropertyByName("TextBox"))
-                xPropSet->setPropertyValue("TextBox", uno::makeAny(mbTextBox));
-
         } while(false);
 
         // try to set text auto style


More information about the Libreoffice-commits mailing list