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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Sep 29 05:16:56 UTC 2018


 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |    5 ++++-
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx    |   11 -----------
 sw/source/filter/ww8/docxattributeoutput.cxx |   27 +++------------------------
 3 files changed, 7 insertions(+), 36 deletions(-)

New commits:
commit 5d4c6ee89ef6302db08c23bbe2d3fb4d7de3b1a3
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Wed Sep 26 10:23:20 2018 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Sat Sep 29 07:16:34 2018 +0200

    tdf#92026 docxexport: eliminate fake tblBorders
    
    This patch depends on tdf#119760.
    
    The border was based on whatever cell A1 had, but that fake
    default was never passed to the cell's functions, so the
    table border definition served no purpose whatsoever.
    Cells had no idea whether they needed to override those
    default borders, and this was bad for non-borders, because
    then the default borders were assigned instead of none.
    
    The other option would be to properly fill m_aTableStyleConf,
    but that didn't seem valuable. Better, and less code churn,
    to just eliminate the function altogether. (Well, the
    empty function kept in place as a placeholder for
    someone who decides it could be useful to reduce
    the number of borders written out per cell.)
    
    Unit test fdo80097.docx's fix was just trying to
    prevent an invalid table border. Since that is still
    obviously true when no table border is defined,
    it is valid to just eliminate this part of the test.
    (Having a table definition wouldn't be invalid
    in the future, so I'm not testing for zero instances.)
    
    Change-Id: I983dbe120bfc3354fefd14bc95ac01abccea7ea8
    Reviewed-on: https://gerrit.libreoffice.org/60989
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 933bd58b1071..db52d019439b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -532,7 +532,10 @@ DECLARE_OOXMLEXPORT_TEST(testTdf82177_tblBorders, "tdf82177_tblBorders.docx")
     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
     uno::Reference< text::XTextTable > xTable( xTables->getByIndex(0), uno::UNO_QUERY );
-    uno::Reference< table::XCell > xCell = xTable->getCellByName( "E5" );
+    uno::Reference< table::XCell > xCell = xTable->getCellByName( "A5" );
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0), getProperty<table::BorderLine2>(xCell, "BottomBorder").LineWidth);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0), getProperty<table::BorderLine2>(xCell, "LeftBorder").LineWidth);
+    xCell.set(xTable->getCellByName( "E5" ));
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0), getProperty<table::BorderLine2>(xCell, "TopBorder").LineWidth);
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0), getProperty<table::BorderLine2>(xCell, "LeftBorder").LineWidth);
 }
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 858f20d0e3b9..401af06a6533 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -669,17 +669,6 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80097, "fdo80097.docx")
     if (!pXmlDocument)
         return;
 
-    //Table Borders
-    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:val = 'single']",1);
-    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:sz = 4]", 1);
-    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:space = 0]", 1);
-    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:color = '000000']", 1);
-
-    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:val = 'single']",1);
-    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:sz = 4]", 1);
-    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:space = 0]", 1);
-    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:color = '000000']", 1);
-
     //Table Cell Borders
     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:val = 'single']",1);
     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:sz = 4]", 1);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index b3e4df7a5f1a..a39ba872cf04 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3032,18 +3032,6 @@ static void impl_borderLine( FSHelperPtr const & pSerializer, sal_Int32 elementT
     pSerializer->singleElementNS( XML_w, elementToken, xAttrs );
 }
 
-static OutputBorderOptions lcl_getTableDefaultBorderOptions(bool bEcma)
-{
-    OutputBorderOptions rOptions;
-
-    rOptions.tag = XML_tblBorders;
-    rOptions.bUseStartEnd = !bEcma;
-    rOptions.bWriteTag = true;
-    rOptions.bWriteDistance = false;
-
-    return rOptions;
-}
-
 static OutputBorderOptions lcl_getTableCellBorderOptions(bool bEcma)
 {
     OutputBorderOptions rOptions;
@@ -3780,19 +3768,10 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
     m_pSerializer->endElementNS( XML_w, XML_tblGrid );
 }
 
-void DocxAttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+void DocxAttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ )
 {
-    const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
-    const SwFrameFormat * pFrameFormat = pTabBox->GetFrameFormat();
-
-    bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
-
-    // Don't write table defaults based on the top-left cell if we have a table style available.
-    if (m_aTableStyleConf.empty())
-    {
-        // the defaults of the table are taken from the top-left cell
-        impl_borders(m_pSerializer, pFrameFormat->GetBox(), lcl_getTableDefaultBorderOptions(bEcma), m_aTableStyleConf);
-    }
+    // Table defaults should only be created IF m_aTableStyleConf contents haven't come from a table style.
+    // Previously this function wrote out Cell A1 as the table default, causing problems with no benefit.
 }
 
 void DocxAttributeOutput::TableDefaultCellMargins( ww8::WW8TableNodeInfoInner::Pointer_t const & pTableTextNodeInfoInner )


More information about the Libreoffice-commits mailing list