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:
bool sendGroupChild(CWGraphInternal::Group &group, size_t child, MWAWPosition position)
send a group child
Definition: CWGraph.cxx:2497
bool readPICT(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1723
main structure which correspond to a document part
Definition: CWStruct.hxx:55
a structure to store the style list and the lookup zone
Definition: CWStyleManager.hxx:59
bool readShape(MWAWEntry const &entry, CWGraphInternal::ZoneShape &zone)
Definition: CWGraph.cxx:1283
bool readNamedPict(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1891
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: CWGraph.cxx:2817
bool readGroupData(CWGraphInternal::Group &group, long beginGroupPos)
Definition: CWGraph.cxx:1149
void checkNumberAccrossPages(CWGraphInternal::Group &group) const
check the number of accross page ( for draw document )
Definition: CWGraph.cxx:2055
shared_ptr< CWStyleManager > m_styleManager
the style manager
Definition: CWGraph.hxx:217
bool readPolygonData(shared_ptr< CWGraphInternal::Zone > zone)
Definition: CWGraph.cxx:1558
void askToSend(int number, bool asGraphic, MWAWPosition const &pos=MWAWPosition())
ask the main parser to send a zone
Definition: CWGraph.cxx:665
bool canSendAsGraphic(CWGraphInternal::Group &group) const
check if we can send a group as graphic
Definition: CWGraph.cxx:2241
This class contains the minimal code needed to write a Graphic sub document.
Definition: MWAWGraphicListener.hxx:60
void setSlideList(std::vector< int > const &slideList)
set the slide list ( for presentation )
Definition: CWGraph.cxx:2832
the class to store a color
Definition: libmwaw_internal.hxx:166
CWGraph & operator=(CWGraph const &orig)
bool sendShape(CWGraphInternal::ZoneShape &pict, MWAWPosition pos)
sends a basic graphic zone
Definition: CWGraph.cxx:2601
the main class to read the graphic part of Claris Works file
Definition: CWGraph.hxx:75
Internal: class which stores a group of graphics, ...
Definition: CWGraph.cxx:445
bool sendBitmap(int number, bool asGraphic, MWAWPosition const &pos=MWAWPosition())
sends the bitmap data to the listener (if it exists )
Definition: CWGraph.cxx:2628
bool readQTimeData(shared_ptr< CWGraphInternal::Zone > zone)
Definition: CWGraph.cxx:1854
bool readOLE(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1806
Internal: the subdocument of a CWGraph.
Definition: CWGraph.cxx:539
bool readPS(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1766
bool readPictData(shared_ptr< CWGraphInternal::Zone > zone)
Definition: CWGraph.cxx:1660
Internal: the structure used to store a style of a CWGraph.
Definition: CWGraph.cxx:104
int numPages() const
returns the number of pages
Definition: CWGraph.cxx:621
bool sendPicture(CWGraphInternal::ZonePict &pict, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList())
sends a picture zone
Definition: CWGraph.cxx:2744
int version() const
returns the file version
Definition: CWGraph.cxx:616
the main class to read a Claris Works file
Definition: CWParser.hxx:73
bool canSendGroupAsGraphic(int number) const
check if we can send a group as graphic
Definition: CWGraph.cxx:2208
shared_ptr< CWGraphInternal::Zone > readGroupDef(MWAWEntry const &entry)
Definition: CWGraph.cxx:895
shared_ptr< CWStruct::DSET > readBitmapZone(CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete)
reads the zone Bitmap DSET
Definition: CWGraph.cxx:779
void updateInformation(CWGraphInternal::Group &group) const
update the group information to choose how to send the group data
Definition: CWGraph.cxx:2072
Internal: structure to store a bitmap of a CWGraph.
Definition: CWGraph.cxx:311
CWGraph(CWParser &parser)
constructor
Definition: CWGraph.cxx:607
Internal: the structure used to store a PICT or a MOVIE.
Definition: CWGraph.cxx:251
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:356
bool readGroupUnknown(CWGraphInternal::Group &group, int zoneSz, int id)
Definition: CWGraph.cxx:1495
bool readBitmapData(CWGraphInternal::Bitmap &zone)
Definition: CWGraph.cxx:1988
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:1411
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
virtual ~CWGraph()
destructor
Definition: CWGraph.cxx:613
MWAWParserStatePtr m_parserState
the parser state
Definition: CWGraph.hxx:208
shared_ptr< CWStruct::DSET > readGroupZone(CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete)
reads the zone Group DSET
Definition: CWGraph.cxx:685
shared_ptr< CWGraphInternal::State > m_state
the state
Definition: CWGraph.hxx:211
Internal: small class to store a basic graphic zone of a CWGraph.
Definition: CWGraph.cxx:212
bool getSurfaceColor(CWGraphInternal::Style const &style, MWAWColor &col) const
return the surface color which corresponds to some ids (if possible)
Definition: CWGraph.cxx:673
CWParser * m_mainParser
the main parser;
Definition: CWGraph.hxx:214
bool sendGroup(int number, bool asGraphic, MWAWPosition const &pos=MWAWPosition())
sends the zone data to the listener (if it exists )
Definition: CWGraph.cxx:2217
bool canSendBitmapAsGraphic(int number) const
check if we can send a group as graphic
Definition: CWGraph.cxx:2617
bool readBitmapColorMap(std::vector< MWAWColor > &cMap)
Definition: CWGraph.cxx:1941

Generated on Tue Mar 10 2015 17:32:08 for libmwaw by doxygen 1.8.5