summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/source/core/data/documen8.cxx10
-rw-r--r--sc/source/core/data/formulacell.cxx3
-rw-r--r--sc/source/filter/excel/excform.cxx1
-rw-r--r--sc/source/filter/excel/excform8.cxx1
-rw-r--r--sc/source/filter/excel/impop.cxx1
-rw-r--r--sc/source/filter/oox/formulabuffer.cxx4
7 files changed, 20 insertions, 2 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a4e65e137706..2e43cb1944fa 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1796,6 +1796,8 @@ public:
bool HasLinkFormulaNeedingCheck() const { return bLinkFormulaNeedingCheck; }
void SetLinkFormulaNeedingCheck(bool bSet) { bLinkFormulaNeedingCheck = bSet; }
+ /** Check token array and set link check if ocDde/ocWebservice is contained. */
+ SC_DLLPUBLIC void CheckLinkFormulaNeedingCheck( const ScTokenArray& rCode );
static bool CheckMacroWarn();
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 2bdfa30e3160..f6a43a1d587e 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -88,6 +88,7 @@
#include "stringutil.hxx"
#include <documentlinkmgr.hxx>
#include <scopetools.hxx>
+#include <tokenarray.hxx>
#include <boost/scoped_ptr.hpp>
@@ -1158,6 +1159,15 @@ void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
}
}
+void ScDocument::CheckLinkFormulaNeedingCheck( const ScTokenArray& rCode )
+{
+ if (HasLinkFormulaNeedingCheck())
+ return;
+
+ if (rCode.HasOpCodeRPN(ocDde) || rCode.HasOpCodeRPN(ocWebservice))
+ SetLinkFormulaNeedingCheck(true);
+}
+
// TimerDelays etc.
void ScDocument::KeyInput( const KeyEvent& )
{
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 96316392ffc3..49d3133f42fe 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1353,8 +1353,7 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr
// After loading, it must be known if ocDde/ocWebservice is in any formula
// (for external links warning, CompileXML is called at the end of loading XML file)
- if (!pDocument->HasLinkFormulaNeedingCheck() && (pCode->HasOpCodeRPN(ocDde) || pCode->HasOpCodeRPN(ocWebservice)))
- pDocument->SetLinkFormulaNeedingCheck(true);
+ pDocument->CheckLinkFormulaNeedingCheck(*pCode);
//volatile cells must be added here for import
if( pCode->IsRecalcModeAlways() || pCode->IsRecalcModeForced() ||
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 08399552c2a3..14be167de85e 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -157,6 +157,7 @@ void ImportExcel::Formula(
{
pCell = new ScFormulaCell(&rDoc.getDoc(), aScPos, *pResult);
pCell->GetCode()->WrapReference(aScPos, EXC_MAXCOL8, EXC_MAXROW8);
+ rDoc.getDoc().CheckLinkFormulaNeedingCheck( *pCell->GetCode());
rDoc.getDoc().EnsureTable(aScPos.Tab());
rDoc.setFormulaCell(aScPos, pCell);
SetLastFormula(aScPos.Col(), aScPos.Row(), fCurVal, nXF, pCell);
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index ebe3b6445e57..c7e56afd1149 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -729,6 +729,7 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
<< nMerk0 << ocClose;
aPool >> aStack;
pExtName->CreateDdeData( GetDoc(), aApplic, aTopic );
+ GetDoc().SetLinkFormulaNeedingCheck(true);
}
}
break;
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 904209d2bb1b..69e536e64ed3 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -866,6 +866,7 @@ void ImportExcel::Shrfmla()
ScFormulaCell* pCell = new ScFormulaCell(pD, aPos, *pErgebnis);
pCell->GetCode()->WrapReference(aPos, EXC_MAXCOL8, EXC_MAXROW8);
+ rDoc.getDoc().CheckLinkFormulaNeedingCheck( *pCell->GetCode());
rDoc.getDoc().EnsureTable(aPos.Tab());
rDoc.setFormulaCell(aPos, pCell);
pCell->SetNeedNumberFormat(false);
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index 189017d65196..2d20e9d73a53 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -229,6 +229,10 @@ void applyCellFormulas(
continue;
aCompiler.CompileTokenArray(); // Generate RPN tokens.
+
+ // Check if ocDde/ocWebservice is in any formula for external links warning.
+ rDoc.getDoc().CheckLinkFormulaNeedingCheck(*pCode);
+
ScFormulaCell* pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, pCode);
rDoc.setFormulaCell(aPos, pCell);
rCache.store(aPos, pCell);