diff options
Diffstat (limited to 'embeddedobj/source')
-rw-r--r-- | embeddedobj/source/inc/oleembobj.hxx | 10 | ||||
-rw-r--r-- | embeddedobj/source/msole/olemisc.cxx | 14 | ||||
-rw-r--r-- | embeddedobj/source/msole/olepersist.cxx | 3 |
3 files changed, 25 insertions, 2 deletions
diff --git a/embeddedobj/source/inc/oleembobj.hxx b/embeddedobj/source/inc/oleembobj.hxx index b1f44fbbd429..d9b75d2a9836 100644 --- a/embeddedobj/source/inc/oleembobj.hxx +++ b/embeddedobj/source/inc/oleembobj.hxx @@ -37,6 +37,7 @@ #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/util/XCloseListener.hpp> #include <com/sun/star/io/XActiveDataStreamer.hpp> +#include <com/sun/star/lang/XInitialization.hpp> #include <cppuhelper/implbase.hxx> #include <rtl/ref.hxx> @@ -117,7 +118,8 @@ class OleEmbeddedObject : public ::cppu::WeakImplHelper , css::embed::XLinkageSupport , css::embed::XInplaceObject , css::container::XChild - , css::io::XActiveDataStreamer > + , css::io::XActiveDataStreamer + , css::lang::XInitialization > { friend class OleComponent; @@ -205,6 +207,9 @@ class OleEmbeddedObject : public ::cppu::WeakImplHelper css::uno::Reference< css::uno::XInterface > m_xParent; + /// If it is allowed to modify entires in the stream of the OLE storage. + bool m_bStreamReadOnly = false; + protected: /// @throws css::uno::Exception css::uno::Reference< css::io::XStream > TryToGetAcceptableFormat_Impl( @@ -441,6 +446,9 @@ public: // XActiveDataStreamer void SAL_CALL setStream(const css::uno::Reference<css::io::XStream>& xStream) override; css::uno::Reference<css::io::XStream> SAL_CALL getStream() override; + + // XInitialization + void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override; }; #endif 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); } } |