WPS8Graph.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwps
3  * Version: MPL 2.0 / LGPLv2.1+
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * Major Contributor(s):
10  * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
11  * Copyright (C) 2006, 2007 Andrew Ziem
12  * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
13  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
14  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
15  *
16  * For minor contributions see the git repository.
17  *
18  * Alternatively, the contents of this file may be used under the terms
19  * of the GNU Lesser General Public License Version 2.1 or later
20  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
21  * applicable instead of those above.
22  *
23  * For further information visit http://libwps.sourceforge.net
24  */
25 
26 #ifndef WPS8_GRAPH
27 # define WPS8_GRAPH
28 
29 #include <list>
30 #include <vector>
31 
32 #include "libwps_internal.h"
33 
34 #include "WPSDebug.h"
35 
36 class WPXBinaryData;
37 
38 class WPSEntry;
39 class WPS8Parser;
40 class WPSPosition;
41 
43 typedef shared_ptr<WPS8ContentListener> WPS8ContentListenerPtr;
44 
45 namespace WPS8GraphInternal
46 {
47 struct State;
48 }
49 
60 class WPS8Graph
61 {
62  friend class WPS8Parser;
63 public:
65  WPS8Graph(WPS8Parser &parser);
66 
68  ~WPS8Graph();
69 
72  {
73  m_listener = listen;
74  }
75 
80  void computePositions() const;
81 
83  int numPages() const;
84 
89  bool sendObject(WPSPosition const &pos, int id, bool ole);
90 
92  bool sendIBGF(WPSPosition const &pos, int ibgfId);
93 
101  void sendObjects(int page, int pageToIgnore=-2);
102 
103 protected:
105  int version() const;
106 
110  void sendBorder(int borderId);
111 
113  void storeObjects(std::vector<WPXBinaryData> const &objects,
114  std::vector<int> const &ids,
115  std::vector<WPSPosition> const &positions);
116 
118  bool readStructures(WPXInputStreamPtr input);
119 
120  // low level
121 
125  bool readPICT(WPXInputStreamPtr input, WPSEntry const &entry);
126 
131  bool readIBGF(WPXInputStreamPtr input, WPSEntry const &entry);
132 
134  bool readBDR(WPXInputStreamPtr input, WPSEntry const &entry);
135 
139  bool readMetaFile(WPXInputStreamPtr input, long endPos, WPXBinaryData &pict);
140 
143  {
144  return m_asciiFile;
145  }
146 private:
147  WPS8Graph(WPS8Graph const &orig);
148  WPS8Graph &operator=(WPS8Graph const &orig);
149 
150 protected:
153 
156 
158  mutable shared_ptr<WPS8GraphInternal::State> m_state;
159 
162 };
163 
164 #endif
165 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
libwps::DebugFile & ascii()
returns the debug file
Definition: WPS8Graph.h:142
shared_ptr< WPS8GraphInternal::State > m_state
the state
Definition: WPS8Graph.h:158
void storeObjects(std::vector< WPXBinaryData > const &objects, std::vector< int > const &ids, std::vector< WPSPosition > const &positions)
adds a list of objects with given ids in the ole lists
Definition: WPS8Graph.cpp:139
This class parses Works version 2000 through 8.
Definition: WPS8.h:53
int version() const
returns the file version
Definition: WPS8Graph.cpp:119
shared_ptr< WPXInputStream > WPXInputStreamPtr
Definition: libwps_internal.h:74
the main class to read/store pictures in a Pc MS Works document v5-8
Definition: WPS8Graph.h:60
bool readMetaFile(WPXInputStreamPtr input, long endPos, WPXBinaryData &pict)
reads METAFILE/CODE
Definition: WPS8Graph.cpp:686
Definition: WPSDebug.h:198
void sendObjects(int page, int pageToIgnore=-2)
send all the objects of a given page:
Definition: WPS8Graph.cpp:262
Definition: WPSContentListener.h:168
bool readBDR(WPXInputStreamPtr input, WPSEntry const &entry)
parsed BDR/WBDR zone: a complex border formed with 8 pictures
Definition: WPS8Graph.cpp:521
bool readPICT(WPXInputStreamPtr input, WPSEntry const &entry)
reads a PICT/MEF4 entry : reads uncompressed picture of sx*sy of rgb
Definition: WPS8Graph.cpp:383
bool readIBGF(WPXInputStreamPtr input, WPSEntry const &entry)
reads a IBGF zone: an entry to a background picture
Definition: WPS8Graph.cpp:459
void computePositions() const
computes the final position of all found figures.
Definition: WPS8Graph.cpp:134
~WPS8Graph()
destructor
Definition: WPS8Graph.cpp:113
WPS8ContentListenerPtr m_listener
the listener
Definition: WPS8Graph.h:152
shared_ptr< WPS8ContentListener > WPS8ContentListenerPtr
Definition: WPS8Graph.h:43
bool readStructures(WPXInputStreamPtr input)
finds all entries which correspond to some pictures, parses them and stores data
Definition: WPS8Graph.cpp:162
bool sendObject(WPSPosition const &pos, int id, bool ole)
sends an object
Definition: WPS8Graph.cpp:206
void sendBorder(int borderId)
sends the border frames.
Definition: WPS8Graph.cpp:339
libwps::DebugFile & m_asciiFile
the ascii file
Definition: WPS8Graph.h:161
void setListener(WPS8ContentListenerPtr &listen)
sets the listener
Definition: WPS8Graph.h:71
int numPages() const
returns the number page where we find a picture. In practice, 0/1
Definition: WPS8Graph.cpp:126
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:37
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: WPSPosition.h:39
WPS8Graph(WPS8Parser &parser)
constructor
Definition: WPS8Graph.cpp:107
WPS8Parser & m_mainParser
the main parser
Definition: WPS8Graph.h:155
WPS8Graph & operator=(WPS8Graph const &orig)
bool sendIBGF(WPSPosition const &pos, int ibgfId)
sends data corresponding to a ibgf entry on a given pos position
Definition: WPS8Graph.cpp:243

Generated on Wed Jun 11 2014 02:26:01 for libwps by doxygen 1.8.5