[Libreoffice-commits] core.git: embeddedobj/source
Caolán McNamara
caolanm at redhat.com
Tue May 9 08:34:39 UTC 2017
embeddedobj/source/msole/oleembed.cxx | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
New commits:
commit 013e34d875aeb75d9660af7c18967c2d468cbd74
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 9 09:32:45 2017 +0100
Related: tdf#62702 also try various other known streams for object content
Change-Id: I5b5fa61e9930ba0eaa5ac86e4231050c9ebebf8a
diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index fd9bb68ecc1c..8dd202d16ea1 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -704,29 +704,31 @@ 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
+ const OUStringLiteral aStreamNames[] =
{
- xNameContainer->getByName("CONTENTS") >>= xCONTENTS;
- }
- catch (container::NoSuchElementException const&)
+ "CONTENTS",
+ "Package",
+ "EmbeddedOdf",
+ "WordDocument",
+ "Workbook",
+ "PowerPoint Document"
+ };
+
+ bool bCopied = false;
+ for (size_t i = 0; i < SAL_N_ELEMENTS(aStreamNames) && !bCopied; ++i)
{
- // ignore
- }
-
- bool bCopied = xCONTENTS.is() && lcl_CopyStream(xCONTENTS->getInputStream(), xStream->getOutputStream());
- if (!bCopied)
- {
- uno::Reference< io::XStream > xEmbeddedOdf;
+ uno::Reference<io::XStream> xEmbeddedFile;
try
{
- xNameContainer->getByName("EmbeddedOdf") >>= xEmbeddedOdf;
+ xNameContainer->getByName(aStreamNames[i]) >>= xEmbeddedFile;
}
- catch (container::NoSuchElementException const&)
+ catch (const container::NoSuchElementException&)
{
// ignore
}
- bCopied = xEmbeddedOdf.is() && lcl_CopyStream(xEmbeddedOdf->getInputStream(), xStream->getOutputStream());
+ bCopied = xEmbeddedFile.is() && lcl_CopyStream(xEmbeddedFile->getInputStream(), xStream->getOutputStream());
}
if (!bCopied)
More information about the Libreoffice-commits
mailing list