LotusSpreadsheet.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwps
3  * Version: MPL 2.0 / LGPLv2.1+
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  * Major Contributor(s):
10  * Copyright (C) 2006, 2007 Andrew Ziem
11  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
12  * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
13  *
14  * For minor contributions see the git repository.
15  *
16  * Alternatively, the contents of this file may be used under the terms
17  * of the GNU Lesser General Public License Version 2.1 or later
18  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
19  * applicable instead of those above.
20  */
21 
22 #ifndef LOTUS_SPREADSHEET_H
23 #define LOTUS_SPREADSHEET_H
24 
25 #include <ostream>
26 #include <vector>
27 
28 #include <librevenge-stream/librevenge-stream.h>
29 
30 #include "libwps_internal.h"
31 
32 #include "WPSDebug.h"
33 #include "WKSContentListener.h"
34 
36 {
37 class Cell;
38 class Spreadsheet;
39 struct Style;
40 struct State;
41 }
42 
43 class LotusParser;
44 class LotusStyleManager;
45 
51 {
52 public:
53  friend class LotusParser;
54 
56  explicit LotusSpreadsheet(LotusParser &parser);
60  void cleanState();
62  void updateState();
65  {
66  m_listener = listen;
67  }
69  void setLastSpreadsheetId(int id);
70 protected:
72  bool checkFilePosition(long pos);
74  int version() const;
76  bool hasSomeSpreadsheetData() const;
77 
79  void sendSpreadsheet(int sheetId);
80 
84  void sendRowContent(LotusSpreadsheetInternal::Spreadsheet const &sheet, int row);
87  LotusSpreadsheetInternal::Style const &style, int numRepeated=1);
88 
90 
91  //
92  // low level
93  //
95 
97  bool readSheetName();
98 
100  bool readColumnDefinition();
102  bool readColumnSizes();
104  bool readRowFormats();
106  bool readRowFormat(LotusSpreadsheetInternal::Style &style, int &numCell, long endPos);
108  bool readRowSizes(long endPos);
109 
111  bool readCell();
113  bool readCellName();
114 
115  // data in formula
116 
117  /* reads a cell */
118  bool readCell(int sId, bool isList, WKSContentListener::FormulaInstruction &instr);
119  /* reads a formula */
120  bool readFormula(long endPos, int sId, bool newFormula,
121  std::vector<WKSContentListener::FormulaInstruction> &formula, std::string &error);
122 private:
123  LotusSpreadsheet(LotusSpreadsheet const &orig);
127  {
128  return m_asciiFile;
129  }
132  shared_ptr<WKSContentListener> m_listener;
136  shared_ptr<LotusStyleManager> m_styleManager;
138  shared_ptr<LotusSpreadsheetInternal::State> m_state;
141 };
142 
143 #endif /* LOTUS_SPREAD_SHEET_H */
144 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
libwps::DebugFile & ascii()
returns the debug file
Definition: LotusSpreadsheet.h:126
void sendSpreadsheet(int sheetId)
send the data
Definition: LotusSpreadsheet.cpp:1420
shared_ptr< WKSContentListener > m_listener
Definition: LotusSpreadsheet.h:132
Definition: WPSDebug.h:196
LotusParser & m_mainParser
the listener (if set)
Definition: LotusSpreadsheet.h:134
LotusSpreadsheet(LotusParser &parser)
constructor
Definition: LotusSpreadsheet.cpp:367
~LotusSpreadsheet()
destructor
Definition: LotusSpreadsheet.cpp:374
a cellule of a Lotus spreadsheet
Definition: LotusSpreadsheet.cpp:117
void sendRowContent(LotusSpreadsheetInternal::Spreadsheet const &sheet, int row)
send the cell data in a row
Definition: LotusSpreadsheet.cpp:1491
int version() const
return the file version
Definition: LotusSpreadsheet.cpp:463
a class used to store a style of a cell in LotusSpreadsheet
Definition: LotusSpreadsheet.cpp:52
void cleanState()
clean internal state
Definition: LotusSpreadsheet.cpp:378
This class parses a WK2..WK4 Lotus spreadsheet.
Definition: Lotus.h:47
void updateState()
update internal state (must be called one time before sending data)
Definition: LotusSpreadsheet.cpp:383
LotusSpreadsheet & operator=(LotusSpreadsheet const &orig)
bool readRowSizes(long endPos)
reads the row size ( in pt*32 )
Definition: LotusSpreadsheet.cpp:934
void setLastSpreadsheetId(int id)
set the last spreadsheet number ( default 0)
Definition: LotusSpreadsheet.cpp:453
shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:113
bool readSheetName()
reads a sheet name
Definition: LotusSpreadsheet.cpp:990
This class parses the Lotus style.
Definition: LotusStyleManager.h:45
bool readCellName()
reads a cell or list of cell name
Definition: LotusSpreadsheet.cpp:1049
the spreadsheet of a LotusSpreadsheet
Definition: LotusSpreadsheet.cpp:178
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
void setListener(WKSContentListenerPtr &listen)
sets the listener
Definition: LotusSpreadsheet.h:64
bool readFormula(long endPos, int sId, bool newFormula, std::vector< WKSContentListener::FormulaInstruction > &formula, std::string &error)
Definition: LotusSpreadsheet.cpp:1738
bool hasSomeSpreadsheetData() const
returns true if some spreadsheet are defined
Definition: LotusSpreadsheet.cpp:482
bool readRowFormat(LotusSpreadsheetInternal::Style &style, int &numCell, long endPos)
reads a cell's row format
Definition: LotusSpreadsheet.cpp:752
This class parses Microsoft Works spreadsheet file.
Definition: LotusSpreadsheet.h:50
bool readColumnDefinition()
reads the columns definitions
Definition: LotusSpreadsheet.cpp:498
bool readRowFormats()
reads the row formats
Definition: LotusSpreadsheet.cpp:628
libwps::DebugFile & m_asciiFile
the ascii file
Definition: LotusSpreadsheet.h:140
shared_ptr< LotusSpreadsheetInternal::State > m_state
the internal state
Definition: LotusSpreadsheet.h:138
bool readCell()
reads a cell
Definition: LotusSpreadsheet.cpp:1127
shared_ptr< LotusStyleManager > m_styleManager
the style manager
Definition: LotusSpreadsheet.h:136
RVNGInputStreamPtr m_input
the input
Definition: LotusSpreadsheet.h:131
Definition: LotusSpreadsheet.cpp:47
bool readColumnSizes()
reads the column sizes ( in char )
Definition: LotusSpreadsheet.cpp:577
void sendCellContent(LotusSpreadsheetInternal::Cell const &cell, LotusSpreadsheetInternal::Style const &style, int numRepeated=1)
send the cell data
Definition: LotusSpreadsheet.cpp:1561
small class use to define a formula instruction
Definition: WKSContentListener.h:54
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition: LotusSpreadsheet.cpp:470

Generated on Sun Feb 21 2016 09:42:14 for libwps by doxygen 1.8.10