summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-03-19 16:39:59 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-03-19 20:55:08 +0100
commitbd063a890e486989b59963e59dd67e8a692f27ba (patch)
tree75bbe8b4bcee233d31fecf36b277ecfbd1dd6ad9 /sw
parent67a023ef9b251c1e6e2a46521a51ad829c417451 (diff)
sw XHTML export: fix missing type attribute for fallback image
This was working in OutHTML_FrameFormatGrfNode(), but not in OutHTML_FrameFormatOLENodeGrf(). Change-Id: I4f8e280713cad2a00cad5da65a09afc5a36d40d0 Reviewed-on: https://gerrit.libreoffice.org/51571 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx12
-rw-r--r--sw/source/filter/html/htmlplug.cxx18
2 files changed, 26 insertions, 4 deletions
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index b23f196a5251..515f7c768273 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -406,6 +406,18 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOleImg, "reqif-ole-img.xhtml")
// Check alternate text (it was empty, for export the 'alt' attribute was used).
CPPUNIT_ASSERT_EQUAL(OUString("OLE Object"), getProperty<OUString>(xObject, "Title").trim());
+
+ if (!mbExported)
+ return;
+
+ // "type" attribute was missing for the inner <object> element.
+ SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
+ CPPUNIT_ASSERT(pStream);
+ pStream->Seek(STREAM_SEEK_TO_END);
+ sal_uInt64 nLength = pStream->Tell();
+ pStream->Seek(0);
+ OString aStream(read_uInt8s_ToOString(*pStream, nLength));
+ CPPUNIT_ASSERT(aStream.indexOf("type=\"image/png\"") != -1);
}
DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfPngImg, "reqif-png-img.xhtml")
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 8f39db95bbb4..93b694c72010 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1448,16 +1448,26 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame
}
OUString aGraphicURL;
+ OUString aMimeType;
if(!rHTMLWrt.mbEmbedImages)
{
const OUString* pTempFileName = rHTMLWrt.GetOrigFileName();
if(pTempFileName)
aGraphicURL = *pTempFileName;
+ OUString aFilterName("JPG");
+ XOutFlags nFlags = XOutFlags::UseGifIfPossible | XOutFlags::UseNativeIfPossible;
+
+ if (bObjectOpened)
+ {
+ aFilterName = "PNG";
+ nFlags = XOutFlags::NONE;
+ aMimeType = "image/png";
+ }
+
ErrCode nErr = XOutBitmap::WriteGraphic( aGraphic, aGraphicURL,
- "JPG",
- (XOutFlags::UseGifIfPossible |
- XOutFlags::UseNativeIfPossible) );
+ aFilterName,
+ nFlags );
if( nErr ) // error, don't write anything
{
rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD;
@@ -1474,7 +1484,7 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame
nFlags |= HtmlFrmOpts::Replacement;
OutHTML_Image( rWrt, rFrameFormat, aGraphicURL, aGraphic,
pOLENd->GetTitle(), pOLENd->GetTwipSize(),
- nFlags, "ole" );
+ nFlags, "ole", nullptr, aMimeType );
if (bObjectOpened)
// Close native data.