diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-08-15 16:13:14 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-08-15 19:46:52 +0200 |
commit | b6f39c47fb477f16c65631523b0c18b4f262fadf (patch) | |
tree | b68c147743d78e6b3073ac7c3aa52a2c1d25c580 /writerperfect/source | |
parent | 26b97ba18e72f7c25c836177d895d429162a0120 (diff) |
EPUB export: initial index support
Split output by chapters. The index is still basic, just "Section N"
entries so far.
Change-Id: I4db659ee4110ab30f4b75f44c41f958533ddad7f
Reviewed-on: https://gerrit.libreoffice.org/41177
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerperfect/source')
-rw-r--r-- | writerperfect/source/writer/EPUBExportFilter.cxx | 2 | ||||
-rw-r--r-- | writerperfect/source/writer/exp/txtparai.cxx | 16 |
2 files changed, 15 insertions, 3 deletions
diff --git a/writerperfect/source/writer/EPUBExportFilter.cxx b/writerperfect/source/writer/EPUBExportFilter.cxx index ee15b88adbc1..8a8e14c72ce8 100644 --- a/writerperfect/source/writer/EPUBExportFilter.cxx +++ b/writerperfect/source/writer/EPUBExportFilter.cxx @@ -36,7 +36,7 @@ sal_Bool EPUBExportFilter::filter(const uno::Sequence<beans::PropertyValue> &rDe // file, the flat ODF filter has access to the doc model, everything else // is in-between. EPUBPackage aPackage(mxContext, rDescriptor); - libepubgen::EPUBTextGenerator aGenerator(&aPackage, libepubgen::EPUB_SPLIT_METHOD_PAGE_BREAK, /*version=*/30); + libepubgen::EPUBTextGenerator aGenerator(&aPackage, libepubgen::EPUB_SPLIT_METHOD_HEADING, /*version=*/30); uno::Reference<xml::sax::XDocumentHandler> xExportHandler(new exp::XMLImport(aGenerator)); uno::Reference<lang::XInitialization> xInitialization(mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.comp.Writer.XMLOasisExporter", mxContext), uno::UNO_QUERY); diff --git a/writerperfect/source/writer/exp/txtparai.cxx b/writerperfect/source/writer/exp/txtparai.cxx index 8abf113dad52..02e4f78c1ef5 100644 --- a/writerperfect/source/writer/exp/txtparai.cxx +++ b/writerperfect/source/writer/exp/txtparai.cxx @@ -62,9 +62,21 @@ XMLImportContext *XMLParaContext::CreateChildContext(const OUString &rName, cons return nullptr; } -void XMLParaContext::startElement(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/) +void XMLParaContext::startElement(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) { - mrImport.GetGenerator().openParagraph(librevenge::RVNGPropertyList()); + librevenge::RVNGPropertyList aPropertyList; + for (sal_Int16 i = 0; i < xAttribs->getLength(); ++i) + { + const OUString &rAttributeName = xAttribs->getNameByIndex(i); + if (rAttributeName != "text:style-name") + { + OString sName = OUStringToOString(rAttributeName, RTL_TEXTENCODING_UTF8); + OString sValue = OUStringToOString(xAttribs->getValueByIndex(i), RTL_TEXTENCODING_UTF8); + aPropertyList.insert(sName.getStr(), sValue.getStr()); + } + } + + mrImport.GetGenerator().openParagraph(aPropertyList); } void XMLParaContext::endElement(const OUString &/*rName*/) |