CWGraph.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 CW_GRAPH
39 # define CW_GRAPH
40 
41 #include <string>
42 #include <vector>
43 
44 #include <libwpd/libwpd.h>
45 
46 #include "libmwaw_internal.hxx"
47 
48 #include "MWAWDebug.hxx"
49 #include "MWAWInputStream.hxx"
50 
51 #include "CWStruct.hxx"
52 
53 namespace CWGraphInternal
54 {
55 struct Group;
56 struct State;
57 struct Style;
58 struct Zone;
59 struct ZoneBasic;
60 struct ZoneBitmap;
61 struct ZonePict;
62 }
63 
64 class CWParser;
65 class CWStyleManager;
66 
72 class CWGraph
73 {
74  friend class CWParser;
75 
76 public:
78  CWGraph(CWParser &parser);
80  virtual ~CWGraph();
81 
83  int version() const;
84 
86  int numPages() const;
87 
89  shared_ptr<CWStruct::DSET> readGroupZone
90  (CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
91 
93  shared_ptr<CWStruct::DSET> readBitmapZone
94  (CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
95 
97  bool readColorList(MWAWEntry const &entry);
98 
100  bool getColor(int id, MWAWColor &col) const;
101 
103  float getPatternPercent(int id) const;
104 
106  bool getWallPaperColor(int id, MWAWColor &col) const;
107 
109  bool getLineColor(CWGraphInternal::Style const style, MWAWColor &col) const;
111  bool getSurfaceColor(CWGraphInternal::Style const style, MWAWColor &col) const;
112 protected:
114  bool sendZone(int number, MWAWPosition pos=MWAWPosition());
115 
117  void flushExtra();
118 
119  //
120  // Intermediate level
121  //
122 
124  void updateInformation(CWGraphInternal::Group &group) const;
125  /* read a simple group */
126  shared_ptr<CWGraphInternal::Zone> readGroupDef(MWAWEntry const &entry);
127 
128  /* read a simple graphic zone */
129  bool readBasicGraphic(MWAWEntry const &entry,
131 
132  /* read the group data.
133 
134  \note \a beginGroupPos is only used to help debugging */
135  bool readGroupData(CWGraphInternal::Group &group, long beginGroupPos);
136 
137  /* try to read the polygon data */
138  bool readPolygonData(shared_ptr<CWGraphInternal::Zone> zone);
139 
141  /* try to read a pict data zone */
142  bool readPictData(shared_ptr<CWGraphInternal::Zone> zone);
143 
144  /* read a picture */
146 
147  /* read a postcript zone */
148  bool readPS(CWGraphInternal::ZonePict &zone);
149 
150  /* read a ole document zone */
152 
154  /* try to read the qtime data zone */
155  bool readQTimeData(shared_ptr<CWGraphInternal::Zone> zone);
156 
157  /* read a named picture */
159 
161  /* try to read a bitmap zone */
162  bool readBitmapColorMap(std::vector<MWAWColor> &cMap);
163 
164  /* try to read the bitmap */
166  //
167  // low level
168  //
169 
170  /* read the first zone of a group type */
172 
173  /* read some unknown data in first zone */
174  bool readGroupUnknown(CWGraphInternal::Group &group, int zoneSz, int id);
175 
178  WPXPropertyList extras = WPXPropertyList());
179 
182  WPXPropertyList extras = WPXPropertyList());
183 
186  WPXPropertyList extras = WPXPropertyList());
187 
188 private:
189  CWGraph(CWGraph const &orig);
190  CWGraph &operator=(CWGraph const &orig);
191 
192 protected:
193  //
194  // data
195  //
198 
200  shared_ptr<CWGraphInternal::State> m_state;
201 
204 
206  shared_ptr<CWStyleManager> m_styleManager;
207 };
208 #endif
209 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
bool readPICT(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1787
main structure which correspond to a document part
Definition: CWStruct.hxx:55
bool getSurfaceColor(CWGraphInternal::Style const style, MWAWColor &col) const
return the surface color which corresponds to some ids (if possible)
Definition: CWGraph.cxx:811
a structure to store the style list and the lookup zone
Definition: CWStyleManager.hxx:60
bool getLineColor(CWGraphInternal::Style const style, MWAWColor &col) const
return the line color which corresponds to some ids (if possible)
Definition: CWGraph.cxx:798
bool readNamedPict(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1955
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: CWGraph.cxx:2653
bool readGroupData(CWGraphInternal::Group &group, long beginGroupPos)
Definition: CWGraph.cxx:1301
shared_ptr< CWStyleManager > m_styleManager
the style manager
Definition: CWGraph.hxx:206
bool readPolygonData(shared_ptr< CWGraphInternal::Zone > zone)
Definition: CWGraph.cxx:1646
bool readColorList(MWAWEntry const &entry)
reads a color map zone ( v4-v6)
Definition: CWGraph.cxx:925
Internal: small class to store a basic graphic zone of a CWGraph.
Definition: CWGraph.cxx:227
the class to store a color
Definition: libmwaw_internal.hxx:161
CWGraph & operator=(CWGraph const &orig)
bool sendZone(int number, MWAWPosition pos=MWAWPosition())
sends the zone data to the listener (if it exists )
Definition: CWGraph.cxx:2182
the main class to read the graphic part of Claris Works file
Definition: CWGraph.hxx:72
Internal: class which stores a group of graphics, ...
Definition: CWGraph.cxx:521
bool readQTimeData(shared_ptr< CWGraphInternal::Zone > zone)
Definition: CWGraph.cxx:1918
bool readOLE(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1870
bool readPS(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1830
bool readPictData(shared_ptr< CWGraphInternal::Zone > zone)
Definition: CWGraph.cxx:1724
Internal: the structure used to store a style of a CWGraph.
Definition: CWGraph.cxx:101
bool readBitmapData(CWGraphInternal::ZoneBitmap &zone)
Definition: CWGraph.cxx:2052
int numPages() const
returns the number of pages
Definition: CWGraph.cxx:734
bool sendPicture(CWGraphInternal::ZonePict &pict, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList())
sends a picture zone
Definition: CWGraph.cxx:2579
bool sendBasicPicture(CWGraphInternal::ZoneBasic &pict, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList())
sends a basic graphic zone
Definition: CWGraph.cxx:2354
int version() const
returns the file version
Definition: CWGraph.cxx:729
the main class to read a Claris Works file
Definition: CWParser.hxx:73
shared_ptr< CWGraphInternal::Zone > readGroupDef(MWAWEntry const &entry)
Definition: CWGraph.cxx:1097
shared_ptr< CWStruct::DSET > readBitmapZone(CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete)
reads the zone Bitmap DSET
Definition: CWGraph.cxx:975
bool getColor(int id, MWAWColor &col) const
return the color which corresponds to an id (if possible)
Definition: CWGraph.cxx:760
void updateInformation(CWGraphInternal::Group &group) const
update the group information to choose how to send the group data
Definition: CWGraph.cxx:2086
CWGraph(CWParser &parser)
constructor
Definition: CWGraph.cxx:720
Internal: the structure used to store a PICT or a MOVIE.
Definition: CWGraph.cxx:314
bool sendBitmap(CWGraphInternal::ZoneBitmap &pict, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList())
sends a bitmap graphic zone
Definition: CWGraph.cxx:2513
bool readBasicGraphic(MWAWEntry const &entry, CWGraphInternal::ZoneBasic &zone)
Definition: CWGraph.cxx:1436
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:342
bool readGroupUnknown(CWGraphInternal::Group &group, int zoneSz, int id)
Definition: CWGraph.cxx:1581
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
bool readGroupHeader(CWGraphInternal::Group &group)
Definition: CWGraph.cxx:1497
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
virtual ~CWGraph()
destructor
Definition: CWGraph.cxx:726
float getPatternPercent(int id) const
return the pattern percent which corresponds to an id (or -1)
Definition: CWGraph.cxx:773
MWAWParserStatePtr m_parserState
the parser state
Definition: CWGraph.hxx:197
shared_ptr< CWStruct::DSET > readGroupZone(CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete)
reads the zone Group DSET
Definition: CWGraph.cxx:832
bool getWallPaperColor(int id, MWAWColor &col) const
return the wall paper color which corresponds to an id (if possible)
Definition: CWGraph.cxx:785
shared_ptr< CWGraphInternal::State > m_state
the state
Definition: CWGraph.hxx:200
Internal: structure to store a bitmap of a CWGraph.
Definition: CWGraph.cxx:375
CWParser * m_mainParser
the main parser;
Definition: CWGraph.hxx:203
bool readBitmapColorMap(std::vector< MWAWColor > &cMap)
Definition: CWGraph.cxx:2005

Generated on Fri May 2 2014 17:42:20 for libmwaw by doxygen 1.8.5