Kaydet (Commit) 8e4f458d authored tarafından László Németh's avatar László Németh

Uncaught exception at HTML export of embedded objects

Using SkipImages FilterOptions with HTML export, LibreOffice
tries to export the content of the embedded objects, too, but
it seems, we get only exceptions for a simple test document, too.

Change-Id: I756ca79b183c0ee2f2be712df799a97612f9475b
üst eadbad60
......@@ -1283,18 +1283,25 @@ Writer& OutHTML_FrmFmtOLENodeGrf( Writer& rWrt, const SwFrmFmt& rFrmFmt,
if (xStorable.is() && !aFilter.isEmpty())
{
SvMemoryStream aStream;
uno::Reference<io::XOutputStream> xOutputStream(new utl::OStreamWrapper(aStream));
utl::MediaDescriptor aMediaDescriptor;
aMediaDescriptor["FilterName"] <<= aFilter;
aMediaDescriptor["FilterOptions"] <<= OUString("SkipHeaderFooter");
aMediaDescriptor["OutputStream"] <<= xOutputStream;
xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList());
OString aData(static_cast<const char*>(aStream.GetData()), aStream.GetSize());
// Wrap output in a <span> tag to avoid 'HTML parser error: Unexpected end tag: p'
HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_span);
rWrt.Strm().WriteCharPtr(aData.getStr());
HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_span, false);
try
{
// FIXME: exception for the simplest test document, too
SvMemoryStream aStream;
uno::Reference<io::XOutputStream> xOutputStream(new utl::OStreamWrapper(aStream));
utl::MediaDescriptor aMediaDescriptor;
aMediaDescriptor["FilterName"] <<= aFilter;
aMediaDescriptor["FilterOptions"] <<= OUString("SkipHeaderFooter");
aMediaDescriptor["OutputStream"] <<= xOutputStream;
xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList());
OString aData(static_cast<const char*>(aStream.GetData()), aStream.GetSize());
// Wrap output in a <span> tag to avoid 'HTML parser error: Unexpected end tag: p'
HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_span);
rWrt.Strm().WriteCharPtr(aData.getStr());
HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_span, false);
}
catch ( uno::Exception& )
{
}
}
return rWrt;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment