GreatWksGraph.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 GreatWorks text document ( graphic part )
36  *
37  */
38 #ifndef GREAT_WKS_GRAPH
39 # define GREAT_WKS_GRAPH
40 
41 #include <set>
42 #include <string>
43 #include <vector>
44 
45 #include <librevenge/librevenge.h>
46 
47 #include "libmwaw_internal.hxx"
48 
49 #include "MWAWDebug.hxx"
50 #include "MWAWInputStream.hxx"
51 
52 namespace GreatWksGraphInternal
53 {
54 struct Frame;
55 struct FrameGroup;
56 struct FrameShape;
57 struct FrameText;
58 struct Zone;
59 
60 struct State;
61 class SubDocument;
62 }
63 
64 class GreatWksDocument;
65 class GreatWksParser;
66 class GreatWksDBParser;
67 class GreatWksDRParser;
68 class GreatWksSSParser;
69 
76 {
77  friend class GreatWksDocument;
78  friend class GreatWksParser;
79  friend class GreatWksDBParser;
80  friend class GreatWksDRParser;
81  friend class GreatWksSSParser;
83 
84 public:
86  explicit GreatWksGraph(GreatWksDocument &document);
88  virtual ~GreatWksGraph();
89 
91  int version() const;
92 
94  int numPages() const;
95 
96 protected:
98  bool sendPageGraphics();
100  void flushExtra();
101 
102  //
103  // Intermediate level
104  //
105 
106  // RSRC
108  bool readPatterns(MWAWEntry const &entry);
110  bool readPalettes(MWAWEntry const &entry);
111 
112  // DataFork: pict
116  bool sendFrame(shared_ptr<GreatWksGraphInternal::Frame> frame, GreatWksGraphInternal::Zone const &zone);
117 
119  bool sendGroup(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos);
126 
130  bool sendTextboxAsGraphic(MWAWBox2f const &box, GreatWksGraphInternal::FrameText const &text, MWAWGraphicStyle const &style, MWAWListenerPtr listener);
132  bool sendTextbox(MWAWEntry const &entry, MWAWListenerPtr listener);
133 
135  bool sendPicture(MWAWEntry const &entry, MWAWPosition pos);
137  bool sendShape(GreatWksGraphInternal::FrameShape const &graph, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos);
138 
139  // DataFork: graphic zone
140 
142  bool readGraphicZone();
144  bool isGraphicZone();
146  bool findGraphicZone();
147 
149  bool isPageFrames();
151  bool readPageFrames();
153  shared_ptr<GreatWksGraphInternal::Frame> readFrameHeader();
155  bool readFrameExtraData(GreatWksGraphInternal::Frame &frame, int id, long endPos=-1);
156 
158  bool readStyle(MWAWGraphicStyle &style);
160  bool readLineFormat(std::string &extra);
161 
162  // interface with mainParser
163 
164  //
165  // low level
166  //
168  bool readFrameExtraDataRec(GreatWksGraphInternal::Zone &zone, int id, std::set<int> &seens, long endPos=-1);
170  bool checkGraph(GreatWksGraphInternal::Zone &zone, int id, std::set<int> &seens);
171 
172 private:
173  GreatWksGraph(GreatWksGraph const &orig);
174  GreatWksGraph &operator=(GreatWksGraph const &orig);
175 
176 protected:
177  //
178  // data
179  //
185  shared_ptr<GreatWksGraphInternal::State> m_state;
188 };
189 #endif
190 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:

Generated on Tue Mar 1 2016 23:42:43 for libmwaw by doxygen 1.8.4