xref: /aoo4110/main/sc/source/filter/inc/imp_op.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_IMP_OP_HXX
25 #define SC_IMP_OP_HXX
26 
27 #include <tools/gen.hxx>
28 #include "xiroot.hxx"
29 #include "xistream.hxx"
30 #include "xistyle.hxx"
31 #include "flttypes.hxx"
32 #include "namebuff.hxx"
33 #include "root.hxx"
34 #include "otlnbuff.hxx"
35 #include "colrowst.hxx"
36 #include "excdefs.hxx"
37 
38 
39 class SfxItemSet;
40 class SvStream;
41 
42 class ScFormulaCell;
43 class SdrObject;
44 class ScDocument;
45 class ScToken;
46 class _ScRangeListTabs;
47 
48 class ExcelToSc;
49 
50 
51 class ImportTyp
52 {
53 protected:
54 	CharSet				eQuellChar;		// Quell-Zeichensatz
55 	ScDocument*			pD;				// Dokument
56 
57 public:
58                         ImportTyp( ScDocument*, CharSet eSrc );
59 	virtual				~ImportTyp();
60 
61 	virtual FltError	Read( void );
62 };
63 
64 class XclImpOutlineDataBuffer : protected XclImpRoot
65 {
66 public:
67     explicit            XclImpOutlineDataBuffer( const XclImpRoot& rRoot, SCTAB nScTab );
68     virtual             ~XclImpOutlineDataBuffer();
69 
GetColRowBuff() const70     inline XclImpColRowSettings* GetColRowBuff() const { return mxColRowBuff.get(); }
GetColOutline() const71     inline XclImpOutlineBuffer* GetColOutline()  const { return mxColOutlineBuff.get(); }
GetRowOutline() const72     inline XclImpOutlineBuffer* GetRowOutline()  const { return mxRowOutlineBuff.get(); }
73     void                Convert();
74 
75 private:
76     typedef ScfRef< XclImpOutlineBuffer >  XclImpOutlineBfrRef;
77     typedef ScfRef< XclImpColRowSettings > XclImpColRowSettRef;
78 
79     XclImpOutlineBfrRef mxColOutlineBuff;
80     XclImpOutlineBfrRef mxRowOutlineBuff;
81     XclImpColRowSettRef mxColRowBuff;
82     SCTAB               mnScTab;
83 };
84 
85 class ImportExcel : public ImportTyp, protected XclImpRoot
86 {
87 protected:
88 	static const double		fExcToTwips;		// Umrechnung 1/256 Zeichen -> Twips
89 
90     RootData*               pExcRoot;
91 
92     XclImpStream            maStrm;             // input stream
93     XclImpStream&           aIn;                // input stream
94 
95     ScfUInt32Vec            maSheetOffsets;
96     ScRange                 maScOleSize;        /// Visible range if embedded.
97 
98     NameBuffer*             pExtNameBuff;       // ... externe Namen (Ind.-Basis=1)
99 	ExcelToSc*				pFormConv;			// Formel-Konverter
100 
101     XclImpOutlineBuffer*    pColOutlineBuff;
102     XclImpOutlineBuffer*    pRowOutlineBuff;
103     XclImpColRowSettings*   pColRowBuff;        // Col/Row-Einstellungen 1 Tabelle
104 
105     typedef ScfDelList< XclImpOutlineDataBuffer > XclImpOutlineListBuffer;
106     XclImpOutlineListBuffer* pOutlineListBuffer;
107 
108     sal_Int16               mnLastRefIdx;
109     sal_uInt16              mnIxfeIndex;        /// Current XF identifier from IXFE record.
110     bool                    mbBiff2HasXfs;      /// Select XF formatting or direct formatting in BIFF2.
111     bool                    mbBiff2HasXfsValid; /// False = mbBiff2HasXfs is undetermined yet.
112 
113 	SCTAB					nBdshtTab;			// Counter fuer Boundsheet
114 	ScFormulaCell*			pLastFormCell;		// fuer String-Records
115 
116 	sal_Bool					bTabTruncated;		// wenn Bereichsueberschreitung zum
117 												//	Abschneiden von Zellen fuehrt
118 
119 	// Record-Funktionen
120     void                    ReadFileSharing();
121 
122     sal_uInt16              ReadXFIndex( const ScAddress& rScPos, bool bBiff2 );
123 
124     void                    ReadDimensions();
125     void                    ReadBlank();
126     void                    ReadInteger();
127     void                    ReadNumber();
128     void                    ReadLabel();
129     void                    ReadBoolErr();
130     void                    ReadRk();
131 
132     void                    Window1();
133 	void					Formula25( void );				// 0x06		-> excform.cxx
134 	void					Row25( void );					// 0x08
135 	void					Bof2( void );					// 0x09
136 	void					Eof( void );					// 0x0A
137 	void					DocProtect( void );             // 0x12
138     void                    SheetProtect( void );           // 0x12 Sheet Protection
139     void                    DocPasssword( void );           // 0x13 document password
140     void                    SheetPassword( void );               // 0x13 sheet password
141 	void					Externsheet( void );			// 0x17
142     void                    WinProtection( void );          // 0x19
143 	void					Columndefault( void );			// 0x20
144 	void					Array25( void );				// 0x21
145 	void					Rec1904( void );				// 0x22
146 	void					Externname25( void );			// 0x23
147 	void					Colwidth( void );				// 0x24
148 	void					Defrowheight2( void );			// 0x25
149 //		void				Window1( void );				// 0x3D
150 	void					Codepage( void );				// 0x42
151 	void					Ixfe( void );					// 0x44
152 	void					DefColWidth( void );			// 0x55
153 	void					Builtinfmtcnt( void );			// 0x56
154 	void					Colinfo( void );				// 0x7D
155 	void					Wsbool( void );					// 0x81
156 	void					Boundsheet( void );				// 0x85
157 	void					Country( void );				// 0x8C
158 	void					Hideobj( void );				// 0x8D
159 	void					Bundleheader( void );			// 0x8F
160 	void					Standardwidth( void );			// 0x99
161 	void					Shrfmla( void );				// 0xBC
162 	void					Mulrk( void );					// 0xBD
163 	void					Mulblank( void );				// 0xBE
164 	void					Rstring( void );				// 0xD6
165     void                    Cellmerging( void );            // 0xE5
166     void                    Olesize( void );                // 0xDE
167     void                    ReadUsesElfs();                 // 0x0160
168 	void					Formula3( void );				// 0x0206		-> excform.cxx
169 															// 0x0207 -> 0x07
170 	void					Row34( void );					// 0x0208
171 	void					Bof3( void );					// 0x0209
172 	void					Array34( void );				// 0x0221
173 	void					Externname34( void );			// 0x0223
174 	void					Defrowheight345( void );		// 0x0225
175 	void					TableOp( void );				// 0x0236
176 	//void					Rk( void );						// 0x027E -> 0x7E
177 	void					Formula4( void );				// 0x0406		-> excform.cxx
178 	void					Bof4( void );					// 0x0409
179 	void					Bof5( void );					// 0x0809
180 
181 	// ---------------------------------------------------------------
182     void                    Formula( const XclAddress& rXclPos,
183                                 sal_uInt16 nXF, sal_uInt16 nFormLen, double &rCurVal, sal_Bool bShrFmla );
184 											// 		-> excform.cxx
185 
186     virtual void            EndSheet( void );
187 	void					NeueTabelle( void );
188 	const ScTokenArray*		ErrorToFormula( sal_uInt8 bErrOrVal, sal_uInt8 nError,
189 								double& rVal );
190 
191     virtual void            AdjustRowHeight();
192     virtual void            PostDocLoad( void );
193 
194 public:
195                             ImportExcel( XclImpRootData& rImpData, SvStream& rStrm );
196 
197 	virtual					~ImportExcel( void );
198 
199 	virtual FltError		Read( void );
200 };
201 
202 #endif
203 
204