summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/core/data/simpleformulacalc.cxx4
-rw-r--r--sc/source/core/inc/interpre.hxx5
-rw-r--r--sc/source/core/tool/interpr2.cxx12
-rw-r--r--sc/source/core/tool/interpr4.cxx1
4 files changed, 16 insertions, 6 deletions
diff --git a/sc/source/core/data/simpleformulacalc.cxx b/sc/source/core/data/simpleformulacalc.cxx
index 49b3459f06c0..63d8b540ae3d 100644
--- a/sc/source/core/data/simpleformulacalc.cxx
+++ b/sc/source/core/data/simpleformulacalc.cxx
@@ -46,6 +46,10 @@ void ScSimpleFormulaCalculator::Calculate()
mbCalculated = true;
ScInterpreter aInt(nullptr, mpDoc, maAddr, *mpCode.get());
+
+ std::unique_ptr<sfx2::LinkManager> pNewLinkMgr( new sfx2::LinkManager(mpDoc->GetDocumentShell()) );
+ aInt.SetLinkManager( pNewLinkMgr.get() );
+
if (mbMatrixFormula)
aInt.AssertFormulaMatrix();
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 5530d58fa992..4f06f86d7f49 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -26,6 +26,7 @@
#include <unotools/textsearch.hxx>
#include <formula/errorcodes.hxx>
#include <formula/tokenarray.hxx>
+#include <sfx2/linkmgr.hxx>
#include "scdll.hxx"
#include "scdllapi.h"
#include "types.hxx"
@@ -182,6 +183,7 @@ private:
ScAddress aPos;
ScTokenArray& rArr;
ScDocument* pDok;
+ sfx2::LinkManager* mpLinkManager;
svl::SharedStringPool& mrStrPool;
formula::FormulaTokenRef xResult;
ScJumpMatrix* pJumpMatrix; // currently active array condition, if any
@@ -922,6 +924,9 @@ public:
{ if (nError && !nGlobalError) nGlobalError = nError; }
void AssertFormulaMatrix();
+ void SetLinkManager(sfx2::LinkManager* pLinkMgr)
+ { mpLinkManager = pLinkMgr; }
+
sal_uInt16 GetError() const { return nGlobalError; }
formula::StackVar GetResultType() const { return xResult->GetType(); }
svl::SharedString GetStringResult() const;
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 18fd2bbd35da..c1a812a19a10 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2452,8 +2452,8 @@ void ScInterpreter::ScDde()
// temporary documents (ScFunctionAccess) have no DocShell
// and no LinkManager -> abort
- sfx2::LinkManager* pLinkMgr = pDok->GetLinkManager();
- if (!pLinkMgr)
+ //sfx2::LinkManager* pLinkMgr = pDok->GetLinkManager();
+ if (!mpLinkManager)
{
PushNoValue();
return;
@@ -2471,7 +2471,7 @@ void ScInterpreter::ScDde()
// Get/ Create link object
- ScDdeLink* pLink = lcl_GetDdeLink( pLinkMgr, aAppl, aTopic, aItem, nMode );
+ ScDdeLink* pLink = lcl_GetDdeLink( mpLinkManager, aAppl, aTopic, aItem, nMode );
//TODO: Save Dde-links (in addition) more efficient at document !!!!!
// ScDdeLink* pLink = pDok->GetDdeLink( aAppl, aTopic, aItem );
@@ -2481,8 +2481,8 @@ void ScInterpreter::ScDde()
if (!pLink)
{
pLink = new ScDdeLink( pDok, aAppl, aTopic, aItem, nMode );
- pLinkMgr->InsertDDELink( pLink, aAppl, aTopic, aItem );
- if ( pLinkMgr->GetLinks().size() == 1 ) // erster ?
+ mpLinkManager->InsertDDELink( pLink, aAppl, aTopic, aItem );
+ if ( mpLinkManager->GetLinks().size() == 1 ) // erster ?
{
SfxBindings* pBindings = pDok->GetViewBindings();
if (pBindings)
@@ -2530,7 +2530,7 @@ void ScInterpreter::ScDde()
PushNA();
pDok->EnableIdle(bOldEnabled);
- pLinkMgr->CloseCachedComps();
+ mpLinkManager->CloseCachedComps();
}
}
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 027a25336f3a..570a3d095cf4 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3461,6 +3461,7 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc,
, aPos(rPos)
, rArr(r)
, pDok(pDoc)
+ , mpLinkManager(pDok->GetLinkManager())
, mrStrPool(pDoc->GetSharedStringPool())
, pJumpMatrix(nullptr)
, pTokenMatrixMap(nullptr)