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