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>
This commit is contained in:
Miklos Vajna
2017-08-03 11:04:07 +02:00
parent fad0ddcb88
commit 15d0dd662c
4 changed files with 177 additions and 0 deletions

View File

@@ -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 \

View File

@@ -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);

View File

@@ -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: */

View File

@@ -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: */