[Libreoffice-commits] core.git: sw/source

László Németh laszlo.nemeth at collabora.com
Wed Apr 15 02:07:24 PDT 2015


 sw/source/filter/html/htmlplug.cxx |   31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

New commits:
commit 8e4f458df490dcce9451b91974bdea52b1fef522
Author: László Németh <laszlo.nemeth at collabora.com>
Date:   Tue Apr 14 22:09:13 2015 +0200

    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

diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 96670fb..213b6b0 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -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;


More information about the Libreoffice-commits mailing list