summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embeddedobj/source/commonembedding/miscobj.cxx8
-rw-r--r--embeddedobj/source/commonembedding/persistence.cxx9
-rw-r--r--embeddedobj/source/inc/commonembobj.hxx8
-rw-r--r--include/svx/svdoole2.hxx7
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/embed/XEmbedPersist2.idl30
-rw-r--r--svx/source/svdraw/svdetc.cxx4
-rw-r--r--svx/source/svdraw/svdoole2.cxx16
8 files changed, 62 insertions, 21 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
diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx
index 238756b2ffc8..fe41d2f64d9a 100644
--- a/include/svx/svdoole2.hxx
+++ b/include/svx/svdoole2.hxx
@@ -155,13 +155,6 @@ public:
bool IsChart() const;
bool IsCalc() const;
- /**
- * Unloadable OLE objects are subject to automatic unloading per memory
- * setting. The "Number of objects" setting in the Memory option controls
- * how many OLE objects can be loaded at any given moment.
- */
- bool IsUnloadable() const;
-
bool UpdateLinkURL_Impl();
void BreakFileLink_Impl();
void DisconnectFileLink_Impl();
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 9c56e9fc9f61..364581d63680 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2423,6 +2423,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/embed,\
XEmbeddedObjectCreator \
XEmbedObjectFactory \
XEmbedPersist \
+ XEmbedPersist2 \
XEmbeddedClient \
XEmbeddedObject \
XEncryptionProtectedSource \
diff --git a/offapi/com/sun/star/embed/XEmbedPersist2.idl b/offapi/com/sun/star/embed/XEmbedPersist2.idl
new file mode 100644
index 000000000000..205b9027bb27
--- /dev/null
+++ b/offapi/com/sun/star/embed/XEmbedPersist2.idl
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __com_sun_star_XEmbedPersist2_idl__
+#define __com_sun_star_XEmbedPersist2_idl__
+
+#include <com/sun/star/embed/XEmbedPersist.idl>
+
+module com { module sun { module star { module embed {
+
+interface XEmbedPersist2 : XEmbedPersist
+{
+ /**
+ * Checks whether or not the object has created its persistent
+ * representation counterpart of its in-memory model.
+ */
+ boolean isStored();
+};
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index fad9bf8f01a1..b68c76fbdf16 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -167,10 +167,6 @@ void OLEObjCache::UnloadOnDemand()
void OLEObjCache::InsertObj(SdrOle2Obj* pObj)
{
- if (!pObj->IsUnloadable())
- // This OLE object is exempt from automatic unloading.
- return;
-
if (!maObjs.empty())
{
SdrOle2Obj* pExistingObj = maObjs.front();
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index bcb7b762e81b..0d3ed8a27113 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/EmbedMisc.hpp>
#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/embed/XEmbedPersist2.hpp>
#include <com/sun/star/embed/XInplaceClient.hpp>
#include <com/sun/star/embed/XInplaceObject.hpp>
#include <com/sun/star/embed/XLinkageSupport.hpp>
@@ -1956,6 +1957,14 @@ void SdrOle2Obj::NbcMove(const Size& rSize)
bool SdrOle2Obj::CanUnloadRunningObj( const uno::Reference< embed::XEmbeddedObject >& xObj, sal_Int64 nAspect )
{
+ uno::Reference<embed::XEmbedPersist2> xPersist(xObj, uno::UNO_QUERY);
+ if (xPersist.is())
+ {
+ if (!xPersist->isStored())
+ // It doesn't have persistent storage. We can't unload this.
+ return false;
+ }
+
bool bResult = false;
sal_Int32 nState = xObj->getCurrentState();
@@ -2178,13 +2187,6 @@ bool SdrOle2Obj::IsCalc() const
return false;
}
-bool SdrOle2Obj::IsUnloadable() const
-{
- // Right now, chart OLE objects are the only ones exempt from automatic
- // unloading.
- return !IsChart();
-}
-
uno::Reference< frame::XModel > SdrOle2Obj::GetParentXModel() const
{
uno::Reference< frame::XModel > xDoc;