summaryrefslogtreecommitdiff
path: root/include/formula/token.hxx
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 /include/formula/token.hxx
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 'include/formula/token.hxx')
-rw-r--r--include/formula/token.hxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/formula/token.hxx b/include/formula/token.hxx
index 3fa00e89339f..77bf3eeb90ea 100644
--- a/include/formula/token.hxx
+++ b/include/formula/token.hxx
@@ -187,6 +187,7 @@ public:
virtual void SetIndex( sal_uInt16 n );
virtual sal_Int16 GetSheet() const;
virtual void SetSheet( sal_Int16 n );
+ virtual sal_Unicode GetChar() const;
virtual short* GetJump() const;
virtual const OUString& GetExternal() const;
virtual FormulaToken* GetFAPOrigToken() const;
@@ -225,6 +226,25 @@ inline void intrusive_ptr_release(const FormulaToken* p)
p->DecRef();
}
+class FORMULA_DLLPUBLIC FormulaSpaceToken : public FormulaToken
+{
+private:
+ sal_uInt8 nByte;
+ sal_Unicode cChar;
+public:
+ FormulaSpaceToken( sal_uInt8 n, sal_Unicode c ) :
+ FormulaToken( svByte, ocWhitespace ),
+ nByte( n ), cChar( c ) {}
+ FormulaSpaceToken( const FormulaSpaceToken& r ) :
+ FormulaToken( r ),
+ nByte( r.nByte ), cChar( r.cChar ) {}
+
+ virtual FormulaToken* Clone() const override { return new FormulaSpaceToken(*this); }
+ virtual sal_uInt8 GetByte() const override;
+ virtual sal_Unicode GetChar() const override;
+ virtual bool operator==( const FormulaToken& rToken ) const override;
+};
+
class FORMULA_DLLPUBLIC FormulaByteToken : public FormulaToken
{
private: