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 class MWAWEntry;
54 
56 typedef shared_ptr<MWAWParserState> MWAWParserStatePtr;
57 
58 namespace CWGraphInternal
59 {
60 struct Group;
61 struct State;
62 struct Style;
63 struct Zone;
64 struct ZoneBasic;
65 struct ZoneBitmap;
66 struct ZonePict;
67 }
68 
69 class CWParser;
70 class CWStyleManager;
71 
77 class CWGraph
78 {
79  friend class CWParser;
80 
81 public:
83  CWGraph(CWParser &parser);
85  virtual ~CWGraph();
86 
88  int version() const;
89 
91  int numPages() const;
92 
94  shared_ptr<CWStruct::DSET> readGroupZone
95  (CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
96 
98  shared_ptr<CWStruct::DSET> readBitmapZone
99  (CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
100 
102  bool readColorList(MWAWEntry const &entry);
103 
105  bool getColor(int id, MWAWColor &col) const;
106 
108  float getPatternPercent(int id) const;
109 
111  bool getWallPaperColor(int id, MWAWColor &col) const;
112 
114  bool getLineColor(CWGraphInternal::Style const style, MWAWColor &col) const;
116  bool getSurfaceColor(CWGraphInternal::Style const style, MWAWColor &col) const;
117 protected:
119  bool sendZone(int number, MWAWPosition pos=MWAWPosition());
120 
122  void flushExtra();
123 
124  //
125  // Intermediate level
126  //
127 
129  void updateInformation(CWGraphInternal::Group &group) const;
130  /* read a simple group */
131  shared_ptr<CWGraphInternal::Zone> readGroupDef(MWAWEntry const &entry);
132 
133  /* read a simple graphic zone */
134  bool readBasicGraphic(MWAWEntry const &entry,
136 
137  /* read the group data.
138 
139  \note \a beginGroupPos is only used to help debugging */
140  bool readGroupData(CWGraphInternal::Group &group, long beginGroupPos);
141 
142  /* try to read the polygon data */
143  bool readPolygonData(shared_ptr<CWGraphInternal::Zone> zone);
144 
146  /* try to read a pict data zone */
147  bool readPictData(shared_ptr<CWGraphInternal::Zone> zone);
148 
149  /* read a picture */
151 
152  /* read a postcript zone */
153  bool readPS(CWGraphInternal::ZonePict &zone);
154 
155  /* read a ole document zone */
157 
159  /* try to read the qtime data zone */
160  bool readQTimeData(shared_ptr<CWGraphInternal::Zone> zone);
161 
162  /* read a named picture */
164 
166  /* try to read a bitmap zone */
167  bool readBitmapColorMap(std::vector<MWAWColor> &cMap);
168 
169  /* try to read the bitmap */
171  //
172  // low level
173  //
174 
175  /* read the first zone of a group type */
177 
178  /* read some unknown data in first zone */
179  bool readGroupUnknown(CWGraphInternal::Group &group, int zoneSz, int id);
180 
183  WPXPropertyList extras = WPXPropertyList());
184 
187  WPXPropertyList extras = WPXPropertyList());
188 
191  WPXPropertyList extras = WPXPropertyList());
192 
193 private:
194  CWGraph(CWGraph const &orig);
195  CWGraph &operator=(CWGraph const &orig);
196 
197 protected:
198  //
199  // data
200  //
203 
205  shared_ptr<CWGraphInternal::State> m_state;
206 
209 
211  shared_ptr<CWStyleManager> m_styleManager;
212 };
213 #endif
214 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
bool readPICT(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1789
main structure which correspond to a document part
Definition: CWStruct.hxx:55
shared_ptr< MWAWParserState > MWAWParserStatePtr
Definition: ACText.hxx:49
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:64
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:1957
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: CWGraph.cxx:2649
bool readGroupData(CWGraphInternal::Group &group, long beginGroupPos)
Definition: CWGraph.cxx:1302
shared_ptr< CWStyleManager > m_styleManager
the style manager
Definition: CWGraph.hxx:211
bool readPolygonData(shared_ptr< CWGraphInternal::Zone > zone)
Definition: CWGraph.cxx:1648
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:2184
the main class to read the graphic part of Claris Works file
Definition: CWGraph.hxx:77
Internal: class which stores a group of graphics, ...
Definition: CWGraph.cxx:521
bool readQTimeData(shared_ptr< CWGraphInternal::Zone > zone)
Definition: CWGraph.cxx:1920
bool readOLE(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1872
a class to define the parser state
Definition: MWAWParser.hxx:60
bool readPS(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1832
bool readPictData(shared_ptr< CWGraphInternal::Zone > zone)
Definition: CWGraph.cxx:1726
Internal: the structure used to store a style of a CWGraph.
Definition: CWGraph.cxx:101
bool readBitmapData(CWGraphInternal::ZoneBitmap &zone)
Definition: CWGraph.cxx:2054
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:2581
bool sendBasicPicture(CWGraphInternal::ZoneBasic &pict, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList())
sends a basic graphic zone
Definition: CWGraph.cxx:2356
int version() const
returns the file version
Definition: CWGraph.cxx:729
the main class to read a Claris Works file
Definition: CWParser.hxx:75
shared_ptr< CWGraphInternal::Zone > readGroupDef(MWAWEntry const &entry)
Definition: CWGraph.cxx:1098
shared_ptr< CWStruct::DSET > readBitmapZone(CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete)
reads the zone Bitmap DSET
Definition: CWGraph.cxx:976
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:2088
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:2515
bool readBasicGraphic(MWAWEntry const &entry, CWGraphInternal::ZoneBasic &zone)
Definition: CWGraph.cxx:1437
bool readGroupUnknown(CWGraphInternal::Group &group, int zoneSz, int id)
Definition: CWGraph.cxx:1582
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:1498
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:202
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:205
Internal: structure to store a bitmap of a CWGraph.
Definition: CWGraph.cxx:375
CWParser * m_mainParser
the main parser;
Definition: CWGraph.hxx:208
bool readBitmapColorMap(std::vector< MWAWColor > &cMap)
Definition: CWGraph.cxx:2007

Generated for libmwaw by doxygen 1.8.5