summaryrefslogtreecommitdiff
path: root/writerperfect/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-08-25 14:10:01 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-08-25 16:07:30 +0200
commit3a1d6a2bccd05e5859ab44593609d11c39fc518a (patch)
tree9aafa9c1c95ff3dc749aee3d4cbc37d477dd74f4 /writerperfect/source
parentbafe8a5ef091a83a90d639fd3f583422fa055d53 (diff)
EPUB export: allow setting a custom version
By parsing the FilterData key of the media descriptor, similar to how the PDF export does it. The default is still EPUB3, but this now exposes the ability of libepubgen to emit EPUB2 if wanted. Change-Id: I23834fa28db9b01ef4cce4a142331b1cc9ecb3c2 Reviewed-on: https://gerrit.libreoffice.org/41566 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'writerperfect/source')
-rw-r--r--writerperfect/source/writer/EPUBExportFilter.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/writerperfect/source/writer/EPUBExportFilter.cxx b/writerperfect/source/writer/EPUBExportFilter.cxx
index 465d8bc256ac..ac16cd570198 100644
--- a/writerperfect/source/writer/EPUBExportFilter.cxx
+++ b/writerperfect/source/writer/EPUBExportFilter.cxx
@@ -34,13 +34,30 @@ EPUBExportFilter::EPUBExportFilter(const uno::Reference<uno::XComponentContext>
sal_Bool EPUBExportFilter::filter(const uno::Sequence<beans::PropertyValue> &rDescriptor)
{
+ sal_Int32 nVersion = 30;
+ uno::Sequence<beans::PropertyValue> aFilterData;
+ for (sal_Int32 i = 0; i < rDescriptor.getLength(); ++i)
+ {
+ if (rDescriptor[i].Name == "FilterData")
+ {
+ rDescriptor[i].Value >>= aFilterData;
+ break;
+ }
+ }
+
+ for (sal_Int32 i = 0; i < aFilterData.getLength(); ++i)
+ {
+ if (aFilterData[i].Name == "EPUBVersion")
+ aFilterData[i].Value >>= nVersion;
+ }
+
// Build the export filter chain: the package has direct access to the ZIP
// 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_HEADING
#if LIBEPUBGEN_VERSION_SUPPORT
- , /*version=*/30
+ , nVersion
#endif
);
uno::Reference<xml::sax::XDocumentHandler> xExportHandler(new exp::XMLImport(aGenerator));