summaryrefslogtreecommitdiff
path: root/embeddedobj
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-07-11 10:50:29 -0400
committerCaolán McNamara <caolanm@redhat.com>2014-07-21 08:54:22 +0000
commit65a41146af0c3c86de5c530446719e75f2c5512e (patch)
tree2dc57ff12a66084ebf4ad1f1dd1b6c766c890f7d /embeddedobj
parenta68dbdd334f9e653eb7e4db934055d32be506537 (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. (cherry picked from commit a0bd5587a5ac62974bdb10731d3fd21584521a72) Conflicts: svx/source/svdraw/svdetc.cxx Change-Id: I2312e86c9376d3699ef4aa1e0cf2f4c04f706c1e Reviewed-on: https://gerrit.libreoffice.org/10237 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
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 8df625dc06b9..fd5ab0d76313 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -363,6 +363,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,
@@ -431,7 +436,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 51210a786f9f..c85e7863e2e6 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -1789,6 +1789,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