writerperfect/qa/unit/EPUBExportTest.cxx                       |   11 +++
 writerperfect/qa/unit/data/writer/epubexport/image-nospan.fodt |   33 
++++++++++
 writerperfect/source/writer/exp/txtparai.cxx                   |    4 -
 3 files changed, 46 insertions(+), 2 deletions(-)

New commits:
commit 0b3a408cfdd0a212423bb172f091f2a0d1c83423
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Mon Nov 27 08:19:47 2017 +0100

    EPUB export: handle images outside spans
    
    CreateParagraphOrSpanChildContext() is already a factory for
    paragraph-or-span parents, just move image handling there.
    
    Change-Id: Ieeb57dc0913a17e92fdc57d79c26326f9cecb6a4
    Reviewed-on: https://gerrit.libreoffice.org/45307
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx 
b/writerperfect/qa/unit/EPUBExportTest.cxx
index bddfb8fd2d92..7f155c35de8e 100644
--- a/writerperfect/qa/unit/EPUBExportTest.cxx
+++ b/writerperfect/qa/unit/EPUBExportTest.cxx
@@ -72,6 +72,7 @@ public:
     void testList();
     void testImage();
     void testImageBorder();
+    void testImageNospan();
     void testTable();
     void testTableRowSpan();
     void testTableCellBorder();
@@ -101,6 +102,7 @@ public:
     CPPUNIT_TEST(testList);
     CPPUNIT_TEST(testImage);
     CPPUNIT_TEST(testImageBorder);
+    CPPUNIT_TEST(testImageNospan);
     CPPUNIT_TEST(testTable);
     CPPUNIT_TEST(testTableRowSpan);
     CPPUNIT_TEST(testTableCellBorder);
@@ -459,6 +461,15 @@ void EPUBExportTest::testImageBorder()
     CPPUNIT_ASSERT_EQUAL(OUString("0.99pt dashed #ed1c24"), 
EPUBExportTest::getCss(aCssDoc, aClass, "border"));
 }
 
+void EPUBExportTest::testImageNospan()
+{
+    createDoc("image-nospan.fodt", {});
+
+    mpXmlDoc = parseExport("OEBPS/sections/section0001.xhtml");
+    // Image outside a span was lost.
+    assertXPath(mpXmlDoc, "//xhtml:p/xhtml:img", 1);
+}
+
 void EPUBExportTest::testTable()
 {
     createDoc("table.fodt", {});
diff --git a/writerperfect/qa/unit/data/writer/epubexport/image-nospan.fodt 
b/writerperfect/qa/unit/data/writer/epubexport/image-nospan.fodt
new file mode 100644
index 000000000000..332052a9eff5
--- /dev/null
+++ b/writerperfect/qa/unit/data/writer/epubexport/image-nospan.fodt
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" 
xmlns:css3t="http://www.w3.org/TR/css3-text/"; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.text">
+  <office:styles>
+    <style:style style:name="Graphics" style:family="graphic">
+      <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" 
svg:y="0cm" style:wrap="dynamic" style:number-wrapped-paragraphs="no-limit" 
style:wrap-contour="false" style:vertical-pos="top" 
style:vertical-rel="paragraph" style:horizontal-pos="center" 
style:horizontal-rel="paragraph"/>
+    </style:style>
+  </office:styles>
+  <office:automatic-styles>
+    <style:style style:name="fr1" style:family="graphic" 
style:parent-style-name="Graphics">
+      <style:graphic-properties style:vertical-pos="top" 
style:vertical-rel="baseline" fo:padding="0.049cm" fo:border="0.99pt dashed 
#ed1c24" style:shadow="none" draw:shadow-opacity="100%" style:mirror="none" 
fo:clip="rect(0cm, 0cm, 0cm, 0cm)" draw:luminance="0%" draw:contrast="0%" 
draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%" 
draw:color-inversion="false" draw:image-opacity="100%" 
draw:color-mode="standard"/>
+    </style:style>
+  </office:automatic-styles>
+  <office:body>
+    <office:text>
+      <text:p text:style-name="Standard">before<draw:frame 
draw:style-name="fr1" draw:name="Object0" text:anchor-type="as-char" 
svg:width="1.663cm" svg:height="1.663cm" draw:z-index="0"><draw:image 
loext:mime-type="image/png"><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz
+        
UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
+        
AAJiS0dEAACqjSMyAAAACW9GRnMAAAAGAAAAAAAMc1XTAAAACXBIWXMAAA3XAAAN1wFCKJt4
+        
AAAACXZwQWcAAABMAAAAQACdMTgbAAABzUlEQVRo3u3ZPU/CQBjA8X+Jxs3ESUDj4iK+LA5+
+        
BBfjqBE1cXB2MlFAEqMgxvhNNL4sLsK3UPQL6ObkoAETz+FKW2mxCPRYnucWUu76/OC59C49
+        
cGOCKqrD9kHRc6ddPv7oW2WCwMh0nF63Myz7Tm8hPTNu0pgHMER3scepTbgK6enJNND83RLn
+        
/878yRaPmgBZFDuMsNLeWB9gmFQHP77MIg9gsYciR50NFKvtjIy10yk84pSZA7DYpwR8scmF
+        
QQCMuoQMpzbh0iAARrlnVn90CWHTsZcAiHPPdINQAuqsc2MQAAnKDUKWEhZ10twaBEDSJWQo
+        
YlFj7S9CzwEegkXWIbQsRAQASFJhpplwbRAACS+hANRJBxMiAkDcJeQ4sQkBhYgMoJ+Ozlwo
+        
2YQ7AJ6CRxyiUGnVy3hVKb0Af9v7hUG2Wy9TEQCUelFTDULB2S+YKYGOMcpM6UIccOQnRA6A
+        
cSp6ibfI+wkGADBGpTEd8xz1AaAfTQ7huA8AvUw5hVjuA0D/C5OaMN8XACRZ8F0zCggKAQhA
+        
AAIQgAAEIAABCEAAAhCAAAQgAAH4zg3feY4w3Xs44M5+oW0qvCWoGcvaIlM3x/f/ab+O738A
+        
hOCNQr34oD4AAAAldEVYdGNyZWF0ZS1kYXRlADIwMTAtMTItMjBUMTc6MDg6MzYrMDE6MDB6
+        
5RscAAAAJXRFWHRtb2RpZnktZGF0ZQAyMDEwLTEyLTIwVDE3OjA4OjM3KzAxOjAwgyNmnAAA
+        AABJRU5ErkJggg==
+       </office:binary-data></draw:image></draw:frame>after</text:p>
+    </office:text>
+  </office:body>
+</office:document>
diff --git a/writerperfect/source/writer/exp/txtparai.cxx 
b/writerperfect/source/writer/exp/txtparai.cxx
index 31df98fe7114..82d0b8ab6e3d 100644
--- a/writerperfect/source/writer/exp/txtparai.cxx
+++ b/writerperfect/source/writer/exp/txtparai.cxx
@@ -80,8 +80,6 @@ XMLSpanContext::XMLSpanContext(XMLImport &rImport, const 
librevenge::RVNGPropert
 
 rtl::Reference<XMLImportContext> XMLSpanContext::CreateChildContext(const 
OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> 
&/*xAttribs*/)
 {
-    if (rName == "draw:frame")
-        return new XMLTextFrameContext(mrImport);
     return CreateParagraphOrSpanChildContext(mrImport, rName, m_aPropertyList);
 }
 
@@ -324,6 +322,8 @@ rtl::Reference<XMLImportContext> 
CreateParagraphOrSpanChildContext(XMLImport &rI
         return new XMLSpaceContext(rImport, rTextPropertyList);
     if (rName == "text:tab")
         return new XMLTabContext(rImport, rTextPropertyList);
+    if (rName == "draw:frame")
+        return new XMLTextFrameContext(rImport);
     return nullptr;
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to