diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-08-08 09:16:04 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-08-08 10:11:05 +0200 |
commit | 06283dcba13ee18716da9eee728210a00bcb5b97 (patch) | |
tree | ec6f9dabaebb808f73462c3155a53bc3d1172aa3 /writerperfect | |
parent | 70dd00331e3112e7c32d5c7ac121ad7e77535817 (diff) |
EPUB export: write mime type
libepubgen won't emit calls on the package interface to do this, it
turns out.
Change-Id: Ib9826f1df348fd7afbccdc5d5a92a6d94f8aa9af
Reviewed-on: https://gerrit.libreoffice.org/40862
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerperfect')
-rw-r--r-- | writerperfect/source/writer/EPUBPackage.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/writerperfect/source/writer/EPUBPackage.cxx b/writerperfect/source/writer/EPUBPackage.cxx index 060c3828a4de..bf9c03089708 100644 --- a/writerperfect/source/writer/EPUBPackage.cxx +++ b/writerperfect/source/writer/EPUBPackage.cxx @@ -28,6 +28,15 @@ EPUBPackage::EPUBPackage(const uno::Reference<uno::XComponentContext> &xContext, auto xStream = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_STREAMFOROUTPUT(), uno::Reference<io::XStream>()); const sal_Int32 nOpenMode = embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE; mxStorage.set(comphelper::OStorageHelper::GetStorageOfFormatFromStream(ZIP_STORAGE_FORMAT_STRING, xStream, nOpenMode, mxContext), uno::UNO_QUERY); + + // The zipped content represents an EPUB Publication. + mxOutputStream.set(mxStorage->openStreamElementByHierarchicalName("mimetype", embed::ElementModes::READWRITE), uno::UNO_QUERY); + const OString aMimeType("application/epub+zip"); + uno::Sequence<sal_Int8> aData(reinterpret_cast<const sal_Int8 *>(aMimeType.getStr()), aMimeType.getLength()); + mxOutputStream->writeBytes(aData); + uno::Reference<embed::XTransactedObject> xTransactedObject(mxOutputStream, uno::UNO_QUERY); + xTransactedObject->commit(); + mxOutputStream.clear(); } EPUBPackage::~EPUBPackage() |