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:

Generated on Wed Jul 10 2013 18:19:39 for libmwaw by doxygen 1.8.4