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

Luboš Luňák l.lunak at collabora.com
Tue Jul 29 04:49:24 PDT 2014


 sw/qa/extras/ooxmlimport/data/floating-table-section-columns.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                          |    7 +++++++
 sw/qa/extras/ww8import/data/floating-table-section-columns.doc    |binary
 sw/qa/extras/ww8import/ww8import.cxx                              |    7 +++++++
 sw/source/filter/ww8/ww8par6.cxx                                  |    4 +++-
 writerfilter/source/dmapper/PropertyMap.cxx                       |    4 +++-
 writerfilter/source/dmapper/PropertyMap.hxx                       |    1 +
 7 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit c20dcded64f85b464bf64bbf3e30ec4e4a8ee205
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Mon Jul 7 13:56:02 2014 +0200

    fix floating table over section with several columns (part of bnc#875383)
    
    Change-Id: Ic6e75cc2cedb61754b45bc4678a1185f580d5ed6
    Reviewed-on: https://gerrit.libreoffice.org/10431
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlimport/data/floating-table-section-columns.docx b/sw/qa/extras/ooxmlimport/data/floating-table-section-columns.docx
new file mode 100644
index 0000000..50bb7ac
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/floating-table-section-columns.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index a0c09c9..de1e641 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2202,6 +2202,13 @@ DECLARE_OOXMLIMPORT_TEST(testTableBtlrCenter, "table-btlr-center.docx")
     CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getProperty<sal_Int16>(xTable->getCellByName("A2"), "VertOrient"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testFloatingTableSectionColumns, "floating-table-section-columns.docx")
+{
+    OUString tableWidth = parseDump("/root/page[1]/body/section/column[2]/body/txt/anchored/fly/tab/infos/bounds", "width");
+    // table width was restricted by a column
+    CPPUNIT_ASSERT( tableWidth.toInt32() > 10000 );
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/extras/ww8import/data/floating-table-section-columns.doc b/sw/qa/extras/ww8import/data/floating-table-section-columns.doc
new file mode 100644
index 0000000..6471ded
Binary files /dev/null and b/sw/qa/extras/ww8import/data/floating-table-section-columns.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index 7cd6153..68cb9c8 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -473,6 +473,13 @@ DECLARE_WW8IMPORT_TEST(testFdp80333, "fdo80333.doc")
 
 #endif
 
+DECLARE_WW8IMPORT_TEST(testFloatingTableSectionColumns, "floating-table-section-columns.doc")
+{
+    OUString tableWidth = parseDump("/root/page[1]/body/section/column[2]/body/txt/anchored/fly/tab/infos/bounds", "width");
+    // table width was restricted by a column
+    CPPUNIT_ASSERT( tableWidth.toInt32() > 10000 );
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index e0100ae..6942f88 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -4939,7 +4939,9 @@ bool SwWW8ImplReader::ParseTabPos(WW8_TablePos *pTabPos, WW8PLCFx_Cp_FKP* pPap)
         // If the table is wider than the text area, then don't create a fly
         // for the table: no wrapping will be performed anyway, but multi-page
         // tables will be broken.
-        pTabPos->bNoFly = nTableWidth >= nTextAreaWidth;
+        // If there are columns, do create a fly, as the flow of the columns
+        // would otherwise restrict the table.
+        pTabPos->bNoFly = nTableWidth >= nTextAreaWidth  && maSectionManager.CurrentSectionColCount() < 2;
     }
     return bRet;
 }
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 6a60e41..dab3285 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -919,8 +919,10 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
         // tables will be broken.
         // If the position is relative to the edge of the page, then we always
         // create the fly.
+        // If there are columns, always create the fly, otherwise the columns would
+        // restrict geometry of the table.
         if ( ( rInfo.getPropertyValue("HoriOrientRelation") == text::RelOrientation::PAGE_FRAME ) ||
-             ( rInfo.m_nTableWidth < nTextAreaWidth ) )
+             ( rInfo.m_nTableWidth < nTextAreaWidth ) || ColumnCount() + 1 >= 2 )
             xBodyText->convertToTextFrame(rInfo.m_xStart, rInfo.m_xEnd, rInfo.m_aFrameProperties);
     }
     rPendingFloatingTables.clear();
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index 6977fff..ccfb897 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -239,6 +239,7 @@ public:
     void SetBorderParams( sal_Int32 nSet ) { m_nBorderParams = nSet; }
 
     void SetColumnCount( sal_Int16 nCount ) { m_nColumnCount = nCount; }
+    sal_Int16 ColumnCount() const { return m_nColumnCount; }
     void SetColumnDistance( sal_Int32 nDist ) { m_nColumnDistance = nDist; }
     void AppendColumnWidth( sal_Int32 nWidth ) { m_aColWidth.push_back( nWidth ); }
     void AppendColumnSpacing( sal_Int32 nDist ) {m_aColDistance.push_back( nDist ); }


More information about the Libreoffice-commits mailing list