ClarisDrawGraph.hxx Source File documentation

ClarisDrawGraph.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33
34 /*
35 * Parser to Claris Works text document ( graphic part )
36 *
37 */
38 #ifndef CLARIS_WKS_GRAPH
39 # define CLARIS_WKS_GRAPH
40
41 #include <string>
42 #include <vector>
43
44 #include <librevenge/librevenge.h>
45
46 #include "libmwaw_internal.hxx"
47
48 #include "MWAWDebug.hxx"
49 #include "MWAWInputStream.hxx"
50 #include "MWAWPosition.hxx"
51
52 #include "ClarisWksStruct.hxx"
53
54 namespace ClarisDrawGraphInternal
55 {
56 struct Group;
57 struct State;
58 struct Style;
59 struct Zone;
60 struct ZoneShape;
61 struct Bitmap;
62
63 class SubDocument;
64 }
65
66 class ClarisDrawParser;
67
73 class ClarisDrawGraph
74 {
75 friend class ClarisDrawGraphInternal::SubDocument;
76 friend class ClarisDrawParser;
77 friend class ClarisWksParser;
78
79 public:
81 explicit ClarisDrawGraph(ClarisDrawParser &parser);
83 virtual ~ClarisDrawGraph();
84
86 int version() const;
88 void resetState();
90 int numPages() const;
91
93 std::shared_ptr<ClarisWksStruct::DSET> readGroupZone
94 (ClarisWksStruct::DSET const &zone, MWAWEntry const &entry, bool isLibHeader=false);
96 std::shared_ptr<ClarisWksStruct::DSET> readBitmapZone(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry);
98 bool readTransformations();
100 void updateGroup(bool isLibrary);
102 bool isEmptyGroup(int gId) const;
103
105 bool getSurfaceColor(ClarisDrawGraphInternal::Style const &style, MWAWColor &col) const;
106 protected:
108 bool sendBitmap(int number, MWAWPosition const &pos=MWAWPosition());
110 bool sendGroup(int number, MWAWPosition const &pos=MWAWPosition());
112 bool sendMainGroupChild(int childId, MWAWPosition const &pos=MWAWPosition());
114 void flushExtra();
115
116 // interface with main parser
117
119 bool sendTextZone(int number, int subZone=-1);
120
121 //
122 // Intermediate level
123 //
124
125 /* read a simple group */
126 std::shared_ptr<ClarisDrawGraphInternal::Zone> readGroupDef(MWAWEntry const &entry);
127 /* read the group data.
128
129 \note \a beginGroupPos is only used to help debugging */
130 bool readGroupData(ClarisDrawGraphInternal::Group &group, long beginGroupPos, bool isLibHeader);
131
132 /* read a simple graphic zone */
133 bool readShape(MWAWEntry const &entry,
134 ClarisDrawGraphInternal::ZoneShape &zone);
135
136 /* try to read the polygon data */
137 bool readPolygonData(std::shared_ptr<ClarisDrawGraphInternal::Zone> zone);
138
140 /* try to read a bitmap zone */
141 bool readBitmapColorMap(std::vector<MWAWColor> &cMap);
142
143 /* try to read the bitmap */
144 bool readBitmapData(ClarisDrawGraphInternal::Bitmap &zone);
145
146 //
147 // low level
148 //
149
150 /* read the first zone of a group type */
151 bool readGroupHeader(ClarisDrawGraphInternal::Group &group);
152
153 /* read some unknown data in first zone */
154 bool readGroupUnknown(ClarisDrawGraphInternal::Group &group, int zoneSz, int id);
155
157 bool sendShape(ClarisDrawGraphInternal::ZoneShape &pict, MWAWPosition pos);
158
160 bool sendBitmap(ClarisDrawGraphInternal::Bitmap &pict, MWAWPosition pos);
161
162 private:
163 ClarisDrawGraph(ClarisDrawGraph const &orig) = delete;
164 ClarisDrawGraph &operator=(ClarisDrawGraph const &orig) = delete;
165
166 protected:
167 //
168 // data
169 //
171 MWAWParserStatePtr m_parserState;
172
174 std::shared_ptr<ClarisDrawGraphInternal::State> m_state;
175
177 ClarisDrawParser *m_mainParser;
179 std::shared_ptr<ClarisDrawStyleManager> m_styleManager;
180 };
181 #endif
182 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
ClarisDrawGraphInternal::SubDocument
Internal: the subdocument of a ClarisDrawGraph.
Definition: ClarisDrawGraph.cxx:700
ClarisDrawGraphInternal::Bitmap
Internal: structure to store a bitmap of a ClarisDrawGraph.
Definition: ClarisDrawGraph.cxx:401
ClarisDrawGraph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: ClarisDrawGraph.hxx:171
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:553
ClarisDrawGraph::version
int version() const
returns the file version
Definition: ClarisDrawGraph.cxx:794
ClarisDrawGraph::m_state
std::shared_ptr< ClarisDrawGraphInternal::State > m_state
the state
Definition: ClarisDrawGraph.hxx:174
ClarisDrawGraph::readGroupData
bool readGroupData(ClarisDrawGraphInternal::Group &group, long beginGroupPos, bool isLibHeader)
Definition: ClarisDrawGraph.cxx:1384
libmwaw_internal.hxx
ClarisDrawGraph::readShape
bool readShape(MWAWEntry const &entry, ClarisDrawGraphInternal::ZoneShape &zone)
Definition: ClarisDrawGraph.cxx:1583
ClarisDrawGraphInternal::Group
Internal: class which stores a group of graphics, ...
Definition: ClarisDrawGraph.cxx:602
ClarisDrawGraph::readTransformations
bool readTransformations()
read the transformations
Definition: ClarisDrawGraph.cxx:913
ClarisWksStruct.hxx
ClarisDrawGraph::sendBitmap
bool sendBitmap(int number, MWAWPosition const &pos=MWAWPosition())
sends the bitmap data to the listener (if it exists )
Definition: ClarisDrawGraph.cxx:2378
ClarisDrawGraphInternal::ZoneShape
Internal: small class to store a basic graphic zone of a ClarisDrawGraph.
Definition: ClarisDrawGraph.cxx:304
ClarisDrawGraph::m_styleManager
std::shared_ptr< ClarisDrawStyleManager > m_styleManager
the style manager
Definition: ClarisDrawGraph.hxx:179
ClarisDrawGraph::operator=
ClarisDrawGraph & operator=(ClarisDrawGraph const &orig)=delete
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:192
ClarisWksStruct::DSET
main structure which correspond to a document part
Definition: ClarisWksStruct.hxx:87
ClarisDrawGraph::readGroupZone
std::shared_ptr< ClarisWksStruct::DSET > readGroupZone(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry, bool isLibHeader=false)
reads the zone Group DSET
Definition: ClarisDrawGraph.cxx:981
ClarisDrawGraph::resetState
void resetState()
resets the current state
Definition: ClarisDrawGraph.cxx:799
ClarisDrawGraph::ClarisDrawGraph
ClarisDrawGraph(ClarisDrawParser &parser)
constructor
Definition: ClarisDrawGraph.cxx:783
ClarisDrawGraph::readBitmapColorMap
bool readBitmapColorMap(std::vector< MWAWColor > &cMap)
Definition: ClarisDrawGraph.cxx:2028
ClarisDrawGraph::numPages
int numPages() const
returns the number of pages
Definition: ClarisDrawGraph.cxx:804
ClarisWksParser
the main class to read a Claris Works file
Definition: ClarisWksParser.hxx:67
ClarisDrawGraph::updateGroup
void updateGroup(bool isLibrary)
update the group: ie. remove empty group child
Definition: ClarisDrawGraph.cxx:832
ClarisDrawGraph::m_mainParser
ClarisDrawParser * m_mainParser
the main parser;
Definition: ClarisDrawGraph.hxx:177
ClarisDrawGraph::getSurfaceColor
bool getSurfaceColor(ClarisDrawGraphInternal::Style const &style, MWAWColor &col) const
return the surface color which corresponds to some ids (if possible)
Definition: ClarisDrawGraph.cxx:905
ClarisDrawGraph::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: ClarisDrawGraph.cxx:2487
ClarisDrawGraph::isEmptyGroup
bool isEmptyGroup(int gId) const
returns true if a group does not exist or is empty
Definition: ClarisDrawGraph.cxx:824
ClarisDrawGraph::readPolygonData
bool readPolygonData(std::shared_ptr< ClarisDrawGraphInternal::Zone > zone)
Definition: ClarisDrawGraph.cxx:1944
ClarisDrawGraph::sendMainGroupChild
bool sendMainGroupChild(int childId, MWAWPosition const &pos=MWAWPosition())
sends the ith child of the root (if it exists )
Definition: ClarisDrawGraph.cxx:2148
ClarisDrawGraph::readBitmapData
bool readBitmapData(ClarisDrawGraphInternal::Bitmap &zone)
Definition: ClarisDrawGraph.cxx:2075
ClarisDrawGraph::~ClarisDrawGraph
virtual ~ClarisDrawGraph()
destructor
Definition: ClarisDrawGraph.cxx:791
ClarisDrawGraph::sendGroup
bool sendGroup(int number, MWAWPosition const &pos=MWAWPosition())
sends the zone data to the listener (if it exists )
Definition: ClarisDrawGraph.cxx:2239
MWAWInputStream.hxx
MWAWDebug.hxx
ClarisDrawGraph::readGroupUnknown
bool readGroupUnknown(ClarisDrawGraphInternal::Group &group, int zoneSz, int id)
Definition: ClarisDrawGraph.cxx:1883
ClarisDrawGraphInternal
Internal: the structures of a ClarisDrawGraph.
Definition: ClarisDrawGraph.cxx:67
ClarisDrawParser
the main class to read a ClarisDraw v1 file
Definition: ClarisDrawParser.hxx:63
ClarisDrawGraph::sendShape
bool sendShape(ClarisDrawGraphInternal::ZoneShape &pict, MWAWPosition pos)
sends a basic graphic zone
Definition: ClarisDrawGraph.cxx:2346
MWAWPosition.hxx
ClarisDrawGraph::readGroupHeader
bool readGroupHeader(ClarisDrawGraphInternal::Group &group)
Definition: ClarisDrawGraph.cxx:1793
ClarisDrawGraph::sendTextZone
bool sendTextZone(int number, int subZone=-1)
sends a text box content (via the main parser )
Definition: ClarisDrawGraph.cxx:819
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
ClarisDrawGraph::readGroupDef
std::shared_ptr< ClarisDrawGraphInternal::Zone > readGroupDef(MWAWEntry const &entry)
Definition: ClarisDrawGraph.cxx:1188
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
ClarisDrawGraph
the main class to read the graphic part of Claris Works file
Definition: ClarisDrawGraph.hxx:73
ClarisDrawGraphInternal::Style
Internal: the structure used to store a style of a ClarisDrawGraph.
Definition: ClarisDrawGraph.cxx:139
ClarisDrawGraph::readBitmapZone
std::shared_ptr< ClarisWksStruct::DSET > readBitmapZone(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry)
reads the zone Bitmap DSET
Definition: ClarisDrawGraph.cxx:1072