LibreOffice Module sc (master)  1
lotimpop.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 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_LOTIMPOP_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_LOTIMPOP_HXX
22 
23 #include <rtl/ustring.hxx>
24 
25 #include "imp_op.hxx"
26 #include "ftools.hxx"
27 #include "lotform.hxx"
28 #include "lotattr.hxx"
29 
30 struct LotusContext;
31 
32 class ImportLotus : public ImportTyp
33 {
34 private:
35  SvStream* pIn; // needed due to multiple Read()!
37  sal_uInt16 nTab; // currently handled table
38  sal_Int32 nExtTab;
39 
40  // in WK?-Datei
41  void Bof(); // 0x0000 00
42  bool BofFm3(); // 0x0000 00
43  void Columnwidth( sal_uInt16 nRecLen ); // 0x0007 07
44  void Hiddencolumn( sal_uInt16 nRecLen ); // 0x0008 08
45  void Userrange(); // 0x0009 09
46  void Errcell(); // 0x0014 20
47  void Nacell(); // 0x0015 21
48  void Labelcell(); // 0x0016 22
49  void Numbercell(); // 0x0017 23
50  void Smallnumcell(); // 0x0018 24
51  void Formulacell( sal_uInt16 nRecLen ); // 0x0019 25
52  // 0x001b 27 special
53  void NamedSheet(); // 14000
54  void RowPresentation( sal_uInt16 nRecLen ); // 2007
55 
56  // in FM? file
57  void Font_Face(); // 174
58  void Font_Type(); // 176
59  void Font_Ysize(); // 177
60  void Row_( const sal_uInt16 nRecLen ); // 197 ?
61 
62  inline void Read( ScAddress& );
63  inline void Read( ScRange& );
64  // for addresses/ranges in the format row(16)/tab(8)/col(8)
65  inline void Read( char& );
66  inline void Read( sal_uInt8& );
67  inline void Read( sal_uInt16& );
68  inline void Read( sal_Int16& );
69  inline void Read( double& ); // read 10-byte IEEE
70  inline void Read( LotAttrWK3& );
71  void Read( OUString& ); // read in 0-terminated string
72  inline void Skip( const sal_uInt16 nNumBytes );
73 
74 public:
75  ImportLotus(LotusContext& rContext, SvStream&, rtl_TextEncoding eSrc);
76 
77  virtual ~ImportLotus() override;
78 
79  ErrCode parse(); //parse + CalcAfterLoad
80  ErrCode Read();
81  ErrCode Read( SvStream& ); // special for *.fm3 files
82 };
83 
84 inline void ImportLotus::Read( ScAddress& rAddr )
85 {
86  sal_uInt16 nRow;
87  pIn->ReadUInt16( nRow );
88  rAddr.SetRow( static_cast<SCROW>(nRow) );
89  sal_uInt8 nByte;
90  pIn->ReadUChar( nByte );
91  rAddr.SetTab( static_cast<SCTAB>(nByte) );
92  pIn->ReadUChar( nByte );
93  rAddr.SetCol( static_cast<SCCOL>(nByte) );
94 }
95 
96 inline void ImportLotus::Read( ScRange& rRange )
97 {
98  Read( rRange.aStart );
99  Read( rRange.aEnd );
100 }
101 
102 inline void ImportLotus::Read( char& r )
103 {
104  pIn->ReadChar( r );
105 }
106 
107 inline void ImportLotus::Read( sal_uInt8& r )
108 {
109  pIn->ReadUChar( r );
110 }
111 
112 inline void ImportLotus::Read( sal_uInt16& r )
113 {
114  pIn->ReadUInt16( r );
115 }
116 
117 inline void ImportLotus::Read( sal_Int16& r )
118 {
119  pIn->ReadInt16( r );
120 }
121 
122 inline void ImportLotus::Read( double& r )
123 {
125 }
126 
127 inline void ImportLotus::Read( LotAttrWK3& r )
128 {
130 }
131 
132 inline void ImportLotus::Skip( const sal_uInt16 n )
133 {
134  pIn->SeekRel( n );
135 }
136 
137 #endif
138 
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static double ReadLongDouble(SvStream &rStrm)
Reads a 10-byte-long-double and converts it to double.
Definition: ftools.cxx:42
SvStream & ReadInt16(sal_Int16 &rInt16)
void NamedSheet()
Definition: lotimpop.cxx:302
sal_uInt8 nFont
Definition: lotattr.hxx:38
void Font_Ysize()
Definition: lotimpop.cxx:349
ScAddress aStart
Definition: address.hxx:500
sal_uInt16 nTab
Definition: lotimpop.hxx:37
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
virtual ~ImportLotus() override
Definition: lotimpop.cxx:54
void Row_(const sal_uInt16 nRecLen)
Definition: lotimpop.cxx:360
void Skip(const sal_uInt16 nNumBytes)
Definition: lotimpop.hxx:132
void RowPresentation(sal_uInt16 nRecLen)
Definition: lotimpop.cxx:268
ScAddress aEnd
Definition: address.hxx:501
sal_uInt64 SeekRel(sal_Int64 nPos)
void Nacell()
Definition: lotimpop.cxx:185
void Userrange()
Definition: lotimpop.cxx:155
void Formulacell(sal_uInt16 nRecLen)
Definition: lotimpop.cxx:237
void Numbercell()
Definition: lotimpop.cxx:213
void SetRow(SCROW nRowP)
Definition: address.hxx:275
void SetCol(SCCOL nColP)
Definition: address.hxx:279
void SetTab(SCTAB nTabP)
Definition: address.hxx:283
ImportLotus(LotusContext &rContext, SvStream &, rtl_TextEncoding eSrc)
Definition: lotimpop.cxx:43
void Font_Type()
Definition: lotimpop.cxx:338
void Labelcell()
Definition: lotimpop.cxx:197
sal_uInt8 nLineStyle
Definition: lotattr.hxx:39
void Bof()
Definition: lotimpop.cxx:60
SvStream * pIn
Definition: lotimpop.hxx:35
bool BofFm3()
Definition: lotimpop.cxx:88
void Hiddencolumn(sal_uInt16 nRecLen)
Definition: lotimpop.cxx:129
void Smallnumcell()
Definition: lotimpop.cxx:225
SvStream & ReadUChar(unsigned char &rChar)
void Font_Face()
Definition: lotimpop.cxx:322
SvStream & ReadChar(char &rChar)
ErrCode Read()
Definition: lotread.cxx:227
unsigned char sal_uInt8
sal_Int32 nExtTab
Definition: lotimpop.hxx:38
sal_uInt8 nFontCol
Definition: lotattr.hxx:40
sal_uInt8 nBack
Definition: lotattr.hxx:41
ErrCode parse()
Definition: lotread.cxx:33
LotusToSc aConv
Definition: lotimpop.hxx:36
void Errcell()
Definition: lotimpop.cxx:173
void Columnwidth(sal_uInt16 nRecLen)
Definition: lotimpop.cxx:98