summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorSzabolcs Toth <szabolcs450@gmail.com>2019-12-30 10:09:34 +0100
committerLászló Németh <nemeth@numbertext.org>2020-01-07 16:55:38 +0100
commit0f4dd820ee433932d9d9237b676292d31c4ba913 (patch)
tree055dd81124805aabd699d48c4977f2a47b8ff6b0 /writerfilter
parent02b7de723e50474a27aa35661c2eaa886e5abfb1 (diff)
tdf#129452 DOCX import: fix bottom border of merged column
Bottom border of a vertically merged column of a table was missing if the inside borders were turned off and the merge included the last cell of the column. This happened because the first cell (topmost) in a set of vertically merged cells determines the borders of the new merged cell, and the turned off inside borders were at the bottom in this case. Change-Id: I3d3defad18a1315117a554a36ad599eb46daffe9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85988 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableHandler.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 9f376b3c07e8..31ce6b21d2c9 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -98,7 +98,7 @@ static void lcl_mergeBorder( PropertyIds nId, const PropertyMapPtr& pOrig, const
}
static void lcl_computeCellBorders( const PropertyMapPtr& pTableBorders, const PropertyMapPtr& pCellProps,
- sal_Int32 nCell, sal_Int32 nRow, bool bIsEndCol, bool bIsEndRow )
+ sal_Int32 nCell, sal_Int32 nRow, bool bIsEndCol, bool bIsEndRow, bool bMergedVertically )
{
o3tl::optional<PropertyMap::Property> pVerticalVal = pCellProps->getProperty(META_PROP_VERTICAL_BORDER);
o3tl::optional<PropertyMap::Property> pHorizontalVal = pCellProps->getProperty(META_PROP_HORIZONTAL_BORDER);
@@ -157,10 +157,13 @@ static void lcl_computeCellBorders( const PropertyMapPtr& pTableBorders, const P
if ( nRow == 0 )
{
lcl_mergeBorder( PROP_TOP_BORDER, pTableBorders, pCellProps );
- if ( pHorizontalVal )
+ if ( pHorizontalVal && !bMergedVertically )
pCellProps->Insert( PROP_BOTTOM_BORDER, aHorizProp, false );
}
+ if ( bMergedVertically )
+ lcl_mergeBorder( PROP_BOTTOM_BORDER, pTableBorders, pCellProps );
+
if ( bIsEndRow )
{
lcl_mergeBorder( PROP_BOTTOM_BORDER, pTableBorders, pCellProps );
@@ -864,7 +867,15 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl
rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER);
}
- lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, nCell, nRow, bIsEndCol, bIsEndRow );
+ // tdf#129452 Checking if current cell is vertically merged with all the other cells below to the bottom.
+ // This must be done in order to apply the bottom border of the table to the first cell in a vertical merge.
+ bool bMergedVertically = bool(m_aCellProperties[nRow][nCell]->getProperty(PROP_VERTICAL_MERGE));
+
+ for (size_t i = nRow + 1; bMergedVertically && i < m_aCellProperties.size(); i++)
+ if ( m_aCellProperties[i].size() > sal::static_int_cast<std::size_t>(nCell) )
+ bMergedVertically = bool(m_aCellProperties[i][nCell]->getProperty(PROP_VERTICAL_MERGE));
+
+ lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, nCell, nRow, bIsEndCol, bIsEndRow, bMergedVertically );
//now set the default left+right border distance TODO: there's an sprm containing the default distance!
aCellIterator->get()->Insert( PROP_LEFT_BORDER_DISTANCE,