summaryrefslogtreecommitdiff
path: root/writerperfect/source/writer/exp/txtparai.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-08-11 09:11:22 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-08-11 10:41:21 +0200
commit9456afaa5aa12926b1aa6b74ece1654d47e1c650 (patch)
treef513f82cfbb258d7585f436f412c8106b6de44bf /writerperfect/source/writer/exp/txtparai.cxx
parent7d30d029f4f95eed91c814469d700445ed6b019b (diff)
EPUB export: rework to use context classes
Before writerperfect::exp::XMLImport grows into a God object. Also, if I'm at it, recurse into text:h to include heading text. Change-Id: Iede56d00dbede40186b6484d0be92a2ac2e4768e Reviewed-on: https://gerrit.libreoffice.org/41005 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerperfect/source/writer/exp/txtparai.cxx')
-rw-r--r--writerperfect/source/writer/exp/txtparai.cxx50
1 files changed, 50 insertions, 0 deletions
diff --git a/writerperfect/source/writer/exp/txtparai.cxx b/writerperfect/source/writer/exp/txtparai.cxx
new file mode 100644
index 000000000000..9507ceb759b9
--- /dev/null
+++ b/writerperfect/source/writer/exp/txtparai.cxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "txtparai.hxx"
+
+#include "xmlimp.hxx"
+
+using namespace com::sun::star;
+
+namespace writerperfect
+{
+namespace exp
+{
+
+XMLParaContext::XMLParaContext(XMLImport &rImport)
+ : XMLImportContext(rImport)
+{
+}
+
+XMLImportContext *XMLParaContext::CreateChildContext(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
+{
+ return nullptr;
+}
+
+void XMLParaContext::startElement(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
+{
+ mrImport.GetGenerator().openParagraph(librevenge::RVNGPropertyList());
+}
+
+void XMLParaContext::endElement(const OUString &/*rName*/)
+{
+ mrImport.GetGenerator().closeParagraph();
+}
+
+void XMLParaContext::characters(const OUString &rChars)
+{
+ OString sCharU8 = OUStringToOString(rChars, RTL_TEXTENCODING_UTF8);
+ mrImport.GetGenerator().insertText(librevenge::RVNGString(sCharU8.getStr()));
+}
+
+} // namespace exp
+} // namespace writerperfect
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */