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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 31 15:59:19 UTC 2018


 sw/qa/extras/ooxmlexport/data/tdf82177_outsideCellBorders.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx                     |   10 +++++
 sw/source/filter/ww8/WW8TableInfo.cxx                          |    4 ++
 sw/source/filter/ww8/WW8TableInfo.hxx                          |    1 
 sw/source/filter/ww8/docxattributeoutput.cxx                   |   17 +++++++---
 5 files changed, 27 insertions(+), 5 deletions(-)

New commits:
commit cecf71c18da5430c10daa8522d38d5144edefc14
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Sat Aug 25 22:22:55 2018 +0300
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Fri Aug 31 17:58:52 2018 +0200

    tdf#82177 docx export: no inside borders on outside cells
    
    Well, not on the bottom or right outside cells.
    Obviously the presence of a bottom or a right in those
    cases doesn't indicate an inside line.
    
    Change-Id: I5d0661fd60f478a392b12fe9093c2e47e130631b
    Reviewed-on: https://gerrit.libreoffice.org/59600
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf82177_outsideCellBorders.docx b/sw/qa/extras/ooxmlexport/data/tdf82177_outsideCellBorders.docx
new file mode 100644
index 000000000000..75c9a656da06
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf82177_outsideCellBorders.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index e02d829b734f..e289d3a40dba 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -456,6 +456,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf112118_DOCX, "tdf112118.docx")
     }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf82177_outsideCellBorders, "tdf82177_outsideCellBorders.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( "E4" );
+    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);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf116976, "tdf116976.docx")
 {
     // This was 0, relative size of shape after bitmap was ignored.
diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx
index 9713931d1e65..b41639243669 100644
--- a/sw/source/filter/ww8/WW8TableInfo.cxx
+++ b/sw/source/filter/ww8/WW8TableInfo.cxx
@@ -120,6 +120,10 @@ void WW8TableNodeInfoInner::setRect(const SwRect & rRect)
     maRect = rRect;
 }
 
+bool WW8TableNodeInfoInner::isFinalRow() const
+{
+    return mpTable && mpTable->GetTabLines().size() - 1 == mnRow;
+}
 
 const SwNode * WW8TableNodeInfoInner::getNode() const
 {
diff --git a/sw/source/filter/ww8/WW8TableInfo.hxx b/sw/source/filter/ww8/WW8TableInfo.hxx
index a3b6df799180..f2a2db21806a 100644
--- a/sw/source/filter/ww8/WW8TableInfo.hxx
+++ b/sw/source/filter/ww8/WW8TableInfo.hxx
@@ -94,6 +94,7 @@ public:
     bool isEndOfCell() const { return mbEndOfCell;}
     bool isEndOfLine() const { return mbEndOfLine;}
     bool isFinalEndOfLine() const { return mbFinalEndOfLine;}
+    bool isFinalRow() const;
     bool isFirstInTable() const { return mbFirstInTable;}
     const SwTableBox * getTableBox() const { return mpTableBox;}
     const SwTable * getTable() const { return mpTable;}
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 77101984d429..adb5e65d913b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3063,8 +3063,13 @@ static OutputBorderOptions lcl_getBoxBorderOptions()
     return rOptions;
 }
 
-static void impl_borders( FSHelperPtr const & pSerializer, const SvxBoxItem& rBox, const OutputBorderOptions& rOptions,
-                          std::map<SvxBoxItemLine, css::table::BorderLine2> &rTableStyleConf )
+static void impl_borders( FSHelperPtr const & pSerializer,
+                          const SvxBoxItem& rBox,
+                          const OutputBorderOptions& rOptions,
+                          std::map<SvxBoxItemLine,
+                          css::table::BorderLine2> &rTableStyleConf,
+                          const bool bIsLastColumn = false,
+                          const bool bIsLastRow = false )
 {
     static const SvxBoxItemLine aBorders[] =
     {
@@ -3156,14 +3161,14 @@ static void impl_borders( FSHelperPtr const & pSerializer, const SvxBoxItem& rBo
                 bWriteInsideV = true;
         }
     }
-    if (bWriteInsideH)
+    if (bWriteInsideH && !bIsLastRow)
     {
         const table::BorderLine2 *aStyleProps = nullptr;
         if( rTableStyleConf.find( SvxBoxItemLine::BOTTOM ) != rTableStyleConf.end() )
             aStyleProps = &rTableStyleConf[ SvxBoxItemLine::BOTTOM ];
         impl_borderLine( pSerializer, XML_insideH, rBox.GetLine(SvxBoxItemLine::BOTTOM), 0, false, aStyleProps );
     }
-    if (bWriteInsideV)
+    if (bWriteInsideV && !bIsLastColumn)
     {
         const table::BorderLine2 *aStyleProps = nullptr;
         if( rTableStyleConf.find( SvxBoxItemLine::RIGHT ) != rTableStyleConf.end() )
@@ -3232,6 +3237,8 @@ void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Point
     const SwTableBox *pTableBox = pTableTextNodeInfoInner->getTableBox( );
 
     bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
+    const bool bIsLastColumn = pTableTextNodeInfoInner->isEndOfLine();
+    const bool bIsLastRow = pTableTextNodeInfoInner->isFinalRow();
 
     // Output any table cell redlines if there are any attached to this specific cell
     TableCellRedline( pTableTextNodeInfoInner );
@@ -3291,7 +3298,7 @@ void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Point
     const SvxBoxItem& rDefaultBox = (*tableFirstCells.rbegin())->getTableBox( )->GetFrameFormat( )->GetBox( );
     {
         // The cell borders
-        impl_borders( m_pSerializer, rBox, lcl_getTableCellBorderOptions(bEcma), m_aTableStyleConf );
+        impl_borders( m_pSerializer, rBox, lcl_getTableCellBorderOptions(bEcma), m_aTableStyleConf, bIsLastColumn, bIsLastRow );
     }
 
     TableBackgrounds( pTableTextNodeInfoInner );


More information about the Libreoffice-commits mailing list