summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-07-19 17:39:02 +0200
committerEike Rathke <erack@redhat.com>2018-07-19 20:36:22 +0200
commitda9a6f426b61937d9cda17f5be3f82d2e15e6ecd (patch)
treedc73ca300ce15eb3169013595419e01258349c78 /sc
parent3e39524d4171f0ecadad5658d6e03cf44126b2a0 (diff)
Related: tdf#118735 introduce FormulaError::LinkFormulaNeedingCheck (Err:540)
To indicate why the result isn't available ("External content disabled") and in future maybe signal to the formula cell that it could keep the hybrid string result, see source code comment. Change-Id: Ic5d336b8489e8776f7b640b7e46815e71d0a82a4 Reviewed-on: https://gerrit.libreoffice.org/57738 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/globstr.hrc1
-rw-r--r--sc/source/core/data/global.cxx3
-rw-r--r--sc/source/core/tool/interpr7.cxx35
3 files changed, 28 insertions, 11 deletions
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 326c9f01c455..09caaf80423c 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -510,6 +510,7 @@
#define STR_TEXT NC_("STR_TEXT", "Text")
#define STR_QUERY_PIVOTTABLE_DELTAB NC_("STR_QUERY_PIVOTTABLE_DELTAB", "The selected sheet(s) contain source data of related pivot tables that will be lost. Are you sure you want to delete the selected sheet(s)?")
#define STR_ERR_NAME_INVALID_CELL_REF NC_("STR_ERR_NAME_INVALID_CELL_REF", "Invalid name. Reference to a cell, or a range of cells not allowed.")
+#define STR_ERR_LONG_LINK_FORMULA_NEEDING_CHECK NC_("STR_ERR_LONG_LINK_FORMULA_NEEDING_CHECK", "External content disabled.")
#endif
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 825278134b43..cf0bd92371da 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -423,6 +423,9 @@ OUString ScGlobal::GetLongErrorString(FormulaError nErr)
case FormulaError::BadArrayContent:
pErrNumber = STR_ERR_LONG_BAD_ARRAY_CONTENT;
break;
+ case FormulaError::LinkFormulaNeedingCheck:
+ pErrNumber = STR_ERR_LONG_LINK_FORMULA_NEEDING_CHECK;
+ break;
case FormulaError::NoValue:
pErrNumber = STR_LONG_ERR_NO_VALUE;
break;
diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index 108d5f4445ea..e2dd62717fb9 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -320,7 +320,6 @@ void ScInterpreter::ScWebservice()
ScWebServiceLink* pLink = lcl_GetWebServiceLink(mpLinkManager, aURI);
bool bWasError = (pMyFormulaCell && pMyFormulaCell->GetRawError() != FormulaError::NONE);
- bool bLinkFormulaNeedingCheck = false;
if (!pLink)
{
@@ -336,8 +335,7 @@ void ScInterpreter::ScWebservice()
//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
- bLinkFormulaNeedingCheck = pDok->HasLinkFormulaNeedingCheck();
- if (!bLinkFormulaNeedingCheck)
+ if (!pDok->HasLinkFormulaNeedingCheck())
{
pLink->Update();
}
@@ -361,7 +359,7 @@ void ScInterpreter::ScWebservice()
// check the value
if (pLink->HasResult())
PushString(pLink->GetResult());
- else
+ else if (pDok->HasLinkFormulaNeedingCheck())
{
// If this formula cell is recalculated just after load and the
// expression is exactly WEBSERVICE("literal_URI") (i.e. no other
@@ -371,18 +369,33 @@ void ScInterpreter::ScWebservice()
// external links has been disabled."
// This will work only once, as the new formula cell result won't
// be a hybrid anymore.
- if (bLinkFormulaNeedingCheck && pMyFormulaCell && pMyFormulaCell->GetCode()->GetCodeLen() == 2 &&
- pMyFormulaCell->HasHybridStringResult())
+ /* TODO: the FormulaError::LinkFormulaNeedingCheck could be used as
+ * a signal for the formula cell to keep the hybrid string as
+ * result of the overall formula *iff* no higher prioritized
+ * ScRecalcMode than ONLOAD_LENIENT is present in the entire
+ * document (i.e. the formula result could not be influenced by an
+ * ONLOAD_MUST or ALWAYS recalc, necessary as we don't track
+ * interim results of subexpressions that could be compared), which
+ * also means to track setting ScRecalcMode somehow.. note this is
+ * just a vague idea so far and might or might not work. */
+ if (pMyFormulaCell && pMyFormulaCell->HasHybridStringResult())
{
- formula::FormulaToken const * const * pRPN = pMyFormulaCell->GetCode()->GetCode();
- if (pRPN[0]->GetType() == formula::svString && pRPN[1]->GetOpCode() == ocWebservice)
- PushString( pMyFormulaCell->GetResultString());
+ if (pMyFormulaCell->GetCode()->GetCodeLen() == 2)
+ {
+ formula::FormulaToken const * const * pRPN = pMyFormulaCell->GetCode()->GetCode();
+ if (pRPN[0]->GetType() == formula::svString && pRPN[1]->GetOpCode() == ocWebservice)
+ PushString( pMyFormulaCell->GetResultString());
+ else
+ PushError(FormulaError::LinkFormulaNeedingCheck);
+ }
else
- PushError(FormulaError::NoValue);
+ PushError(FormulaError::LinkFormulaNeedingCheck);
}
else
- PushError(FormulaError::NoValue);
+ PushError(FormulaError::LinkFormulaNeedingCheck);
}
+ else
+ PushError(FormulaError::NoValue);
pDok->EnableIdle(bOldEnabled);
mpLinkManager->CloseCachedComps();