LibreOffice Module sc (master) 1
imp_op.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#pragma once
21
22#include <sal/types.h>
23#include "xiroot.hxx"
24#include "xistream.hxx"
25#include "ftools.hxx"
26
27#include <vector>
28#include <memory>
29#include <unordered_map>
30
31class SvStream;
32
33class ScFormulaCell;
34class ScDocument;
35class ScTokenArray;
36
37class ExcelToSc;
40struct XclAddress;
41
43{
44protected:
45 rtl_TextEncoding eQuellChar; // source (Quelle) character set
46 ScDocument& rD; // document
47
48public:
49 ImportTyp( ScDocument&, rtl_TextEncoding eSrc );
50 virtual ~ImportTyp();
51};
52
54{
55public:
56 explicit XclImpOutlineDataBuffer( const XclImpRoot& rRoot, SCTAB nScTab );
57 virtual ~XclImpOutlineDataBuffer() override;
58
62 void Convert();
63
64private:
65 typedef std::shared_ptr< XclImpOutlineBuffer > XclImpOutlineBfrRef;
66 typedef std::shared_ptr< XclImpColRowSettings > XclImpColRowSettRef;
67
72};
73
74class ImportExcel : public ImportTyp, protected XclImpRoot
75{
76protected:
78 {
79 sal_uInt16 mnXF;
82 double mfValue;
84 };
85 typedef std::unordered_map<SCCOL, LastFormula> LastFormulaMapType;
86
88
89 XclImpStream maStrm; // input stream
90 XclImpStream& aIn; // input stream
91
94
95 std::unique_ptr<ExcelToSc> pFormConv; // formula-converter
96
99 XclImpColRowSettings* pColRowBuff; // Col/Row settings 1 table
100
101 typedef std::vector< std::unique_ptr<XclImpOutlineDataBuffer> > XclImpOutlineListBuffer;
102 std::unique_ptr<XclImpOutlineListBuffer> pOutlineListBuffer;
103
104 LastFormulaMapType maLastFormulaCells; // Keep track of last formula cells in each column.
106
107 sal_Int16 mnLastRefIdx;
108 sal_uInt16 mnIxfeIndex;
109 sal_uInt16 mnLastRecId;
110
111 SCTAB nBdshtTab; // Counter for Boundsheet
112
113 bool bTabTruncated; // if extended range leads to
114 // truncation of cells
115
118
119 void SetLastFormula( SCCOL nCol, SCROW nRow, double fVal, sal_uInt16 nXF, ScFormulaCell* pCell );
120
121 // Record functions
122 void ReadFileSharing();
123
124 sal_uInt16 ReadXFIndex( const ScAddress& rScPos, bool bBiff2 );
125
126 void ReadDimensions();
127 void ReadBlank();
128 void ReadInteger();
129 void ReadNumber();
130 void ReadLabel();
131 void ReadBoolErr();
132 void ReadRk();
133
134 void Window1();
135 void Formula25(); // 0x06 -> excform.cxx
136 void Row25(); // 0x08
137 void Bof2(); // 0x09
138 void Eof(); // 0x0A
139 void DocProtect(); // 0x12
140 void SheetProtect(); // 0x12 Sheet Protection
141 void DocPassword(); // 0x13 document password
142 void SheetPassword(); // 0x13 sheet password
143 void Externsheet(); // 0x17
144 void WinProtection(); // 0x19
145 void Columndefault(); // 0x20
146 void Array25(); // 0x21
147 void Rec1904(); // 0x22
148 void Externname25(); // 0x23
149 void Colwidth(); // 0x24
150 void Defrowheight2(); // 0x25
151// void Window1(); // 0x3D
152 void Codepage(); // 0x42
153 void Ixfe(); // 0x44
154 void DefColWidth(); // 0x55
155 void Colinfo(); // 0x7D
156 void Wsbool(); // 0x81
157 void Boundsheet(); // 0x85
158 void Country(); // 0x8C
159 void Hideobj(); // 0x8D
160 void Standardwidth(); // 0x99
161 void Shrfmla(); // 0xBC
162 void Mulrk(); // 0xBD
163 void Mulblank(); // 0xBE
164 void Rstring(); // 0xD6
165 void Cellmerging(); // 0xE5
166 void Olesize(); // 0xDE
167 void ReadUsesElfs(); // 0x0160
168 void Formula3(); // 0x0206 -> excform.cxx
169 // 0x0207 -> 0x07
170 void Row34(); // 0x0208
171 void Bof3(); // 0x0209
172 void Array34(); // 0x0221
173 void Defrowheight345(); // 0x0225
174 void TableOp(); // 0x0236
175 //void Rk(); // 0x027E -> 0x7E
176 void Formula4(); // 0x0406 -> excform.cxx
177 void Bof4(); // 0x0409
178 void Bof5(); // 0x0809
179
180 void Formula(
181 const XclAddress& rXclPos, sal_uInt16 nXF, sal_uInt16 nFormLen, double fCurVal, bool bShrFmla);
182 // -> excform.cxx
183
184 virtual void EndSheet();
185 void NewTable();
186 std::unique_ptr<ScTokenArray> ErrorToFormula( bool bErrOrVal, sal_uInt8 nError,
187 double& rVal );
188
189 void AdjustRowHeight();
190 virtual void PostDocLoad();
191
192public:
193 ImportExcel( XclImpRootData& rImpData, SvStream& rStrm );
194
195 virtual ~ImportExcel() override;
196
197 virtual ErrCode Read();
198};
199
200/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void Formula4()
Definition: excform.cxx:82
bool mbBiff2HasXfs
Definition: imp_op.hxx:116
void ReadUsesElfs()
Definition: impop.cxx:745
LastFormulaMapType maLastFormulaCells
Definition: imp_op.hxx:104
void ReadFileSharing()
Definition: impop.cxx:160
void Shrfmla()
Definition: impop.cxx:801
void Boundsheet()
Definition: impop.cxx:695
void ReadBoolErr()
Definition: impop.cxx:344
void DocPassword()
Definition: impop.cxx:617
void ReadBlank()
Definition: impop.cxx:266
void ReadNumber()
Definition: impop.cxx:297
void DefColWidth()
Definition: impop.cxx:635
virtual void EndSheet()
Definition: impop.cxx:1219
void SheetPassword()
Definition: impop.cxx:446
std::unique_ptr< ScTokenArray > ErrorToFormula(bool bErrOrVal, sal_uInt8 nError, double &rVal)
Definition: impop.cxx:1259
ScRange maScOleSize
Definition: imp_op.hxx:93
sal_uInt16 ReadXFIndex(const ScAddress &rScPos, bool bBiff2)
Definition: impop.cxx:181
void Row25()
Definition: impop.cxx:394
void ReadRk()
Definition: impop.cxx:372
void Formula25()
Definition: excform.cxx:43
sal_uInt16 mnLastRecId
Current XF identifier from IXFE record.
Definition: imp_op.hxx:109
void Defrowheight2()
Definition: impop.cxx:593
void Formula3()
Definition: excform.cxx:77
void Hideobj()
Definition: impop.cxx:755
void Colinfo()
Definition: impop.cxx:654
bool bTabTruncated
Definition: imp_op.hxx:113
void Columndefault()
Definition: impop.cxx:471
sal_Int16 mnLastRefIdx
Definition: imp_op.hxx:107
XclImpOutlineBuffer * pRowOutlineBuff
Definition: imp_op.hxx:98
void Ixfe()
Definition: impop.cxx:630
void Standardwidth()
Definition: impop.cxx:790
bool mbBiff2HasXfsValid
Select XF formatting or direct formatting in BIFF2.
Definition: imp_op.hxx:117
void Mulblank()
Definition: impop.cxx:902
sal_uInt16 mnIxfeIndex
Definition: imp_op.hxx:108
SCTAB nBdshtTab
Definition: imp_op.hxx:111
void Country()
Definition: impop.cxx:728
void Bof4()
Definition: impop.cxx:1176
void Row34()
Definition: impop.cxx:997
void ReadLabel()
Definition: impop.cxx:314
void WinProtection()
Definition: impop.cxx:463
void Wsbool()
Definition: impop.cxx:684
void ReadInteger()
Definition: impop.cxx:280
XclImpStream maStrm
Definition: imp_op.hxx:89
void Rec1904()
Definition: impop.cxx:537
RootData * pExcRoot
Definition: imp_op.hxx:87
ImportExcel(XclImpRootData &rImpData, SvStream &rStrm)
Definition: impop.cxx:84
void Bof2()
Definition: impop.cxx:424
void Cellmerging()
Definition: impop.cxx:965
ScfUInt32Vec maSheetOffsets
Definition: imp_op.hxx:92
void Defrowheight345()
Definition: impop.cxx:1078
void Array34()
Definition: impop.cxx:1045
std::unique_ptr< XclImpOutlineListBuffer > pOutlineListBuffer
Definition: imp_op.hxx:102
std::unique_ptr< ExcelToSc > pFormConv
Visible range if embedded.
Definition: imp_op.hxx:95
void Codepage()
Definition: impop.cxx:625
void Bof5()
Definition: impop.cxx:1193
void AdjustRowHeight()
Definition: impop.cxx:1264
void DocProtect()
Definition: impop.cxx:609
void Olesize()
Definition: impop.cxx:987
void Colwidth()
Definition: impop.cxx:576
void Externsheet()
Definition: impop.cxx:454
virtual void PostDocLoad()
Definition: impop.cxx:1274
XclImpOutlineBuffer * pColOutlineBuff
Definition: imp_op.hxx:97
std::vector< std::unique_ptr< XclImpOutlineDataBuffer > > XclImpOutlineListBuffer
Definition: imp_op.hxx:101
void NewTable()
Definition: impop.cxx:1232
void Window1()
Definition: impop.cxx:389
void Formula(const XclAddress &rXclPos, sal_uInt16 nXF, sal_uInt16 nFormLen, double fCurVal, bool bShrFmla)
Definition: excform.cxx:95
XclImpStream & aIn
Definition: imp_op.hxx:90
virtual ErrCode Read()
Definition: read.cxx:70
XclImpColRowSettings * pColRowBuff
Definition: imp_op.hxx:99
void Mulrk()
Definition: impop.cxx:859
void ReadDimensions()
Definition: impop.cxx:223
std::unordered_map< SCCOL, LastFormula > LastFormulaMapType
Definition: imp_op.hxx:85
void Array25()
Definition: impop.cxx:497
void TableOp()
Definition: impop.cxx:1093
void Bof3()
Definition: impop.cxx:1027
void Eof()
Definition: impop.cxx:439
void Externname25()
Definition: impop.cxx:552
LastFormula * mpLastFormula
Definition: imp_op.hxx:105
void SheetProtect()
Definition: impop.cxx:601
void SetLastFormula(SCCOL nCol, SCROW nRow, double fVal, sal_uInt16 nXF, ScFormulaCell *pCell)
False = mbBiff2HasXfs is undetermined yet.
Definition: impop.cxx:141
virtual ~ImportExcel() override
Definition: impop.cxx:132
void Rstring()
Definition: impop.cxx:942
ScDocument & rD
Definition: imp_op.hxx:46
ImportTyp(ScDocument &, rtl_TextEncoding eSrc)
Definition: impop.cxx:73
rtl_TextEncoding eQuellChar
Definition: imp_op.hxx:45
virtual ~ImportTyp()
Definition: impop.cxx:80
XclImpOutlineBfrRef mxRowOutlineBuff
Definition: imp_op.hxx:69
std::shared_ptr< XclImpColRowSettings > XclImpColRowSettRef
Definition: imp_op.hxx:66
XclImpColRowSettings * GetColRowBuff() const
Definition: imp_op.hxx:59
std::shared_ptr< XclImpOutlineBuffer > XclImpOutlineBfrRef
Definition: imp_op.hxx:65
XclImpOutlineDataBuffer(const XclImpRoot &rRoot, SCTAB nScTab)
Definition: impop.cxx:1390
XclImpOutlineBuffer * GetColOutline() const
Definition: imp_op.hxx:60
XclImpOutlineBuffer * GetRowOutline() const
Definition: imp_op.hxx:61
XclImpColRowSettRef mxColRowBuff
Definition: imp_op.hxx:70
XclImpOutlineBfrRef mxColOutlineBuff
Definition: imp_op.hxx:68
virtual ~XclImpOutlineDataBuffer() override
Definition: impop.cxx:1399
Access to global data from other classes.
Definition: xiroot.hxx:129
This class is used to import record oriented streams.
Definition: xistream.hxx:278
::std::vector< sal_uInt32 > ScfUInt32Vec
Definition: ftools.hxx:257
ScFormulaCell * mpCell
Definition: imp_op.hxx:83
A 2D cell address struct with Excel column and row indexes.
Definition: xladdress.hxx:30
Stores global buffers and data needed for Excel import filter.
Definition: xiroot.hxx:64
unsigned char sal_uInt8
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17