QuattroGraph.h Source File documentation

QuattroGraph.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 QUATTRO_GRAPH_H
23 #define QUATTRO_GRAPH_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 QuattroGraphInternal
37 {
38 struct Dialog;
39 struct Graph;
40 struct State;
41
42 class SubDocument;
43 }
44
45 class QuattroParser;
46 class QuattroStyleManager;
47
52 class QuattroGraph
53 {
54 public:
55 friend class QuattroParser;
56 friend class QuattroGraphInternal::SubDocument;
57
59 explicit QuattroGraph(QuattroParser &parser);
61 ~QuattroGraph();
63 void setListener(WKSContentListenerPtr &listen)
64 {
65 m_listener = listen;
66 }
68 void cleanState();
70 void updateState();
71
72 protected:
74 int version() const;
75
77 void storeObjects(std::map<librevenge::RVNGString,WPSEmbeddedObject> const &nameToObjectMap);
79 std::vector<Vec2i> getGraphicCellsInSheet(int sheetId) const;
81 bool sendGraphics(int sheetId, Vec2i const &cell) const;
83 bool sendGraphic(QuattroGraphInternal::Graph const &graph) const;
84
85 //
86 // low level
87 //
88
89 // ////////////////////// zone //////////////////////////////
90
92 bool readBeginEnd(std::shared_ptr<WPSStream> stream, int sheetId);
94 bool readFrameOLE(std::shared_ptr<WPSStream> stream);
96 bool readImage(std::shared_ptr<WPSStream> stream);
98 bool readBitmap(std::shared_ptr<WPSStream> stream);
100 bool readChart(std::shared_ptr<WPSStream> stream);
102 bool readFrame(std::shared_ptr<WPSStream> stream);
104 bool readButton(std::shared_ptr<WPSStream> stream);
106 bool readOLEData(std::shared_ptr<WPSStream> stream);
107
109 bool readHeader(QuattroGraphInternal::Graph &header, std::shared_ptr<WPSStream> stream, long endPos);
110
111 // ////////////////////// dialog zone //////////////////////////////
112
114 bool readDialog(std::shared_ptr<WPSStream> stream);
116 bool readDialogUnknown(std::shared_ptr<WPSStream> stream);
117
119 bool readHeader(QuattroGraphInternal::Dialog &header, std::shared_ptr<WPSStream> stream, long endPos);
120
121 private:
122 QuattroGraph(QuattroGraph const &orig) = delete;
123 QuattroGraph &operator=(QuattroGraph const &orig) = delete;
124 std::shared_ptr<WKSContentListener> m_listener;
125 QuattroParser &m_mainParser;
128 std::shared_ptr<QuattroGraphInternal::State> m_state;
129 };
130
131 #endif /* QUATTRO_GRAPH_H */
132 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
QuattroGraph::readHeader
bool readHeader(QuattroGraphInternal::Graph &header, std::shared_ptr< WPSStream > stream, long endPos)
try to read a graph header
Definition: QuattroGraph.cpp:322
QuattroGraph::readBitmap
bool readBitmap(std::shared_ptr< WPSStream > stream)
read a bitmap zone: zone 383(wb2)
Definition: QuattroGraph.cpp:739
QuattroGraph::readFrameOLE
bool readFrameOLE(std::shared_ptr< WPSStream > stream)
read a new OLE frame zone: zone 381(wb2)
Definition: QuattroGraph.cpp:443
QuattroGraph::readImage
bool readImage(std::shared_ptr< WPSStream > stream)
read a image zone: zone 382(wb2)
Definition: QuattroGraph.cpp:679
QuattroGraph::readFrame
bool readFrame(std::shared_ptr< WPSStream > stream)
read an frame: zone 385
Definition: QuattroGraph.cpp:384
QuattroGraph::version
int version() const
return the file version
Definition: QuattroGraph.cpp:291
QuattroGraph::readButton
bool readButton(std::shared_ptr< WPSStream > stream)
read a button: zone 386
Definition: QuattroGraph.cpp:575
QuattroGraph::sendGraphic
bool sendGraphic(QuattroGraphInternal::Graph const &graph) const
send a graphic
Definition: QuattroGraph.cpp:1088
QuattroGraph::getGraphicCellsInSheet
std::vector< Vec2i > getGraphicCellsInSheet(int sheetId) const
return the list of cells containing some graphics in a sheet
Definition: QuattroGraph.cpp:303
WKSContentListener.h
QuattroGraph::m_mainParser
QuattroParser & m_mainParser
the listener (if set)
Definition: QuattroGraph.h:126
QuattroGraph::setListener
void setListener(WKSContentListenerPtr &listen)
sets the listener
Definition: QuattroGraph.h:63
QuattroGraph::readDialog
bool readDialog(std::shared_ptr< WPSStream > stream)
read a dialog zone: 35e
Definition: QuattroGraph.cpp:900
QuattroGraphInternal::Graph
a graph
Definition: QuattroGraph.cpp:99
QuattroGraph::operator=
QuattroGraph & operator=(QuattroGraph const &orig)=delete
QuattroGraph::storeObjects
void storeObjects(std::map< librevenge::RVNGString, WPSEmbeddedObject > const &nameToObjectMap)
stores the OLE objets
Definition: QuattroGraph.cpp:298
libwps_internal.h
QuattroGraphInternal::Dialog
a dialog header
Definition: QuattroGraph.cpp:55
QuattroGraph::sendGraphics
bool sendGraphics(int sheetId, Vec2i const &cell) const
send the graphic corresponding to a cell
Definition: QuattroGraph.cpp:1065
QuattroGraph::readBeginEnd
bool readBeginEnd(std::shared_ptr< WPSStream > stream, int sheetId)
read the begin/end graph zone: 321/322
Definition: QuattroGraph.cpp:345
QuattroGraph::cleanState
void cleanState()
clean internal state
Definition: QuattroGraph.cpp:282
WKSSubDocument::parser
WKSParser * parser() const
returns the parser
Definition: WKSSubDocument.h:44
QuattroGraph::m_state
std::shared_ptr< QuattroGraphInternal::State > m_state
the internal state
Definition: QuattroGraph.h:128
QuattroParser
This class parses Quattro Pro spreadsheet: .wq1 and wq2.
Definition: Quattro.h:51
QuattroGraph::~QuattroGraph
~QuattroGraph()
destructor
Definition: QuattroGraph.cpp:278
QuattroGraph
This class parses QuattroPro graph file.
Definition: QuattroGraph.h:52
QuattroGraph::readOLEData
bool readOLEData(std::shared_ptr< WPSStream > stream)
read a OLE data: zone 38b
Definition: QuattroGraph.cpp:503
QuattroGraph::QuattroGraph
QuattroGraph(QuattroParser &parser)
constructor
Definition: QuattroGraph.cpp:271
QuattroGraph::readDialogUnknown
bool readDialogUnknown(std::shared_ptr< WPSStream > stream)
read a unknown dialog zone: 335,343,345
Definition: QuattroGraph.cpp:988
WKSContentListenerPtr
std::shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:114
QuattroGraph::updateState
void updateState()
update the state (need to be called before sending data)
Definition: QuattroGraph.cpp:287
Vec2< int >
QuattroGraph::m_listener
std::shared_ptr< WKSContentListener > m_listener
Definition: QuattroGraph.h:124
QuattroGraphInternal::SubDocument
Internal: the subdocument of a LotusGraphc.
Definition: QuattroGraph.cpp:219
WPSDebug.h
QuattroGraph::readChart
bool readChart(std::shared_ptr< WPSStream > stream)
read a chart zone: zone 384
Definition: QuattroGraph.cpp:807
QuattroGraphInternal
Definition: QuattroGraph.cpp:52