summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
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())