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

Miklos Vajna vmiklos at collabora.co.uk
Fri Nov 24 10:14:53 UTC 2017


 writerperfect/qa/unit/EPUBExportTest.cxx                            |   14 ++
 writerperfect/qa/unit/data/writer/epubexport/table-cell-border.fodt |   48 ++++++++++
 writerperfect/source/writer/exp/txtparai.cxx                        |   27 ++---
 writerperfect/source/writer/exp/txtparai.hxx                        |    9 +
 writerperfect/source/writer/exp/txtstyli.cxx                        |   37 +++++++
 writerperfect/source/writer/exp/txtstyli.hxx                        |    2 
 writerperfect/source/writer/exp/xmlfmt.cxx                          |   12 ++
 writerperfect/source/writer/exp/xmlfmt.hxx                          |    6 +
 writerperfect/source/writer/exp/xmlimp.cxx                          |   18 +++
 writerperfect/source/writer/exp/xmlimp.hxx                          |    4 
 writerperfect/source/writer/exp/xmltbli.cxx                         |   11 +-
 11 files changed, 163 insertions(+), 25 deletions(-)

New commits:
commit de523ce9b834b2d8f29409fe21d68b81ef314fe5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Nov 24 09:11:32 2017 +0100

    EPUB export: handle cell border size/style/color
    
    By adding support for automatic cell styles.
    
    Change-Id: I31ff2bb6fed3391f571705505ccbbd89087e5972
    Reviewed-on: https://gerrit.libreoffice.org/45201
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx
index b92d5763276a..31ad665a62a0 100644
--- a/writerperfect/qa/unit/EPUBExportTest.cxx
+++ b/writerperfect/qa/unit/EPUBExportTest.cxx
@@ -75,6 +75,7 @@ public:
     void testImage();
     void testTable();
     void testTableRowSpan();
+    void testTableCellBorder();
     void testLink();
     void testLinkCharFormat();
     void testLinkNamedCharFormat();
@@ -99,6 +100,7 @@ public:
     CPPUNIT_TEST(testImage);
     CPPUNIT_TEST(testTable);
     CPPUNIT_TEST(testTableRowSpan);
+    CPPUNIT_TEST(testTableCellBorder);
     CPPUNIT_TEST(testLink);
     CPPUNIT_TEST(testLinkCharFormat);
     CPPUNIT_TEST(testLinkNamedCharFormat);
@@ -486,6 +488,18 @@ void EPUBExportTest::testTableRowSpan()
     assertXPath(mpXmlDoc, "//xhtml:table/xhtml:tbody/xhtml:tr[1]/xhtml:td[1]", "rowspan", "2");
 }
 
+void EPUBExportTest::testTableCellBorder()
+{
+    createDoc("table-cell-border.fodt", {});
+
+    mpXmlDoc = parseExport("OEBPS/sections/section0001.xhtml");
+    OUString aStyle = getXPath(mpXmlDoc, "//xhtml:table/xhtml:tbody/xhtml:tr[1]/xhtml:td[1]", "style");
+    std::map<OUString, OUString> aCss;
+    parseCssStyle(aStyle, aCss);
+    // This failed, cell border wasn't exported.
+    CPPUNIT_ASSERT_EQUAL(OUString("0.05pt solid #000000"), aCss["border-left"]);
+}
+
 void EPUBExportTest::testLink()
 {
     createDoc("link.fodt", {});
diff --git a/writerperfect/qa/unit/data/writer/epubexport/table-cell-border.fodt b/writerperfect/qa/unit/data/writer/epubexport/table-cell-border.fodt
new file mode 100644
index 000000000000..28beff5ef44f
--- /dev/null
+++ b/writerperfect/qa/unit/data/writer/epubexport/table-cell-border.fodt
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+  <office:automatic-styles>
+    <style:style style:name="Table1" style:family="table">
+      <style:table-properties style:width="17.59cm" table:align="margins"/>
+    </style:style>
+    <style:style style:name="Table1.A" style:family="table-column">
+      <style:table-column-properties style:column-width="8.795cm" style:rel-column-width="32767*"/>
+    </style:style>
+    <style:style style:name="Table1.A1" style:family="table-cell">
+      <style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="0.05pt solid #000000" fo:border-bottom="0.05pt solid #000000"/>
+    </style:style>
+    <style:style style:name="Table1.B1" style:family="table-cell">
+      <style:table-cell-properties fo:padding="0.097cm" fo:border="0.05pt solid #000000"/>
+    </style:style>
+    <style:style style:name="Table1.A2" style:family="table-cell">
+      <style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
+    </style:style>
+    <style:style style:name="Table1.B2" style:family="table-cell">
+      <style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
+    </style:style>
+  </office:automatic-styles>
+  <office:body>
+    <office:text>
+      <text:p>Before</text:p>
+      <table:table table:name="Table1" table:style-name="Table1">
+        <table:table-column table:style-name="Table1.A" table:number-columns-repeated="2"/>
+        <table:table-row>
+          <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+            <text:p>A1</text:p>
+          </table:table-cell>
+          <table:table-cell table:style-name="Table1.B1" office:value-type="string">
+            <text:p>B1</text:p>
+          </table:table-cell>
+        </table:table-row>
+        <table:table-row>
+          <table:table-cell table:style-name="Table1.A2" office:value-type="string">
+            <text:p>A2</text:p>
+          </table:table-cell>
+          <table:table-cell table:style-name="Table1.B2" office:value-type="string">
+            <text:p>B2</text:p>
+          </table:table-cell>
+        </table:table-row>
+      </table:table>
+      <text:p>After</text:p>
+    </office:text>
+  </office:body>
+</office:document>
diff --git a/writerperfect/source/writer/exp/txtparai.cxx b/writerperfect/source/writer/exp/txtparai.cxx
index 9c649c1d25ec..31df98fe7114 100644
--- a/writerperfect/source/writer/exp/txtparai.cxx
+++ b/writerperfect/source/writer/exp/txtparai.cxx
@@ -17,13 +17,6 @@ using namespace com::sun::star;
 namespace
 {
 
-/// Looks for rName in rAutomaticStyles (and failing that, in rNamedStyles) and
-/// fills rPropertyList based on that.
-void FillStyles(const OUString &rName,
-                std::map<OUString, librevenge::RVNGPropertyList> &rAutomaticStyles,
-                std::map<OUString, librevenge::RVNGPropertyList> &rNamedStyles,
-                librevenge::RVNGPropertyList &rPropertyList);
-
 /// Looks for rName in rStyles and fills rPropertyList based on that
 /// (rAutomaticStyles and rNamedStyles are a list of possible parents).
 void FillStyle(const OUString &rName,
@@ -42,7 +35,7 @@ void FillStyle(const OUString &rName,
         // Style has a parent.
         OUString aParent = OStringToOUString(rStyle["style:parent-style-name"]->getStr().cstr(), RTL_TEXTENCODING_UTF8);
         if (!aParent.isEmpty())
-            FillStyles(aParent, rAutomaticStyles, rNamedStyles, rPropertyList);
+            writerperfect::exp::FillStyles(aParent, rAutomaticStyles, rNamedStyles, rPropertyList);
     }
 
     // Apply properties from named style.
@@ -54,15 +47,6 @@ void FillStyle(const OUString &rName,
     }
 }
 
-void FillStyles(const OUString &rName,
-                std::map<OUString, librevenge::RVNGPropertyList> &rAutomaticStyles,
-                std::map<OUString, librevenge::RVNGPropertyList> &rNamedStyles,
-                librevenge::RVNGPropertyList &rPropertyList)
-{
-    FillStyle(rName, rAutomaticStyles, rAutomaticStyles, rNamedStyles, rPropertyList);
-    FillStyle(rName, rNamedStyles, rAutomaticStyles, rNamedStyles, rPropertyList);
-}
-
 }
 
 namespace writerperfect
@@ -343,6 +327,15 @@ rtl::Reference<XMLImportContext> CreateParagraphOrSpanChildContext(XMLImport &rI
     return nullptr;
 }
 
+void FillStyles(const OUString &rName,
+                std::map<OUString, librevenge::RVNGPropertyList> &rAutomaticStyles,
+                std::map<OUString, librevenge::RVNGPropertyList> &rNamedStyles,
+                librevenge::RVNGPropertyList &rPropertyList)
+{
+    FillStyle(rName, rAutomaticStyles, rAutomaticStyles, rNamedStyles, rPropertyList);
+    FillStyle(rName, rNamedStyles, rAutomaticStyles, rNamedStyles, rPropertyList);
+}
+
 } // namespace exp
 } // namespace writerperfect
 
diff --git a/writerperfect/source/writer/exp/txtparai.hxx b/writerperfect/source/writer/exp/txtparai.hxx
index c32ef1916b0b..8a79397e1471 100644
--- a/writerperfect/source/writer/exp/txtparai.hxx
+++ b/writerperfect/source/writer/exp/txtparai.hxx
@@ -10,6 +10,8 @@
 #ifndef INCLUDED_WRITERPERFECT_SOURCE_WRITER_EXP_TXTPARAI_HXX
 #define INCLUDED_WRITERPERFECT_SOURCE_WRITER_EXP_TXTPARAI_HXX
 
+#include <map>
+
 #include "xmlictxt.hxx"
 
 namespace writerperfect
@@ -38,6 +40,13 @@ private:
 /// Shared child context factory for paragraph and span contexts.
 rtl::Reference<XMLImportContext> CreateParagraphOrSpanChildContext(XMLImport &rImport, const OUString &rName, const librevenge::RVNGPropertyList &rTextPropertyList);
 
+/// Looks for rName in rAutomaticStyles (and failing that, in rNamedStyles) and
+/// fills rPropertyList based on that.
+void FillStyles(const OUString &rName,
+                std::map<OUString, librevenge::RVNGPropertyList> &rAutomaticStyles,
+                std::map<OUString, librevenge::RVNGPropertyList> &rNamedStyles,
+                librevenge::RVNGPropertyList &rPropertyList);
+
 } // namespace exp
 } // namespace writerperfect
 
diff --git a/writerperfect/source/writer/exp/txtstyli.cxx b/writerperfect/source/writer/exp/txtstyli.cxx
index bdb36eedea51..a6f04e20c39e 100644
--- a/writerperfect/source/writer/exp/txtstyli.cxx
+++ b/writerperfect/source/writer/exp/txtstyli.cxx
@@ -75,6 +75,34 @@ void XMLTextPropertiesContext::startElement(const OUString &/*rName*/, const css
     }
 }
 
+/// Handler for <style:table-cell-properties>.
+class XMLTableCellPropertiesContext : public XMLImportContext
+{
+public:
+    XMLTableCellPropertiesContext(XMLImport &rImport, XMLStyleContext &rStyle);
+
+    void SAL_CALL startElement(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
+
+private:
+    XMLStyleContext &mrStyle;
+};
+
+XMLTableCellPropertiesContext::XMLTableCellPropertiesContext(XMLImport &rImport, XMLStyleContext &rStyle)
+    : XMLImportContext(rImport)
+    , mrStyle(rStyle)
+{
+}
+
+void XMLTableCellPropertiesContext::startElement(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs)
+{
+    for (sal_Int16 i = 0; i < xAttribs->getLength(); ++i)
+    {
+        OString sName = OUStringToOString(xAttribs->getNameByIndex(i), RTL_TEXTENCODING_UTF8);
+        OString sValue = OUStringToOString(xAttribs->getValueByIndex(i), RTL_TEXTENCODING_UTF8);
+        mrStyle.GetCellPropertyList().insert(sName.getStr(), sValue.getStr());
+    }
+}
+
 XMLStyleContext::XMLStyleContext(XMLImport &rImport, XMLStylesContext &rStyles)
     : XMLImportContext(rImport),
       m_rStyles(rStyles)
@@ -87,6 +115,8 @@ rtl::Reference<XMLImportContext> XMLStyleContext::CreateChildContext(const OUStr
         return new XMLParagraphPropertiesContext(mrImport, *this);
     if (rName == "style:text-properties")
         return new XMLTextPropertiesContext(mrImport, *this);
+    if (rName == "style:table-cell-properties")
+        return new XMLTableCellPropertiesContext(mrImport, *this);
     return nullptr;
 }
 
@@ -118,6 +148,8 @@ void XMLStyleContext::endElement(const OUString &/*rName*/)
         m_rStyles.GetCurrentTextStyles()[m_aName] = m_aTextPropertyList;
     if (m_aFamily == "paragraph")
         m_rStyles.GetCurrentParagraphStyles()[m_aName] = m_aParagraphPropertyList;
+    if (m_aFamily == "table-cell")
+        m_rStyles.GetCurrentCellStyles()[m_aName] = m_aCellPropertyList;
 }
 
 librevenge::RVNGPropertyList &XMLStyleContext::GetTextPropertyList()
@@ -130,6 +162,11 @@ librevenge::RVNGPropertyList &XMLStyleContext::GetParagraphPropertyList()
     return m_aParagraphPropertyList;
 }
 
+librevenge::RVNGPropertyList &XMLStyleContext::GetCellPropertyList()
+{
+    return m_aCellPropertyList;
+}
+
 } // namespace exp
 } // namespace writerperfect
 
diff --git a/writerperfect/source/writer/exp/txtstyli.hxx b/writerperfect/source/writer/exp/txtstyli.hxx
index 5852730049a0..8550cb66d879 100644
--- a/writerperfect/source/writer/exp/txtstyli.hxx
+++ b/writerperfect/source/writer/exp/txtstyli.hxx
@@ -33,12 +33,14 @@ public:
 
     librevenge::RVNGPropertyList &GetTextPropertyList();
     librevenge::RVNGPropertyList &GetParagraphPropertyList();
+    librevenge::RVNGPropertyList &GetCellPropertyList();
 
 private:
     OUString m_aName;
     OUString m_aFamily;
     librevenge::RVNGPropertyList m_aTextPropertyList;
     librevenge::RVNGPropertyList m_aParagraphPropertyList;
+    librevenge::RVNGPropertyList m_aCellPropertyList;
     XMLStylesContext &m_rStyles;
 };
 
diff --git a/writerperfect/source/writer/exp/xmlfmt.cxx b/writerperfect/source/writer/exp/xmlfmt.cxx
index f1e501ccc748..52698fec8740 100644
--- a/writerperfect/source/writer/exp/xmlfmt.cxx
+++ b/writerperfect/source/writer/exp/xmlfmt.cxx
@@ -19,10 +19,13 @@ namespace writerperfect
 namespace exp
 {
 
-XMLStylesContext::XMLStylesContext(XMLImport &rImport, std::map<OUString, librevenge::RVNGPropertyList> &rParagraphStyles, std::map<OUString, librevenge::RVNGPropertyList> &rTextStyles)
+XMLStylesContext::XMLStylesContext(XMLImport &rImport, std::map<OUString, librevenge::RVNGPropertyList> &rParagraphStyles,
+                                   std::map<OUString, librevenge::RVNGPropertyList> &rTextStyles,
+                                   std::map<OUString, librevenge::RVNGPropertyList> &rCellStyles)
     : XMLImportContext(rImport),
       m_rParagraphStyles(rParagraphStyles),
-      m_rTextStyles(rTextStyles)
+      m_rTextStyles(rTextStyles),
+      m_rCellStyles(rCellStyles)
 {
 }
 
@@ -43,6 +46,11 @@ std::map<OUString, librevenge::RVNGPropertyList> &XMLStylesContext::GetCurrentTe
     return m_rTextStyles;
 }
 
+std::map<OUString, librevenge::RVNGPropertyList> &XMLStylesContext::GetCurrentCellStyles()
+{
+    return m_rCellStyles;
+}
+
 } // namespace exp
 } // namespace writerperfect
 
diff --git a/writerperfect/source/writer/exp/xmlfmt.hxx b/writerperfect/source/writer/exp/xmlfmt.hxx
index aea29dbdfa8f..cd89121b7dd5 100644
--- a/writerperfect/source/writer/exp/xmlfmt.hxx
+++ b/writerperfect/source/writer/exp/xmlfmt.hxx
@@ -25,15 +25,19 @@ namespace exp
 class XMLStylesContext : public XMLImportContext
 {
 public:
-    XMLStylesContext(XMLImport &rImport, std::map<OUString, librevenge::RVNGPropertyList> &rParagraphStyles, std::map<OUString, librevenge::RVNGPropertyList> &rTextStyles);
+    XMLStylesContext(XMLImport &rImport, std::map<OUString, librevenge::RVNGPropertyList> &rParagraphStyles,
+                     std::map<OUString, librevenge::RVNGPropertyList> &rTextStyles,
+                     std::map<OUString, librevenge::RVNGPropertyList> &rCellStyles);
 
     rtl::Reference<XMLImportContext> CreateChildContext(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
 
     std::map<OUString, librevenge::RVNGPropertyList> &GetCurrentParagraphStyles();
     std::map<OUString, librevenge::RVNGPropertyList> &GetCurrentTextStyles();
+    std::map<OUString, librevenge::RVNGPropertyList> &GetCurrentCellStyles();
 private:
     std::map<OUString, librevenge::RVNGPropertyList> &m_rParagraphStyles;
     std::map<OUString, librevenge::RVNGPropertyList> &m_rTextStyles;
+    std::map<OUString, librevenge::RVNGPropertyList> &m_rCellStyles;
 };
 
 } // namespace exp
diff --git a/writerperfect/source/writer/exp/xmlimp.cxx b/writerperfect/source/writer/exp/xmlimp.cxx
index 5d368ed277f0..67b4fd713149 100644
--- a/writerperfect/source/writer/exp/xmlimp.cxx
+++ b/writerperfect/source/writer/exp/xmlimp.cxx
@@ -63,9 +63,13 @@ rtl::Reference<XMLImportContext> XMLOfficeDocContext::CreateChildContext(const O
     else if (rName == "office:meta")
         return new XMLMetaDocumentContext(mrImport);
     else if (rName == "office:automatic-styles")
-        return new XMLStylesContext(mrImport, mrImport.GetAutomaticParagraphStyles(), mrImport.GetAutomaticTextStyles());
+        return new XMLStylesContext(mrImport, mrImport.GetAutomaticParagraphStyles(),
+                                    mrImport.GetAutomaticTextStyles(),
+                                    mrImport.GetAutomaticCellStyles());
     else if (rName == "office:styles")
-        return new XMLStylesContext(mrImport, mrImport.GetParagraphStyles(), mrImport.GetTextStyles());
+        return new XMLStylesContext(mrImport, mrImport.GetParagraphStyles(),
+                                    mrImport.GetTextStyles(),
+                                    mrImport.GetCellStyles());
     return nullptr;
 }
 
@@ -96,6 +100,11 @@ std::map<OUString, librevenge::RVNGPropertyList> &XMLImport::GetAutomaticParagra
     return maAutomaticParagraphStyles;
 }
 
+std::map<OUString, librevenge::RVNGPropertyList> &XMLImport::GetAutomaticCellStyles()
+{
+    return maAutomaticCellStyles;
+}
+
 std::map<OUString, librevenge::RVNGPropertyList> &XMLImport::GetTextStyles()
 {
     return maTextStyles;
@@ -106,6 +115,11 @@ std::map<OUString, librevenge::RVNGPropertyList> &XMLImport::GetParagraphStyles(
     return maParagraphStyles;
 }
 
+std::map<OUString, librevenge::RVNGPropertyList> &XMLImport::GetCellStyles()
+{
+    return maCellStyles;
+}
+
 void XMLImport::startDocument()
 {
     mrGenerator.startDocument(librevenge::RVNGPropertyList());
diff --git a/writerperfect/source/writer/exp/xmlimp.hxx b/writerperfect/source/writer/exp/xmlimp.hxx
index f971327fada8..2540e4db8d22 100644
--- a/writerperfect/source/writer/exp/xmlimp.hxx
+++ b/writerperfect/source/writer/exp/xmlimp.hxx
@@ -39,6 +39,8 @@ class XMLImport : public cppu::WeakImplHelper
     std::map<OUString, librevenge::RVNGPropertyList> maTextStyles;
     std::map<OUString, librevenge::RVNGPropertyList> maAutomaticParagraphStyles;
     std::map<OUString, librevenge::RVNGPropertyList> maParagraphStyles;
+    std::map<OUString, librevenge::RVNGPropertyList> maAutomaticCellStyles;
+    std::map<OUString, librevenge::RVNGPropertyList> maCellStyles;
 
 public:
     XMLImport(librevenge::RVNGTextInterface &rGenerator);
@@ -48,8 +50,10 @@ public:
     librevenge::RVNGTextInterface &GetGenerator() const;
     std::map<OUString, librevenge::RVNGPropertyList> &GetAutomaticTextStyles();
     std::map<OUString, librevenge::RVNGPropertyList> &GetAutomaticParagraphStyles();
+    std::map<OUString, librevenge::RVNGPropertyList> &GetAutomaticCellStyles();
     std::map<OUString, librevenge::RVNGPropertyList> &GetTextStyles();
     std::map<OUString, librevenge::RVNGPropertyList> &GetParagraphStyles();
+    std::map<OUString, librevenge::RVNGPropertyList> &GetCellStyles();
 
     // XDocumentHandler
     void SAL_CALL startDocument() override;
diff --git a/writerperfect/source/writer/exp/xmltbli.cxx b/writerperfect/source/writer/exp/xmltbli.cxx
index cdaabdab0349..15444bc33e0b 100644
--- a/writerperfect/source/writer/exp/xmltbli.cxx
+++ b/writerperfect/source/writer/exp/xmltbli.cxx
@@ -50,9 +50,14 @@ void XMLTableCellContext::startElement(const OUString &/*rName*/, const css::uno
         const OUString &rAttributeName = xAttribs->getNameByIndex(i);
         const OUString &rAttributeValue = xAttribs->getValueByIndex(i);
 
-        OString sName = OUStringToOString(rAttributeName, RTL_TEXTENCODING_UTF8);
-        OString sValue = OUStringToOString(rAttributeValue, RTL_TEXTENCODING_UTF8);
-        aPropertyList.insert(sName.getStr(), sValue.getStr());
+        if (rAttributeName == "table:style-name")
+            FillStyles(rAttributeValue, mrImport.GetAutomaticCellStyles(), mrImport.GetCellStyles(), aPropertyList);
+        else
+        {
+            OString sName = OUStringToOString(rAttributeName, RTL_TEXTENCODING_UTF8);
+            OString sValue = OUStringToOString(rAttributeValue, RTL_TEXTENCODING_UTF8);
+            aPropertyList.insert(sName.getStr(), sValue.getStr());
+        }
     }
     mrImport.GetGenerator().openTableCell(aPropertyList);
 }


More information about the Libreoffice-commits mailing list