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

Miklos Vajna vmiklos at collabora.co.uk
Fri Oct 3 09:23:22 PDT 2014


 sw/qa/extras/ooxmlexport/data/table-position.docx            |binary
 sw/qa/extras/ooxmlexport/data/table-style-border-export.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                     |   10 ++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx                 |    8 ++++++--
 4 files changed, 16 insertions(+), 2 deletions(-)

New commits:
commit a3b154ab0262e39497e788917085708ec645eae6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Oct 3 18:04:56 2014 +0200

    DOCX export: fix missing table border when original doc has table style
    
    Scenario is that the original document has a table style, which sets
    borders around the table, so A1 cell gets top and left borders (and none
    for right/bottom). Then on export, if we write A1 as table default, then
    this overwrites the table style, so the real right / bottom borders from
    the table style are lost, as on export we think that they are available
    from the table style already, so we don't write them.
    
    Regression from commit ae61569eea0719a882010cfbb260a1a0d690d974 (oox: Do
    not overwrite table style properties, 2014-04-03).
    
    Change-Id: I54c10ffc2ade65260693b769274b1311efc086f9

diff --git a/sw/qa/extras/ooxmlexport/data/table-style-border-export.docx b/sw/qa/extras/ooxmlexport/data/table-style-border-export.docx
new file mode 100644
index 0000000..eeb23ee
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/table-style-border-export.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index c35b404..d1ef8ae 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -393,6 +393,16 @@ DECLARE_OOXMLEXPORT_TEST(testTableStyleBorder, "table-style-border.docx")
     CPPUNIT_ASSERT(getProperty<table::BorderLine2>(xCell, "RightBorder").LineWidth > 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTableStyleBorderExport, "table-style-border-export.docx")
+{
+    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+    uno::Reference<table::XCell> xCell = xTable->getCellByName("A3");
+    // Bottom border was white, so this was 0xffffff.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0x8064A2), getProperty<table::BorderLine2>(xCell, "BottomBorder").Color);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index da0c48c..36b1f30 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3386,8 +3386,12 @@ void DocxAttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Point
 
     bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
 
-    // the defaults of the table are taken from the top-left cell
-    impl_borders( m_pSerializer, pFrmFmt->GetBox( ), lcl_getTableDefaultBorderOptions(bEcma), NULL, m_aTableStyleConf );
+    // 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, pFrmFmt->GetBox(), lcl_getTableDefaultBorderOptions(bEcma), NULL, m_aTableStyleConf);
+    }
 }
 
 void DocxAttributeOutput::TableDefaultCellMargins( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
commit 453583cc610b3dacddede52662fa4df276dd7c61
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Oct 3 17:54:45 2014 +0200

    CppunitTest_sw_ooxmlexport2: clean up test file
    
    This test file wants to test table positioning, but it also has
    references to table styles. Remove these references to keep the testcase
    minimal.
    
    Change-Id: Ib7c7086bf767a8580dd7bae4452d0773e02d32a2

diff --git a/sw/qa/extras/ooxmlexport/data/table-position.docx b/sw/qa/extras/ooxmlexport/data/table-position.docx
index 4347854..f59a5da 100644
Binary files a/sw/qa/extras/ooxmlexport/data/table-position.docx and b/sw/qa/extras/ooxmlexport/data/table-position.docx differ


More information about the Libreoffice-commits mailing list