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 #include "MWAWPosition.hxx"
51 
52 #include "CWStruct.hxx"
53 
54 namespace CWGraphInternal
55 {
56 struct Group;
57 struct State;
58 struct Style;
59 struct Zone;
60 struct ZoneShape;
61 struct Bitmap;
62 struct ZonePict;
63 
64 class SubDocument;
65 }
66 
67 class CWParser;
68 class CWStyleManager;
69 
75 class CWGraph
76 {
78  friend class CWParser;
79 
80 public:
82  CWGraph(CWParser &parser);
84  virtual ~CWGraph();
85 
87  int version() const;
88 
90  int numPages() const;
91 
93  shared_ptr<CWStruct::DSET> readGroupZone
94  (CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
95 
97  shared_ptr<CWStruct::DSET> readBitmapZone
98  (CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
99 
101  bool getSurfaceColor(CWGraphInternal::Style const &style, MWAWColor &col) const;
102 protected:
104  void setSlideList(std::vector<int> const &slideList);
106  bool canSendGroupAsGraphic(int number) const;
108  bool sendGroup(int number, bool asGraphic, MWAWPosition const &pos=MWAWPosition());
110  bool canSendBitmapAsGraphic(int number) const;
112  bool sendBitmap(int number, bool asGraphic, MWAWPosition const &pos=MWAWPosition());
113 
115  void flushExtra();
116 
117  // interface with main parser
118 
120  void askToSend(int number, bool asGraphic, MWAWPosition const &pos=MWAWPosition());
121 
122  //
123  // Intermediate level
124  //
125 
129  void updateInformation(CWGraphInternal::Group &group) const;
131  bool canSendAsGraphic(CWGraphInternal::Group &group) const;
133  bool sendGroup(CWGraphInternal::Group &group, MWAWPosition const &position);
135  bool sendGroup(CWGraphInternal::Group &group, std::vector<size_t> const &lChild, MWAWGraphicListener &listener);
137  bool sendGroupChild(CWGraphInternal::Group &group, size_t child, MWAWPosition position);
138  /* read a simple group */
139  shared_ptr<CWGraphInternal::Zone> readGroupDef(MWAWEntry const &entry);
140 
141  /* read a simple graphic zone */
142  bool readShape(MWAWEntry const &entry,
144 
145  /* read the group data.
146 
147  \note \a beginGroupPos is only used to help debugging */
148  bool readGroupData(CWGraphInternal::Group &group, long beginGroupPos);
149 
150  /* try to read the polygon data */
151  bool readPolygonData(shared_ptr<CWGraphInternal::Zone> zone);
152 
154  /* try to read a pict data zone */
155  bool readPictData(shared_ptr<CWGraphInternal::Zone> zone);
156 
157  /* read a picture */
159 
160  /* read a postcript zone */
161  bool readPS(CWGraphInternal::ZonePict &zone);
162 
163  /* read a ole document zone */
165 
167  /* try to read the qtime data zone */
168  bool readQTimeData(shared_ptr<CWGraphInternal::Zone> zone);
169 
170  /* read a named picture */
172 
174  /* try to read a bitmap zone */
175  bool readBitmapColorMap(std::vector<MWAWColor> &cMap);
176 
177  /* try to read the bitmap */
179  //
180  // low level
181  //
182 
183  /* read the first zone of a group type */
185 
186  /* read some unknown data in first zone */
187  bool readGroupUnknown(CWGraphInternal::Group &group, int zoneSz, int id);
188 
191  WPXPropertyList extras = WPXPropertyList());
192 
195 
197  bool sendBitmap(CWGraphInternal::Bitmap &pict, bool asGraphic, MWAWPosition pos);
198 
199 private:
200  CWGraph(CWGraph const &orig);
201  CWGraph &operator=(CWGraph const &orig);
202 
203 protected:
204  //
205  // data
206  //
209 
211  shared_ptr<CWGraphInternal::State> m_state;
212 
215 
217  shared_ptr<CWStyleManager> m_styleManager;
218 };
219 #endif
220 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:

Generated on Tue May 6 2014 09:50:46 for libmwaw by doxygen 1.8.3.1