Kaydet (Commit) 3cb619bd authored tarafından Pierre-Eric Pelloux-Prayer's avatar Pierre-Eric Pelloux-Prayer Kaydeden (comit) Miklos Vajna

docx import: properly import table position

This a follow up of commit 53b7f7df

Change-Id: Ia0f79ca24418636af14162e9f339237d847dc221
Reviewed-on: https://gerrit.libreoffice.org/714Reviewed-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
Tested-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
üst e33a9181
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment