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 
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:

Generated on Tue Apr 30 2013 06:16:18 for libmwaw by doxygen 1.8.3.1