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 
57 struct LotusContext;
58 
60 {
61 private:
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>)'
87 public:
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 
96 private:
98 };
99 
100 inline 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 
109 inline void LotusToSc::SetWK3()
110 {
111  bWK3 = true;
112 }
113 
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
LotusContext & m_rContext
Definition: lotform.hxx:62
rtl_TextEncoding eSrcChar
Definition: lotform.hxx:63
Single reference (one address) into the sheet.
Definition: refdata.hxx:29
void LotusRelToScRel(sal_uInt16 nCol, sal_uInt16 nRow, ScSingleRefData &rSRD)
Definition: lotform.cxx:246
void DecToken(TokenId &rParam)
Definition: lotform.cxx:344
TokenId nSubToken
Definition: lotform.hxx:65
OpCode
TokenId n0Token
Definition: lotform.hxx:66
TokenId nAddToken
Definition: lotform.hxx:64
void DoFunc(DefTokenId eOc, sal_uInt8 nCnt, const char *pExtName)
Definition: lotform.cxx:37
ScSingleRefData Ref1
Definition: refdata.hxx:124
ScSingleRefData Ref2
Definition: refdata.hxx:125
void IncToken(TokenId &rParam)
Definition: lotform.cxx:338
void ReadSRD(const ScDocument &rDoc, ScSingleRefData &rSRD, sal_uInt8 nFlags)
Definition: lotform.cxx:319
static FUNC_TYPE IndexToTypeWK123(sal_uInt8)
Definition: lotform.cxx:1197
virtual void Convert(std::unique_ptr< ScTokenArray > &rpErg, sal_Int32 &nRest) override
Definition: lotform.cxx:384
bool bWK3
Definition: lotform.hxx:74
bool bWK123
Definition: lotform.hxx:75
unsigned char sal_uInt8
FUNC_TYPE
Definition: lotform.hxx:24
static FUNC_TYPE IndexToType(sal_uInt8)
Definition: lotform.cxx:668
LotusToSc(LotusContext &rContext, SvStream &aStr, svl::SharedStringPool &rSPool, rtl_TextEncoding eSrc, bool b)
Definition: lotform.cxx:371
void SetWK3()
Definition: lotform.hxx:109
LotusContext & getContext()
Definition: lotform.hxx:94
Complex reference (a range) into the sheet.
Definition: refdata.hxx:122
static DefTokenId IndexToToken(sal_uInt8)
Definition: lotform.cxx:932
void Reset()
Definition: frmbase.cxx:161
void NegToken(TokenId &rParam)
Definition: lotform.cxx:350
void ReadCRD(const ScDocument &rDoc, ScComplexRefData &rCRD, sal_uInt8 nFlags)
Definition: lotform.hxx:100
static DefTokenId IndexToTokenWK123(sal_uInt8)
Definition: lotform.cxx:1461