[Libreoffice-commits] core.git: writerperfect/Library_wpftwriter.mk writerperfect/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Aug 1 16:02:07 UTC 2017


 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(-)

New commits:
commit c90e9ca50300c7f59558095c2716c098632c8d37
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Aug 1 16:45:44 2017 +0200

    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 <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

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 <cppuhelper/supportsservice.hxx>
 
+#include "exp/xmlimp.hxx"
+
 using namespace com::sun::star;
 
 namespace writerperfect
@@ -31,7 +33,7 @@ sal_Bool EPUBExportFilter::filter(const uno::Sequence<beans::PropertyValue> &rDe
     uno::Reference<lang::XInitialization> 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<xml::sax::XDocumentHandler> xExportHandler;
+    uno::Reference<xml::sax::XDocumentHandler> 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<css::xml::sax::XAttributeList> &/*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<css::xml::sax::XLocator> &/*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 <cppuhelper/implbase.hxx>
+
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+
+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<css::xml::sax::XAttributeList> &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<css::xml::sax::XLocator> &xLocator) override;
+};
+
+} // namespace exp
+} // namespace writerperfect
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list