summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2014-07-07 13:56:02 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-07-29 11:48:51 +0000
commitc20dcded64f85b464bf64bbf3e30ec4e4a8ee205 (patch)
treeda12f93e7ab1f7b936781e6f87f826060310789f
parentbd300cfba34ee8d4cc479cbbe9cf8703590c74b6 (diff)
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@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/qa/extras/ooxmlimport/data/floating-table-section-columns.docxbin0 -> 5668 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx7
-rw-r--r--sw/qa/extras/ww8import/data/floating-table-section-columns.docbin0 -> 27648 bytes
-rw-r--r--sw/qa/extras/ww8import/ww8import.cxx7
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx4
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx4
-rw-r--r--writerfilter/source/dmapper/PropertyMap.hxx1
7 files changed, 21 insertions, 2 deletions
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 000000000000..50bb7accb2a3
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/floating-table-section-columns.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index a0c09c9d7ba3..de1e64174622 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 000000000000..6471ded397c6
--- /dev/null
+++ b/sw/qa/extras/ww8import/data/floating-table-section-columns.doc
Binary files differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index 7cd6153f42e3..68cb9c86de36 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 e0100ae819b4..6942f88d1b51 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 6a60e4115c43..dab32853ad70 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 6977fff8a0e1..ccfb897c1bf1 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 ); }