diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-02-07 01:03:32 +0300 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2018-02-07 18:29:58 +0100 |
commit | a34f87f8f97aa6aafd4098cffd214e8d2c3a0ba3 (patch) | |
tree | 6dad951f0111d1e104d6a7ac016617fb5e371b91 /writerfilter | |
parent | 19bfffcf3a89fd2fd070e1a878ac628e93d06cc7 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 76d6fcd05c630a928dd3bd028d560792d9c904ca)
Reviewed-on: https://gerrit.libreoffice.org/49333
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 6 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 5 |
3 files changed, 12 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index a6e6947d9491..2f254be9c67c 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -1151,8 +1151,10 @@ 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.emplace_back(xStart, xEnd, comphelper::containerToSequence(aFrameProperties), nTableWidth); + m_rDMapper_Impl.m_aPendingFloatingTables.emplace_back(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 589a79953f13..cf51e7fac46c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -356,17 +356,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 c416ba52ba69..b1ee1fd971a3 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> @@ -1030,6 +1031,10 @@ bool SectionPropertyMap::FloatingTableConversion( DomainMapper_Impl& rDM_Impl, F 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; |