[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Jun 2 00:21:13 PDT 2015


 sw/qa/extras/ooxmlexport/data/tdf79639.docx              |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                 |    8 ++++++++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   11 +++++++++--
 3 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 3cf789a15450efcdcf8dd95eeb71bfc746591f1c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jun 1 09:03:05 2015 +0200

    tdf#79639 DOCX import: don't delay text frame conversion of in-header tables
    
    Floating tables may or may not be converted to table-in-textframes
    during import, depending on if we guess that it'll be a multi-page table
    with minimal wrapping or a real wrapped table.
    
    If the floating table is in a header or footer, then it won't be a
    multi-page one, so can do the conversion right away.
    
    Change-Id: I8d5ff8c5fe00037d5cef92dea6b54de6806214bc
    (cherry picked from commit 81ef96a2417c7843dfed0558c920ad3064e58921)

diff --git a/sw/qa/extras/ooxmlexport/data/tdf79639.docx b/sw/qa/extras/ooxmlexport/data/tdf79639.docx
new file mode 100644
index 0000000..b84aaea
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf79639.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ba7715b..fc05887 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -695,6 +695,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf91261, "tdf91261.docx")
 
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf79639, "tdf79639.docx")
+{
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+    // This was 0, floating table in header wasn't converted to a TextFrame.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xDrawPage->getCount());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 809429d..b08e52a 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1113,12 +1113,19 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel)
             // Also, when the anchor is within a table, then do it here as well,
             // as xStart/xEnd would not point to the start/end at conversion
             // time anyway.
+            // Next exception: it's pointless to delay the conversion if the
+            // table is not in the body text.
             sal_Int32 nTableWidth = 0;
             m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH, nTableWidth);
-            if (m_rDMapper_Impl.GetSectionContext() && nestedTableLevel <= 1)
+            if (m_rDMapper_Impl.GetSectionContext() && nestedTableLevel <= 1 && !m_rDMapper_Impl.IsInHeaderFooter())
                 m_rDMapper_Impl.m_aPendingFloatingTables.push_back(FloatingTableInfo(xStart, xEnd, comphelper::containerToSequence(aFrameProperties), nTableWidth));
             else
-                m_xText->convertToTextFrame(xStart, xEnd, comphelper::containerToSequence(aFrameProperties));
+            {
+                // m_xText points to the body text, get to current xText from m_rDMapper_Impl, in case e.g. we would be in a header.
+                uno::Reference<text::XTextAppendAndConvert> xTextAppendAndConvert(m_rDMapper_Impl.GetTopTextAppend(), uno::UNO_QUERY);
+                if (xTextAppendAndConvert.is())
+                    xTextAppendAndConvert->convertToTextFrame(xStart, xEnd, comphelper::containerToSequence(aFrameProperties));
+            }
         }
     }
 


More information about the Libreoffice-commits mailing list