[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - 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 1a1fc4ad83539b63d4dace3ddd3e24a54bf44791
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/49709
    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 c208332b48f6..219a80cd452a 100644
--- a/sc/inc/stringutil.hxx
+++ b/sc/inc/stringutil.hxx
@@ -88,6 +88,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 28445f7c469a..8e36534e8461 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1721,11 +1721,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 afcbe7412474..f52646c980af 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 0e6eab3bc56c..e0202ce7e6fe 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -330,6 +330,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