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);
86  void sendCellContent(LotusSpreadsheetInternal::Cell const &cell,
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;
133  LotusParser &m_mainParser;
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
shared_ptr< WKSContentListener > m_listener
Definition: LotusSpreadsheet.h:132
int version() const
return the file version
Definition: Lotus.cpp:183
Definition: WPSDebug.h:196
a cellule of a Lotus spreadsheet
Definition: LotusSpreadsheet.cpp:117
a class used to store a style of a cell in LotusSpreadsheet
Definition: LotusSpreadsheet.cpp:52
This class parses a WK2..WK4 Lotus spreadsheet.
Definition: Lotus.h:47
shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:113
This class parses the Lotus style.
Definition: LotusStyleManager.h:45
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition: Lotus.cpp:188
the spreadsheet of a LotusSpreadsheet
Definition: LotusSpreadsheet.cpp:178
WKSParser & operator=(const WKSParser &)
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
This class parses Microsoft Works spreadsheet file.
Definition: LotusSpreadsheet.h:50
libwps::DebugFile m_asciiFile
the debug file
Definition: WKSParser.h:75
libwps::DebugFile & m_asciiFile
the ascii file
Definition: LotusSpreadsheet.h:140
shared_ptr< LotusSpreadsheetInternal::State > m_state
the internal state
Definition: LotusSpreadsheet.h:138
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
small class use to define a formula instruction
Definition: WKSContentListener.h:54
shared_ptr< WKSContentListener > m_listener
Definition: Lotus.h:125
friend class LotusSpreadsheet
Definition: Lotus.h:51

Generated on Mon Feb 15 2016 10:16:42 for libwps by doxygen 1.8.11