diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx index 3bce1b5a9ba5..0d869737fc8e 100644 --- a/writerperfect/qa/unit/EPUBExportTest.cxx +++ b/writerperfect/qa/unit/EPUBExportTest.cxx @@ -325,7 +325,9 @@ void EPUBExportTest::testLineBreak() mpXmlDoc = parseExport("OEBPS/sections/section0001.xhtml"); // This was 0, line break was not handled. - assertXPath(mpXmlDoc, "//xhtml:p/xhtml:br", 1); + assertXPath(mpXmlDoc, "//xhtml:p[1]/xhtml:br", 1); + // This was 0, line break inside span was not handled. + assertXPath(mpXmlDoc, "//xhtml:p[2]/xhtml:br", 1); } CPPUNIT_TEST_SUITE_REGISTRATION(EPUBExportTest); diff --git a/writerperfect/qa/unit/data/writer/epubexport/line-break.fodt b/writerperfect/qa/unit/data/writer/epubexport/line-break.fodt index c380f6df0063..1a6fca72b08a 100644 --- a/writerperfect/qa/unit/data/writer/epubexport/line-break.fodt +++ b/writerperfect/qa/unit/data/writer/epubexport/line-break.fodt @@ -1,8 +1,20 @@ - + + + + + + + + + + + + ab + aabb diff --git a/writerperfect/source/writer/exp/txtparai.cxx b/writerperfect/source/writer/exp/txtparai.cxx index c476904277e2..b085537cf106 100644 --- a/writerperfect/source/writer/exp/txtparai.cxx +++ b/writerperfect/source/writer/exp/txtparai.cxx @@ -103,7 +103,7 @@ XMLImportContext *XMLSpanContext::CreateChildContext(const OUString &rName, cons return new XMLTextFrameContext(mrImport); if (rName == "text:span") return new XMLSpanContext(mrImport, &m_aPropertyList); - return nullptr; + return writerperfect::exp::CreateChildContext(mrImport, rName); } void XMLSpanContext::startElement(const OUString &/*rName*/, const css::uno::Reference &xAttribs) @@ -207,9 +207,7 @@ XMLImportContext *XMLParaContext::CreateChildContext(const OUString &rName, cons return new XMLSpanContext(mrImport, nullptr); if (rName == "text:a") return new XMLHyperlinkContext(mrImport); - if (rName == "text:line-break") - return new XMLLineBreakContext(mrImport); - return nullptr; + return writerperfect::exp::CreateChildContext(mrImport, rName); } void XMLParaContext::startElement(const OUString &/*rName*/, const css::uno::Reference &xAttribs) @@ -253,6 +251,13 @@ void XMLParaContext::characters(const OUString &rChars) mrImport.GetGenerator().closeSpan(); } +XMLImportContext *CreateChildContext(XMLImport &rImport, const OUString &rName) +{ + if (rName == "text:line-break") + return new XMLLineBreakContext(rImport); + return nullptr; +} + } // namespace exp } // namespace writerperfect diff --git a/writerperfect/source/writer/exp/txtparai.hxx b/writerperfect/source/writer/exp/txtparai.hxx index 61c3fc5bfc73..52543ffeadde 100644 --- a/writerperfect/source/writer/exp/txtparai.hxx +++ b/writerperfect/source/writer/exp/txtparai.hxx @@ -33,6 +33,9 @@ private: OUString m_aStyleName; }; +/// Shared child context factory for paragraph and span contexts. +XMLImportContext *CreateChildContext(XMLImport &rImport, const OUString &rName); + } // namespace exp } // namespace writerperfect