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