summaryrefslogtreecommitdiff
path: root/writerperfect/source/writer/exp/txtparai.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-09-08 12:02:51 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-09-08 14:10:16 +0200
commita27eb931c22313d4dd5c73b35358c0532d20b79e (patch)
treeeb922abdafe8c26d7f6a3302aadcde90c49f143a /writerperfect/source/writer/exp/txtparai.cxx
parent9c34c9c2409a8f09c3373d314ef7872d7c2aee92 (diff)
EPUB export: fix double escaped NBSP
The EPUB package interface already XML-escapes characters, avoid a double escape. And once that works, handle NBSP/tabs. Change-Id: I8b7bbdc2592096bdd46fbdb29b48b723ef5cf990 Reviewed-on: https://gerrit.libreoffice.org/42098 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.cxx46
1 files changed, 46 insertions, 0 deletions
diff --git a/writerperfect/source/writer/exp/txtparai.cxx b/writerperfect/source/writer/exp/txtparai.cxx
index b085537cf106..e660a34b1e30 100644
--- a/writerperfect/source/writer/exp/txtparai.cxx
+++ b/writerperfect/source/writer/exp/txtparai.cxx
@@ -152,6 +152,48 @@ void XMLLineBreakContext::startElement(const OUString &/*rName*/, const css::uno
mrImport.GetGenerator().insertLineBreak();
}
+/// Handler for <text:s>.
+class XMLSpaceContext : public XMLImportContext
+{
+public:
+ XMLSpaceContext(XMLImport &rImport);
+
+ void SAL_CALL startElement(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
+};
+
+XMLSpaceContext::XMLSpaceContext(XMLImport &rImport)
+ : XMLImportContext(rImport)
+{
+}
+
+void XMLSpaceContext::startElement(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
+{
+ mrImport.GetGenerator().openSpan(librevenge::RVNGPropertyList());
+ mrImport.GetGenerator().insertSpace();
+ mrImport.GetGenerator().closeSpan();
+}
+
+/// Handler for <text:tab>.
+class XMLTabContext : public XMLImportContext
+{
+public:
+ XMLTabContext(XMLImport &rImport);
+
+ void SAL_CALL startElement(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
+};
+
+XMLTabContext::XMLTabContext(XMLImport &rImport)
+ : XMLImportContext(rImport)
+{
+}
+
+void XMLTabContext::startElement(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
+{
+ mrImport.GetGenerator().openSpan(librevenge::RVNGPropertyList());
+ mrImport.GetGenerator().insertTab();
+ mrImport.GetGenerator().closeSpan();
+}
+
/// Handler for <text:a>.
class XMLHyperlinkContext : public XMLImportContext
{
@@ -255,6 +297,10 @@ XMLImportContext *CreateChildContext(XMLImport &rImport, const OUString &rName)
{
if (rName == "text:line-break")
return new XMLLineBreakContext(rImport);
+ if (rName == "text:s")
+ return new XMLSpaceContext(rImport);
+ if (rName == "text:tab")
+ return new XMLTabContext(rImport);
return nullptr;
}