[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/source

Eike Rathke erack at redhat.com
Fri Feb 9 17:12:26 UTC 2018


 sc/source/core/data/documentimport.cxx |    1 +
 sc/source/ui/docshell/impex.cxx        |   11 +++++++++++
 2 files changed, 12 insertions(+)

New commits:
commit 20e0ed5c664f7ee49ee074ebf8ea72023e896217
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Feb 9 15:17:35 2018 +0100

    CheckLinkFormulaNeedingCheck() for .csv import
    
    Change-Id: I89be713531436f10b38d38f9e0fa527db1e036cd
    (cherry picked from commit c7dd72b2bd6a7988e4e1074e9a85222b53ba84ac)
    Reviewed-on: https://gerrit.libreoffice.org/49498
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index c46f1b09c95d..1062cc893cd7 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -206,6 +206,7 @@ void ScDocumentImport::setAutoInput(const ScAddress& rPos, const OUString& rStr,
             pBlockPos->miCellPos = rCells.set(pBlockPos->miCellPos, rPos.Row(), aCell.mfValue);
         break;
         case CELLTYPE_FORMULA:
+            mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( *aCell.mpFormula->GetCode());
             // This formula cell instance is directly placed in the document without copying.
             pBlockPos->miCellPos = rCells.set(pBlockPos->miCellPos, rPos.Row(), aCell.mpFormula);
             aCell.mpFormula = nullptr;
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 88bab11ffb11..e4ed928537be 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1206,7 +1206,18 @@ static bool lcl_PutString(
         if ( bUseDocImport )
             rDocImport.setAutoInput(ScAddress(nCol, nRow, nTab), rStr, &aParam);
         else
+        {
             pDoc->SetString( nCol, nRow, nTab, rStr, &aParam );
+            // ScColumn::ParseString() is strict about the first character
+            // having to be '=' for formula, so we can use that here and don't
+            // need to obtain the created cell for each and every value.
+            if (rStr.getLength() > 1 && rStr[0] == '=')
+            {
+                const ScFormulaCell* pFC = pDoc->GetFormulaCell( ScAddress( nCol, nRow, nTab));
+                if (pFC)
+                    pDoc->CheckLinkFormulaNeedingCheck( *pFC->GetCode());
+            }
+        }
     }
     else
     {


More information about the Libreoffice-commits mailing list