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 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_LOTFORM_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_LOTFORM_HXX
22 
23 #include "formel.hxx"
24 
26 {
27  FT_Return = 0, // End Formula
28  FT_FuncFix0, // Function, 0 Parameter
29  FT_FuncFix1, // Function, 0 Parameter
30  FT_FuncFix2, // Function, 0 Parameter
31  FT_FuncFix3, // Function, 0 Parameter
32  FT_FuncFix4, // Function, 0 Parameter
33  FT_FuncVar, // ~, var. P.
34  FT_Neg, // Negation
35  FT_Op, // Operator
36  FT_NotImpl, // not implemented
37  FT_ConstFloat, // Double (8-Byte)
38  FT_Variable, // Single Ref
39  FT_Range, // Double Ref
40  FT_Braces, // Braces
41  FT_ConstInt, // Integer
42  FT_ConstString, // String
43  FT_NOP, // nothing
44  // additionally since WK3
45  FT_Cref, // Cell Reference
46  FT_Rref, // Range Reference
47  FT_Nrref, // Named range reference
48  FT_Absnref, // Absolute named range
49  FT_Erref, // Err range reference
50  FT_Ecref, // Err cell reference
51  FT_Econstant, // Err constant
52  FT_Splfunc, // SPLfunction
53  FT_Const10Float,// Float (10-Byte)
54  FT_Snum // Const Short Num
55  // for 'Problem Cases' during Import
56 };
57 
58 struct LotusContext;
59 
61 {
62 private:
64  rtl_TextEncoding eSrcChar;
65  TokenId nAddToken; // ')+1.0'
67  TokenId n0Token; // '0.0';
68 
73  void DoFunc( DefTokenId eOc, sal_uInt8 nCnt, const char* pExtName );
74  void LotusRelToScRel(sal_uInt16 nCol, sal_uInt16 nRow, ScSingleRefData& rSRD);
75  bool bWK3; // alternative Code translation for < WK1
76  bool bWK123; // alternative for 123
77 
78  void ReadSRD( const ScDocument* pDoc, ScSingleRefData& rSRD, sal_uInt8 nFlags );
79  inline void ReadCRD( const ScDocument* pDoc, ScComplexRefData& rCRD, sal_uInt8 nFlags );
80  void IncToken( TokenId &rParam );
81  // Attention: here the Token-chain is extended in Pool
82  // with '(<rParam>)+1' and finished with Store() !
83 
84  void DecToken( TokenId& rParam );
85  // Attention: ~
86  void NegToken( TokenId& rParam );
87  // Attention: like ~, but with '-(<rParam>)'
88 public:
89  LotusToSc(LotusContext &rContext, SvStream& aStr, svl::SharedStringPool& rSPool, rtl_TextEncoding eSrc, bool b);
90 
91  virtual void Convert( std::unique_ptr<ScTokenArray>& rpErg, sal_Int32& nRest ) override;
92 
93  void Reset( const ScAddress& rEingPos );
94  inline void SetWK3();
96 
97 private:
99 };
100 
101 inline void LotusToSc::ReadCRD( const ScDocument* pDoc, ScComplexRefData& rCRD, sal_uInt8 nRelBit )
102 {
103  // 1st part
104  ReadSRD( pDoc, rCRD.Ref1, nRelBit );
105 
106  // 2nd part
107  ReadSRD( pDoc, rCRD.Ref2, nRelBit >> 3 );
108 }
109 
110 inline void LotusToSc::SetWK3()
111 {
112  bWK3 = true;
113 }
114 
115 #endif
116 
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
LotusContext & m_rContext
Definition: lotform.hxx:63
rtl_TextEncoding eSrcChar
Definition: lotform.hxx:64
Single reference (one address) into the sheet.
Definition: refdata.hxx:30
void LotusRelToScRel(sal_uInt16 nCol, sal_uInt16 nRow, ScSingleRefData &rSRD)
Definition: lotform.cxx:247
void DecToken(TokenId &rParam)
Definition: lotform.cxx:345
TokenId nSubToken
Definition: lotform.hxx:66
OpCode
TokenId n0Token
Definition: lotform.hxx:67
TokenId nAddToken
Definition: lotform.hxx:65
void DoFunc(DefTokenId eOc, sal_uInt8 nCnt, const char *pExtName)
Definition: lotform.cxx:38
ScSingleRefData Ref1
Definition: refdata.hxx:125
ScSingleRefData Ref2
Definition: refdata.hxx:126
void IncToken(TokenId &rParam)
Definition: lotform.cxx:339
static FUNC_TYPE IndexToTypeWK123(sal_uInt8)
Definition: lotform.cxx:1198
virtual void Convert(std::unique_ptr< ScTokenArray > &rpErg, sal_Int32 &nRest) override
Definition: lotform.cxx:385
bool bWK3
Definition: lotform.hxx:75
bool bWK123
Definition: lotform.hxx:76
void ReadCRD(const ScDocument *pDoc, ScComplexRefData &rCRD, sal_uInt8 nFlags)
Definition: lotform.hxx:101
unsigned char sal_uInt8
FUNC_TYPE
Definition: lotform.hxx:25
static FUNC_TYPE IndexToType(sal_uInt8)
Definition: lotform.cxx:669
LotusToSc(LotusContext &rContext, SvStream &aStr, svl::SharedStringPool &rSPool, rtl_TextEncoding eSrc, bool b)
Definition: lotform.cxx:372
void SetWK3()
Definition: lotform.hxx:110
LotusContext & getContext()
Definition: lotform.hxx:95
Complex reference (a range) into the sheet.
Definition: refdata.hxx:123
static DefTokenId IndexToToken(sal_uInt8)
Definition: lotform.cxx:933
void ReadSRD(const ScDocument *pDoc, ScSingleRefData &rSRD, sal_uInt8 nFlags)
Definition: lotform.cxx:320
void Reset()
Definition: frmbase.cxx:161
void NegToken(TokenId &rParam)
Definition: lotform.cxx:351
static DefTokenId IndexToTokenWK123(sal_uInt8)
Definition: lotform.cxx:1462