diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-05-09 09:32:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-05-09 09:33:57 +0100 |
commit | 013e34d875aeb75d9660af7c18967c2d468cbd74 (patch) | |
tree | 7bb281c9d541c06e4823aa73a5010dc253784d9f /embeddedobj/source | |
parent | 48270327e15770acb5872fa9aed8938f35d33e12 (diff) |
Related: tdf#62702 also try various other known streams for object content
Change-Id: I5b5fa61e9930ba0eaa5ac86e4231050c9ebebf8a
Diffstat (limited to 'embeddedobj/source')
-rw-r--r-- | embeddedobj/source/msole/oleembed.cxx | 32 |
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) |