summaryrefslogtreecommitdiff
path: root/writerperfect/source/writer/exp/txtparai.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-08-15 08:45:33 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-08-15 10:20:18 +0200
commit185e197724c1e2cdb07ebb94be617c856d45d96f (patch)
tree24a35cec349fe42f5a34d7288d43c5664ec792fd /writerperfect/source/writer/exp/txtparai.cxx
parentec630a00212c90d5a6e57264dd3fb9c3f31a1f53 (diff)
EPUB export: initial span support
Characters under <text:span> (and not only under <text:p>) are now handled. Change-Id: Iac353005423d65f446b9f93519957f4caeaf1c7a Reviewed-on: https://gerrit.libreoffice.org/41164 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'writerperfect/source/writer/exp/txtparai.cxx')
-rw-r--r--writerperfect/source/writer/exp/txtparai.cxx36
1 files changed, 35 insertions, 1 deletions
diff --git a/writerperfect/source/writer/exp/txtparai.cxx b/writerperfect/source/writer/exp/txtparai.cxx
index 9507ceb759b9..8abf113dad52 100644
--- a/writerperfect/source/writer/exp/txtparai.cxx
+++ b/writerperfect/source/writer/exp/txtparai.cxx
@@ -18,13 +18,47 @@ namespace writerperfect
namespace exp
{
+/// Handler for <text:span>.
+class XMLSpanContext : public XMLImportContext
+{
+public:
+ XMLSpanContext(XMLImport &rImport);
+
+ void SAL_CALL startElement(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
+ void SAL_CALL endElement(const OUString &rName) override;
+ void SAL_CALL characters(const OUString &rChars) override;
+};
+
+XMLSpanContext::XMLSpanContext(XMLImport &rImport)
+ : XMLImportContext(rImport)
+{
+}
+
+void XMLSpanContext::startElement(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
+{
+ mrImport.GetGenerator().openSpan(librevenge::RVNGPropertyList());
+}
+
+void XMLSpanContext::endElement(const OUString &/*rName*/)
+{
+ mrImport.GetGenerator().closeSpan();
+}
+
+void XMLSpanContext::characters(const OUString &rChars)
+{
+ OString sCharU8 = OUStringToOString(rChars, RTL_TEXTENCODING_UTF8);
+ mrImport.GetGenerator().insertText(librevenge::RVNGString(sCharU8.getStr()));
+}
+
XMLParaContext::XMLParaContext(XMLImport &rImport)
: XMLImportContext(rImport)
{
}
-XMLImportContext *XMLParaContext::CreateChildContext(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
+XMLImportContext *XMLParaContext::CreateChildContext(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
{
+ if (rName == "text:span")
+ return new XMLSpanContext(mrImport);
return nullptr;
}