[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/source
Eike Rathke
erack at redhat.com
Thu Feb 15 01:25:19 UTC 2018
sc/inc/stringutil.hxx | 7 +++++++
sc/source/core/data/column3.cxx | 10 +++++++---
sc/source/core/tool/stringutil.cxx | 3 ++-
sc/source/filter/rtf/eeimpars.cxx | 1 +
4 files changed, 17 insertions(+), 4 deletions(-)
New commits:
commit df72c65fdaf5f1276d1759ba3e7eec83eaaa2d20
Author: Eike Rathke <erack at redhat.com>
Date: Tue Feb 13 17:10:21 2018 +0100
ScSetStringParam::mbCheckLinkFormula for HTML and RTF import
This is a combination of 3 commits.
Introduce ScSetStringParam::mbCheckLinkFormula
(cherry picked from commit 5a93c51e3b7f455ff5d4cfc9e8b6e510fc126b75)
Handle ScSetStringParam::mbCheckLinkFormula in ScColumn::ParseString()
(cherry picked from commit 271d9ebfe0c4fc57ea6f01a9c048021e5429dd15)
Conflicts:
sc/source/core/data/column3.cxx
ScSetStringParam::mbCheckLinkFormula for HTML and RTF import
(cherry picked from commit 98c0bd7ffd008015623b2c5eb8630649394d76f6)
d6b0705140baacdb872560f7031efaf0c03f0e00
7cf7cf12142322cbffd5160e9a8dce55efd36be5
Change-Id: I2028fc53f9778606778cd8629611752acd3f1a1c
Reviewed-on: https://gerrit.libreoffice.org/49708
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/inc/stringutil.hxx b/sc/inc/stringutil.hxx
index 005a99713f2f..a1ecbdd85c82 100644
--- a/sc/inc/stringutil.hxx
+++ b/sc/inc/stringutil.hxx
@@ -92,6 +92,13 @@ struct SAL_WARN_UNUSED SC_DLLPUBLIC ScSetStringParam
sc::StartListeningType meStartListening;
+ /** When true and the string results in a compiled formula, check the
+ formula tokens for presence of functions that could trigger access to
+ external resources. This is to be set to true in import filter code,
+ but not for user input.
+ */
+ bool mbCheckLinkFormula;
+
ScSetStringParam();
/**
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 397fe3310087..730003196151 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1722,11 +1722,15 @@ bool ScColumn::ParseString(
rCell.set(rPool.intern(rString));
}
else // = Formula
- rCell.set(
- new ScFormulaCell(
+ {
+ ScFormulaCell* pFormulaCell = new ScFormulaCell(
pDocument, ScAddress(nCol, nRow, nTabP), rString,
formula::FormulaGrammar::mergeToGrammar(formula::FormulaGrammar::GRAM_DEFAULT, eConv),
- ScMatrixMode::NONE));
+ ScMatrixMode::NONE);
+ if (aParam.mbCheckLinkFormula)
+ pDocument->CheckLinkFormulaNeedingCheck( *pFormulaCell->GetCode());
+ rCell.set( pFormulaCell);
+ }
}
else if ( cFirstChar == '\'') // 'Text
{
diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx
index 8ac5a3a6a0d0..8ba3fd0a94ff 100644
--- a/sc/source/core/tool/stringutil.cxx
+++ b/sc/source/core/tool/stringutil.cxx
@@ -30,7 +30,8 @@ ScSetStringParam::ScSetStringParam() :
mbDetectNumberFormat(true),
meSetTextNumFormat(Never),
mbHandleApostrophe(true),
- meStartListening(sc::SingleCellListening)
+ meStartListening(sc::SingleCellListening),
+ mbCheckLinkFormula(false)
{
}
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 0214a78240d6..a3af0cb868b7 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -341,6 +341,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
aParam.mbDetectNumberFormat = true;
aParam.meSetTextNumFormat = ScSetStringParam::SpecialNumberOnly;
aParam.mbHandleApostrophe = false;
+ aParam.mbCheckLinkFormula = true;
if (!aValStr.isEmpty())
mpDoc->SetValue( nCol, nRow, nTab, fVal );
More information about the Libreoffice-commits
mailing list