sw/qa/extras/ooxmlimport/data/tdf114217.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 8 ++++++++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 5 ++++- writerfilter/source/dmapper/DomainMapper_Impl.hxx | 6 ++++-- writerfilter/source/dmapper/PropertyMap.cxx | 5 +++++ 5 files changed, 21 insertions(+), 3 deletions(-)
New commits: commit 561f2a32966ff68bdf0d30a33b90fe95ee7e48cb Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Wed Feb 7 01:03:32 2018 +0300 tdf#114217: Consider relative width when importing floating table Unit test included Change-Id: I8e3338d7df431bd016caa4e06e684fbd189127c4 Reviewed-on: https://gerrit.libreoffice.org/49324 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/49335 Reviewed-by: Aron Budea <aron.bu...@collabora.com> Tested-by: Aron Budea <aron.bu...@collabora.com> diff --git a/sw/qa/extras/ooxmlimport/data/tdf114217.docx b/sw/qa/extras/ooxmlimport/data/tdf114217.docx new file mode 100644 index 000000000000..49f1ce164cbe Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf114217.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index a45d1c8469e3..b8920caf2976 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1587,6 +1587,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf111550, "tdf111550.docx") getCell(innerTable, "A1", "[outer:A2]\n[inner:A1]"); } +DECLARE_OOXMLIMPORT_TEST(testTdf114217, "tdf114217.docx") +{ + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); + // This was 1, multi-page table was imported as a floating one. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount()); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 4c8365f0ad6f..a872ecb16c6a 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -1136,8 +1136,11 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel, bool bTab // table is not in the body text. sal_Int32 nTableWidth = 0; m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH, nTableWidth); + sal_Int32 nTableWidthType = text::SizeType::FIX; + m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH_TYPE, nTableWidthType); 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)); + m_rDMapper_Impl.m_aPendingFloatingTables.push_back( + FloatingTableInfo(xStart, xEnd, comphelper::containerToSequence(aFrameProperties), nTableWidth, nTableWidthType)); else { // m_xText points to the body text, get the current xText from m_rDMapper_Impl, in case e.g. we would be in a header. diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 44a2be003c30..9d51754bd1ef 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -310,17 +310,19 @@ struct FloatingTableInfo css::uno::Reference<css::text::XTextRange> m_xEnd; css::uno::Sequence<css::beans::PropertyValue> m_aFrameProperties; sal_Int32 m_nTableWidth; + sal_Int32 m_nTableWidthType; /// Break type of the section that contains this table. sal_Int32 m_nBreakType = -1; FloatingTableInfo(css::uno::Reference<css::text::XTextRange> const& xStart, css::uno::Reference<css::text::XTextRange> const& xEnd, const css::uno::Sequence<css::beans::PropertyValue>& aFrameProperties, - sal_Int32 nTableWidth) + sal_Int32 nTableWidth, sal_Int32 nTableWidthType) : m_xStart(xStart), m_xEnd(xEnd), m_aFrameProperties(aFrameProperties), - m_nTableWidth(nTableWidth) + m_nTableWidth(nTableWidth), + m_nTableWidthType(nTableWidthType) { } css::uno::Any getPropertyValue(const OUString &propertyName); diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 91528c7967ce..70d9c3fcbf32 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/table/ShadowFormat.hpp> #include <com/sun/star/text/RelOrientation.hpp> #include <com/sun/star/text/HoriOrientation.hpp> +#include <com/sun/star/text/SizeType.hpp> #include <com/sun/star/text/VertOrientation.hpp> #include <com/sun/star/text/WritingMode.hpp> #include <com/sun/star/text/XTextColumns.hpp> @@ -1074,6 +1075,10 @@ bool SectionPropertyMap::FloatingTableConversion(DomainMapper_Impl& rDM_Impl, Fl sal_Int32 nTextAreaWidth = nPageWidth - GetLeftMargin() - GetRightMargin(); // Count the layout width of the table. sal_Int32 nTableWidth = rInfo.m_nTableWidth; + if (rInfo.m_nTableWidthType == text::SizeType::VARIABLE) + { + nTableWidth *= nTextAreaWidth / 100.0; + } sal_Int32 nLeftMargin = 0; if (rInfo.getPropertyValue("LeftMargin") >>= nLeftMargin) nTableWidth += nLeftMargin; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits