summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-02-09 15:17:35 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2018-02-13 21:44:42 +0100
commit9d751166f3cf785b8b350fcff86c2d6864f5633f (patch)
tree210c0e8129d933aeb355bdeb659b1a8d0ab22101
parentCheckLinkFormulaNeedingCheck() for .slk import (diff)
downloadcore-9d751166f3cf785b8b350fcff86c2d6864f5633f.tar.gz
core-9d751166f3cf785b8b350fcff86c2d6864f5633f.zip
CheckLinkFormulaNeedingCheck() for .csv import
Change-Id: I89be713531436f10b38d38f9e0fa527db1e036cd (cherry picked from commit c7dd72b2bd6a7988e4e1074e9a85222b53ba84ac) Reviewed-on: https://gerrit.libreoffice.org/49501 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/source/core/data/documentimport.cxx1
-rw-r--r--sc/source/ui/docshell/impex.cxx11
2 files changed, 12 insertions, 0 deletions
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
{