oox/source/helper/graphichelper.cxx        |    8 +++++++-
 sw/qa/extras/ww8export/data/tdf118133.docx |binary
 sw/qa/extras/ww8export/ww8export2.cxx      |    7 +++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit d647dc45b9ae0494e4f3185a6eb85e006b336b00
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Mon Jun 25 22:13:24 2018 +0200

    tdf#118133 DOCX import: disable lazy-loading of tiff images
    
    The same code that works for jpeg/png doesn't work for tiff, go back to
    synchronous loading there for now.
    
    (cherry picked from commit fa356008b08a8a5b5556aa8f89ca8f7989c53516)
    
    Change-Id: I9b16f40811f6d485c986bd06daa7d4d8c8a76178
    Reviewed-on: https://gerrit.libreoffice.org/56444
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/oox/source/helper/graphichelper.cxx 
b/oox/source/helper/graphichelper.cxx
index 073cfe6d694f..6500f82e9a44 100644
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -242,7 +242,8 @@ Reference< XGraphic > GraphicHelper::importGraphic( const 
Reference< XInputStrea
         aArgs[ 0 ].Name = "InputStream";
         aArgs[ 0 ].Value <<= rxInStrm;
         aArgs[ 1 ].Name = "LazyRead";
-        aArgs[ 1 ].Value <<= true;
+        bool bLazyRead = !pExtHeader;
+        aArgs[ 1 ].Value <<= bLazyRead;
 
         if ( pExtHeader && pExtHeader->mapMode > 0 )
         {
@@ -341,6 +342,11 @@ Reference< XGraphic > 
GraphicHelper::importEmbeddedGraphic( const OUString& rStr
         EmbeddedGraphicMap::const_iterator aIt = maEmbeddedGraphics.find( 
rStreamName );
         if( aIt == maEmbeddedGraphics.end() )
         {
+            // Lazy-loading doesn't work with TIFF at the moment.
+            WmfExternal aHeader;
+            if (rStreamName.endsWith(".tiff") && !pExtHeader)
+                pExtHeader = &aHeader;
+
             xGraphic = importGraphic(mxStorage->openInputStream(rStreamName), 
pExtHeader);
             if( xGraphic.is() )
                 maEmbeddedGraphics[ rStreamName ] = xGraphic;
diff --git a/sw/qa/extras/ww8export/data/tdf118133.docx 
b/sw/qa/extras/ww8export/data/tdf118133.docx
new file mode 100644
index 000000000000..613aa1bd73c9
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf118133.docx differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx 
b/sw/qa/extras/ww8export/ww8export2.cxx
index c982009b44cc..c1af4cb538b1 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -851,6 +851,13 @@ DECLARE_WW8EXPORT_TEST(testTdf117885, "tdf117885.doc")
     CPPUNIT_ASSERT_EQUAL(nParaA_Top, nParaB_Top);
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf118133, "tdf118133.docx")
+{
+    // This was 0, doc import + doc export resulted in lost image due to broken
+    // lazy-loading of tiff images.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(15240), 
getShape(1)->getSize().Width);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to