[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

Justin Luth justin_luth at sil.org
Thu Oct 26 10:21:35 UTC 2017


 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx        |    3 +++
 sw/source/filter/ww8/docxattributeoutput.cxx      |   14 +++++++-------
 writerfilter/source/dmapper/CellMarginHandler.cxx |    2 ++
 3 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 018687837648dfe1832ddabbd4cda183708d7fdc
Author: Justin Luth <justin_luth at sil.org>
Date:   Tue Oct 17 12:45:48 2017 +0300

    related tdf#78508 and n#793262: import w:tcMar_start/end
    
    Although 2013 commit 60ec497e0e91354a616978be531d15d3efa3f559
    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/43432
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 7fe5f86ff7ef..2c9812c121cf 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -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 );
     }
 }
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c8e690ac7b9e..a9ef70d22119 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -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;
diff --git a/writerfilter/source/dmapper/CellMarginHandler.cxx b/writerfilter/source/dmapper/CellMarginHandler.cxx
index d1e20d2ee3a8..194e9e2722ec 100644
--- a/writerfilter/source/dmapper/CellMarginHandler.cxx
+++ b/writerfilter/source/dmapper/CellMarginHandler.cxx
@@ -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;


More information about the Libreoffice-commits mailing list