summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-12-18 20:48:52 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-01-12 08:58:53 +0000
commita20c344627a71c079c6b9abc1fd629a636b37cc8 (patch)
tree567aa93a3d3ccec519a290f4ca213beae3f1a378 /sw
parent9f6cb113a9a6a55de34bf2fab6da757275ead6ea (diff)
sw: stop using SfxObjectShell in DocxExport::WriteOLEObject
(cherry picked from commit 1a5104a6cd7c69b960d84ecb4f375b15d4bc042c) sw: add yet another stupid component for WNT (cherry picked from commit 3612634fee539c7ee4163ac553691f8d64291244) WIP: Fix build with --disable-atl on Windows This avoids finding emboleobj's component in such case. Reviewed-on: https://gerrit.libreoffice.org/21075 Reviewed-by: Matúš Kukan <matus@libreoffice.org> Tested-by: Matúš Kukan <matus@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit 3c42024f467ec9110be751e9af49d025ecc17182) Change-Id: I3ffa29c57bcb6d12208ef24cb6972364c2f50315 Reviewed-on: https://gerrit.libreoffice.org/21348 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/ooxmlexport_setup.mk5
-rw-r--r--sw/source/filter/ww8/docxexport.cxx38
2 files changed, 32 insertions, 11 deletions
diff --git a/sw/ooxmlexport_setup.mk b/sw/ooxmlexport_setup.mk
index 7b33349598d1..d78d276a113a 100644
--- a/sw/ooxmlexport_setup.mk
+++ b/sw/ooxmlexport_setup.mk
@@ -33,7 +33,10 @@ define sw_ooxmlexport_components
dbaccess/util/dba \
drawinglayer/drawinglayer \
embeddedobj/util/embobj \
- $(if $(filter-out WNT,$(OS)), \
+ $(if $(filter WNT,$(OS)), \
+ $(if $(DISABLE_ATL),, \
+ embeddedobj/source/msole/emboleobj.windows \
+ ), \
embeddedobj/source/msole/emboleobj \
) \
filter/source/config/cache/filterconfig1 \
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index d2c05c44953d..cd01cd43c9af 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -24,8 +24,10 @@
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XStorageBasedDocument.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/embed/XEmbedPersist.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XStorable.hpp>
@@ -548,24 +550,40 @@ static uno::Reference<io::XInputStream> lcl_StoreOwnAsOOXML(
OString DocxExport::WriteOLEObject(SwOLEObj& rObject, OUString & io_rProgID)
{
uno::Reference <embed::XEmbeddedObject> xObj( rObject.GetOleRef() );
- comphelper::EmbeddedObjectContainer* aContainer = rObject.GetObject().GetContainer();
- uno::Reference< io::XInputStream > xInStream = aContainer->GetObjectStream( xObj );
+ uno::Reference<io::XInputStream> xInStream;
OUString sMediaType;
OUString sRelationType;
OUString sSuffix;
const char * pProgID(nullptr);
- if (xInStream.is())
+ try
{
- lcl_ConvertProgID(io_rProgID, sMediaType, sRelationType, sSuffix);
+ uno::Reference<document::XStorageBasedDocument> const xParent(
+ uno::Reference<container::XChild>(xObj, uno::UNO_QUERY)->getParent(),
+ uno::UNO_QUERY);
+ uno::Reference<embed::XStorage> const xParentStorage(xParent->getDocumentStorage());
+ OUString const entryName(
+ uno::Reference<embed::XEmbedPersist>(xObj, uno::UNO_QUERY)->getEntryName());
+
+ if (xParentStorage->isStreamElement(entryName))
+ {
+ lcl_ConvertProgID(io_rProgID, sMediaType, sRelationType, sSuffix);
+
+ xInStream = xParentStorage->cloneStreamElement(entryName)->getInputStream();
+ // TODO: is it possible to take the sMediaType from the stream?
+ }
+ else // the object is ODF - either the whole document is
+ { // ODF, or the OLE was edited so it was converted to ODF
+ uno::Reference<uno::XComponentContext> const xContext(
+ GetFilter().getComponentContext());
+ xInStream = lcl_StoreOwnAsOOXML(xContext, xObj,
+ pProgID, sMediaType, sRelationType, sSuffix);
+ }
}
- else // the object is ODF - either the whole document is
- { // ODF, or the OLE was edited so it was converted to ODF
- uno::Reference<uno::XComponentContext> const xContext(
- GetFilter().getComponentContext());
- xInStream = lcl_StoreOwnAsOOXML(xContext, xObj,
- pProgID, sMediaType, sRelationType, sSuffix);
+ catch (uno::Exception const& e)
+ {
+ SAL_WARN("sw.ww8", "DocxExport::WriteOLEObject: exception: " << e.Message);
}
if (!xInStream.is())