summaryrefslogtreecommitdiff
path: root/embeddedobj
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-07-11 10:50:29 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-07-11 11:16:00 -0400
commita0bd5587a5ac62974bdb10731d3fd21584521a72 (patch)
treecfd7fc3ebd11f7e830551529a1be86b0d387d61b /embeddedobj
parent4cb52136220b417f09eb2156e11436ee0a06729f (diff)
bnc#883684: Better fix for this.
Instead of making all chart objects exempt from unloading, check each OLE object on whether or not it already has its persistent storage created. If not, don't unload it else it would have nothing to load back from once unloaded. Change-Id: I2312e86c9376d3699ef4aa1e0cf2f4c04f706c1e
Diffstat (limited to 'embeddedobj')
-rw-r--r--embeddedobj/source/commonembedding/miscobj.cxx8
-rw-r--r--embeddedobj/source/commonembedding/persistence.cxx9
-rw-r--r--embeddedobj/source/inc/commonembobj.hxx8
3 files changed, 22 insertions, 3 deletions
diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx
index e88092981388..de1bee71c8a7 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -360,6 +360,11 @@ uno::Any SAL_CALL OCommonEmbeddedObject::queryInterface( const uno::Type& rType
void * p = static_cast< embed::XEmbeddedObject * >( this );
return uno::Any( &p, rType );
}
+ else if (rType == cppu::UnoType<embed::XEmbedPersist2>::get())
+ {
+ void* p = static_cast<embed::XEmbedPersist2*>(this);
+ return uno::Any(&p, rType);
+ }
else
aReturn <<= ::cppu::queryInterface(
rType,
@@ -428,7 +433,8 @@ uno::Sequence< uno::Type > SAL_CALL OCommonEmbeddedObject::getTypes()
cppu::UnoType<embed::XInplaceObject>::get(),
cppu::UnoType<embed::XCommonEmbedPersist>::get(),
cppu::UnoType<container::XChild>::get(),
- cppu::UnoType<embed::XEmbedPersist>::get());
+ cppu::UnoType<embed::XEmbedPersist>::get(),
+ cppu::UnoType<embed::XEmbedPersist2>::get());
pTypeCollection = &aTypeCollection ;
}
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
index 5ef9253276b3..260cce01c40a 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -1790,6 +1790,15 @@ void SAL_CALL OCommonEmbeddedObject::reload(
}
}
+sal_Bool SAL_CALL OCommonEmbeddedObject::isStored() throw (css::uno::RuntimeException, std::exception)
+{
+ uno::Reference<container::XNameAccess> xNA(m_xObjectStorage, uno::UNO_QUERY);
+ if (!xNA.is())
+ return false;
+
+ return xNA->getElementNames().getLength() > 0;
+}
+
void SAL_CALL OCommonEmbeddedObject::breakLink( const uno::Reference< embed::XStorage >& xStorage,
const OUString& sEntName )
diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx
index ceba61e43198..0808363733ca 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -27,7 +27,7 @@
#include <com/sun/star/document/XStorageBasedDocument.hpp>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/embed/XVisualObject.hpp>
-#include <com/sun/star/embed/XEmbedPersist.hpp>
+#include <com/sun/star/embed/XEmbedPersist2.hpp>
#include <com/sun/star/embed/XLinkageSupport.hpp>
#include <com/sun/star/embed/XClassifiedObject.hpp>
#include <com/sun/star/embed/XComponentSupplier.hpp>
@@ -72,7 +72,7 @@ namespace comphelper {
class Interceptor;
class OCommonEmbeddedObject : public ::com::sun::star::embed::XEmbeddedObject
- , public ::com::sun::star::embed::XEmbedPersist
+ , public ::com::sun::star::embed::XEmbedPersist2
, public ::com::sun::star::embed::XLinkageSupport
, public ::com::sun::star::embed::XInplaceObject
, public ::com::sun::star::container::XChild
@@ -429,6 +429,10 @@ public:
::com::sun::star::uno::Exception,
::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+// XEmbedPersist2
+
+ virtual sal_Bool SAL_CALL isStored()
+ throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
// XInplaceObject