summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Trzebiatowski <ubap.dev@gmail.com>2016-09-07 20:42:11 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-09-08 07:49:11 +0200
commit6ccb82ddf302acbd56bd4ea67fce107883e5391c (patch)
tree3e125009a2d6c51a7bd7cae20da57dfb4da49e56
parent1c2ac71f80e271a6352384e0bce8c8f432bf37f6 (diff)
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
-rw-r--r--sw/qa/extras/odfexport/data/table_styles_5.odtbin0 -> 9841 bytes
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx24
-rw-r--r--sw/source/core/unocore/unostyle.cxx3
3 files changed, 26 insertions, 1 deletions
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 000000000000..c90958322a30
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/table_styles_5.odt
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index cca1ed0f6c5f..f53ec92c9c02 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 41948a2c3a34..95f16478ecff 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)