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_IMP_OP_HXX
21 : #define SC_IMP_OP_HXX
22 :
23 : #include <tools/gen.hxx>
24 : #include "xiroot.hxx"
25 : #include "xistream.hxx"
26 : #include "xistyle.hxx"
27 : #include "flttypes.hxx"
28 : #include "namebuff.hxx"
29 : #include "root.hxx"
30 : #include "otlnbuff.hxx"
31 : #include "colrowst.hxx"
32 : #include "excdefs.hxx"
33 : #include <boost/shared_ptr.hpp>
34 : #include <boost/ptr_container/ptr_vector.hpp>
35 :
36 :
37 : class SvStream;
38 :
39 : class ScFormulaCell;
40 : class ScDocument;
41 :
42 : class ExcelToSc;
43 :
44 :
45 : class ImportTyp
46 : {
47 : protected:
48 : CharSet eQuellChar; // Quell-Zeichensatz
49 : ScDocument* pD; // Dokument
50 :
51 : public:
52 : ImportTyp( ScDocument*, CharSet eSrc );
53 : virtual ~ImportTyp();
54 :
55 : virtual FltError Read( void );
56 : };
57 :
58 : class XclImpOutlineDataBuffer : protected XclImpRoot
59 : {
60 : public:
61 : explicit XclImpOutlineDataBuffer( const XclImpRoot& rRoot, SCTAB nScTab );
62 : virtual ~XclImpOutlineDataBuffer();
63 :
64 75 : inline XclImpColRowSettings* GetColRowBuff() const { return mxColRowBuff.get(); }
65 75 : inline XclImpOutlineBuffer* GetColOutline() const { return mxColOutlineBuff.get(); }
66 75 : inline XclImpOutlineBuffer* GetRowOutline() const { return mxRowOutlineBuff.get(); }
67 : void Convert();
68 :
69 : private:
70 : typedef boost::shared_ptr< XclImpOutlineBuffer > XclImpOutlineBfrRef;
71 : typedef boost::shared_ptr< XclImpColRowSettings > XclImpColRowSettRef;
72 :
73 : XclImpOutlineBfrRef mxColOutlineBuff;
74 : XclImpOutlineBfrRef mxRowOutlineBuff;
75 : XclImpColRowSettRef mxColRowBuff;
76 : SCTAB mnScTab;
77 : };
78 :
79 : class ImportExcel : public ImportTyp, protected XclImpRoot
80 : {
81 : protected:
82 : static const double fExcToTwips; // Umrechnung 1/256 Zeichen -> Twips
83 :
84 : RootData* pExcRoot;
85 :
86 : XclImpStream maStrm; // input stream
87 : XclImpStream& aIn; // input stream
88 :
89 : ScfUInt32Vec maSheetOffsets;
90 : ScRange maScOleSize; /// Visible range if embedded.
91 :
92 : NameBuffer* pExtNameBuff; // ... externe Namen (Ind.-Basis=1)
93 : ExcelToSc* pFormConv; // Formel-Konverter
94 :
95 : XclImpOutlineBuffer* pColOutlineBuff;
96 : XclImpOutlineBuffer* pRowOutlineBuff;
97 : XclImpColRowSettings* pColRowBuff; // Col/Row-Einstellungen 1 Tabelle
98 :
99 : typedef boost::ptr_vector< XclImpOutlineDataBuffer > XclImpOutlineListBuffer;
100 : XclImpOutlineListBuffer* pOutlineListBuffer;
101 :
102 : sal_Int16 mnLastRefIdx;
103 : sal_uInt16 mnIxfeIndex; /// Current XF identifier from IXFE record.
104 : bool mbBiff2HasXfs; /// Select XF formatting or direct formatting in BIFF2.
105 : bool mbBiff2HasXfsValid; /// False = mbBiff2HasXfs is undetermined yet.
106 :
107 : SCTAB nBdshtTab; // Counter fuer Boundsheet
108 : ScFormulaCell* pLastFormCell; // fuer String-Records
109 :
110 : sal_Bool bTabTruncated; // wenn Bereichsueberschreitung zum
111 : // Abschneiden von Zellen fuehrt
112 :
113 : // Record-Funktionen
114 : void ReadFileSharing();
115 :
116 : sal_uInt16 ReadXFIndex( const ScAddress& rScPos, bool bBiff2 );
117 :
118 : void ReadDimensions();
119 : void ReadBlank();
120 : void ReadInteger();
121 : void ReadNumber();
122 : void ReadLabel();
123 : void ReadBoolErr();
124 : void ReadRk();
125 :
126 : void Window1();
127 : void Formula25( void ); // 0x06 -> excform.cxx
128 : void Row25( void ); // 0x08
129 : void Bof2( void ); // 0x09
130 : void Eof( void ); // 0x0A
131 : void DocProtect( void ); // 0x12
132 : void SheetProtect( void ); // 0x12 Sheet Protection
133 : void DocPasssword( void ); // 0x13 document password
134 : void SheetPassword( void ); // 0x13 sheet password
135 : void Externsheet( void ); // 0x17
136 : void WinProtection( void ); // 0x19
137 : void Columndefault( void ); // 0x20
138 : void Array25( void ); // 0x21
139 : void Rec1904( void ); // 0x22
140 : void Externname25( void ); // 0x23
141 : void Colwidth( void ); // 0x24
142 : void Defrowheight2( void ); // 0x25
143 : // void Window1( void ); // 0x3D
144 : void Codepage( void ); // 0x42
145 : void Ixfe( void ); // 0x44
146 : void DefColWidth( void ); // 0x55
147 : void Builtinfmtcnt( void ); // 0x56
148 : void Colinfo( void ); // 0x7D
149 : void Wsbool( void ); // 0x81
150 : void Boundsheet( void ); // 0x85
151 : void Country( void ); // 0x8C
152 : void Hideobj( void ); // 0x8D
153 : void Bundleheader( void ); // 0x8F
154 : void Standardwidth( void ); // 0x99
155 : void Shrfmla( void ); // 0xBC
156 : void Mulrk( void ); // 0xBD
157 : void Mulblank( void ); // 0xBE
158 : void Rstring( void ); // 0xD6
159 : void Cellmerging( void ); // 0xE5
160 : void Olesize( void ); // 0xDE
161 : void ReadUsesElfs(); // 0x0160
162 : void Formula3( void ); // 0x0206 -> excform.cxx
163 : // 0x0207 -> 0x07
164 : void Row34( void ); // 0x0208
165 : void Bof3( void ); // 0x0209
166 : void Array34( void ); // 0x0221
167 : void Externname34( void ); // 0x0223
168 : void Defrowheight345( void ); // 0x0225
169 : void TableOp( void ); // 0x0236
170 : //void Rk( void ); // 0x027E -> 0x7E
171 : void Formula4( void ); // 0x0406 -> excform.cxx
172 : void Bof4( void ); // 0x0409
173 : void Bof5( void ); // 0x0809
174 :
175 : // ---------------------------------------------------------------
176 : void Formula(
177 : const XclAddress& rXclPos, sal_uInt16 nXF, sal_uInt16 nFormLen, double fCurVal, bool bShrFmla);
178 : // -> excform.cxx
179 :
180 : virtual void EndSheet( void );
181 : void NeueTabelle( void );
182 : const ScTokenArray* ErrorToFormula( sal_uInt8 bErrOrVal, sal_uInt8 nError,
183 : double& rVal );
184 :
185 : virtual void AdjustRowHeight();
186 : virtual void PostDocLoad( void );
187 :
188 : public:
189 : ImportExcel( XclImpRootData& rImpData, SvStream& rStrm );
190 :
191 : virtual ~ImportExcel( void );
192 :
193 : virtual FltError Read( void );
194 : };
195 :
196 : #endif
197 :
198 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|