From 5d0c83fd4cf91083805f60f49e4fafd3d6ac73d4 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 16 Oct 2018 18:00:45 +0300 Subject: tdf#119885: OOXML import: try to get cell paddings as Word does Change-Id: I7abd715b6bb71d6e2e01939c4cf849d94eb6a103 Reviewed-on: https://gerrit.libreoffice.org/61843 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 13 ++++++++++++- sw/qa/extras/rtfexport/rtfexport.cxx | 2 +- sw/source/filter/ww8/docxattributeoutput.cxx | 9 --------- 3 files changed, 13 insertions(+), 11 deletions(-) (limited to 'sw') diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index 4db28720e0fa..794a76245525 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -1160,7 +1160,18 @@ DECLARE_OOXMLEXPORT_TEST( testTableCellMargin, "table-cell-margin.docx" ) 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 ); + { + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Incorrect cell left padding", + 0.5 * aLeftBorderLine.LineWidth, aLeftMargin, 1); + // tdf#119885: cell's edit area must touch right border + sal_Int32 aRightMargin = -1; + xPropSet->getPropertyValue("RightBorderDistance") >>= aRightMargin; + uno::Any aRightBorder = xPropSet->getPropertyValue("RightBorder"); + table::BorderLine2 aRightBorderLine; + aRightBorder >>= aRightBorderLine; + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Incorrect cell right padding", + 0.5 * aRightBorderLine.LineWidth, aRightMargin, 1); + } } } diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 009cd00eb14d..8b6ecdb27f85 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -754,7 +754,7 @@ DECLARE_RTFEXPORT_TEST(testTdf84832, "tdf84832.docx") { uno::Reference xCell = getCell(getParagraphOrTable(2), "A1"); // This was 0, as left padding wasn't exported. - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(113)), + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(108)), getProperty(xCell, "LeftBorderDistance")); } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 0c9e4a04c63b..3d539978f096 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3175,15 +3175,6 @@ static void impl_cellMargins( FSHelperPtr const & pSerializer, const SvxBoxItem& 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. - // So we add half left-border width to tblIndent value - const SvxBorderLine* pLn = rBox.GetLine( *pBrd ); - if (pLn) - nDist -= pLn->GetWidth() * 0.5; - } - if (!tagWritten) { pSerializer->startElementNS( XML_w, tag, FSEND ); tagWritten = true; -- cgit