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 
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 
83  LotusSpreadsheetInternal::Style const &style);
84 
86 
87  //
88  // low level
89  //
91 
93  bool readSheetName();
94 
96  bool readColumnDefinition();
98  bool readColumnSizes();
100  bool readRowFormats();
102  bool readRowFormat(LotusSpreadsheetInternal::Style &style, int &numCell, long endPos);
104  bool readRowSizes(long endPos);
105 
107  bool readCell();
109  bool readCellName();
110 
111  // data in formula
112 
113  /* reads a cell */
114  bool readCell(int sId, bool isList, WKSContentListener::FormulaInstruction &instr);
115  /* reads a formula */
116  bool readFormula(long endPos, int sId, bool newFormula,
117  std::vector<WKSContentListener::FormulaInstruction> &formula, std::string &error);
118 private:
119  LotusSpreadsheet(LotusSpreadsheet const &orig);
123  {
124  return m_asciiFile;
125  }
128  shared_ptr<WKSContentListener> m_listener;
132  shared_ptr<LotusStyleManager> m_styleManager;
134  shared_ptr<LotusSpreadsheetInternal::State> m_state;
137 };
138 
139 #endif /* LOTUS_SPREAD_SHEET_H */
140 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
libwps::DebugFile & ascii()
returns the debug file
Definition: LotusSpreadsheet.h:122
void sendSpreadsheet(int sheetId)
send the data
Definition: LotusSpreadsheet.cpp:1405
shared_ptr< WKSContentListener > m_listener
Definition: LotusSpreadsheet.h:128
Definition: WPSDebug.h:196
LotusParser & m_mainParser
the listener (if set)
Definition: LotusSpreadsheet.h:130
LotusSpreadsheet(LotusParser &parser)
constructor
Definition: LotusSpreadsheet.cpp:355
~LotusSpreadsheet()
destructor
Definition: LotusSpreadsheet.cpp:362
a cellule of a Lotus spreadsheet
Definition: LotusSpreadsheet.cpp:119
void sendCellContent(LotusSpreadsheetInternal::Cell const &cell, LotusSpreadsheetInternal::Style const &style)
send the cell data
Definition: LotusSpreadsheet.cpp:1465
int version() const
return the file version
Definition: LotusSpreadsheet.cpp:452
a class used to store a style of a cell in LotusSpreadsheet
Definition: LotusSpreadsheet.cpp:52
void cleanState()
clean internal state
Definition: LotusSpreadsheet.cpp:366
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:371
LotusSpreadsheet & operator=(LotusSpreadsheet const &orig)
bool readRowSizes(long endPos)
reads the row size ( in pt*32 )
Definition: LotusSpreadsheet.cpp:919
void setLastSpreadsheetId(int id)
set the last spreadsheet number ( default 0)
Definition: LotusSpreadsheet.cpp:442
shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:113
bool readSheetName()
reads a sheet name
Definition: LotusSpreadsheet.cpp:975
This class parses the Lotus style.
Definition: LotusStyleManager.h:45
bool readCellName()
reads a cell or list of cell name
Definition: LotusSpreadsheet.cpp:1034
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:1642
bool hasSomeSpreadsheetData() const
returns true if some spreadshet are defined
Definition: LotusSpreadsheet.cpp:471
bool readRowFormat(LotusSpreadsheetInternal::Style &style, int &numCell, long endPos)
reads a cell's row format
Definition: LotusSpreadsheet.cpp:737
This class parses Microsoft Works spreadsheet file.
Definition: LotusSpreadsheet.h:50
bool readColumnDefinition()
reads the columns definitions
Definition: LotusSpreadsheet.cpp:487
bool readRowFormats()
reads the row formats
Definition: LotusSpreadsheet.cpp:617
libwps::DebugFile & m_asciiFile
the ascii file
Definition: LotusSpreadsheet.h:136
shared_ptr< LotusSpreadsheetInternal::State > m_state
the internal state
Definition: LotusSpreadsheet.h:134
bool readCell()
reads a cell
Definition: LotusSpreadsheet.cpp:1112
shared_ptr< LotusStyleManager > m_styleManager
the style manager
Definition: LotusSpreadsheet.h:132
RVNGInputStreamPtr m_input
the input
Definition: LotusSpreadsheet.h:127
Definition: LotusSpreadsheet.cpp:47
bool readColumnSizes()
reads the column sizes ( in char )
Definition: LotusSpreadsheet.cpp:566
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:459

Generated on Tue Oct 6 2015 15:57:51 for libwps by doxygen 1.8.9.1