summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config_host/config_libepubgen.h.in16
-rw-r--r--configure.ac19
-rw-r--r--writerperfect/source/writer/EPUBExportFilter.cxx8
3 files changed, 42 insertions, 1 deletions
diff --git a/config_host/config_libepubgen.h.in b/config_host/config_libepubgen.h.in
new file mode 100644
index 000000000000..7219082449c6
--- /dev/null
+++ b/config_host/config_libepubgen.h.in
@@ -0,0 +1,16 @@
+/* -*- 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/.
+ */
+
+/* Configuration for libepubgen.
+ */
+
+// Defined if libepubgen supports setting EPUB version (devel. only)
+#undef LIBEPUBGEN_VERSION_SUPPORT
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/configure.ac b/configure.ac
index 222932ec7815..fa0635647ae7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7724,6 +7724,24 @@ libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${
libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.0])
+AS_IF([test "$SYSTEM_EPUBGEN" = "TRUE"], [
+ AC_MSG_CHECKING([whether libepubgen supports setting EPUB version])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+ #include <libepubgen/libepubgen.h>
+ ], [
+ const libepubgen::EPUBTextGenerator generator(nullptr, EPUB_SPLIT_METHOD_NONE, 30);
+ ])],
+ [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([LIBEPUBGEN_VERSION_SUPPORT])
+ ],
+ [
+ AC_MSG_RESULT([no])
+ ]
+ )
+], [
+ AC_DEFINE([LIBEPUBGEN_VERSION_SUPPORT])
+])
AS_IF([test "$COM" = "MSC"],
[libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
@@ -12414,6 +12432,7 @@ AC_CONFIG_HEADERS([config_host/config_gio.h])
AC_CONFIG_HEADERS([config_host/config_global.h])
AC_CONFIG_HEADERS([config_host/config_java.h])
AC_CONFIG_HEADERS([config_host/config_lgpl.h])
+AC_CONFIG_HEADERS([config_host/config_libepubgen.h])
AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
AC_CONFIG_HEADERS([config_host/config_locales.h])
AC_CONFIG_HEADERS([config_host/config_mpl.h])
diff --git a/writerperfect/source/writer/EPUBExportFilter.cxx b/writerperfect/source/writer/EPUBExportFilter.cxx
index 8a8e14c72ce8..2cc5c6479aa8 100644
--- a/writerperfect/source/writer/EPUBExportFilter.cxx
+++ b/writerperfect/source/writer/EPUBExportFilter.cxx
@@ -7,6 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include "config_libepubgen.h"
+
#include "EPUBExportFilter.hxx"
#include <libepubgen/EPUBTextGenerator.h>
@@ -36,7 +38,11 @@ sal_Bool EPUBExportFilter::filter(const uno::Sequence<beans::PropertyValue> &rDe
// file, the flat ODF filter has access to the doc model, everything else
// is in-between.
EPUBPackage aPackage(mxContext, rDescriptor);
- libepubgen::EPUBTextGenerator aGenerator(&aPackage, libepubgen::EPUB_SPLIT_METHOD_HEADING, /*version=*/30);
+ libepubgen::EPUBTextGenerator aGenerator(&aPackage, libepubgen::EPUB_SPLIT_METHOD_HEADING
+#if defined(LIBEPUBGEN_VERSION_SUPPORT)
+ , /*version=*/30
+#endif
+ );
uno::Reference<xml::sax::XDocumentHandler> xExportHandler(new exp::XMLImport(aGenerator));
uno::Reference<lang::XInitialization> xInitialization(mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.comp.Writer.XMLOasisExporter", mxContext), uno::UNO_QUERY);