[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - embeddedobj/source

Caolán McNamara caolanm at redhat.com
Tue May 9 13:47:37 UTC 2017


 embeddedobj/source/msole/oleembed.cxx |   31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

New commits:
commit 8f45915b6c76ace7aeffaa042d487e8e2d7f4d89
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 9 09:24:11 2017 +0100

    Related: tdf#62702 handle EmbeddedOdf like CONTENTS on ole activate attempt
    
    (cherry picked from commit 8db9cfd2973b3e6f0c682fe8961540d528e6d493)
    
    Related: tdf#62702 also try various other known streams for object content
    
    (cherry picked from commit 013e34d875aeb75d9660af7c18967c2d468cbd74)
    
    Change-Id: I11f1d6ad049cada1cadfe97a440b7ae562ba4ced
    5b5fa61e9930ba0eaa5ac86e4231050c9ebebf8a
    Reviewed-on: https://gerrit.libreoffice.org/37434
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index 2faed0ba62be..e26875732ef3 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -711,18 +711,33 @@ namespace
                 "com.sun.star.embed.OLESimpleStorage",
                 aArgs ), uno::UNO_QUERY_THROW );
 
-        uno::Reference< io::XStream > xCONTENTS;
-        try
+        //various stream names that can contain the real document contents for
+        //this object in a straightforward direct way
+        static const OUStringLiteral aStreamNames[] =
         {
-            xNameContainer->getByName("CONTENTS") >>= xCONTENTS;
-        }
-        catch (container::NoSuchElementException const&)
+            OUStringLiteral("CONTENTS"),
+            OUStringLiteral("Package"),
+            OUStringLiteral("EmbeddedOdf"),
+            OUStringLiteral("WordDocument"),
+            OUStringLiteral("Workbook"),
+            OUStringLiteral("PowerPoint Document")
+        };
+
+        bool bCopied = false;
+        for (size_t i = 0; i < SAL_N_ELEMENTS(aStreamNames) && !bCopied; ++i)
         {
-            // ignore
+            uno::Reference<io::XStream> xEmbeddedFile;
+            try
+            {
+                xNameContainer->getByName(aStreamNames[i]) >>= xEmbeddedFile;
+            }
+            catch (const container::NoSuchElementException&)
+            {
+                // ignore
+            }
+            bCopied = xEmbeddedFile.is() && lcl_CopyStream(xEmbeddedFile->getInputStream(), xStream->getOutputStream());
         }
 
-        bool bCopied = xCONTENTS.is() && lcl_CopyStream(xCONTENTS->getInputStream(), xStream->getOutputStream());
-
         if (!bCopied)
         {
             uno::Reference< io::XStream > xOle10Native;


More information about the Libreoffice-commits mailing list