diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-01-11 14:16:15 +0000 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-02-09 09:49:30 +0100 |
commit | f1ade9c8625f4e215cd2ce5cd115f748de7a0f34 (patch) | |
tree | 14135f0a5de69a3d95ca32b25feda7df73788300 | |
parent | d810b2762dcd59488faf8ccdd835911094c5a719 (diff) |
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
Reviewed-on: https://gerrit.libreoffice.org/47757
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit b0597ba5d745974fce752e1b677451a19350d351)
Reviewed-on: https://gerrit.libreoffice.org/47818
Reviewed-by: Eike Rathke <erack@redhat.com>
Conflicts:
sc/qa/unit/ucalc.cxx
sc/source/core/data/documen2.cxx
sc/inc/document.hxx
Change-Id: I016b53288076d83dd49e92e245346a5f7f560522
-rw-r--r-- | sc/inc/document.hxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/documen2.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsh4.cxx | 2 |
6 files changed, 18 insertions, 10 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 69e6f5bd9586..f73be94d994b 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -429,7 +429,7 @@ private: bool bDetectiveDirty; sal_uInt8 nMacroCallMode; // Macros per warning dialog disabled? - bool bHasMacroFunc; // valid only after loading + bool bLinkFormulaNeedingCheck; // valid only after loading, for ocDde sal_uInt8 nVisSpellState; @@ -1793,8 +1793,8 @@ public: sal_uInt8 GetMacroCallMode() const { return nMacroCallMode; } void SetMacroCallMode(sal_uInt8 nNew) { nMacroCallMode = nNew; } - bool GetHasMacroFunc() const { return bHasMacroFunc; } - void SetHasMacroFunc(bool bSet) { bHasMacroFunc = bSet; } + bool HasLinkFormulaNeedingCheck() const { return bLinkFormulaNeedingCheck; } + void SetLinkFormulaNeedingCheck(bool bSet) { bLinkFormulaNeedingCheck = bSet; } static bool CheckMacroWarn(); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 8d3e4e3d3b8f..0d494c4c583d 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -202,7 +202,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : bExpandRefs( false ), bDetectiveDirty( false ), nMacroCallMode( SC_MACROCALL_ALLOWED ), - bHasMacroFunc( false ), + bLinkFormulaNeedingCheck( false ), nVisSpellState( 0 ), nAsianCompression(SC_ASIANCOMPRESSION_INVALID), nAsianKerning(SC_ASIANKERNING_INVALID), diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index ceb7f68d6a6f..9a9b5705e5e2 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -1351,10 +1351,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 d82bc29eaff9..5f6b5af7d980 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -2421,8 +2421,14 @@ void ScInterpreter::ScDde() pBindings->Invalidate( SID_LINKS ); // Link-Manager enablen } + //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 9fcf549c8920..ad8a75a44c58 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -477,6 +477,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 ff3a5a1d94f1..0c9b036863c0 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1584,7 +1584,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) |