LibreOffice Module sc (master) 1
lotform.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include "formel.hxx"
23
25{
26 FT_Return = 0, // End Formula
27 FT_FuncFix0, // Function, 0 Parameter
28 FT_FuncFix1, // Function, 0 Parameter
29 FT_FuncFix2, // Function, 0 Parameter
30 FT_FuncFix3, // Function, 0 Parameter
31 FT_FuncFix4, // Function, 0 Parameter
32 FT_FuncVar, // ~, var. P.
33 FT_Neg, // Negation
34 FT_Op, // Operator
35 FT_NotImpl, // not implemented
36 FT_ConstFloat, // Double (8-Byte)
37 FT_Variable, // Single Ref
38 FT_Range, // Double Ref
39 FT_Braces, // Braces
40 FT_ConstInt, // Integer
41 FT_ConstString, // String
42 FT_NOP, // nothing
43 // additionally since WK3
44 FT_Cref, // Cell Reference
45 FT_Rref, // Range Reference
46 FT_Nrref, // Named range reference
47 FT_Absnref, // Absolute named range
48 FT_Erref, // Err range reference
49 FT_Ecref, // Err cell reference
50 FT_Econstant, // Err constant
51 FT_Splfunc, // SPLfunction
52 FT_Const10Float,// Float (10-Byte)
53 FT_Snum // Const Short Num
54 // for 'Problem Cases' during Import
55};
56
57struct LotusContext;
58
60{
61private:
63 rtl_TextEncoding eSrcChar;
64 TokenId nAddToken; // ')+1.0'
66 TokenId n0Token; // '0.0';
67
72 void DoFunc( DefTokenId eOc, sal_uInt8 nCnt, const char* pExtName );
73 void LotusRelToScRel(sal_uInt16 nCol, sal_uInt16 nRow, ScSingleRefData& rSRD);
74 bool bWK3; // alternative Code translation for < WK1
75 bool bWK123; // alternative for 123
76
77 void ReadSRD( const ScDocument& rDoc, ScSingleRefData& rSRD, sal_uInt8 nFlags );
78 inline void ReadCRD( const ScDocument& rDoc, ScComplexRefData& rCRD, sal_uInt8 nFlags );
79 void IncToken( TokenId &rParam );
80 // Attention: here the Token-chain is extended in Pool
81 // with '(<rParam>)+1' and finished with Store() !
82
83 void DecToken( TokenId& rParam );
84 // Attention: ~
85 void NegToken( TokenId& rParam );
86 // Attention: like ~, but with '-(<rParam>)'
87public:
88 LotusToSc(LotusContext &rContext, SvStream& aStr, svl::SharedStringPool& rSPool, rtl_TextEncoding eSrc, bool b);
89
90 virtual void Convert( std::unique_ptr<ScTokenArray>& rpErg, sal_Int32& nRest ) override;
91
92 void Reset( const ScAddress& rEingPos );
93 inline void SetWK3();
95
96private:
98};
99
100inline void LotusToSc::ReadCRD( const ScDocument& rDoc, ScComplexRefData& rCRD, sal_uInt8 nRelBit )
101{
102 // 1st part
103 ReadSRD( rDoc, rCRD.Ref1, nRelBit );
104
105 // 2nd part
106 ReadSRD( rDoc, rCRD.Ref2, nRelBit >> 3 );
107}
108
109inline void LotusToSc::SetWK3()
110{
111 bWK3 = true;
112}
113
114/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Convert(std::unique_ptr< ScTokenArray > &rpErg, sal_Int32 &nRest) override
Definition: lotform.cxx:391
static FUNC_TYPE IndexToTypeWK123(sal_uInt8)
Definition: lotform.cxx:1211
void Reset()
Definition: frmbase.cxx:164
static FUNC_TYPE IndexToType(sal_uInt8)
Definition: lotform.cxx:682
void NegToken(TokenId &rParam)
Definition: lotform.cxx:357
void ReadSRD(const ScDocument &rDoc, ScSingleRefData &rSRD, sal_uInt8 nFlags)
Definition: lotform.cxx:320
TokenId nSubToken
Definition: lotform.hxx:65
bool bWK3
Definition: lotform.hxx:74
void IncToken(TokenId &rParam)
Definition: lotform.cxx:345
void ReadCRD(const ScDocument &rDoc, ScComplexRefData &rCRD, sal_uInt8 nFlags)
Definition: lotform.hxx:100
LotusContext & getContext()
Definition: lotform.hxx:94
rtl_TextEncoding eSrcChar
Definition: lotform.hxx:63
TokenId nAddToken
Definition: lotform.hxx:64
void DecToken(TokenId &rParam)
Definition: lotform.cxx:351
void LotusRelToScRel(sal_uInt16 nCol, sal_uInt16 nRow, ScSingleRefData &rSRD)
Definition: lotform.cxx:247
void DoFunc(DefTokenId eOc, sal_uInt8 nCnt, const char *pExtName)
Definition: lotform.cxx:38
bool bWK123
Definition: lotform.hxx:75
static DefTokenId IndexToToken(sal_uInt8)
Definition: lotform.cxx:946
LotusToSc(LotusContext &rContext, SvStream &aStr, svl::SharedStringPool &rSPool, rtl_TextEncoding eSrc, bool b)
Definition: lotform.cxx:378
static DefTokenId IndexToTokenWK123(sal_uInt8)
Definition: lotform.cxx:1475
void SetWK3()
Definition: lotform.hxx:109
LotusContext & m_rContext
Definition: lotform.hxx:62
TokenId n0Token
Definition: lotform.hxx:66
FUNC_TYPE
Definition: lotform.hxx:25
@ FT_NotImpl
Definition: lotform.hxx:35
@ FT_ConstFloat
Definition: lotform.hxx:36
@ FT_Braces
Definition: lotform.hxx:39
@ FT_Op
Definition: lotform.hxx:34
@ FT_Const10Float
Definition: lotform.hxx:52
@ FT_ConstString
Definition: lotform.hxx:41
@ FT_FuncVar
Definition: lotform.hxx:32
@ FT_FuncFix1
Definition: lotform.hxx:28
@ FT_Range
Definition: lotform.hxx:38
@ FT_ConstInt
Definition: lotform.hxx:40
@ FT_FuncFix0
Definition: lotform.hxx:27
@ FT_Absnref
Definition: lotform.hxx:47
@ FT_Ecref
Definition: lotform.hxx:49
@ FT_Return
Definition: lotform.hxx:26
@ FT_Nrref
Definition: lotform.hxx:46
@ FT_Neg
Definition: lotform.hxx:33
@ FT_Econstant
Definition: lotform.hxx:50
@ FT_FuncFix2
Definition: lotform.hxx:29
@ FT_Erref
Definition: lotform.hxx:48
@ FT_Snum
Definition: lotform.hxx:53
@ FT_Rref
Definition: lotform.hxx:45
@ FT_NOP
Definition: lotform.hxx:42
@ FT_Variable
Definition: lotform.hxx:37
@ FT_FuncFix3
Definition: lotform.hxx:30
@ FT_Cref
Definition: lotform.hxx:44
@ FT_FuncFix4
Definition: lotform.hxx:31
@ FT_Splfunc
Definition: lotform.hxx:51
OpCode
Complex reference (a range) into the sheet.
Definition: refdata.hxx:123
ScSingleRefData Ref2
Definition: refdata.hxx:125
ScSingleRefData Ref1
Definition: refdata.hxx:124
Single reference (one address) into the sheet.
Definition: refdata.hxx:30
unsigned char sal_uInt8