summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-01-11 16:59:50 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-01-12 16:18:39 +0100
commitdabcc069de794f38a04625cbc1cb5f70dcd3dff9 (patch)
tree63c65ae0df53f93e8ba27d4f78f7dfb205be8358 /sc
parentb39f962e0be52f0d8380e1662f88a2f627fbfb89 (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. Change-Id: I016b53288076d83dd49e92e245346a5f7f560522 Reviewed-on: https://gerrit.libreoffice.org/47768 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/document.hxx5
-rw-r--r--sc/qa/unit/ucalc.cxx1
-rw-r--r--sc/source/core/data/documen2.cxx1
-rw-r--r--sc/source/core/data/formulacell.cxx5
-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, 22 insertions, 2 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 3d13fd4d649f..28d815a748aa 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -500,6 +500,8 @@ private:
// for detective update, is set for each change of a formula
bool bDetectiveDirty;
+ bool bLinkFormulaNeedingCheck; // valid only after loading, for ocDde
+
CharCompressType nAsianCompression;
sal_uInt8 nAsianKerning;
@@ -1988,6 +1990,9 @@ public:
bool IsDetectiveDirty() const { return bDetectiveDirty; }
void SetDetectiveDirty(bool bSet) { bDetectiveDirty = bSet; }
+ bool HasLinkFormulaNeedingCheck() const { return bLinkFormulaNeedingCheck; }
+ void SetLinkFormulaNeedingCheck(bool bSet) { bLinkFormulaNeedingCheck = bSet; }
+
void SetRangeOverflowType(ErrCode nType) { nRangeOverflowType = nType; }
bool HasRangeOverflow() const { return nRangeOverflowType != ERRCODE_NONE; }
SC_DLLPUBLIC const ErrCode& GetRangeOverflowType() const { return nRangeOverflowType; }
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 36572e564cb5..175564916e20 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -6548,6 +6548,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->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 bd0f72e76658..4e8e83614d5d 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -203,6 +203,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
bInDtorClear( false ),
bExpandRefs( false ),
bDetectiveDirty( 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 efab5fa09cf3..813f74f29655 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1358,6 +1358,11 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr
bChanged = 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() ||
pCode->IsRecalcModeOnLoad() || pCode->IsRecalcModeOnLoadOnce() )
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 5464d9b6c778..ab07afe355e0 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2780,8 +2780,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 7071e42ab0e4..d555c99aaea3 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -476,6 +476,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 d1f40a7bd313..969dfb7efd8b 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1567,7 +1567,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)