Line data Source code
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 SC_LOTFORM_HXX
21 : #define SC_LOTFORM_HXX
22 :
23 : #include "formel.hxx"
24 : #include <rtl/ustring.hxx>
25 :
26 : enum FUNC_TYPE
27 : {
28 : FT_Return = 0, // End Formula
29 : FT_FuncFix0, // Funktion, 0 Parameter
30 : FT_FuncFix1, // Funktion, 0 Parameter
31 : FT_FuncFix2, // Funktion, 0 Parameter
32 : FT_FuncFix3, // Funktion, 0 Parameter
33 : FT_FuncFix4, // Funktion, 0 Parameter
34 : FT_FuncVar, // ~, var. P.
35 : FT_Neg, // Negierung
36 : FT_Op, // Operator
37 : FT_NotImpl, // nicht implementiert
38 : FT_ConstFloat, // Double (8-Byte)
39 : FT_Variable, // Single Ref
40 : FT_Range, // Double Ref
41 : FT_Braces, // Klammmern
42 : FT_ConstInt, // Integer
43 : FT_ConstString, // String
44 : FT_NOP, // nichts
45 : // zusaetzlich ab WK3
46 : FT_Cref, // Cell Reference
47 : FT_Rref, // Range Reference
48 : FT_Nrref, // Named range reference
49 : FT_Absnref, // Absolut named range
50 : FT_Erref, // Err range reference
51 : FT_Ecref, // Err cell reference
52 : FT_Econstant, // Err constant
53 : FT_Splfunc, // SPLfunction
54 : FT_Const10Float,// Float (10-Byte)
55 : FT_Snum // Const Short Num
56 : // fuer 'Problemfaelle' beim Import
57 : };
58 :
59 :
60 0 : class LotusToSc : public LotusConverterBase
61 : {
62 : private:
63 : rtl_TextEncoding eSrcChar;
64 : TokenId nAddToken; // ')+1.0'
65 : TokenId nSubToken; // ~
66 : TokenId n0Token; // '0.0';
67 :
68 : static FUNC_TYPE IndexToType( sal_uInt8 );
69 : static DefTokenId IndexToToken( sal_uInt8 );
70 : static FUNC_TYPE IndexToTypeWK123( sal_uInt8 );
71 : static DefTokenId IndexToTokenWK123( sal_uInt8 );
72 : void DoFunc( DefTokenId eOc, sal_uInt8 nAnz, const sal_Char* pExtName );
73 : void LotusRelToScRel( sal_uInt16 nCol, sal_uInt16 nRow,
74 : ScSingleRefData& rSRD );
75 : bool bWK3; // alternative Codeumsetzung statt fuer < WK1
76 : bool bWK123; // alternative for 123
77 :
78 : void ReadSRD( ScSingleRefData& rSRD, sal_uInt8 nFlags );
79 : inline void ReadCRD( ScComplexRefData& rCRD, sal_uInt8 nFlags );
80 : void IncToken( TokenId &rParam );
81 : // ACHTUNG: hier wird die aktuelle Token-Kette im Pool
82 : // mit '(<rParam>)+1' fortgeschrieben und mit
83 : // Store() abgeschlossen!
84 : void DecToken( TokenId& rParam );
85 : // ACHTUNG: ~
86 : void NegToken( TokenId& rParam );
87 : // ACHTUNG: wie ~, nur wird '-(<rParam>)' gebildet
88 : public:
89 : LotusToSc( SvStream& aStr, rtl_TextEncoding eSrc, bool b );
90 : virtual ConvErr Convert( const ScTokenArray*& rpErg, sal_Int32& nRest,
91 : const FORMULA_TYPE eFT = FT_CellFormula ) SAL_OVERRIDE;
92 :
93 : void Reset( const ScAddress& rEingPos );
94 : inline void SetWK3( void );
95 :
96 : private:
97 : using LotusConverterBase::Reset;
98 : };
99 :
100 :
101 0 : inline void LotusToSc::ReadCRD( ScComplexRefData& rCRD, sal_uInt8 nRelBit )
102 : {
103 : // erster Teil
104 0 : ReadSRD( rCRD.Ref1, nRelBit );
105 :
106 : // zweiter Teil
107 0 : ReadSRD( rCRD.Ref2, nRelBit >> 3 );
108 0 : }
109 :
110 :
111 0 : inline void LotusToSc::SetWK3( void )
112 : {
113 0 : bWK3 = true;
114 0 : }
115 :
116 : #endif
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|