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
36namespace QuattroGraphInternal
37{
38struct Dialog;
39struct Graph;
40struct ShapeHeader;
41struct Textbox;
42
43struct State;
44
45class SubDocument;
46}
47
48class QuattroParser;
49class QuattroStyleManager;
50
55 class QuattroGraph
56{
57public:
58 friend class QuattroParser;
59 friend class QuattroGraphInternal::SubDocument;
60
62 explicit QuattroGraph(QuattroParser &parser);
64 ~QuattroGraph();
66 void setListener(WKSContentListenerPtr &listen)
67 {
68 m_listener = listen;
69 }
70
71 void cleanState();
73 void updateState();
74
75protected:
77 int version() const;
78
80 void storeObjects(std::map<librevenge::RVNGString,WPSEmbeddedObject> const &nameToObjectMap);
82 std::vector<Vec2i> getGraphicCellsInSheet(int sheetId) const;
84 bool sendGraphics(int sheetId, Vec2i const &cell) const;
86 bool sendPageGraphics(int sheetId) const;
87
89 bool sendGraphic(QuattroGraphInternal::Graph const &graph) const;
91 bool sendShape(QuattroGraphInternal::Graph const &graph, int sheetId) const;
93 bool sendTextbox(QuattroGraphInternal::Graph const &graph, int sheetId) const;
95 bool send(QuattroGraphInternal::Textbox const &textbox,
96 std::shared_ptr<WPSStream> stream) const;
97 //
98 // low level
99 //
100
101 // ////////////////////// zone //////////////////////////////
102
104 bool readBeginEnd(std::shared_ptr<WPSStream> stream, int sheetId);
106 bool readFrameOLE(std::shared_ptr<WPSStream> stream);
108 bool readImage(std::shared_ptr<WPSStream> stream);
110 bool readBitmap(std::shared_ptr<WPSStream> stream);
112 bool readChart(std::shared_ptr<WPSStream> stream);
114 bool readFrame(std::shared_ptr<WPSStream> stream);
116 bool readButton(std::shared_ptr<WPSStream> stream);
118 bool readOLEData(std::shared_ptr<WPSStream> stream);
120 static bool readHeader(QuattroGraphInternal::Graph &header, std::shared_ptr<WPSStream> stream, long endPos);
121
122 // ////////////////////// shape //////////////////////////////
123
125 bool readShape(std::shared_ptr<WPSStream> stream);
128 bool readShapeHeader(QuattroGraphInternal::ShapeHeader &shape, std::shared_ptr<WPSStream> stream, long endPos);
130 bool readLine(std::shared_ptr<WPSStream> stream);
132 bool readRect(std::shared_ptr<WPSStream> stream);
134 bool readPolygon(std::shared_ptr<WPSStream> stream);
136 bool readTextBox(std::shared_ptr<WPSStream> stream);
137
138 // ////////////////////// dialog zone //////////////////////////////
139
141 static bool readHeader(QuattroGraphInternal::Dialog &header, std::shared_ptr<WPSStream> stream, long endPos);
143 bool readDialog(std::shared_ptr<WPSStream> stream);
145 static bool readDialogUnknown(std::shared_ptr<WPSStream> stream);
146
147 // ////////////////////// style //////////////////////////////
148 bool readFillData(WPSGraphicStyle &style, int fillType, std::shared_ptr<WPSStream> stream, long endPos);
149private:
150 QuattroGraph(QuattroGraph const &orig) = delete;
151 QuattroGraph &operator=(QuattroGraph const &orig) = delete;
152 std::shared_ptr<WKSContentListener> m_listener;
154 QuattroParser &m_mainParser;
156 std::shared_ptr<QuattroGraphInternal::State> m_state;
157};
158
159#endif /* QUATTRO_GRAPH_H */
160/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WKSContentListener.h
WPSDebug.h
QuattroGraphInternal::SubDocument
Internal: the subdocument of a QuattroGraphInternal.
Definition QuattroGraph.cpp:389
QuattroGraph::m_listener
std::shared_ptr< WKSContentListener > m_listener
Definition QuattroGraph.h:152
QuattroGraph::sendGraphic
bool sendGraphic(QuattroGraphInternal::Graph const &graph) const
send a graphic
Definition QuattroGraph.cpp:1958
QuattroGraph::readHeader
static bool readHeader(QuattroGraphInternal::Graph &header, std::shared_ptr< WPSStream > stream, long endPos)
try to read a graph header
Definition QuattroGraph.cpp:514
QuattroGraph::storeObjects
void storeObjects(std::map< librevenge::RVNGString, WPSEmbeddedObject > const &nameToObjectMap)
stores the OLE objets
Definition QuattroGraph.cpp:490
QuattroGraph::readShape
bool readShape(std::shared_ptr< WPSStream > stream)
read a shape header: zone 4d3
Definition QuattroGraph.cpp:1318
QuattroGraph::QuattroParser
friend class QuattroParser
Definition QuattroGraph.h:58
QuattroGraph::readChart
bool readChart(std::shared_ptr< WPSStream > stream)
read a chart zone: zone 384
Definition QuattroGraph.cpp:1243
QuattroGraph::setListener
void setListener(WKSContentListenerPtr &listen)
sets the listener
Definition QuattroGraph.h:66
QuattroGraph::version
int version() const
return the file version
Definition QuattroGraph.cpp:483
QuattroGraph::readFrameOLE
bool readFrameOLE(std::shared_ptr< WPSStream > stream)
read a new OLE frame zone: zone 381(wb2)
Definition QuattroGraph.cpp:882
QuattroGraph::~QuattroGraph
~QuattroGraph()
destructor
Definition QuattroGraph.cpp:470
QuattroGraph::send
bool send(QuattroGraphInternal::Textbox const &textbox, std::shared_ptr< WPSStream > stream) const
send the textbox content
Definition QuattroGraph.cpp:2054
QuattroGraph::sendShape
bool sendShape(QuattroGraphInternal::Graph const &graph, int sheetId) const
send a shape
Definition QuattroGraph.cpp:2012
QuattroGraph::operator=
QuattroGraph & operator=(QuattroGraph const &orig)=delete
QuattroGraph::readRect
bool readRect(std::shared_ptr< WPSStream > stream)
read a oval/rect/round rect data: zone 33e/364/379
Definition QuattroGraph.cpp:1449
QuattroGraph::readOLEData
bool readOLEData(std::shared_ptr< WPSStream > stream)
read a OLE data: zone 38b
Definition QuattroGraph.cpp:941
QuattroGraph::readFrame
bool readFrame(std::shared_ptr< WPSStream > stream)
read an frame: zone 385
Definition QuattroGraph.cpp:824
QuattroGraph::readDialog
bool readDialog(std::shared_ptr< WPSStream > stream)
read a dialog zone: 35e
Definition QuattroGraph.cpp:1771
QuattroGraph::sendGraphics
bool sendGraphics(int sheetId, Vec2i const &cell) const
send the graphic corresponding to a cell
Definition QuattroGraph.cpp:1921
QuattroGraph::readTextBox
bool readTextBox(std::shared_ptr< WPSStream > stream)
read a textbox data: zone 36f
Definition QuattroGraph.cpp:1571
QuattroGraph::updateState
void updateState()
update the state (need to be called before sending data)
Definition QuattroGraph.cpp:479
QuattroGraph::readBitmap
bool readBitmap(std::shared_ptr< WPSStream > stream)
read a bitmap zone: zone 383(wb2)
Definition QuattroGraph.cpp:1176
QuattroGraph::sendPageGraphics
bool sendPageGraphics(int sheetId) const
send the page graphic corresponding to a sheet
Definition QuattroGraph.cpp:1944
QuattroGraph::readDialogUnknown
static bool readDialogUnknown(std::shared_ptr< WPSStream > stream)
read a unknown dialog zone: 335,343,345
Definition QuattroGraph.cpp:1859
QuattroGraph::sendTextbox
bool sendTextbox(QuattroGraphInternal::Graph const &graph, int sheetId) const
send a textbox
Definition QuattroGraph.cpp:2034
QuattroGraph::readPolygon
bool readPolygon(std::shared_ptr< WPSStream > stream)
read a polygon/polyline data: zone 35c/37c/35b/388
Definition QuattroGraph.cpp:1506
QuattroGraph::m_state
std::shared_ptr< QuattroGraphInternal::State > m_state
the internal state
Definition QuattroGraph.h:156
QuattroGraph::m_mainParser
QuattroParser & m_mainParser
the listener (if set)
Definition QuattroGraph.h:154
QuattroGraph::cleanState
void cleanState()
clean internal state
Definition QuattroGraph.cpp:474
QuattroGraph::readImage
bool readImage(std::shared_ptr< WPSStream > stream)
read a image zone: zone 382(wb2)
Definition QuattroGraph.cpp:1115
QuattroGraph::readShapeHeader
bool readShapeHeader(QuattroGraphInternal::ShapeHeader &shape, std::shared_ptr< WPSStream > stream, long endPos)
read a shape header
Definition QuattroGraph.cpp:537
QuattroGraph::readButton
bool readButton(std::shared_ptr< WPSStream > stream)
read a button: zone 386
Definition QuattroGraph.cpp:1012
QuattroGraph::readBeginEnd
bool readBeginEnd(std::shared_ptr< WPSStream > stream, int sheetId)
read the begin/end graph zone: 321/322
Definition QuattroGraph.cpp:789
QuattroGraph::QuattroGraph
QuattroGraph(QuattroGraph const &orig)=delete
QuattroGraph::readFillData
bool readFillData(WPSGraphicStyle &style, int fillType, std::shared_ptr< WPSStream > stream, long endPos)
Definition QuattroGraph.cpp:714
QuattroGraph::QuattroGraph
QuattroGraph(QuattroParser &parser)
constructor
Definition QuattroGraph.cpp:463
QuattroGraph::readLine
bool readLine(std::shared_ptr< WPSStream > stream)
read a line/arrow data: zone 35a/37b
Definition QuattroGraph.cpp:1378
QuattroGraph::getGraphicCellsInSheet
std::vector< Vec2i > getGraphicCellsInSheet(int sheetId) const
return the list of cells containing some graphics in a sheet
Definition QuattroGraph.cpp:495
QuattroParser
This class parses Quattro Pro spreadsheet: .wb1, ..., .wb3.
Definition Quattro.h:54
WPSGraphicStyle
a structure used to define a picture style
Definition WPSGraphicStyle.h:38
libwps_internal.h
WKSContentListenerPtr
std::shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition libwps_internal.h:114
Vec2i
Vec2< int > Vec2i
Vec2 of int.
Definition libwps_internal.h:702
QuattroGraphInternal
Definition QuattroGraph.cpp:53
QuattroGraphInternal::Dialog
a dialog header
Definition QuattroGraph.cpp:56
QuattroGraphInternal::Graph
Internal: a graph of a QuattroGraph.
Definition QuattroGraph.cpp:231
QuattroGraphInternal::ShapeHeader
a shape header of a QuattroGraph
Definition QuattroGraph.cpp:100
QuattroGraphInternal::State
the state of QuattroGraph
Definition QuattroGraph.cpp:318
QuattroGraphInternal::Textbox
Internal: a shape of a QuattroGraph.
Definition QuattroGraph.cpp:201