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

Jakub Trzebiatowski ubap.dev at gmail.com
Thu Sep 8 05:49:53 UTC 2016


 sw/qa/extras/odfexport/data/table_styles_5.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx           |   24 ++++++++++++++++++++++++
 sw/source/core/unocore/unostyle.cxx            |    3 ++-
 3 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit 6ccb82ddf302acbd56bd4ea67fce107883e5391c
Author: Jakub Trzebiatowski <ubap.dev at gmail.com>
Date:   Wed Sep 7 20:42:11 2016 +0200

    tdf#101712 Writer Table Style; odf export; remove parent export for cell style
    
    Do not export the parent-style-name attribute for a cell style.
    The parent-style-name attribute should refer to a style of table-cell
    family. Not a table-template element.
    
    Reviewed on:
    	https://gerrit.libreoffice.org/28729
    
    Change-Id: I350ec7cef0ac544ce4e5dec54015412a4070b1d8

diff --git a/sw/qa/extras/odfexport/data/table_styles_5.odt b/sw/qa/extras/odfexport/data/table_styles_5.odt
new file mode 100644
index 0000000..c909583
Binary files /dev/null and b/sw/qa/extras/odfexport/data/table_styles_5.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index cca1ed0..f53ec92 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1139,6 +1139,30 @@ DECLARE_ODFIMPORT_TEST(testTableStyles4, "table_styles_4.odt")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00ff00), getProperty<sal_Int32>(xCell1Style, "BackColor"));
 }
 
+DECLARE_ODFEXPORT_TEST(testTableStyles5, "table_styles_5.odt")
+{
+    // Test if cell styles doesn't have a style:parent-style-name attribute.
+    if (xmlDocPtr pXmlDoc = parseExport("styles.xml"))
+    {
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.1']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.2']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.3']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.4']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.5']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.6']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.7']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.8']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.9']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.10']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.11']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.12']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.13']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.14']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.15']", "parent-style-name");
+        assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:display-name='Test style.16']", "parent-style-name");
+    }
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 41948a2..95f1647 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -4860,7 +4860,8 @@ sal_Bool SAL_CALL SwXTextCellStyle::isInUse() throw (css::uno::RuntimeException,
 
 OUString SAL_CALL SwXTextCellStyle::getParentStyle() throw (css::uno::RuntimeException, std::exception)
 {
-    return m_sParentStyle;
+    // Do not return name of the parent (which is a table style) because the parent should be a cell style.
+    return OUString();
 }
 
 void SAL_CALL SwXTextCellStyle::setParentStyle(const OUString& /*sParentStyle*/) throw (css::container::NoSuchElementException, css::uno::RuntimeException, std::exception)


More information about the Libreoffice-commits mailing list