diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/htmlexport/htmlexport.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/html/htmlflywriter.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/html/htmlplug.cxx | 9 |
3 files changed, 25 insertions, 6 deletions
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index e3c1f33321bb..2f9ff7dbbf07 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -379,10 +379,6 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOleImg, "reqif-ole-img.xhtml") // This was only 1247, size was not set explicitly. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(aLogic.getWidth()), aSize.Width); - if (mbExported) - // The below is not yet working for export. - return; - // Check mime/media types. CPPUNIT_ASSERT_EQUAL(OUString("image/png"), getProperty<OUString>(xGraphic, "MimeType")); @@ -391,9 +387,13 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOleImg, "reqif-ole-img.xhtml") auto aStreamName = getProperty<OUString>(xObject, "StreamName"); uno::Reference<io::XStream> xStream = xStorage->openStreamElement(aStreamName, embed::ElementModes::READ); - // This was empty. + // This was empty when either import or export handling was missing. CPPUNIT_ASSERT_EQUAL(OUString("text/rtf"), getProperty<OUString>(xStream, "MediaType")); + if (mbExported) + // The below is not yet working for export. + return; + // Check alternate text (it was empty). CPPUNIT_ASSERT_EQUAL(OUString("OLE Object"), getProperty<OUString>(xObject, "Title").trim()); } diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index de06ac48a199..ba9a62260543 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -1385,6 +1385,18 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrameFormat &rFrameFormat, aHtml.attribute(aAttribute, sBuffer.makeStringAndClear().getStr()); } + if (nFrameOpts & HtmlFrmOpts::Replacement) + { + // Handle XHTML type attribute for OLE replacement images. + uno::Reference<beans::XPropertySet> xGraphic(rGraphic.GetXGraphic(), uno::UNO_QUERY); + if (xGraphic.is()) + { + OUString aMimeType; + xGraphic->getPropertyValue("MimeType") >>= aMimeType; + aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_type, aMimeType.toUtf8()); + } + } + // Events if (SfxItemState::SET == rItemSet.GetItemState(RES_FRMMACRO, true, &pItem)) { diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index 4d272872aa8f..7ad6b589e2b3 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1424,12 +1424,19 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame comphelper::OStorageHelper::CopyInputToOutput(xInStream->getInputStream(), xOutStream->getOutputStream()); aFileName = URIHelper::simpleNormalizedMakeRelative(rWrt.GetBaseURL(), aFileName); + uno::Reference<beans::XPropertySet> xOutStreamProps(xInStream, uno::UNO_QUERY); + OUString aFileType; + if (xOutStreamProps.is()) + xOutStreamProps->getPropertyValue("MediaType") >>= aFileType; // Refer to this data. if (rHTMLWrt.m_bLFPossible) rHTMLWrt.OutNewLine(); rWrt.Strm().WriteOString("<" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_object); - rWrt.Strm().WriteOString(" data=\"" + aFileName.toUtf8() + "\">"); + rWrt.Strm().WriteOString(" data=\"" + aFileName.toUtf8() + "\""); + if (!aFileType.isEmpty()) + rWrt.Strm().WriteOString(" type=\"" + aFileType.toUtf8() + "\""); + rWrt.Strm().WriteOString(">"); bObjectOpened = true; rHTMLWrt.m_bLFPossible = true; } |