MSKGraph.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 Microsoft Works text document ( graphic part )
36  *
37  */
38 #ifndef MSK_MWAW_GRAPH
39 # define MSK_MWAW_GRAPH
40 
41 #include <list>
42 #include <string>
43 #include <vector>
44 
45 #include "MWAWPosition.hxx"
46 
47 #include "MWAWEntry.hxx"
48 #include "MWAWParser.hxx"
49 
51 typedef shared_ptr<MWAWParserState> MWAWParserStatePtr;
52 
53 namespace MSKGraphInternal
54 {
55 struct Font;
56 struct Zone;
57 struct DataPict;
58 struct Table;
59 struct GroupZone;
60 struct TextBox;
61 struct State;
62 class SubDocument;
63 }
64 
65 class MSKParser;
66 class MSK3Parser;
67 class MSK4Zone;
68 
74 class MSKGraph
75 {
76  friend class MSK3Parser;
77  friend class MSK4Zone;
79 public:
81  MSKGraph(MSKParser &parser);
83  virtual ~MSKGraph();
84 
86  int version() const;
87 
89  int numPages(int zoneId) const;
90 
92  void send(int id, MWAWPosition::AnchorTo anchor);
93 
95  void sendAll(int zoneId, bool mainZone);
96 
97  struct SendData {
98  // constructor
99  SendData();
101  enum Type { RBDR, RBIL, ALL } m_type;
103  int m_id;
107  int m_page;
110  };
112  void sendObjects(SendData const what);
113 
115  void computePositions(int zoneId, std::vector<int> &linesHeight, std::vector<int> &pagesHeight);
116 
117 protected:
119  void flushExtra();
120 
121  //
122  // Intermediate level
123  //
124 
127 
131  int getEntryPictureV1(int zoneId, MWAWEntry &zone);
132 
136  int getEntryPicture(int zoneId, MWAWEntry &zone);
137 
138  // version 4 file
139 
141  bool readRB(MWAWInputStreamPtr input, MWAWEntry const &entry);
142 
143 
145  bool readPictureV4(MWAWInputStreamPtr input, MWAWEntry const &entry);
146 
148  bool readText(MSKGraphInternal::TextBox &textBox);
150  void sendTextBox(int id);
152  void checkTextBoxLinks(int zId);
153 
155  void sendFrameText(MWAWEntry const &entry, std::string const &frame);
156 
158  bool readTable(MSKGraphInternal::Table &table);
160  void sendTable(int id);
161 
163  bool readChart(MSKGraphInternal::Zone &zone);
164 
165  //
166  // low level
167  //
169  shared_ptr<MSKGraphInternal::GroupZone> readGroup(MSKGraphInternal::Zone &group);
170 
172  bool readFont(MSKGraphInternal::Font &font);
173 
174 private:
175  MSKGraph(MSKGraph const &orig);
176  MSKGraph &operator=(MSKGraph const &orig);
177 
178 protected:
179  //
180  // data
181  //
184 
186  shared_ptr<MSKGraphInternal::State> m_state;
187 
190 };
191 #endif
192 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Definition: MSKGraph.hxx:101
int getEntryPictureV1(int zoneId, MWAWEntry &zone)
checks if the next zone is a v1 picture and returns a zone id.
Definition: MSKGraph.cxx:1658
void send(int id, MWAWPosition::AnchorTo anchor)
send a zone (textbox, ...)
Definition: MSKGraph.cxx:2572
shared_ptr< MWAWParserState > MWAWParserStatePtr
Definition: ACText.hxx:49
bool readRB(MWAWInputStreamPtr input, MWAWEntry const &entry)
reads the RBDR or a RBIL zone: a zone which seems to regroup all pages pictures
Definition: MSKGraph.cxx:1725
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
Definition: ACText.hxx:44
Definition: MSKGraph.hxx:101
Definition: MSKGraph.hxx:101
virtual ~MSKGraph()
destructor
Definition: MSKGraph.cxx:1003
Internal: the generic pict.
Definition: MSKGraph.cxx:156
bool readChart(MSKGraphInternal::Zone &zone)
try to read a chart (very incomplete)
Definition: MSKGraph.cxx:2241
the main class to read the text part of Claris Works file
Definition: MSKGraph.hxx:74
void sendTable(int id)
try to a table zone
Definition: MSKGraph.cxx:2455
MWAWPosition::AnchorTo m_anchor
the anchor
Definition: MSKGraph.hxx:105
Internal: the subdocument of a MSKGraph.
Definition: MSKGraph.cxx:899
void checkTextBoxLinks(int zId)
check the text box link
Definition: MSKGraph.cxx:1836
Internal: the fonts.
Definition: MSKGraph.cxx:65
bool readTable(MSKGraphInternal::Table &table)
try to read a table zone
Definition: MSKGraph.cxx:2120
SendData()
Definition: MSKGraph.cxx:2751
Definition: MSKGraph.hxx:97
bool readText(MSKGraphInternal::TextBox &textBox)
try to read a text zone
Definition: MSKGraph.cxx:1973
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: MSKGraph.cxx:2739
a class to define the parser state
Definition: MWAWParser.hxx:60
Type
the type
Definition: MSKGraph.hxx:101
AnchorTo
a list of enum used to defined the anchor
Definition: MWAWPosition.hxx:51
generic parser for Microsoft Works file
Definition: MSKParser.hxx:58
int m_page
the page ( used if anchor==page)
Definition: MSKGraph.hxx:107
MSKGraph(MSKParser &parser)
constructor
Definition: MSKGraph.cxx:997
void sendTextBox(int id)
send a textbox to the listener
Definition: MSKGraph.cxx:2390
the main class to read a Microsoft Works file
Definition: MSK3Parser.hxx:62
MSKGraph & operator=(MSKGraph const &orig)
The class which parses the main zones of a mac MS Works document v4.
Definition: MSK4Zone.hxx:80
int version() const
returns the file version
Definition: MSKGraph.cxx:1006
Internal: the textbox of a MSKGraph ( v2-v3)
Definition: MSKGraph.cxx:769
shared_ptr< MSKGraphInternal::State > m_state
the state
Definition: MSKGraph.hxx:186
int m_id
the rbil id
Definition: MSKGraph.hxx:103
bool readPictHeader(MSKGraphInternal::Zone &pict)
read the picture header
Definition: MSKGraph.cxx:1040
void sendAll(int zoneId, bool mainZone)
send all the picture corresponding to a zone
Definition: MSKGraph.cxx:2655
int numPages(int zoneId) const
returns the number of pages
Definition: MSKGraph.cxx:1013
bool readPictureV4(MWAWInputStreamPtr input, MWAWEntry const &entry)
reads a Pict zone: a zone which seems to code in v4 : header/footer picture
Definition: MSKGraph.cxx:1900
void sendObjects(SendData const what)
sends all the object of a page, frame, ...
Definition: MSKGraph.cxx:2665
void sendFrameText(MWAWEntry const &entry, std::string const &frame)
ask m_mainParser to send a frame text(v4)
Definition: MSKGraph.cxx:1030
MWAWParserStatePtr m_parserState
the parser state
Definition: MSKGraph.hxx:183
void computePositions(int zoneId, std::vector< int > &linesHeight, std::vector< int > &pagesHeight)
try to update positions knowing pages and lines height
Definition: MSKGraph.cxx:1625
bool readFont(MSKGraphInternal::Font &font)
reads the textbox font
Definition: MSKGraph.cxx:2527
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
enum MSKGraph::SendData::Type m_type
Internal: the table of a MSKGraph.
Definition: MSKGraph.cxx:721
shared_ptr< MSKGraphInternal::GroupZone > readGroup(MSKGraphInternal::Zone &group)
try to read the group data
Definition: MSKGraph.cxx:1932
int getEntryPicture(int zoneId, MWAWEntry &zone)
checks if the next zone is a v2 picture and returns a zone id.
Definition: MSKGraph.cxx:1151
MSKParser * m_mainParser
the main parser;
Definition: MSKGraph.hxx:189
Vec2i m_size
the size of the data ( used by rbil )
Definition: MSKGraph.hxx:109

Generated for libmwaw by doxygen 1.8.5