summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2021-12-28 19:55:29 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-01-13 09:48:37 +0100
commit5ee413d78cfc1cbfbe7c05f0c21c40ffb32f572a (patch)
treec9b61e1cbf28f16a9e9767f9700eae4e983b1283 /sc
parent3ce308300b276f62f11e0ed077775dea2e5f9340 (diff)
tdf#146454 - Check for multiline string in setDataArray
Check for a multiline string in the setDataArray function. If that is the case, set a string or edit cell. Otherwise, just set a plain string in order to prevent performance issues due to the adjustments of the row height. Regression from b9e2c5d2a36fbd189c20448cadf4212edf02914d Change-Id: I9216b198b878fda5da29596d25504db853acd756 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127660 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de> (cherry picked from commit 2d11710df6d81c03007d136667a443e09cc70eed) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128332 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit b1e2d386afc3174d79a11fcfe365bf3a51f0caef) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128333
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 29d3b29086da..9d280b35213e 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1098,7 +1098,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
const uno::Sequence< uno::Sequence<uno::Any> >& aData )
{
ScDocument& rDoc = rDocShell.GetDocument();
- ScDocFunc& rDocFunc = rDocShell.GetDocFunc();
+ ScFieldEditEngine& rEngine = rDoc.GetEditEngine();
SCTAB nTab = rRange.aStart.Tab();
SCCOL nStartCol = rRange.aStart.Col();
SCROW nStartRow = rRange.aStart.Row();
@@ -1175,7 +1175,19 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
rElement >>= aUStr;
if ( !aUStr.isEmpty() )
{
- rDocFunc.SetStringOrEditCell(aPos, aUStr, false);
+ // tdf#146454 - check for a multiline string since setting an edit
+ // or string cell is in magnitudes slower than setting a plain string
+ if (ScStringUtil::isMultiline(aUStr))
+ {
+ rEngine.SetTextCurrentDefaults(aUStr);
+ rDoc.SetEditText(aPos, rEngine.CreateTextObject());
+ }
+ else
+ {
+ ScSetStringParam aParam;
+ aParam.setTextInput();
+ rDoc.SetString(aPos, aUStr, &aParam);
+ }
}
}
break;