diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-08-03 11:04:07 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-08-03 12:44:11 +0200 |
commit | 15d0dd662c79c24944689f9fa7396d85ce4f33e2 (patch) | |
tree | 266c7e60bc1eb8fa500cb57b1fe084e1fbaec4c1 /writerperfect | |
parent | fad0ddcb8804e16c7eba5c8582c9a189a962abaf (diff) |
EPUB export: add initial package implementation
Just a skeleton, doesn't use comphelper::OStorageHelper yet.
Change-Id: Ic83e05b3a041c0c572e294eacd5b9dcb6eeae897
Reviewed-on: https://gerrit.libreoffice.org/40703
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerperfect')
-rw-r--r-- | writerperfect/Library_wpftwriter.mk | 2 | ||||
-rw-r--r-- | writerperfect/source/writer/EPUBExportFilter.cxx | 4 | ||||
-rw-r--r-- | writerperfect/source/writer/EPUBPackage.cxx | 103 | ||||
-rw-r--r-- | writerperfect/source/writer/EPUBPackage.hxx | 68 |
4 files changed, 177 insertions, 0 deletions
diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index 5d9b6b47ed1d..953f00c3e0d9 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -49,6 +49,7 @@ $(eval $(call gb_Library_use_externals,wpftwriter,\ abw \ boost_headers \ ebook \ + epubgen \ etonyek \ icu_headers \ icui18n \ @@ -68,6 +69,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftwriter,\ writerperfect/source/writer/AbiWordImportFilter \ writerperfect/source/writer/EBookImportFilter \ writerperfect/source/writer/EPUBExportFilter \ + writerperfect/source/writer/EPUBPackage \ writerperfect/source/writer/MSWorksImportFilter \ writerperfect/source/writer/MWAWImportFilter \ writerperfect/source/writer/PagesImportFilter \ diff --git a/writerperfect/source/writer/EPUBExportFilter.cxx b/writerperfect/source/writer/EPUBExportFilter.cxx index 3e4bd6198de1..75032cae6ada 100644 --- a/writerperfect/source/writer/EPUBExportFilter.cxx +++ b/writerperfect/source/writer/EPUBExportFilter.cxx @@ -16,6 +16,7 @@ #include <cppuhelper/supportsservice.hxx> #include "exp/xmlimp.hxx" +#include "EPUBPackage.hxx" using namespace com::sun::star; @@ -29,6 +30,9 @@ EPUBExportFilter::EPUBExportFilter(const uno::Reference<uno::XComponentContext> sal_Bool EPUBExportFilter::filter(const uno::Sequence<beans::PropertyValue> &rDescriptor) { + // The package writes to the output file. + EPUBPackage aPackage(mxContext, rDescriptor); + // Create ODT exporter, this will feed our document handler. uno::Reference<lang::XInitialization> xInitialization(mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.comp.Writer.XMLOasisExporter", mxContext), uno::UNO_QUERY); diff --git a/writerperfect/source/writer/EPUBPackage.cxx b/writerperfect/source/writer/EPUBPackage.cxx new file mode 100644 index 000000000000..0296b183327c --- /dev/null +++ b/writerperfect/source/writer/EPUBPackage.cxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "EPUBPackage.hxx" + +using namespace com::sun::star; + +namespace writerperfect +{ + +EPUBPackage::EPUBPackage(const uno::Reference<uno::XComponentContext> &xContext, const uno::Sequence<beans::PropertyValue> &/*rDescriptor*/) + : mxContext(xContext) +{ +} + +EPUBPackage::~EPUBPackage() +{ +} + +void EPUBPackage::openXMLFile(const char *pName) +{ + SAL_WARN("writerperfect", "EPUBPackage::openXMLFile, " << pName << ": implement me"); +} + +void EPUBPackage::openElement(const char *pName, const librevenge::RVNGPropertyList &/*rAttributes*/) +{ + SAL_WARN("writerperfect", "EPUBPackage::openElement, " << pName << ": implement me"); +} + +void EPUBPackage::closeElement(const char *pName) +{ + SAL_WARN("writerperfect", "EPUBPackage::closeElement, " << pName << ": implement me"); +} + +void EPUBPackage::insertCharacters(const librevenge::RVNGString &/*rCharacters*/) +{ + SAL_WARN("writerperfect", "EPUBPackage::insertCharacters: implement me"); +} + +void EPUBPackage::closeXMLFile() +{ + SAL_WARN("writerperfect", "EPUBPackage::closeXMLFile: implement me"); +} + +void EPUBPackage::openCSSFile(const char *pName) +{ + SAL_WARN("writerperfect", "EPUBPackage::openCSSFile, " << pName << ": implement me"); +} + +void EPUBPackage::insertRule(const librevenge::RVNGString &/*rSelector*/, const librevenge::RVNGPropertyList &/*rProperties*/) +{ + SAL_WARN("writerperfect", "EPUBPackage::insertRule: implement me"); +} + +void EPUBPackage::closeCSSFile() +{ + SAL_WARN("writerperfect", "EPUBPackage::closeCSSFile: implement me"); +} + +void EPUBPackage::openBinaryFile(const char *pName) +{ + SAL_WARN("writerperfect", "EPUBPackage::openBinaryFile, " << pName << ": implement me"); +} + +void EPUBPackage::insertBinaryData(const librevenge::RVNGBinaryData &/*rData*/) +{ + SAL_WARN("writerperfect", "EPUBPackage::insertBinaryData: implement me"); +} + +void EPUBPackage::closeBinaryFile() +{ + SAL_WARN("writerperfect", "EPUBPackage::closeBinaryFile: implement me"); +} + +void EPUBPackage::openTextFile(const char *pName) +{ + SAL_WARN("writerperfect", "EPUBPackage::openTextFile, " << pName << ": implement me"); +} + +void EPUBPackage::insertText(const librevenge::RVNGString &/*rCharacters*/) +{ + SAL_WARN("writerperfect", "EPUBPackage::insertText: implement me"); +} + +void EPUBPackage::insertLineBreak() +{ + SAL_WARN("writerperfect", "EPUBPackage::insertLineBreak: implement me"); +} + +void EPUBPackage::closeTextFile() +{ + SAL_WARN("writerperfect", "EPUBPackage::closeTextFile: implement me"); +} + +} // namespace writerperfect + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/writer/EPUBPackage.hxx b/writerperfect/source/writer/EPUBPackage.hxx new file mode 100644 index 000000000000..48c1f8a035e0 --- /dev/null +++ b/writerperfect/source/writer/EPUBPackage.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_WRITERPERFECT_SOURCE_WRITER_EPUBPACKAGE_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_WRITER_EPUBPACKAGE_HXX + +#include <libepubgen/EPUBPackage.h> + +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> + +namespace writerperfect +{ + +/// The epub package has direct access to the resulting ZIP file. +class EPUBPackage : public libepubgen::EPUBPackage +{ + css::uno::Reference<css::uno::XComponentContext> mxContext; + css::uno::Reference<css::embed::XStorage> mxStorage; + +public: + explicit EPUBPackage(const css::uno::Reference<css::uno::XComponentContext> &xContext, const css::uno::Sequence<css::beans::PropertyValue> &rDescriptor); + + ~EPUBPackage() override; + + void openXMLFile(const char *pName) override; + + void openElement(const char *pName, const librevenge::RVNGPropertyList &rAttributes) override; + void closeElement(const char *pName) override; + + void insertCharacters(const librevenge::RVNGString &rCharacters) override; + + void closeXMLFile() override; + + void openCSSFile(const char *pName) override; + + void insertRule(const librevenge::RVNGString &rSelector, const librevenge::RVNGPropertyList &rProperties) override; + + void closeCSSFile() override; + + void openBinaryFile(const char *pName) override; + + void insertBinaryData(const librevenge::RVNGBinaryData &rData) override; + + void closeBinaryFile() override; + + void openTextFile(const char *pName) override; + + void insertText(const librevenge::RVNGString &rCharacters) override; + + void insertLineBreak() override; + + void closeTextFile() override; +}; + +} // namespace writerperfect + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |