diff options
author | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2021-12-30 19:57:10 +0100 |
---|---|---|
committer | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2022-02-15 07:46:03 +0100 |
commit | 44d237c375b7ef9a5a61a2f752bd19b57649ffbd (patch) | |
tree | 79ab534d175fb69f926a759260834ca7cf3ecce3 /sc/source/ui/view | |
parent | 31180cc24f8ff66895c52a2d4aa828ee0dcb34f3 (diff) |
tdf#104902 - Handle embedded newline in Calc's .uno:EnterString
Change-Id: I6377aebb06b6e6873ce61984a887d9e16eecd361
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127766
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 26aa7907779a..a1a5083205b8 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -75,6 +75,7 @@ #include <comphelper/lok.hxx> #include <conditio.hxx> #include <columnspanset.hxx> +#include <stringutil.hxx> #include <memory> @@ -575,10 +576,24 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, } else { + ScFieldEditEngine& rEngine = rDoc.GetEditEngine(); for (const auto& rTab : rMark) { bool bNumFmtSet = false; - rFunc.SetNormalString( bNumFmtSet, ScAddress( nCol, nRow, rTab ), rString, false ); + const ScAddress aScAddress(nCol, nRow, rTab); + + // tdf#104902 - handle embedded newline + if (ScStringUtil::isMultiline(rString)) + { + rEngine.SetTextCurrentDefaults(rString); + rDoc.SetEditText(aScAddress, rEngine.CreateTextObject()); + pDocSh->AdjustRowHeight(nRow, nRow, rTab); + } + else + { + rFunc.SetNormalString(bNumFmtSet, aScAddress, rString, false); + } + if (bNumFmtSet) { /* FIXME: if set on any sheet results in changed only on |