summaryrefslogtreecommitdiff
path: root/external/libepubgen
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-11-27 08:22:09 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-11-27 12:36:03 +0100
commit50b1bbf6024f30616a3f2f77e5bb268fe35c5cf2 (patch)
tree86edab3350560bad0e1657b29dd24f354eb9c714 /external/libepubgen
parent034c6ef667e734ee1f525daffc55d89cdc83b261 (diff)
EPUB export: handle image wrap types
Change-Id: If7ef8f8e72e68fb71285ddb0164f033f44c62a53 Reviewed-on: https://gerrit.libreoffice.org/45309 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'external/libepubgen')
-rw-r--r--external/libepubgen/libepubgen-epub3.patch.164
1 files changed, 64 insertions, 0 deletions
diff --git a/external/libepubgen/libepubgen-epub3.patch.1 b/external/libepubgen/libepubgen-epub3.patch.1
index 70a77b101a5c..d83521aa0b3d 100644
--- a/external/libepubgen/libepubgen-epub3.patch.1
+++ b/external/libepubgen/libepubgen-epub3.patch.1
@@ -3619,3 +3619,67 @@ index 2311e76..8414da5 100644
--
2.13.6
+From 3d47458738729c86992a1ed0002726cba5ec315c Mon Sep 17 00:00:00 2001
+From: Miklos Vajna <vmiklos@collabora.co.uk>
+Date: Fri, 10 Nov 2017 12:27:35 +0100
+Subject: [PATCH] EPUBImageManager: initial wrap type handling
+
+You could assume that the wrap is the opposide of clear, but given it's
+an attribute on the next element, they are the same at the end in case
+of left and right.
+---
+ src/lib/EPUBHTMLGenerator.cpp | 24 ++++++++++++++++++++++++
+ src/test/EPUBTextGeneratorTest.cpp | 38 ++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 62 insertions(+)
+
+diff --git a/src/lib/EPUBHTMLGenerator.cpp b/src/lib/EPUBHTMLGenerator.cpp
+index d81a905..a90ac68 100644
+--- a/src/lib/EPUBHTMLGenerator.cpp
++++ b/src/lib/EPUBHTMLGenerator.cpp
+@@ -982,6 +982,7 @@ void EPUBHTMLGenerator::insertBinaryObject(const RVNGPropertyList &propList)
+ propList["librevenge:mime-type"]->getStr());
+
+ RVNGPropertyList attrs;
++ RVNGString wrap;
+
+ if (!m_impl->m_framePropertiesStack.empty())
+ {
+@@ -995,12 +996,35 @@ void EPUBHTMLGenerator::insertBinaryObject(const RVNGPropertyList &propList)
+ attrs.insert("style", m_impl->m_imageManager.getImageStyle(frameProperties).c_str());
+ break;
+ }
++
++ if (frameProperties["style:wrap"])
++ wrap = frameProperties["style:wrap"]->getStr();
+ }
+
+ attrs.insert("src", path.relativeTo(m_impl->m_path).str().c_str());
+ // FIXME: use alternative repr. if available
+ attrs.insert("alt", path.str().c_str());
+ m_impl->output().insertEmptyElement("img", attrs);
++
++ // Emulate wrap type with a break after the image.
++ RVNGString brStyle;
++ if (wrap == "none")
++ brStyle = "clear: both;";
++ else if (wrap == "left")
++ // We want content on the left side, space on the right side, so the next
++ // element should clear on its left.
++ brStyle = "clear: left;";
++ else if (wrap == "right")
++ // Same here.
++ brStyle = "clear: right;";
++ else if (wrap == "parallel")
++ brStyle = "clear: none;";
++ if (!brStyle.empty())
++ {
++ attrs.clear();
++ attrs.insert("style", brStyle);
++ m_impl->output().insertEmptyElement("br", attrs);
++ }
+ }
+
+ void EPUBHTMLGenerator::insertEquation(const RVNGPropertyList & /* propList */) {}
+--
+2.13.6
+