From c90e9ca50300c7f59558095c2716c098632c8d37 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 1 Aug 2017 16:45:44 +0200 Subject: EPUB export: add initial document handler It doesn't do anything useful yet, though. Change-Id: Ic881a9aec92981306aa815d9d10b6aa0ea949237 Reviewed-on: https://gerrit.libreoffice.org/40639 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- writerperfect/Library_wpftwriter.mk | 1 + writerperfect/source/writer/EPUBExportFilter.cxx | 4 +- writerperfect/source/writer/exp/xmlimp.cxx | 60 ++++++++++++++++++++++++ writerperfect/source/writer/exp/xmlimp.hxx | 47 +++++++++++++++++++ 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 writerperfect/source/writer/exp/xmlimp.cxx create mode 100644 writerperfect/source/writer/exp/xmlimp.hxx diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index 85ede9a89f74..5d9b6b47ed1d 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -73,6 +73,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftwriter,\ writerperfect/source/writer/PagesImportFilter \ writerperfect/source/writer/StarOfficeWriterImportFilter \ writerperfect/source/writer/WordPerfectImportFilter \ + writerperfect/source/writer/exp/xmlimp \ )) # vim: set noet sw=4 ts=4: diff --git a/writerperfect/source/writer/EPUBExportFilter.cxx b/writerperfect/source/writer/EPUBExportFilter.cxx index 36cff7ab9dd6..3e4bd6198de1 100644 --- a/writerperfect/source/writer/EPUBExportFilter.cxx +++ b/writerperfect/source/writer/EPUBExportFilter.cxx @@ -15,6 +15,8 @@ #include +#include "exp/xmlimp.hxx" + using namespace com::sun::star; namespace writerperfect @@ -31,7 +33,7 @@ sal_Bool EPUBExportFilter::filter(const uno::Sequence &rDe uno::Reference xInitialization(mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.comp.Writer.XMLOasisExporter", mxContext), uno::UNO_QUERY); // The document handler will make the calls on the text interface provided by the EPUB export. - uno::Reference xExportHandler; + uno::Reference xExportHandler(new exp::XMLImport); // Let the ODT exporter read the doc model and invoke the doc handler. xInitialization->initialize({uno::makeAny(xExportHandler)}); diff --git a/writerperfect/source/writer/exp/xmlimp.cxx b/writerperfect/source/writer/exp/xmlimp.cxx new file mode 100644 index 000000000000..1c915857413e --- /dev/null +++ b/writerperfect/source/writer/exp/xmlimp.cxx @@ -0,0 +1,60 @@ +/* -*- 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 "xmlimp.hxx" + +using namespace com::sun::star; + +namespace writerperfect +{ +namespace exp +{ + +XMLImport::XMLImport() +{ +} + +void XMLImport::startDocument() +{ +} + +void XMLImport::endDocument() +{ +} + +void XMLImport::startElement(const OUString &/*rName*/, const css::uno::Reference &/*xAttribs*/) +{ +} + +void XMLImport::endElement(const OUString &/*rName*/) +{ +} + +void XMLImport::characters(const OUString &/*rChars*/) +{ +} + +void XMLImport::ignorableWhitespace(const OUString &/*rWhitespaces*/) +{ +} + +void XMLImport::processingInstruction(const OUString &/*rTarget*/, const OUString &/*rData*/) +{ + SAL_WARN("writerperfect", "XMLImport::processingInstruction: implement me"); +} + +void XMLImport::setDocumentLocator(const css::uno::Reference &/*xLocator*/) +{ + SAL_WARN("writerperfect", "XMLImport::setDocumentLocator: implement me"); +} + +} // namespace exp +} // namespace writerperfect + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/writer/exp/xmlimp.hxx b/writerperfect/source/writer/exp/xmlimp.hxx new file mode 100644 index 000000000000..9d6d1eb4c0c6 --- /dev/null +++ b/writerperfect/source/writer/exp/xmlimp.hxx @@ -0,0 +1,47 @@ +/* -*- 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_EXP_XMLIMP_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_WRITER_EXP_XMLIMP_HXX + +#include + +#include + +namespace writerperfect +{ +namespace exp +{ + +/// ODT export feeds this class to make librevenge calls. +class XMLImport : public cppu::WeakImplHelper + < + css::xml::sax::XDocumentHandler + > +{ +public: + XMLImport(); + + // XDocumentHandler + void SAL_CALL startDocument() override; + void SAL_CALL endDocument() override; + void SAL_CALL startElement(const OUString &rName, const css::uno::Reference &xAttribs) override; + void SAL_CALL endElement(const OUString &rName) override; + void SAL_CALL characters(const OUString &rChars) override; + void SAL_CALL ignorableWhitespace(const OUString &rWhitespaces) override; + void SAL_CALL processingInstruction(const OUString &rTarget, const OUString &rData) override; + void SAL_CALL setDocumentLocator(const css::uno::Reference &xLocator) override; +}; + +} // namespace exp +} // namespace writerperfect + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit