summaryrefslogtreecommitdiff
path: root/embeddedobj/source/msole
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2018-11-14 17:17:46 +0100
committerMiklos Vajna <vmiklos@collabora.com>2018-11-14 19:20:43 +0100
commit72e6269b88a32a672e00d2c25f0d0400038d1360 (patch)
tree13ba7aecd52a64f354f5d2a94a62dba7fc0aa5dc /embeddedobj/source/msole
parent6e566c2b2b23d457a9fd47c16df15ce11e84c8e8 (diff)
sw: fix modification of ole obj native data during HTML import
It is expected that if you load an OLE2 storage (from reqif-xhtml) and you save it as ODT, the OLE2 data is not modified. This was almost the case, but we insisted on removing the OLE2 preview from the storage. Add a new flag to OleEmbeddedObject, so import filters can opt in for not modifying the OLE2 data. [ The nice situation is that we already had a test file which had a preview stream in the OLE2 storage, so we can easily assert there that the size doesn't change. ] Change-Id: I9b8b29f015dd4f2513e51a1066767218580cb5d8 Reviewed-on: https://gerrit.libreoffice.org/63381 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'embeddedobj/source/msole')
-rw-r--r--embeddedobj/source/msole/olemisc.cxx14
-rw-r--r--embeddedobj/source/msole/olepersist.cxx3
2 files changed, 16 insertions, 1 deletions
diff --git a/embeddedobj/source/msole/olemisc.cxx b/embeddedobj/source/msole/olemisc.cxx
index 83485c89d768..2d757a594533 100644
--- a/embeddedobj/source/msole/olemisc.cxx
+++ b/embeddedobj/source/msole/olemisc.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <cppuhelper/interfacecontainer.h>
+#include <comphelper/sequenceashashmap.hxx>
#include <oleembobj.hxx>
#include "olepersist.hxx"
@@ -676,4 +677,17 @@ css::uno::Reference<css::io::XStream> OleEmbeddedObject::getStream()
return m_xObjectStream;
}
+void OleEmbeddedObject::initialize(const uno::Sequence<uno::Any>& rArguments)
+{
+ if (!rArguments.hasElements())
+ return;
+
+ comphelper::SequenceAsHashMap aValues(rArguments[0]);
+ for (const auto& rValue : aValues)
+ {
+ if (rValue.first == "StreamReadOnly")
+ rValue.second >>= m_bStreamReadOnly;
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx
index eedc8c4fe63b..df78e09291ce 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -1201,7 +1201,8 @@ void OleEmbeddedObject::StoreToLocation_Impl(
if ( !xCachedVisualRepresentation.is() )
xCachedVisualRepresentation = TryToRetrieveCachedVisualRepresentation_Impl( xTargetStream );
- RemoveVisualCache_Impl( xTargetStream );
+ if (!m_bStreamReadOnly)
+ RemoveVisualCache_Impl(xTargetStream);
}
}