summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-01-11 14:16:15 +0000
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-02-09 01:46:10 +0100
commit2c029414605a6e089c78f60eacc3c470869510c4 (patch)
tree1c916d057f687f393ca1d4907c4871015af21130
parent2f081cdb767bcdef75a04643274945ac6f725e1d (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> (cherry picked from commit 4ede45eb239b1604bca900c22481b7d13e4c2790) Signed-off-by: Andras Timar <andras.timar@collabora.com> Change-Id: I016b53288076d83dd49e92e245346a5f7f560522
-rw-r--r--sc/inc/document.hxx6
-rw-r--r--sc/qa/unit/ucalc.cxx2
-rw-r--r--sc/source/core/data/documen2.cxx2
-rw-r--r--sc/source/core/data/formulacell.cxx8
-rw-r--r--sc/source/core/tool/interpr2.cxx8
-rw-r--r--sc/source/ui/docshell/docsh4.cxx2
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx2
7 files changed, 19 insertions, 11 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index f5f9f0387174..693fb7a7d2bb 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -448,7 +448,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
sal_uInt8 nAsianCompression;
sal_uInt8 nAsianKerning;
@@ -1928,8 +1928,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 ea44ff7d4f3d..90ca51f47073 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -6215,7 +6215,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 7a41f14c01c2..017f8629c910 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -200,7 +200,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
bInDtorClear( false ),
bExpandRefs( false ),
bDetectiveDirty( false ),
- bHasMacroFunc( false ),
+ bLinkFormulaNeedingCheck( false ),
nAsianCompression(SC_ASIANCOMPRESSION_INVALID),
nAsianKerning(SC_ASIANKERNING_INVALID),
bPastingDrawFromOtherDoc( false ),
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 381fb173d4b7..c4f596df1936 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1379,10 +1379,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 c40623320b3d..7f215495538b 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2742,8 +2742,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 81dbf194d0c7..2821745e312c 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 e8f4491ae26e..60d46d3e9627 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1575,7 +1575,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)