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 bool mbFuzzing:1;
119
120 void SetLastFormula( SCCOL nCol, SCROW nRow, double fVal, sal_uInt16 nXF, ScFormulaCell* pCell );
121
122 // Record functions
123 void ReadFileSharing();
124
125 sal_uInt16 ReadXFIndex( const ScAddress& rScPos, bool bBiff2 );
126
127 void ReadDimensions();
128 void ReadBlank();
129 void ReadInteger();
130 void ReadNumber();
131 void ReadLabel();
132 void ReadBoolErr();
133 void ReadRk();
134
135 void Window1();
136 void Formula25(); // 0x06 -> excform.cxx
137 void Row25(); // 0x08
138 void Bof2(); // 0x09
139 void Eof(); // 0x0A
140 void DocProtect(); // 0x12
141 void SheetProtect(); // 0x12 Sheet Protection
142 void DocPassword(); // 0x13 document password
143 void SheetPassword(); // 0x13 sheet password
144 void Externsheet(); // 0x17
145 void WinProtection(); // 0x19
146 void Columndefault(); // 0x20
147 void Array25(); // 0x21
148 void Rec1904(); // 0x22
149 void Externname25(); // 0x23
150 void Colwidth(); // 0x24
151 void Defrowheight2(); // 0x25
152// void Window1(); // 0x3D
153 void Codepage(); // 0x42
154 void Ixfe(); // 0x44
155 void DefColWidth(); // 0x55
156 void Colinfo(); // 0x7D
157 void Wsbool(); // 0x81
158 void Boundsheet(); // 0x85
159 void Country(); // 0x8C
160 void Hideobj(); // 0x8D
161 void Standardwidth(); // 0x99
162 void Shrfmla(); // 0xBC
163 void Mulrk(); // 0xBD
164 void Mulblank(); // 0xBE
165 void Rstring(); // 0xD6
166 void Cellmerging(); // 0xE5
167 void Olesize(); // 0xDE
168 void ReadUsesElfs(); // 0x0160
169 void Formula3(); // 0x0206 -> excform.cxx
170 // 0x0207 -> 0x07
171 void Row34(); // 0x0208
172 void Bof3(); // 0x0209
173 void Array34(); // 0x0221
174 void Defrowheight345(); // 0x0225
175 void TableOp(); // 0x0236
176 //void Rk(); // 0x027E -> 0x7E
177 void Formula4(); // 0x0406 -> excform.cxx
178 void Bof4(); // 0x0409
179 void Bof5(); // 0x0809
180
181 void Formula(
182 const XclAddress& rXclPos, sal_uInt16 nXF, sal_uInt16 nFormLen, double fCurVal, bool bShrFmla);
183 // -> excform.cxx
184
185 virtual void EndSheet();
186 void NewTable();
187 std::unique_ptr<ScTokenArray> ErrorToFormula( bool bErrOrVal, sal_uInt8 nError,
188 double& rVal );
189
190 void AdjustRowHeight();
191 virtual void PostDocLoad();
192
193public:
194 ImportExcel( XclImpRootData& rImpData, SvStream& rStrm );
195
196 virtual ~ImportExcel() override;
197
198 virtual ErrCode Read();
199};
200
201/* 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:161
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:1223
void SheetPassword()
Definition: impop.cxx:446
std::unique_ptr< ScTokenArray > ErrorToFormula(bool bErrOrVal, sal_uInt8 nError, double &rVal)
Definition: impop.cxx:1263
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:1180
void Row34()
Definition: impop.cxx:1001
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:1082
void Array34()
Definition: impop.cxx:1049
std::unique_ptr< XclImpOutlineListBuffer > pOutlineListBuffer
Definition: imp_op.hxx:102
bool mbFuzzing
False = mbBiff2HasXfs is undetermined yet.
Definition: imp_op.hxx:118
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:1197
void AdjustRowHeight()
Definition: impop.cxx:1268
void DocProtect()
Definition: impop.cxx:609
void Olesize()
Definition: impop.cxx:991
void Colwidth()
Definition: impop.cxx:576
void Externsheet()
Definition: impop.cxx:454
virtual void PostDocLoad()
Definition: impop.cxx:1278
XclImpOutlineBuffer * pColOutlineBuff
Definition: imp_op.hxx:97
std::vector< std::unique_ptr< XclImpOutlineDataBuffer > > XclImpOutlineListBuffer
Definition: imp_op.hxx:101
void NewTable()
Definition: impop.cxx:1236
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:1097
void Bof3()
Definition: impop.cxx:1031
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)
True if fuzzing filter.
Definition: impop.cxx:142
virtual ~ImportExcel() override
Definition: impop.cxx:133
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:1394
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:1403
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