sc/inc/document.hxx | 6 +++--- sc/qa/unit/ucalc.cxx | 2 +- sc/source/core/data/documen2.cxx | 2 +- sc/source/core/data/formulacell.cxx | 8 ++++---- sc/source/core/tool/interpr2.cxx | 8 +++++++- sc/source/ui/docshell/docsh4.cxx | 2 ++ sc/source/ui/view/tabvwsh4.cxx | 2 +- 7 files changed, 19 insertions(+), 11 deletions(-)
New commits: commit 4ede45eb239b1604bca900c22481b7d13e4c2790 Author: Caolán McNamara <[email protected]> Date: Thu Jan 11 14:16:15 2018 +0000 Better handle ScDde formulas with missing dde-link entries typically each ScDde formula has a matching table:dde-link which results in a ScDdeLink getting inserted during the load. If that dde-link is missing then no ScDdeLink exists and ScDde() will create a new one without cached content. So detect that ScDde is used in the freshing loaded ods and defer fetching new content until the right time. only call GetHasMacroFunc to set SetHasMacroFunc and bHasMacroFunc is not accessed any other way, so this is an oxbow Change-Id: I016b53288076d83dd49e92e245346a5f7f560522 Reviewed-on: https://gerrit.libreoffice.org/47757 Tested-by: Jenkins <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> (cherry picked from commit b0597ba5d745974fce752e1b677451a19350d351) Reviewed-on: https://gerrit.libreoffice.org/47818 Reviewed-by: Eike Rathke <[email protected]> diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index da3f6feb2d66..2b12dd412643 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -457,7 +457,7 @@ private: // for detective update, is set for each change of a formula bool bDetectiveDirty; - bool bHasMacroFunc; // valid only after loading + bool bLinkFormulaNeedingCheck; // valid only after loading, for ocDde CharCompressType nAsianCompression; sal_uInt8 nAsianKerning; @@ -1939,8 +1939,8 @@ public: bool IsDetectiveDirty() const { return bDetectiveDirty; } void SetDetectiveDirty(bool bSet) { bDetectiveDirty = bSet; } - bool GetHasMacroFunc() const { return bHasMacroFunc; } - void SetHasMacroFunc(bool bSet) { bHasMacroFunc = bSet; } + bool HasLinkFormulaNeedingCheck() const { return bLinkFormulaNeedingCheck; } + void SetLinkFormulaNeedingCheck(bool bSet) { bLinkFormulaNeedingCheck = bSet; } void SetRangeOverflowType(sal_uInt32 nType) { nRangeOverflowType = nType; } bool HasRangeOverflow() const { return nRangeOverflowType != 0; } diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index fe8d35aeeb09..b8af5e78d38e 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -6554,7 +6554,7 @@ void Test::testEmptyCalcDocDefaults() CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IdleCalcTextWidth() ); CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsIdleEnabled() ); CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsDetectiveDirty() ); - CPPUNIT_ASSERT_EQUAL( false, m_pDoc->GetHasMacroFunc() ); + CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasLinkFormulaNeedingCheck() ); CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsChartListenerCollectionNeedsUpdate() ); CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasRangeOverflow() ); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 7d089f2a3d79..90afbfdca234 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -201,7 +201,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : bInDtorClear( false ), bExpandRefs( false ), bDetectiveDirty( false ), - bHasMacroFunc( false ), + bLinkFormulaNeedingCheck( false ), nAsianCompression(CharCompressType::Invalid), nAsianKerning(SC_ASIANKERNING_INVALID), bPastingDrawFromOtherDoc( false ), diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 2555c15b6371..55353067bc29 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -1368,10 +1368,10 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr bChanged = true; } - // Same as in Load: after loading, it must be known if ocMacro is in any formula - // (for macro warning, CompileXML is called at the end of loading XML file) - if ( !pDocument->GetHasMacroFunc() && pCode->HasOpCodeRPN( ocMacro ) ) - pDocument->SetHasMacroFunc( true ); + // After loading, it must be known if ocDde is in any formula + // (for external links warning, CompileXML is called at the end of loading XML file) + if (!pDocument->HasLinkFormulaNeedingCheck() && pCode->HasOpCodeRPN(ocDde)) + pDocument->SetLinkFormulaNeedingCheck(true); //volatile cells must be added here for import if( pCode->IsRecalcModeAlways() || pCode->IsRecalcModeForced() || diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 35f748a959e2..d16883beaa31 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -2783,8 +2783,14 @@ void ScInterpreter::ScDde() pBindings->Invalidate( SID_LINKS ); // Link-Manager enabled } + //if the document was just loaded, but the ScDdeLink entry was missing, then + //don't update this link until the links are updated in response to the users + //decision + if (!pDok->HasLinkFormulaNeedingCheck()) + { //TODO: evaluate asynchron ??? - pLink->TryUpdate(); // TryUpdate doesn't call Update multiple times + pLink->TryUpdate(); // TryUpdate doesn't call Update multiple times + } if (pMyFormulaCell) { diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index bc4a8a8df386..826bfc7f7478 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -472,6 +472,8 @@ void ScDocShell::Execute( SfxRequest& rReq ) rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); rReq.Ignore(); } + + rDoc.SetLinkFormulaNeedingCheck(false); } break; diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index a38a87f1dd81..488dd048b164 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1570,7 +1570,7 @@ void ScTabViewShell::Construct( TriState nForceDesignMode ) if (!bLink) { const sc::DocumentLinkManager& rMgr = rDoc.GetDocLinkManager(); - if (rMgr.hasDdeOrOleLinks() || rDoc.HasAreaLinks()) + if (rMgr.hasDdeOrOleLinks() || rDoc.HasAreaLinks() || rDoc.HasLinkFormulaNeedingCheck()) bLink = true; } if (bLink) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
