LotusGraph.h Source File documentation

LotusGraph.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_GRAPH_H
23#define LOTUS_GRAPH_H
24
25#include <ostream>
26#include <map>
27#include <string>
28#include <vector>
29
30#include <librevenge-stream/librevenge-stream.h>
31
32#include "libwps_internal.h"
33
34#include "WPSDebug.h"
35#include "WKSContentListener.h"
36
37namespace LotusGraphInternal
38{
39struct ZoneMac; // 123 mac
40struct ZonePc; // 123 pc
41struct ZonePcList; // 123 pc
42struct ZoneWK4; // lotus 4
43struct State;
44
45class SubDocument;
46}
47
48class LotusParser;
49class LotusStyleManager;
50
55 class LotusGraph
56{
57public:
58 friend class LotusParser;
59 friend class LotusGraphInternal::SubDocument;
60
62 explicit LotusGraph(LotusParser &parser);
64 ~LotusGraph();
66 void cleanState();
68 void setListener(WKSContentListenerPtr &listen)
69 {
70 m_listener = listen;
71 }
78 void updateState(std::map<int,int> const &zIdToSheetIdMap,
79 std::map<std::string,int> const &nameToChartIdMap);
80protected:
82 int version() const;
83
85 bool hasGraphics(int sheetId) const;
87 void sendGraphics(int sheetId);
89 void sendZone(LotusGraphInternal::ZonePcList const &zoneList, size_t id, WPSTransformation const &transf);
91 void sendPicture(LotusGraphInternal::ZoneMac const &zone);
93 void sendTextBox(std::shared_ptr<WPSStream> stream, WPSEntry const &entry);
95 void sendTextBoxWK4(std::shared_ptr<WPSStream> stream, WPSEntry const &entry, bool isButton);
96
98 bool setChartId(int chartId);
99
100 //
101 // low level
102 //
103
104 // ////////////////////// zone //////////////////////////////
105
106 // zone 1b
107
109 bool readZoneBegin(std::shared_ptr<WPSStream> stream, long endPos);
111 bool readZoneData(std::shared_ptr<WPSStream> stream, long endPos, int type);
113 bool readTextBoxData(std::shared_ptr<WPSStream> stream, long endPos);
115 bool readPictureDefinition(std::shared_ptr<WPSStream> stream, long endPos);
117 bool readPictureData(std::shared_ptr<WPSStream> stream, long endPos);
118
119 // fmt
120
122 bool readFMTPictName(std::shared_ptr<WPSStream> stream);
124 bool readZoneBeginC9(std::shared_ptr<WPSStream> stream);
126 bool readGraphic(std::shared_ptr<WPSStream> stream);
128 bool readFrame(std::shared_ptr<WPSStream> stream);
130 bool readTextBoxDataD1(std::shared_ptr<WPSStream> stream);
131
132 // 123 zone 3XX
133
135 bool readGraphZone(std::shared_ptr<WPSStream> stream, int zId);
137 bool readGraphDataZone(std::shared_ptr<WPSStream> stream, long endPos);
138
139private:
140 LotusGraph(LotusGraph const &orig) = delete;
141 LotusGraph &operator=(LotusGraph const &orig) = delete;
142 std::shared_ptr<WKSContentListener> m_listener;
144 LotusParser &m_mainParser;
146 std::shared_ptr<LotusStyleManager> m_styleManager;
148 std::shared_ptr<LotusGraphInternal::State> m_state;
149};
150
151#endif /* LOTUS_GRAPH_H */
152/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WKSContentListener.h
WPSDebug.h
LotusGraphInternal::SubDocument
Internal: the subdocument of a LotusGraphc.
Definition LotusGraph.cpp:525
LotusGraph
This class parses Microsoft Works graph file.
Definition LotusGraph.h:56
LotusGraph::readZoneBegin
bool readZoneBegin(std::shared_ptr< WPSStream > stream, long endPos)
reads a begin graphic zone: 2328 (wk3mac)
Definition LotusGraph.cpp:653
LotusGraph::updateState
void updateState(std::map< int, int > const &zIdToSheetIdMap, std::map< std::string, int > const &nameToChartIdMap)
update the state (need to be called before sending data)
Definition LotusGraph.cpp:605
LotusGraph::readFMTPictName
bool readFMTPictName(std::shared_ptr< WPSStream > stream)
try to read the pict filename, ...: b7 (wk3-wk4 pc)
Definition LotusGraph.cpp:1380
LotusGraph::setChartId
bool setChartId(int chartId)
sets the current chart id(interface with LotusChart)
Definition LotusGraph.cpp:634
LotusGraph::m_listener
std::shared_ptr< WKSContentListener > m_listener
Definition LotusGraph.h:142
LotusGraph::readTextBoxDataD1
bool readTextBoxDataD1(std::shared_ptr< WPSStream > stream)
reads a graphic textbox data: 0xd1 (wk4)
Definition LotusGraph.cpp:1999
LotusGraph::hasGraphics
bool hasGraphics(int sheetId) const
return true if the sheet sheetId has some graphic
Definition LotusGraph.cpp:619
LotusGraph::readGraphDataZone
bool readGraphDataZone(std::shared_ptr< WPSStream > stream, long endPos)
try to read the graphic data zone: 010d
Definition LotusGraph.cpp:2635
LotusGraph::operator=
LotusGraph & operator=(LotusGraph const &orig)=delete
LotusGraph::readZoneData
bool readZoneData(std::shared_ptr< WPSStream > stream, long endPos, int type)
reads a graphic zone: 2332, 2346, 2350, 2352, 23f0 (wk3mac)
Definition LotusGraph.cpp:685
LotusGraph::m_styleManager
std::shared_ptr< LotusStyleManager > m_styleManager
the style manager
Definition LotusGraph.h:146
LotusGraph::setListener
void setListener(WKSContentListenerPtr &listen)
sets the listener
Definition LotusGraph.h:68
LotusGraph::sendZone
void sendZone(LotusGraphInternal::ZonePcList const &zoneList, size_t id, WPSTransformation const &transf)
try to send a shape: 123 pc
Definition LotusGraph.cpp:2127
LotusGraph::readGraphic
bool readGraphic(std::shared_ptr< WPSStream > stream)
try to read a graphic: 0xca (wk4)
Definition LotusGraph.cpp:1472
LotusGraph::m_mainParser
LotusParser & m_mainParser
the listener (if set)
Definition LotusGraph.h:144
LotusGraph::readTextBoxData
bool readTextBoxData(std::shared_ptr< WPSStream > stream, long endPos)
reads a graphic textbox data: 23f0 (wk3mac)
Definition LotusGraph.cpp:867
LotusGraph::readFrame
bool readFrame(std::shared_ptr< WPSStream > stream)
try to read a graph's frame: 0xcc (wk4)
Definition LotusGraph.cpp:1917
LotusGraph::sendPicture
void sendPicture(LotusGraphInternal::ZoneMac const &zone)
try to send a picture: 123 mac
Definition LotusGraph.cpp:1007
LotusGraph::readZoneBeginC9
bool readZoneBeginC9(std::shared_ptr< WPSStream > stream)
try to read the sheet id: 0xc9 (wk4)
Definition LotusGraph.cpp:1349
LotusGraph::readGraphZone
bool readGraphZone(std::shared_ptr< WPSStream > stream, int zId)
try to read the graphic zone: 1XXX
Definition LotusGraph.cpp:2205
LotusGraph::version
int version() const
return the file version
Definition LotusGraph.cpp:612
LotusGraph::cleanState
void cleanState()
clean internal state
Definition LotusGraph.cpp:600
LotusGraph::sendGraphics
void sendGraphics(int sheetId)
send the graphics corresponding to a sheetId
Definition LotusGraph.cpp:1231
LotusGraph::sendTextBoxWK4
void sendTextBoxWK4(std::shared_ptr< WPSStream > stream, WPSEntry const &entry, bool isButton)
try to send a textbox content's
Definition LotusGraph.cpp:2031
LotusGraph::~LotusGraph
~LotusGraph()
destructor
Definition LotusGraph.cpp:596
LotusGraph::readPictureData
bool readPictureData(std::shared_ptr< WPSStream > stream, long endPos)
reads a picture data: 2410 (wk3mac)
Definition LotusGraph.cpp:954
LotusGraph::LotusGraph
LotusGraph(LotusGraph const &orig)=delete
LotusGraph::readPictureDefinition
bool readPictureDefinition(std::shared_ptr< WPSStream > stream, long endPos)
reads a picture definition: 240e (wk3mac)
Definition LotusGraph.cpp:903
LotusGraph::sendTextBox
void sendTextBox(std::shared_ptr< WPSStream > stream, WPSEntry const &entry)
try to send a textbox content's
Definition LotusGraph.cpp:1032
LotusGraph::LotusGraph
LotusGraph(LotusParser &parser)
constructor
Definition LotusGraph.cpp:588
LotusGraph::m_state
std::shared_ptr< LotusGraphInternal::State > m_state
the internal state
Definition LotusGraph.h:148
LotusParser
This class parses a wk3,wk4,123 Lotus spreadsheet.
Definition Lotus.h:73
LotusStyleManager
This class parses the Lotus style.
Definition LotusStyleManager.h:51
WPSEntry
basic class to store an entry in a file This contained :
Definition WPSEntry.h:39
WPSTransformation
a transformation which stored the first row of a 3x3 perspective matrix
Definition libwps_internal.h:1131
libwps_internal.h
WKSContentListenerPtr
std::shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition libwps_internal.h:114
LotusGraphInternal
Definition LotusGraph.cpp:52
LotusGraphInternal::ZoneMac
the graphic zone of a LotusGraph for 123 mac
Definition LotusGraph.cpp:55
LotusGraphInternal::ZonePcList
a list of ZonePc of a LotusGraph for 123 pc
Definition LotusGraph.cpp:460