summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-07-25 16:58:28 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-07-28 11:07:09 +0200
commitd045fd7b5d5bbd7e2569ba1571229f4f1fc3559a (patch)
treee75634c80b767e2e154649625b4525ccdb964b03 /writerfilter
parent7db521284cfd15585334eb73023be8afb5aa701d (diff)
tdf#109524: use 100% table width when there's no explicit width available
According to ECMA-376-1:2016 17.4.63, 17.18.87, etc, all table widths are considered preferred, and actual table layout should be determined using an algorithm described in 17.18.87. When w:tblLayout element is omitted, or there is no explicit width information given, it is assumed that AutoFit Table Layout should be used, i.e. using cells content to determine final widths of table grid. In the description of the AutoFit Table Layout algorithm, it is stated that the table width grows to hold data, but no more than page width. As a first approach, this commit just sets table width to 100% when there's no width data available. TODO is to implement the AutoFit Table Layout algorithm properly. Change-Id: I000c548eb152c70d2c6e053f4d2b1d16e8976c27 Reviewed-on: https://gerrit.libreoffice.org/40500 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit cae5dd9363b68dbabbeb2069f4aee7d057f6b5a8) Reviewed-on: https://gerrit.libreoffice.org/40508 Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableHandler.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 5676a3c3ce80..4c8365f0ad6f 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -325,8 +325,6 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
//pPropMap->Insert( PROP_HORI_ORIENT, uno::makeAny( text::HoriOrientation::RIGHT ));
sal_Int32 nGapHalf = 0;
sal_Int32 nLeftMargin = 0;
- sal_Int32 nTableWidth = 0;
- sal_Int32 nTableWidthType = text::SizeType::FIX;
comphelper::SequenceAsHashMap aGrabBag;
@@ -555,14 +553,23 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
m_aTableProperties->Insert( PROP_LEFT_MARGIN, uno::makeAny( nLeftMargin - nGapHalf - rInfo.nLeftBorderDistance ));
}
+ sal_Int32 nTableWidth = 0;
+ sal_Int32 nTableWidthType = text::SizeType::FIX;
m_aTableProperties->getValue( TablePropertyMap::TABLE_WIDTH, nTableWidth );
m_aTableProperties->getValue( TablePropertyMap::TABLE_WIDTH_TYPE, nTableWidthType );
if( nTableWidthType == text::SizeType::FIX )
{
if( nTableWidth > 0 )
m_aTableProperties->Insert( PROP_WIDTH, uno::makeAny( nTableWidth ));
+ else
+ {
+ // tdf#109524: If there is no width for the table, make it simply 100% by default.
+ // TODO: use cell contents to evaluate width (according to ECMA-376-1:2016 17.18.87)
+ nTableWidth = 100;
+ nTableWidthType = text::SizeType::VARIABLE;
+ }
}
- else
+ if (nTableWidthType != text::SizeType::FIX)
{
m_aTableProperties->Insert( PROP_RELATIVE_WIDTH, uno::makeAny( sal_Int16( nTableWidth ) ) );
m_aTableProperties->Insert( PROP_IS_WIDTH_RELATIVE, uno::makeAny( true ) );