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

Miklos Vajna vmiklos at collabora.co.uk
Mon Feb 24 01:21:34 PST 2014


 sw/qa/extras/ooxmlimport/data/fdo74357.docx              |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                 |   11 +++++++++++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |    5 ++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 364682a19713169b374d949d0fc34d105a2be5d4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Feb 17 09:37:51 2014 +0100

    fdo#74357 DOCX import: fix nested tables anchored inside tables
    
    Regression from bbef85c157169efa958ea1014d91d467cb243e6f (bnc#779620
    DOCX import: try harder to convert floating tables to text frames,
    2013-10-01), the conversion of nested tables is delayed by default till
    we know the page size. However, in case the anchor is in a table, we
    should convert it right away, because the conversion of the parent table
    would invalidate our XTextRange references.
    
    (cherry picked from commit e5fd7c2dacf3c128cdc62622e736ce8abbc578a5)
    
    Conflicts:
    	sw/qa/extras/ooxmlimport/ooxmlimport.cxx
    
    Change-Id: Id41556e721c6e1c7239e4ea25abd57c999d2219b

diff --git a/sw/qa/extras/ooxmlimport/data/fdo74357.docx b/sw/qa/extras/ooxmlimport/data/fdo74357.docx
new file mode 100644
index 0000000..9703729
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo74357.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 32545c2..dee45c9 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -85,6 +85,7 @@ public:
     void testN779627();
     void testN779941();
     void testFdo55187();
+    void testFdo74357();
     void testN780563();
     void testN780853();
     void testN780843();
@@ -188,6 +189,7 @@ void Test::run()
         {"n779627.docx", &Test::testN779627},
         {"n779941.docx", &Test::testN779941},
         {"fdo55187.docx", &Test::testFdo55187},
+        {"fdo74357.docx", &Test::testFdo74357},
         {"n780563.docx", &Test::testN780563},
         {"n780853.docx", &Test::testN780853},
         {"n780843.docx", &Test::testN780843},
@@ -969,6 +971,15 @@ void Test::testN779627()
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered vertically relatively to page", text::RelOrientation::PAGE_FRAME, nValue);
 }
 
+void Test::testFdo74357()
+{
+    // Floating table wasn't converted to a textframe.
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+    // This was 0.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
+}
+
 void Test::testFdo55187()
 {
     // 0x010d was imported as a newline.
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 28be09c..a79bc79 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -947,9 +947,12 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel)
             // SectionPropertyMap::CloseSectionGroup(), so we'll have no idea
             // about the text area width, nor can fix this by delaying the text
             // frame conversion: just do it here.
+            // Also, we 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.
             sal_Int32 nTableWidth = 0;
             m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH, nTableWidth);
-            if (m_rDMapper_Impl.GetSectionContext())
+            if (m_rDMapper_Impl.GetSectionContext() && nestedTableLevel <= 1)
                 m_rDMapper_Impl.m_aPendingFloatingTables.push_back(FloatingTableInfo(xStart, xEnd, aFrameProperties, nTableWidth));
             else
                 m_xText->convertToTextFrame(xStart, xEnd, aFrameProperties);


More information about the Libreoffice-commits mailing list