diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-06-25 22:13:24 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-06-26 14:00:33 +0200 |
commit | d647dc45b9ae0494e4f3185a6eb85e006b336b00 (patch) | |
tree | 64a9850ff2e5e392c1fad468923b19bcc75c4cc5 | |
parent | e223e70f5d92e2ed027fc5d449bd790a123acdc2 (diff) |
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 <vmiklos@collabora.co.uk>
-rw-r--r-- | oox/source/helper/graphichelper.cxx | 8 | ||||
-rw-r--r-- | sw/qa/extras/ww8export/data/tdf118133.docx | bin | 0 -> 23359 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export2.cxx | 7 |
3 files changed, 14 insertions, 1 deletions
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 Binary files differnew file mode 100644 index 000000000000..613aa1bd73c9 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf118133.docx 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: */ |