writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 27 ++++++--------- 1 file changed, 11 insertions(+), 16 deletions(-)
New commits: commit 3cb619bd15a6017f253891f4c377fc790d8aae82 Author: Pierre-Eric Pelloux-Prayer <pierre-e...@lanedo.com> Date: Thu Sep 27 10:15:58 2012 +0200 docx import: properly import table position This a follow up of commit 53b7f7df0617bcbd7bbef9a34ef53e5097eb16dc Change-Id: Ia0f79ca24418636af14162e9f339237d847dc221 Reviewed-on: https://gerrit.libreoffice.org/714 Reviewed-by: Miklos Vajna <vmik...@suse.cz> Tested-by: Miklos Vajna <vmik...@suse.cz> diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index e710a13..2690105 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -398,7 +398,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)) { @@ -410,10 +410,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)) { @@ -440,23 +441,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 ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits