summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj/tokenuno.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2021-07-28 17:31:56 +0200
committerEike Rathke <erack@redhat.com>2021-07-28 18:56:29 +0200
commit516318113f0bd2b3c658aba9b285165e63a280e2 (patch)
tree3e33e570b0d62b36afa95045999d115fe005d126 /sc/source/ui/unoobj/tokenuno.cxx
parent24b06b9c6bdb777dff385b0fbfc81d55d3d013a1 (diff)
Resolves: tdf#76310 Preserve whitespace TAB, CR, LF in formula expressions
Allowed whitespace in ODFF and OOXML are U+0020 SPACE U+0009 CHARACTER TABULATION U+000A LINE FEED U+000D CARRIAGE RETURN Line feed and carriage return look a bit funny in the Function Wizard if part of a function's argument but work. Once a formula is edited, CR are converted to LF though, probably already in EditEngine, didn't investigate. Change-Id: I6278f6be48872e0710a3d74212db391dda249ed2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119635 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sc/source/ui/unoobj/tokenuno.cxx')
-rw-r--r--sc/source/ui/unoobj/tokenuno.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx
index 33f005fff8d6..b07a04e12b04 100644
--- a/sc/source/ui/unoobj/tokenuno.cxx
+++ b/sc/source/ui/unoobj/tokenuno.cxx
@@ -32,6 +32,7 @@
#include <svl/itemprop.hxx>
#include <vcl/svapp.hxx>
+#include <comphelper/string.hxx>
#include <miscuno.hxx>
#include <convuno.hxx>
@@ -388,6 +389,18 @@ void ScTokenConversion::ConvertToTokenSequence( const ScDocument& rDoc,
// Only the count of spaces is stored as "long". Parameter count is ignored.
if ( eOpCode == ocSpaces )
rAPI.Data <<= static_cast<sal_Int32>(rToken.GetByte());
+ else if (eOpCode == ocWhitespace)
+ {
+ // Convention is one character repeated.
+ if (rToken.GetByte() == 1)
+ rAPI.Data <<= OUString( rToken.GetChar());
+ else
+ {
+ OUStringBuffer aBuf( rToken.GetByte());
+ comphelper::string::padToLength( aBuf, rToken.GetByte(), rToken.GetChar());
+ rAPI.Data <<= aBuf.makeStringAndClear();
+ }
+ }
else
rAPI.Data.clear(); // no data
break;