[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

Eike Rathke erack at redhat.com
Tue Feb 13 20:45:05 UTC 2018


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

New commits:
commit 9d751166f3cf785b8b350fcff86c2d6864f5633f
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/49501
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index dd061648e485..95d38ee08f51 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -204,6 +204,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 2aa9e57559ac..e48096dc39ec 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1203,7 +1203,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