summaryrefslogtreecommitdiff
path: root/embeddedobj/source/msole/oleembed.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'embeddedobj/source/msole/oleembed.cxx')
-rw-r--r--embeddedobj/source/msole/oleembed.cxx32
1 files changed, 17 insertions, 15 deletions
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)