diff options
author | Martin Nathansen <marsianer@gmail.com> | 2016-04-18 14:59:13 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-04-18 17:44:32 +0000 |
commit | 6a92ada1f624b3d37976845517595e15ed5a73f6 (patch) | |
tree | e1bf63aae7d0b362962831ea1da5cba162d1e37f | |
parent | ec730348a62748a4d53e2d73fc87cee92f53d044 (diff) |
tdf#99371 fix for DDE link update via Function Wizard
With this fix the DDE links can be edited again without
producing additional wrong DDE links. However below
the updated DDE link there is still a unnecessary table
added which should be fixed.
Change-Id: I51e5a7ec84d2fc1429e68554dc131e4e456540df
Reviewed-on: https://gerrit.libreoffice.org/24213
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | sc/source/core/data/simpleformulacalc.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/inc/interpre.hxx | 5 | ||||
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 12 | ||||
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 1 |
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) |