sw/qa/extras/ooxmlimport/data/tdf8255.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 9 +++++++++ writerfilter/source/dmapper/PropertyMap.cxx | 12 +++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-)
New commits: commit 853033da3710f0e8df1b5d0d5355c6b0ce1c9ea0 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Jun 8 07:48:42 2015 +0200 tdf#82553 DOCX import: handle table margin when converting floattables (cherry picked from commit 292ec5fe8d01af6119325f1a426422bb42e58615) Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: I7a3a233a34453153b3e1c0fe3d60bb0ede65dc86 Reviewed-on: https://gerrit.libreoffice.org/16248 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/qa/extras/ooxmlimport/data/tdf8255.docx b/sw/qa/extras/ooxmlimport/data/tdf8255.docx new file mode 100644 index 0000000..366e498 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf8255.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 0721a1e..4a7a8bc 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2581,6 +2581,15 @@ DECLARE_OOXMLIMPORT_TEST(testFdo87488, "fdo87488.docx") } } +DECLARE_OOXMLIMPORT_TEST(testTdf8255, "tdf8255.docx") +{ + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xTextDocument, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); + // This was 1: a full-page-wide multi-page floating table was imported as a TextFrame. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount()); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 845dbe6..f83862c 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1037,6 +1037,16 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) for (size_t i = 0; i < rPendingFloatingTables.size(); ++i) { FloatingTableInfo& rInfo = rPendingFloatingTables[i]; + + // Count the layout width of the table. + sal_Int32 nTableWidth = rInfo.m_nTableWidth; + sal_Int32 nLeftMargin = 0; + if (rInfo.getPropertyValue("LeftMargin") >>= nLeftMargin) + nTableWidth += nLeftMargin; + sal_Int32 nRightMargin = 0; + if (rInfo.getPropertyValue("RightMargin") >>= nRightMargin) + nTableWidth += nRightMargin; + // 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. @@ -1045,7 +1055,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) // 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 ) || ColumnCount() + 1 >= 2 ) + nTableWidth < nTextAreaWidth || ColumnCount() + 1 >= 2 ) xBodyText->convertToTextFrame(rInfo.m_xStart, rInfo.m_xEnd, rInfo.m_aFrameProperties); } rPendingFloatingTables.clear();
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits