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

Miklos Vajna vmiklos at collabora.co.uk
Tue Aug 1 12:58:21 UTC 2017


 filter/Configuration_filter.mk                                |    2 
 filter/source/config/fragments/filters/EPUB.xcu               |   30 ++++
 filter/source/config/fragments/types/writer_EPUB_Document.xcu |   29 ++++
 writerperfect/Library_wpftwriter.mk                           |    1 
 writerperfect/source/writer/EPUBExportFilter.cxx              |   66 ++++++++++
 writerperfect/source/writer/EPUBExportFilter.hxx              |   52 +++++++
 writerperfect/source/writer/wpftwriter.component              |    4 
 7 files changed, 184 insertions(+)

New commits:
commit ba7ebd400d39bc84ababab3bb416a199d57780e8
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Aug 1 13:51:28 2017 +0200

    writerperfect: add initial EPUB export filter
    
    It doesn't do anything yet, but EPUBExportFilter::filter() is called.
    Actual functionality will be provided by libepubgen later.
    
    Change-Id: I7229dc33c69238c6e98a7bb30fd38473b3c35bfe
    Reviewed-on: https://gerrit.libreoffice.org/40630
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index c39e5e03aba7..85bbaf583a85 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -354,6 +354,7 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_writer_types.xcu
 	MWAW_Text_Document \
 	Palm_Text_Document \
 	StarOffice_Writer \
+	writer_EPUB_Document \
 ))
 
 $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_writer_filters.xcu,filter/source/config/fragments/filters,\
@@ -401,6 +402,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_writer_filters
 	MWAW_Text_Document \
 	Palm_Text_Document \
 	StarOffice_Writer \
+	EPUB \
 ))
 
 # fcfg_web
diff --git a/filter/source/config/fragments/filters/EPUB.xcu b/filter/source/config/fragments/filters/EPUB.xcu
new file mode 100644
index 000000000000..49d8020b0d39
--- /dev/null
+++ b/filter/source/config/fragments/filters/EPUB.xcu
@@ -0,0 +1,30 @@
+<!--
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+    <node oor:name="EPUB" oor:op="replace">
+        <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+        <prop oor:name="UIComponent"/>
+        <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.EPUBExportFilter</value></prop>
+        <prop oor:name="UserData"><value>EPUB</value></prop>
+        <prop oor:name="UIName">
+            <value xml:lang="en-US">EPUB Document</value>
+        </prop>
+        <prop oor:name="FileFormatVersion"><value>0</value></prop>
+        <prop oor:name="Type"><value>writer_EPUB_Document</value></prop>
+        <prop oor:name="TemplateName"/>
+        <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+    </node>
diff --git a/filter/source/config/fragments/types/writer_EPUB_Document.xcu b/filter/source/config/fragments/types/writer_EPUB_Document.xcu
new file mode 100644
index 000000000000..51a0a73c2047
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_EPUB_Document.xcu
@@ -0,0 +1,29 @@
+<!--
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+    <node oor:name="writer_EPUB_Document" oor:op="replace" >
+        <prop oor:name="DetectService"/>
+        <prop oor:name="URLPattern"/>
+        <prop oor:name="Extensions"><value>epub</value></prop>
+        <prop oor:name="MediaType"><value>application/epub+zip</value></prop>
+        <prop oor:name="Preferred"><value>false</value></prop>
+        <prop oor:name="PreferredFilter"/>
+        <prop oor:name="UIName">
+            <value>EPUB Document</value>
+        </prop>
+        <prop oor:name="ClipboardFormat"/>
+    </node>
diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk
index cc59480eae11..85ede9a89f74 100644
--- a/writerperfect/Library_wpftwriter.mk
+++ b/writerperfect/Library_wpftwriter.mk
@@ -67,6 +67,7 @@ $(eval $(call gb_Library_use_externals,wpftwriter,\
 $(eval $(call gb_Library_add_exception_objects,wpftwriter,\
 	writerperfect/source/writer/AbiWordImportFilter \
 	writerperfect/source/writer/EBookImportFilter \
+	writerperfect/source/writer/EPUBExportFilter \
 	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
new file mode 100644
index 000000000000..d7fb0cac0e0d
--- /dev/null
+++ b/writerperfect/source/writer/EPUBExportFilter.cxx
@@ -0,0 +1,66 @@
+/* -*- 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 "EPUBExportFilter.hxx"
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <cppuhelper/supportsservice.hxx>
+
+using namespace com::sun::star;
+
+namespace writerperfect
+{
+
+EPUBExportFilter::EPUBExportFilter()
+{
+}
+
+sal_Bool EPUBExportFilter::filter(const uno::Sequence<beans::PropertyValue> &/*rDescriptor*/)
+{
+    SAL_WARN("writerperfect", "EPUBExportFilter::filter: implement me");
+    return true;
+}
+
+void EPUBExportFilter::cancel()
+{
+}
+
+void EPUBExportFilter::setSourceDocument(const uno::Reference<lang::XComponent> &xDocument)
+{
+    mxSourceDocument = xDocument;
+}
+
+OUString EPUBExportFilter::getImplementationName()
+{
+    return OUString("com.sun.star.comp.Writer.EPUBExportFilter");
+}
+
+sal_Bool EPUBExportFilter::supportsService(const OUString &rServiceName)
+{
+    return cppu::supportsService(this, rServiceName);
+}
+
+uno::Sequence<OUString> EPUBExportFilter::getSupportedServiceNames()
+{
+    uno::Sequence<OUString> aRet =
+    {
+        OUString("com.sun.star.document.ExportFilter")
+    };
+    return aRet;
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface *SAL_CALL com_sun_star_comp_Writer_EPUBExportFilter_get_implementation(uno::XComponentContext *, uno::Sequence<uno::Any> const &)
+{
+    return cppu::acquire(new EPUBExportFilter);
+}
+
+} // namespace writerperfect
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/writer/EPUBExportFilter.hxx b/writerperfect/source/writer/EPUBExportFilter.hxx
new file mode 100644
index 000000000000..101a4f85bf42
--- /dev/null
+++ b/writerperfect/source/writer/EPUBExportFilter.hxx
@@ -0,0 +1,52 @@
+/* -*- 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_EPUBEXPORTFILTER_HXX
+#define INCLUDED_WRITERPERFECT_SOURCE_WRITER_EPUBEXPORTFILTER_HXX
+
+#include <cppuhelper/implbase.hxx>
+
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+namespace writerperfect
+{
+
+/// EPUB export XFilter implementation.
+class EPUBExportFilter : public cppu::WeakImplHelper
+    <
+    css::document::XFilter,
+    css::document::XExporter,
+    css::lang::XServiceInfo
+    >
+{
+    css::uno::Reference<css::lang::XComponent> mxSourceDocument;
+
+public:
+    EPUBExportFilter();
+
+    // XFilter
+    sal_Bool SAL_CALL filter(const css::uno::Sequence<css::beans::PropertyValue> &rDescriptor) override;
+    void SAL_CALL cancel() override;
+
+    // XExporter
+    void SAL_CALL setSourceDocument(const css::uno::Reference<css::lang::XComponent> &xDocument) override;
+
+    // XServiceInfo
+    OUString SAL_CALL getImplementationName() override;
+    sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override;
+    css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+};
+
+} // namespace writerperfect
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/writer/wpftwriter.component b/writerperfect/source/writer/wpftwriter.component
index ace6b687363c..5e68de56cfd2 100644
--- a/writerperfect/source/writer/wpftwriter.component
+++ b/writerperfect/source/writer/wpftwriter.component
@@ -53,4 +53,8 @@
     <service name="com.sun.star.document.ImportFilter"/>
     <service name="com.sun.star.document.ExtendedTypeDetection"/>
   </implementation>
+  <implementation name="com.sun.star.comp.Writer.EPUBExportFilter"
+      constructor="com_sun_star_comp_Writer_EPUBExportFilter_get_implementation">
+    <service name="com.sun.star.document.ExportFilter"/>
+  </implementation>
 </component>


More information about the Libreoffice-commits mailing list