[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/inc writerfilter/source

Miklos Vajna vmiklos at suse.cz
Wed Aug 21 08:05:18 PDT 2013


 sw/qa/extras/ooxmlexport/ooxmlexport.cxx        |   19 +++----------------
 writerfilter/inc/resourcemodel/TableManager.hxx |    8 ++++++++
 writerfilter/source/dmapper/DomainMapper.cxx    |    6 ++++++
 3 files changed, 17 insertions(+), 16 deletions(-)

New commits:
commit 9bc83f1b56385c832f15b93d35bb738d0c68ec56
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Aug 21 16:50:32 2013 +0200

    sw_ooxmlexport test: remove no longer needed m_bImport
    
    Change-Id: Ib95491e07d5619bd1a1b2946596c0308c6f73739

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index f2ab8ed..47cd3a0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -46,7 +46,6 @@
 class Test : public SwModelTestBase
 {
 public:
-    Test();
     void testZoom();
     void defaultTabStopNotInStyles();
     void testFdo38244();
@@ -126,15 +125,8 @@ private:
      */
     xmlDocPtr parseExport();
     void assertXPath(xmlDocPtr pXmlDoc, OString aXPath, OString aAttribute = OString(), OUString aExpectedValue = OUString());
-    /// If the XPath test for now runs only after one export iteration, check for this variable.
-    bool m_bImport;
 };
 
-Test::Test()
-    : m_bImport(false)
-{
-}
-
 void Test::run()
 {
     MethodEntry<Test> aMethods[] = {
@@ -212,11 +204,9 @@ void Test::run()
     {
         MethodEntry<Test>& rEntry = aMethods[i];
         load("/sw/qa/extras/ooxmlexport/data/", rEntry.pName);
-        m_bImport = true;
         // If the testcase is stored in some other format, it's pointless to test.
         if (OString(rEntry.pName).endsWith(".docx") && std::find(vBlacklist.begin(), vBlacklist.end(), rEntry.pName) == vBlacklist.end())
             (this->*rEntry.pMethod)();
-        m_bImport = false;
         reload("Office Open XML Text");
         (this->*rEntry.pMethod)();
         finish();
commit d4d0df13bd4291b7f988bdce68a087a58bb4c70f
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Aug 21 16:01:12 2013 +0200

    DOCX import: fix handling of textframes having shape text ending with a table
    
    Change-Id: I82ef1072bfeb1195152ef7f1ea743653ac102b37

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2db8917..f2ab8ed 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1168,12 +1168,9 @@ void Test::testTableFloatingMargins()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1000), getProperty<sal_Int32>(xFrame, "TopMargin"));
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), getProperty<sal_Int32>(xFrame, "BottomMargin"));
 
-    if (m_bImport)
-    {
-        // Paragraph bottom margin wasn't 0 in the A1 cell of the floating table.
-        xmlDocPtr pXmlDoc = parseExport();
-        assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:pict/v:rect/v:textbox/w:txbxContent/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "after", "0");
-    }
+    // Paragraph bottom margin wasn't 0 in the A1 cell of the floating table.
+    xmlDocPtr pXmlDoc = parseExport();
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:pict/v:rect/v:textbox/w:txbxContent/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "after", "0");
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/writerfilter/inc/resourcemodel/TableManager.hxx b/writerfilter/inc/resourcemodel/TableManager.hxx
index 72841ff..ed51250 100644
--- a/writerfilter/inc/resourcemodel/TableManager.hxx
+++ b/writerfilter/inc/resourcemodel/TableManager.hxx
@@ -531,6 +531,14 @@ public:
     virtual void endLevel();
 
     /**
+     * Signal that the next paragraph definitely won't be part of any table.
+     */
+    void endTable()
+    {
+        setRowEnd(false);
+    }
+
+    /**
        Tells whether a table has been started or not
       */
     bool isInTable();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index e572690..d4061aa 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3558,6 +3558,12 @@ void DomainMapper::lcl_endShape( )
 {
     if (m_pImpl->GetTopContext())
     {
+        // End the current table, if there are any. Otherwise the unavoidable
+        // empty paragraph at the end of the shape text will cause problems: if
+        // the shape text ends with a table, the extra paragraph will be
+        // handled as an additional row of the ending table.
+        m_pImpl->getTableManager().endTable();
+
         lcl_endParagraphGroup();
         m_pImpl->PopShapeContext( );
     }


More information about the Libreoffice-commits mailing list