kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

Blame SOURCES/0006-bnc-883684-Make-chart-objects-exempt-from-automatic-.patch

f085be
From bac8126cf1d485eaa65d9ab480118346eff90ad2 Mon Sep 17 00:00:00 2001
f085be
From: Kohei Yoshida <kohei.yoshida@collabora.com>
f085be
Date: Wed, 9 Jul 2014 21:46:34 -0400
f085be
Subject: [PATCH 006/137] bnc#883684: Make chart objects exempt from automatic
f085be
 unloading.
f085be
f085be
The Memory option page contains "Number of objects" setting which controls
f085be
how many OLE objects can be loaded at any given time.  When the number of
f085be
total OLE objects exceeds this number the oldest ones get unloaded.  Note
f085be
that the total number is across all open documents, not per document.
f085be
f085be
Technically, chart objects are OLE objects, but unlike other OLE objects
f085be
that are embedded Calc, Writer, Draw documents, chart objects normally
f085be
"belong" to the host document.  It therefore makes no sense to subject
f085be
chart objects to this automatic unloading.
f085be
f085be
In the future we may want to apply this exemption to other types of OLE
f085be
objects, like formula objects for example..  Or maybe this setting can be
f085be
removed altogether...
f085be
f085be
(cherry picked from commit b023565d4f064cd0312e8c1fcc23a9f552112935)
f085be
Signed-off-by: Andras Timar <andras.timar@collabora.com>
f085be
f085be
Conflicts:
f085be
	include/svx/svdoole2.hxx
f085be
	svx/source/svdraw/svdetc.cxx
f085be
	svx/source/svdraw/svdoole2.cxx
f085be
f085be
Change-Id: I7dd92550880efb4db8fc843cf1c915c712166da4
f085be
(cherry picked from commit 55612305b645a1c0872373c0a9f434763708732a)
f085be
Signed-off-by: Andras Timar <andras.timar@collabora.com>
f085be
---
f085be
 include/svx/svdoole2.hxx       | 7 +++++++
f085be
 svx/source/svdraw/svdetc.cxx   | 4 ++++
f085be
 svx/source/svdraw/svdoole2.cxx | 8 +++++++-
f085be
 3 files changed, 18 insertions(+), 1 deletion(-)
f085be
f085be
diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx
f085be
index 7a93f4b..0f1df14 100644
f085be
--- a/include/svx/svdoole2.hxx
f085be
+++ b/include/svx/svdoole2.hxx
f085be
@@ -167,6 +167,13 @@ public:
f085be
     sal_Bool IsChart() const;
f085be
     sal_Bool IsCalc() const;
f085be
 
f085be
+    /**
f085be
+     * Unloadable OLE objects are subject to automatic unloading per memory
f085be
+     * setting.  The "Number of objects" setting in the Memory option controls
f085be
+     * how many OLE objects can be loaded at any given moment.
f085be
+     */
f085be
+    bool IsUnloadable() const;
f085be
+
f085be
     sal_Bool UpdateLinkURL_Impl();
f085be
     void BreakFileLink_Impl();
f085be
     void DisconnectFileLink_Impl();
f085be
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
f085be
index 4caca94..afcc792 100644
f085be
--- a/svx/source/svdraw/svdetc.cxx
f085be
+++ b/svx/source/svdraw/svdetc.cxx
f085be
@@ -165,6 +165,10 @@ void OLEObjCache::UnloadOnDemand()
f085be
 
f085be
 void OLEObjCache::InsertObj(SdrOle2Obj* pObj)
f085be
 {
f085be
+    if (!pObj->IsUnloadable())
f085be
+        // This OLE object is exempt from automatic unloading.
f085be
+        return;
f085be
+
f085be
     if ( !empty() )
f085be
     {
f085be
         SdrOle2Obj* pExistingObj = front();
f085be
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
f085be
index 2929252..1102de8 100644
f085be
--- a/svx/source/svdraw/svdoole2.cxx
f085be
+++ b/svx/source/svdraw/svdoole2.cxx
f085be
@@ -2142,7 +2142,13 @@ sal_Bool SdrOle2Obj::IsCalc() const
f085be
     return sal_False;
f085be
 }
f085be
 
f085be
-// -----------------------------------------------------------------------------
f085be
+bool SdrOle2Obj::IsUnloadable() const
f085be
+{
f085be
+    // Right now, chart OLE objects are the only ones exempt from automatic
f085be
+    // unloading.
f085be
+    return !IsChart();
f085be
+}
f085be
+
f085be
 uno::Reference< frame::XModel > SdrOle2Obj::GetParentXModel() const
f085be
 {
f085be
     uno::Reference< frame::XModel > xDoc;
f085be
-- 
f085be
1.9.3
f085be