sc/source/core/data/simpleformulacalc.cxx |    4 ++++
 sc/source/core/inc/interpre.hxx           |    5 +++++
 sc/source/core/tool/interpr2.cxx          |   12 ++++++------
 sc/source/core/tool/interpr4.cxx          |    1 +
 4 files changed, 16 insertions(+), 6 deletions(-)

New commits:
commit 6a92ada1f624b3d37976845517595e15ed5a73f6
Author: Martin Nathansen <marsia...@gmail.com>
Date:   Mon Apr 18 14:59:13 2016 +0200

    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 <c...@libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/core/data/simpleformulacalc.cxx 
b/sc/source/core/data/simpleformulacalc.cxx
index 49b3459..63d8b54 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 5530d58..4f06f86 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 18fd2bb..c1a812a 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 027a253..570a3d0 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)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to