writerperfect/qa/unit/EPUBExportTest.cxx | 5 +++++ writerperfect/source/writer/exp/txtparai.cxx | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+)
New commits: commit cb682e03bd8f1ae852135dc7a68d6926d9356405 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Nov 27 08:26:34 2017 +0100 EPUB export: handle sequence fields Just emit their expanded content for now. Change-Id: Ibca40d201dde9c8d6ef920b5213f786f64d7c027 Reviewed-on: https://gerrit.libreoffice.org/45313 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx index fdcafe827147..25d1a35c1873 100644 --- a/writerperfect/qa/unit/EPUBExportTest.cxx +++ b/writerperfect/qa/unit/EPUBExportTest.cxx @@ -581,6 +581,11 @@ void EPUBExportTest::testTextBox() // This failed, image with caption was lost. assertXPath(mpXmlDoc, "//xhtml:img", "class", "frame1"); + // Expected spans: + // 1) break after the image + // 2) "Illustration " + // 3) The sequence field, this was missing (was ": foo" instead). + assertXPathContent(mpXmlDoc, "//xhtml:div/xhtml:p/xhtml:span[3]", "1"); } CPPUNIT_TEST_SUITE_REGISTRATION(EPUBExportTest); diff --git a/writerperfect/source/writer/exp/txtparai.cxx b/writerperfect/source/writer/exp/txtparai.cxx index 82d0b8ab6e3d..75144f5a1f19 100644 --- a/writerperfect/source/writer/exp/txtparai.cxx +++ b/writerperfect/source/writer/exp/txtparai.cxx @@ -54,6 +54,30 @@ namespace writerperfect namespace exp { +/// Handler for <text:sequence>. +class XMLTextSequenceContext : public XMLImportContext +{ +public: + XMLTextSequenceContext(XMLImport &rImport); + + void SAL_CALL characters(const OUString &rChars) override; +}; + +XMLTextSequenceContext::XMLTextSequenceContext(XMLImport &rImport) + : XMLImportContext(rImport) +{ +} + +void XMLTextSequenceContext::characters(const OUString &rChars) +{ + mrImport.GetGenerator().openSpan(librevenge::RVNGPropertyList()); + + OString sCharU8 = OUStringToOString(rChars, RTL_TEXTENCODING_UTF8); + mrImport.GetGenerator().insertText(librevenge::RVNGString(sCharU8.getStr())); + + mrImport.GetGenerator().closeSpan(); +} + /// Handler for <text:span>. class XMLSpanContext : public XMLImportContext { @@ -324,6 +348,8 @@ rtl::Reference<XMLImportContext> CreateParagraphOrSpanChildContext(XMLImport &rI return new XMLTabContext(rImport, rTextPropertyList); if (rName == "draw:frame") return new XMLTextFrameContext(rImport); + if (rName == "text:sequence") + return new XMLTextSequenceContext(rImport); return nullptr; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits