Kaydet (Commit) e8eecbca authored tarafından Miklos Vajna's avatar Miklos Vajna Kaydeden (comit) David Tardon

external: upload libepubgen-0.1.0

The only change is that version support is now available
unconditionally, otherwise most code changes were bundled already in the
form of patches.

(cherry picked from commits b2b1debf and
14c91e12b5bb3444235e1444eeefab42e21e3cb5)

Conflicts:
	configure.ac
	external/libepubgen/libepubgen-epub3.patch.1
	writerperfect/source/writer/EPUBExportDialog.cxx
	writerperfect/source/writer/EPUBExportFilter.cxx

Change-Id: I0e456d85c9d84002cabcd77b31b02c9a7ad16ac5
Reviewed-on: https://gerrit.libreoffice.org/46440Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst 8582e9a8
...@@ -1819,7 +1819,7 @@ $(call gb_LinkTarget_set_include,$(1),\ ...@@ -1819,7 +1819,7 @@ $(call gb_LinkTarget_set_include,$(1),\
$$(INCLUDE) \ $$(INCLUDE) \
) )
$(call gb_LinkTarget_add_libs,$(1),\ $(call gb_LinkTarget_add_libs,$(1),\
$(call gb_UnpackedTarball_get_dir,libepubgen)/src/lib/.libs/libepubgen-0.0$(gb_StaticLibrary_PLAINEXT) \ $(call gb_UnpackedTarball_get_dir,libepubgen)/src/lib/.libs/libepubgen-0.1$(gb_StaticLibrary_PLAINEXT) \
) )
$(call gb_LinkTarget_use_external_project,$(1),libepubgen) $(call gb_LinkTarget_use_external_project,$(1),libepubgen)
......
/* -*- 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)
#define LIBEPUBGEN_VERSION_SUPPORT 0
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -7677,25 +7677,7 @@ libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${ ...@@ -7677,25 +7677,7 @@ 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([libodfgen],[ODFGEN],[libodfgen-0.1])
libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.0]) libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
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"], AS_IF([test "$COM" = "MSC"],
[libwpd_libdir="${WORKDIR}/LinkTarget/Library"], [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
...@@ -12564,7 +12546,6 @@ AC_CONFIG_HEADERS([config_host/config_global.h]) ...@@ -12564,7 +12546,6 @@ AC_CONFIG_HEADERS([config_host/config_global.h])
AC_CONFIG_HEADERS([config_host/config_gpgme.h]) AC_CONFIG_HEADERS([config_host/config_gpgme.h])
AC_CONFIG_HEADERS([config_host/config_java.h]) AC_CONFIG_HEADERS([config_host/config_java.h])
AC_CONFIG_HEADERS([config_host/config_lgpl.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_liblangtag.h])
AC_CONFIG_HEADERS([config_host/config_locales.h]) AC_CONFIG_HEADERS([config_host/config_locales.h])
AC_CONFIG_HEADERS([config_host/config_mpl.h]) AC_CONFIG_HEADERS([config_host/config_mpl.h])
......
...@@ -37,8 +37,8 @@ export EPOXY_SHA256SUM := 1d8668b0a259c709899e1c4bab62d756d9002d546ce4f59c9665e2 ...@@ -37,8 +37,8 @@ export EPOXY_SHA256SUM := 1d8668b0a259c709899e1c4bab62d756d9002d546ce4f59c9665e2
export EPOXY_TARBALL := libepoxy-1.3.1.tar.bz2 export EPOXY_TARBALL := libepoxy-1.3.1.tar.bz2
export EPM_SHA256SUM := b3fc4c5445de6c9a801504a3ea3efb2d4ea9d5a622c9427e716736e7713ddb91 export EPM_SHA256SUM := b3fc4c5445de6c9a801504a3ea3efb2d4ea9d5a622c9427e716736e7713ddb91
export EPM_TARBALL := 3ade8cfe7e59ca8e65052644fed9fca4-epm-3.7.tar.gz export EPM_TARBALL := 3ade8cfe7e59ca8e65052644fed9fca4-epm-3.7.tar.gz
export EPUBGEN_SHA256SUM := eea910b042526ed52f7ab9292b7fa31fca32f9e042285818074ff33664db4fa2 export EPUBGEN_SHA256SUM := 730bd1cbeee166334faadbc06c953a67b145c3c4754a3b503482066dae4cd633
export EPUBGEN_TARBALL := libepubgen-0.0.1.tar.bz2 export EPUBGEN_TARBALL := libepubgen-0.1.0.tar.bz2
export ETONYEK_SHA256SUM := 69dbe10d4426d52f09060d489f8eb90dfa1df592e82eb0698d9dbaf38cc734ac export ETONYEK_SHA256SUM := 69dbe10d4426d52f09060d489f8eb90dfa1df592e82eb0698d9dbaf38cc734ac
export ETONYEK_VERSION_MICRO := 7 export ETONYEK_VERSION_MICRO := 7
export ETONYEK_TARBALL := libetonyek-0.1.$(ETONYEK_VERSION_MICRO).tar.xz export ETONYEK_TARBALL := libetonyek-0.1.$(ETONYEK_VERSION_MICRO).tar.xz
......
...@@ -8,17 +8,6 @@ ...@@ -8,17 +8,6 @@
# #
epubgen_patches := epubgen_patches :=
# Backport of <https://sourceforge.net/p/libepubgen/code/ci/96e9786f5aba1078251f36e58feefc8d953cdea0/>.
epubgen_patches += libepubgen-validation1.patch.1
# Backport of <https://sourceforge.net/p/libepubgen/code/ci/2e51fb9163bbc6b9a27fa524382c5aad9700dd0d/>.
epubgen_patches += libepubgen-validation2.patch.1
# Backport of <https://sourceforge.net/p/libepubgen/code/ci/9041ef42f9e0a5c4bc3b0a912d36683c4e10ca84/>.
epubgen_patches += libepubgen-validation3.patch.1
# Backport of <https://sourceforge.net/p/libepubgen/code/ci/49f6461d4751d3b16e32ab8f9c93a3856b33be49/>.
epubgen_patches += libepubgen-vc.patch.1
# Backport of <https://sourceforge.net/p/libepubgen/code/ci/2e9e9af9f49a78cca75d3c862c8dd4b5f7cc7eb2/> (and its deps).
epubgen_patches += libepubgen-epub3.patch.1
ifeq ($(COM_IS_CLANG),TRUE) ifeq ($(COM_IS_CLANG),TRUE)
ifneq ($(filter -fsanitize=%,$(CC)),) ifneq ($(filter -fsanitize=%,$(CC)),)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
From 96e9786f5aba1078251f36e58feefc8d953cdea0 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Tue, 8 Aug 2017 16:54:24 +0200
Subject: [PATCH 1/3] EPUBGenerator: fix validation error with empty
dc:identifier element
<http://www.idpf.org/epub/31/spec/epub-packages.html#sec-opf-dcidentifier>
"3.4.3.2.1 The identifier Element" says that the character content is
not optional, so write it.
---
configure.ac | 3 +++
src/lib/EPUBGenerator.cpp | 14 +++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/lib/EPUBGenerator.cpp b/src/lib/EPUBGenerator.cpp
index 0d0f866..507eb14 100644
--- a/src/lib/EPUBGenerator.cpp
+++ b/src/lib/EPUBGenerator.cpp
@@ -7,6 +7,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/uuid_generators.hpp>
+#include <boost/uuid/uuid_io.hpp>
+
#include "EPUBCSSSink.h"
#include "EPUBHTMLGenerator.h"
#include "EPUBGenerator.h"
@@ -193,7 +197,15 @@ void EPUBGenerator::writeRoot()
RVNGPropertyList identifierAttrs;
identifierAttrs.insert("id", uniqueId);
- sink.insertEmptyElement("dc:identifier", identifierAttrs);
+ identifierAttrs.insert("opf:scheme", "UUID");
+ sink.openElement("dc:identifier", identifierAttrs);
+ // The identifier element is required to have a unique character content.
+ std::stringstream identifierStream("urn:uuid:");
+ boost::uuids::uuid uuid = boost::uuids::random_generator()();
+ identifierStream << uuid;
+ std::string identifierCharactrs = identifierStream.str();
+ sink.insertCharacters(identifierCharactrs.c_str());
+ sink.closeElement("dc:identifier");
sink.openElement("dc:title");
sink.closeElement("dc:title");
--
2.12.3
From 2e51fb9163bbc6b9a27fa524382c5aad9700dd0d Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Tue, 8 Aug 2017 17:23:38 +0200
Subject: [PATCH 2/3] EPUBGenerator: don't write empty guide element
<http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.6> "2.6:
Guide" requires:
Within the package there may be one guide element, containing one or
more reference elements.
Given that we never wrote reference child-elements, just don't write the
guide element at all, especially seeing that it's deprecated in OPF3.
---
src/lib/EPUBGenerator.cpp | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/lib/EPUBGenerator.cpp b/src/lib/EPUBGenerator.cpp
index 507eb14..9dbccac 100644
--- a/src/lib/EPUBGenerator.cpp
+++ b/src/lib/EPUBGenerator.cpp
@@ -225,9 +225,6 @@ void EPUBGenerator::writeRoot()
m_htmlManager.writeSpineTo(sink);
sink.closeElement("spine");
- sink.openElement("guide");
- sink.closeElement("guide");
-
sink.closeElement("package");
sink.writeTo(*m_package, "OEBPS/content.opf");
--
2.12.3
From 9041ef42f9e0a5c4bc3b0a912d36683c4e10ca84 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Tue, 8 Aug 2017 17:39:18 +0200
Subject: [PATCH 3/3] EPUBHTMLManager: fix value of <navPoint playOrder"...">
<http://www.niso.org/workrooms/daisy/Z39-86-2005.html#NCXplay> "8.4.3
playOrder Attribute" says:
playOrder is a positive integer; the first playOrder value in a document
shall be 1.
So instead of writing an empty attribute, write the same number that's
already used for <navPoint id="...">.
---
src/lib/EPUBHTMLManager.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/lib/EPUBHTMLManager.cpp b/src/lib/EPUBHTMLManager.cpp
index e5add82..03dbf21 100644
--- a/src/lib/EPUBHTMLManager.cpp
+++ b/src/lib/EPUBHTMLManager.cpp
@@ -75,7 +75,9 @@ void EPUBHTMLManager::writeTocTo(EPUBXMLSink &sink, const EPUBPath &tocPath)
id << "section" << (i + 1);
navPointAttrs.insert("id", id.str().c_str());
navPointAttrs.insert("class", "document");
- navPointAttrs.insert("playOrder", "");
+ std::ostringstream playOrder;
+ playOrder << (i + 1);
+ navPointAttrs.insert("playOrder", playOrder.str().c_str());
sink.openElement("navPoint", navPointAttrs);
sink.openElement("navLabel");
sink.openElement("text");
--
2.12.3
From 49f6461d4751d3b16e32ab8f9c93a3856b33be49 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Wed, 2 Aug 2017 14:53:36 +0200
Subject: [PATCH] m4: MSVC defines __cplusplus as 199711L still
See e.g.
<https://stackoverflow.com/questions/37503029/cplusplus-is-equal-to-199711-in-msvc-does-it-support-c11>,
on MSVC we can't depend on the value of __cplusplus, since that one is a
too low value, even if everything else works fine.
---
m4/ax_cxx_compile_stdcxx.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -Naur a/configure b/configure
--- a/configure 2017-08-02 14:50:09.000000000 +0200
+++ b/configure 2017-08-02 14:50:57.000000000 +0200
@@ -16001,7 +16001,7 @@
#error "This is not a C++ compiler"
-#elif __cplusplus < 201103L
+#elif __cplusplus < 201103L && !(defined _MSC_VER)
#error "This is not a C++11 compiler"
@@ -16314,7 +16314,7 @@
#error "This is not a C++ compiler"
-#elif __cplusplus < 201103L
+#elif __cplusplus < 201103L && !(defined _MSC_VER)
#error "This is not a C++11 compiler"
@@ -16636,7 +16636,7 @@
#error "This is not a C++ compiler"
-#elif __cplusplus < 201103L
+#elif __cplusplus < 201103L && !(defined _MSC_VER)
#error "This is not a C++11 compiler"
diff --git a/src/lib/EPUBGenerator.cpp b/src/lib/EPUBGenerator.cpp
index 9dbccac..3357cf2 100644
--- a/src/lib/EPUBGenerator.cpp
+++ b/src/lib/EPUBGenerator.cpp
@@ -7,6 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <sstream>
+
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
--
2.12.3
...@@ -40,7 +40,7 @@ $(eval $(call gb_Module_add_check_targets,writerperfect,\ ...@@ -40,7 +40,7 @@ $(eval $(call gb_Module_add_check_targets,writerperfect,\
$(eval $(call gb_Module_add_slowcheck_targets,writerperfect,\ $(eval $(call gb_Module_add_slowcheck_targets,writerperfect,\
CppunitTest_writerperfect_calc \ CppunitTest_writerperfect_calc \
CppunitTest_writerperfect_draw \ CppunitTest_writerperfect_draw \
$(if $(SYSTEM_EPUBGEN),,CppunitTest_writerperfect_epubexport) \ CppunitTest_writerperfect_epubexport \
CppunitTest_writerperfect_import \ CppunitTest_writerperfect_import \
CppunitTest_writerperfect_impress \ CppunitTest_writerperfect_impress \
CppunitTest_writerperfect_writer \ CppunitTest_writerperfect_writer \
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#include "EPUBExportFilter.hxx" #include "EPUBExportFilter.hxx"
#include <config_libepubgen.h>
#include <libepubgen/EPUBTextGenerator.h> #include <libepubgen/EPUBTextGenerator.h>
#include <libepubgen/libepubgen-decls.h> #include <libepubgen/libepubgen-decls.h>
...@@ -25,17 +23,6 @@ ...@@ -25,17 +23,6 @@
using namespace com::sun::star; using namespace com::sun::star;
#if !LIBEPUBGEN_VERSION_SUPPORT
namespace libepubgen
{
enum EPUBStylesMethod
{
EPUB_STYLES_METHOD_CSS, //< The styles will be described in a separate CSS file.
EPUB_STYLES_METHOD_INLINE, //< The styles will be described inline.
};
}
#endif
namespace writerperfect namespace writerperfect
{ {
...@@ -88,14 +75,9 @@ sal_Bool EPUBExportFilter::filter(const uno::Sequence<beans::PropertyValue> &rDe ...@@ -88,14 +75,9 @@ sal_Bool EPUBExportFilter::filter(const uno::Sequence<beans::PropertyValue> &rDe
// file, the flat ODF filter has access to the doc model, everything else // file, the flat ODF filter has access to the doc model, everything else
// is in-between. // is in-between.
EPUBPackage aPackage(mxContext, rDescriptor); EPUBPackage aPackage(mxContext, rDescriptor);
libepubgen::EPUBTextGenerator aGenerator(&aPackage, static_cast<libepubgen::EPUBSplitMethod>(nSplitMethod) libepubgen::EPUBTextGenerator aGenerator(&aPackage, nVersion);
#if LIBEPUBGEN_VERSION_SUPPORT aGenerator.setOption(libepubgen::EPUB_GENERATOR_OPTION_SPLIT, nSplitMethod);
, nVersion aGenerator.setOption(libepubgen::EPUB_GENERATOR_OPTION_STYLES, nStylesMethod);
#endif
);
#if LIBEPUBGEN_VERSION_SUPPORT
aGenerator.setStylesMethod(static_cast<libepubgen::EPUBStylesMethod>(nStylesMethod));
#endif
uno::Reference<xml::sax::XDocumentHandler> xExportHandler(new exp::XMLImport(aGenerator)); 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); uno::Reference<lang::XInitialization> xInitialization(mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.comp.Writer.XMLOasisExporter", mxContext), uno::UNO_QUERY);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment