summaryrefslogtreecommitdiff
path: root/sc/inc
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/inc
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/inc')
-rw-r--r--sc/inc/compiler.hxx20
1 files changed, 19 insertions, 1 deletions
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index d8935c7f7545..17e258dc3805 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -108,6 +108,10 @@ public:
union {
double nValue;
struct {
+ sal_uInt8 nCount;
+ sal_Unicode cChar;
+ } whitespace;
+ struct {
sal_uInt8 cByte;
formula::ParamClass eInForceArray;
} sbyte;
@@ -326,7 +330,21 @@ private:
bool ToUpperAsciiOrI18nIsAscii( OUString& rUpper, const OUString& rOrg ) const;
virtual void SetError(FormulaError nError) override;
- sal_Int32 NextSymbol(bool bInArray);
+
+ struct Whitespace final
+ {
+ sal_Int32 nCount;
+ sal_Unicode cChar;
+
+ Whitespace() : nCount(0), cChar(0x20) {}
+ void reset( sal_Unicode c ) { nCount = 0; cChar = c; }
+ };
+
+ static void addWhitespace( std::vector<ScCompiler::Whitespace> & rvSpaces,
+ ScCompiler::Whitespace & rSpace, sal_Unicode c, sal_Int32 n = 1 );
+
+ std::vector<Whitespace> NextSymbol(bool bInArray);
+
bool IsValue( const OUString& );
bool IsOpCode( const OUString&, bool bInArray );
bool IsOpCode2( const OUString& );