diff options
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 91d652d3b3e4..f44e93ce1616 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -403,7 +403,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo //table border settings table::TableBorder aTableBorder; - table::BorderLine2 aBorderLine; + table::BorderLine2 aBorderLine, aLeftBorder; if (lcl_extractTableBorderProperty(m_aTableProperties, PROP_TOP_BORDER, rInfo, aBorderLine)) { @@ -415,10 +415,11 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo aTableBorder.BottomLine = aBorderLine; aTableBorder.IsBottomLineValid = sal_True; } - if (lcl_extractTableBorderProperty(m_aTableProperties, PROP_LEFT_BORDER, rInfo, aBorderLine)) + if (lcl_extractTableBorderProperty(m_aTableProperties, PROP_LEFT_BORDER, rInfo, aLeftBorder)) { - aTableBorder.LeftLine = aBorderLine; + aTableBorder.LeftLine = aLeftBorder; aTableBorder.IsLeftLineValid = sal_True; + rInfo.nLeftBorderDistance += aLeftBorder.LineWidth * 0.5; } if (lcl_extractTableBorderProperty(m_aTableProperties, PROP_RIGHT_BORDER, rInfo, aBorderLine)) { @@ -445,23 +446,17 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo lcl_debug_TableBorder(aTableBorder); #endif - // Mimic Office behavior : if tlbInd is defined, use it place table. - // Otherwise, top-level table's position depends w:tblCellMar attribute (but not nested tables) - if (nLeftMargin) + // Table position in Office is computed in 2 different ways : + // - top level tables: the goal is to have in-cell text starting at table indent pos (tblInd), + // so table's position depends on table's cells margin + // - nested tables: the goal is to have left-most border starting at table_indent pos + if (rInfo.nNestLevel > 1) { - m_aTableProperties->Insert( PROP_LEFT_MARGIN, false, uno::makeAny( nLeftMargin - nGapHalf)); + m_aTableProperties->Insert( PROP_LEFT_MARGIN, false, uno::makeAny( nLeftMargin - nGapHalf )); } else { - // TODO: top-level position depends on w:tblCellMar attribute, not w:cellMar - if (rInfo.nNestLevel > 1) - { - m_aTableProperties->Insert( PROP_LEFT_MARGIN, false, uno::makeAny( - nGapHalf)); - } - else - { - m_aTableProperties->Insert( PROP_LEFT_MARGIN, false, uno::makeAny( - nGapHalf - rInfo.nLeftBorderDistance)); - } + m_aTableProperties->Insert( PROP_LEFT_MARGIN, false, uno::makeAny( nLeftMargin - nGapHalf - rInfo.nLeftBorderDistance )); } m_aTableProperties->getValue( TablePropertyMap::TABLE_WIDTH, nTableWidth ); |