Kaydet (Commit) 01868783 authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Miklos Vajna

related tdf#78508 and n#793262: import w:tcMar_start/end

Although 2013 commit 60ec497e
added support for the other tcMar items, it omitted _start and
_end (perhaps because they caused unit test failures).
The document in bug 78508 proves that these are needed.

Testing whether the cell spacing matches the default table
spacing should occur before adjusting for MSO compatibility.
This fixes the three unit tests that mysteriously failed
when adding _start/_end support.

Unfortunately, these two fixes could not be committed
separately - the unit test fails unless both parts
are included. I couldn't figure out why.

Change-Id: I9507da48b629b9618c5ee790bf0088ce82fc5692
Reviewed-on: https://gerrit.libreoffice.org/43432Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst f2fa3440
......@@ -1071,6 +1071,9 @@ DECLARE_OOXMLEXPORT_TEST( testTableCellMargin, "table-cell-margin.docx" )
aLeftBorder >>= aLeftBorderLine;
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Incorrect left spacing computed from docx cell margin",
cellLeftMarginFromOffice[i], aLeftMargin - 0.5 * aLeftBorderLine.LineWidth, 1 );
// The 'a' in the fourth table should not be partly hidden by the border
if ( i == 3 )
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Incorrect cell padding", 0.5 * aLeftBorderLine.LineWidth, aLeftMargin, 1 );
}
}
......
......@@ -3144,6 +3144,13 @@ static void impl_cellMargins( FSHelperPtr const & pSerializer, const SvxBoxItem&
{
sal_Int32 nDist = sal_Int32( rBox.GetDistance( *pBrd ) );
if (pDefaultMargins)
{
// Skip output if cell margin == table default margin
if (sal_Int32( pDefaultMargins->GetDistance( *pBrd ) ) == nDist)
continue;
}
if ( aBorders[i] == SvxBoxItemLine::LEFT ) {
// Office's cell margin is measured from the right of the border.
// While LO's cell spacing is measured from the center of the border.
......@@ -3153,13 +3160,6 @@ static void impl_cellMargins( FSHelperPtr const & pSerializer, const SvxBoxItem&
nDist -= pLn->GetWidth() * 0.5;
}
if (pDefaultMargins)
{
// Skip output if cell margin == table default margin
if (sal_Int32( pDefaultMargins->GetDistance( *pBrd ) ) == nDist)
continue;
}
if (!tagWritten) {
pSerializer->startElementNS( XML_w, tag, FSEND );
tagWritten = true;
......
......@@ -108,6 +108,7 @@ void CellMarginHandler::lcl_sprm(Sprm & rSprm)
createGrabBag("top");
break;
case NS_ooxml::LN_CT_TblCellMar_start:
case NS_ooxml::LN_CT_TcMar_start:
if( rtl )
{
m_nRightMargin = m_nValue;
......@@ -133,6 +134,7 @@ void CellMarginHandler::lcl_sprm(Sprm & rSprm)
createGrabBag("bottom");
break;
case NS_ooxml::LN_CT_TblCellMar_end:
case NS_ooxml::LN_CT_TcMar_end:
if( rtl )
{
m_nLeftMargin = m_nValue;
......
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