Debian Codegraph @

src/lib/QuattroDosChart.h

raw symbols SCIP
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 ([email protected])
12 * Copyright (C) 2003 Marc Maurer ([email protected])
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 QUATTRO_DOS_CHART_H
23 #define QUATTRO_DOS_CHART_H
24
25 #include <ostream>
26 #include <map>
27 #include <vector>
28
29 #include <librevenge-stream/librevenge-stream.h>
30
31 #include "libwps_internal.h"
32
33 #include "WPSDebug.h"
34 #include "WKSContentListener.h"
35
36 namespace QuattroDosChartInternal
37 {
38 class Chart;
39 struct State;
40
41 }
42
43 class QuattroDosParser;
44
45 /**
46 * This class parses Quattro Pro DOS chart file
47 *
48 */
49 class QuattroDosChart
50 {
51 public:
52 friend class QuattroDosParser;
53 friend class QuattroDosChartInternal::Chart;
54
55 //! constructor
56 explicit QuattroDosChart(QuattroDosParser &parser);
57 //! destructor
58 ~QuattroDosChart();
59 //! sets the listener
60 void setListener(WKSContentListenerPtr &listen)
61 {
62 m_listener = listen;
63 }
64 //! reads the chart type: b8(3d) or ca(bubble)
65 bool readChartSetType();
66 //! reads the chart name: b9
67 bool readChartName();
68 //! reads a structure which define a chart: 2d(default), 2e(name + value)
69 bool readChart();
70
71 //! returns the number of spreadsheet
72 int getNumSpreadsheets() const;
73 //! returns the list of cell's begin to end corresponding to a chart
74 void getChartPositionMap(int sheetId, std::map<Vec2i,Vec2i> &cellMap) const;
75 //! try to send the chart corresponding to sheetId and a position
76 bool sendChart(int sheetId, Vec2i const &cell, Vec2f const &chartSize);
77 protected:
78 //! return true if the pos is in the file, update the file size if need
79 bool checkFilePosition(long pos);
80 //! return the file version
81 int version() const;
82
83 //! try to send the text
84 bool sendText(WPSEntry const &entry);
85 //! update the chart spreadsheet name
86 bool updateSpreadsheetNames(QuattroDosChartInternal::Chart &chart);
87 private:
88 QuattroDosChart(QuattroDosChart const &orig) = delete;
89 QuattroDosChart &operator=(QuattroDosChart const &orig) = delete;
90 //! returns the debug file
91 libwps::DebugFile &ascii()
92 {
93 return m_asciiFile;
94 }
95 /** the input */
96 RVNGInputStreamPtr m_input;
97 std::shared_ptr<WKSContentListener> m_listener; /** the listener (if set)*/
98 //! the main parser
99 QuattroDosParser &m_mainParser;
100 //! the internal state
101 std::shared_ptr<QuattroDosChartInternal::State> m_state;
102 //! the ascii file
103 libwps::DebugFile &m_asciiFile;
104 };
105
106 #endif /* WPS4_H */
107 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */