WPS4.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) 2006, 2007 Andrew Ziem
11  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
12  * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
13  *
14  * For minor contributions see the git repository.
15  *
16  * Alternatively, the contents of this file may be used under the terms
17  * of the GNU Lesser General Public License Version 2.1 or later
18  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
19  * applicable instead of those above.
20  */
21 
22 #ifndef WPS4_H
23 #define WPS4_H
24 
25 #include <vector>
26 
27 #include <libwpd-stream/WPXStream.h>
28 #include "libwps_internal.h"
29 
30 #include "WPSParser.h"
31 
32 class WPXString;
35 class WPSEntry;
36 class WPSPosition;
37 class WPSPageSpan;
38 
39 namespace WPS4ParserInternal
40 {
41 class SubDocument;
42 struct State;
43 }
44 
45 class WPS4Graph;
46 class WPS4Text;
47 
52 class WPS4Parser : public WPSParser
53 {
55  friend class WPS4Graph;
56  friend class WPS4Text;
57 
58 public:
60  WPS4Parser(WPXInputStreamPtr &input, WPSHeaderPtr &header);
62  ~WPS4Parser();
64  void parse(WPXDocumentInterface *documentInterface);
65 protected:
67  bool getColor(int id, uint32_t &color) const;
68 
70  long getSizeFile() const;
72  void setSizeFile(long sz);
74  bool checkInFile(long pos);
75 
77  void newPage(int number);
79  void setListener(shared_ptr<WPS4ContentListener> listener);
80 
82  bool createStructures();
84  bool createOLEStructures();
86  shared_ptr<WPS4ContentListener> createListener(WPXDocumentInterface *interface);
87 
88  // interface with text parser
89 
91  float pageHeight() const;
93  float pageWidth() const;
95  int numColumns() const;
96 
100  void createDocument(WPSEntry const &entry, libwps::SubDocumentType type);
102  void createNote(WPSEntry const &entry, WPXString const &label);
104  void createTextBox(WPSEntry const &entry, WPSPosition const &pos, WPXPropertyList &extras);
106  void send(WPSEntry const &entry, libwps::SubDocumentType type);
107 
108  // interface with graph parser
109 
113  int readObject(WPXInputStreamPtr input, WPSEntry const &entry);
114 
118  void sendObject(Vec2f const &size, int id);
119 
120  //
121  // low level
122  //
123 
125  bool findZones();
126 
130  bool parseEntry(std::string const &name);
131 
133  bool readDocDim();
134 
136  bool readPrnt(WPSEntry const &entry);
137 
142  bool readDocWindowsInfo(WPSEntry const &entry);
143 
144  shared_ptr<WPS4ContentListener> m_listener; /* the listener (if set)*/
146  shared_ptr<WPS4Graph> m_graphParser;
148  shared_ptr<WPS4Text> m_textParser;
150  shared_ptr<WPS4ParserInternal::State> m_state;
151 };
152 
153 #endif /* WPS4_H */
154 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
shared_ptr< WPS4Graph > m_graphParser
the graph parser
Definition: WPS4.h:146
void createTextBox(WPSEntry const &entry, WPSPosition const &pos, WPXPropertyList &extras)
creates a textbox and then send the data
Definition: WPS4.cpp:350
Internal: the subdocument of a WPS4Parser.
Definition: WPS4.cpp:46
int numColumns() const
returns the number of columns
Definition: WPS4.cpp:174
float pageWidth() const
returns the page width, ie. paper size less margin (in inches)
Definition: WPS4.cpp:169
shared_ptr< WPXInputStream > WPXInputStreamPtr
Definition: libwps_internal.h:74
bool findZones()
finds the different zones (text, print, ...) and updates nameMultiMap
Definition: WPS4.cpp:515
int readObject(WPXInputStreamPtr input, WPSEntry const &entry)
tries to read a picture ( via its WPS4Graph )
Definition: WPS4.cpp:302
void parse(WPXDocumentInterface *documentInterface)
called by WPSDocument to parse the file
Definition: WPS4.cpp:359
This class parses Works version 2 through 4.
Definition: WPS4.h:52
void send(WPSEntry const &entry, libwps::SubDocumentType type)
sends text corresponding to the entry to the listener (via WPS4Text)
Definition: WPS4.cpp:315
bool parseEntry(std::string const &name)
parses an entry
Definition: WPS4.cpp:479
WPSContentListener WPS4ContentListener
Definition: WPS4.h:33
bool readDocDim()
tries to read the document dimension
Definition: WPS4.cpp:755
Definition: WPSContentListener.h:168
shared_ptr< WPS4ContentListener > m_listener
Definition: WPS4.h:144
Definition: WPSParser.h:41
the main class to read/store picture in a Pc MS Works document v1-4
Definition: WPS4Graph.h:62
bool createStructures()
tries to parse the main zone, ...
Definition: WPS4.cpp:415
WPS4Parser(WPXInputStreamPtr &input, WPSHeaderPtr &header)
constructor
Definition: WPS4.cpp:150
void createNote(WPSEntry const &entry, WPXString const &label)
creates a document for a footnote entry with label and then send the data
Definition: WPS4.cpp:342
SubDocumentType
Definition: libwps_internal.h:265
bool getColor(int id, uint32_t &color) const
color
Definition: WPS4.cpp:179
std::string name(long id)
returns the name given Windows© id
Definition: libwps_tools_win.cpp:409
shared_ptr< WPS4Text > m_textParser
the text parser
Definition: WPS4.h:148
void setListener(shared_ptr< WPS4ContentListener > listener)
set the listener
Definition: WPS4.cpp:238
bool readPrnt(WPSEntry const &entry)
tries to read the printer information
Definition: WPS4.cpp:822
shared_ptr< WPS4ContentListener > createListener(WPXDocumentInterface *interface)
creates the main listener
Definition: WPS4.cpp:245
void setSizeFile(long sz)
sets the file size ( filled by WPS4Text )
Definition: WPS4.cpp:218
shared_ptr< WPSHeader > WPSHeaderPtr
Definition: WPSHeader.h:66
long getSizeFile() const
returns the file size (or the ole zone size)
Definition: WPS4.cpp:214
float pageHeight() const
returns the page height, ie. paper size less margin (in inches)
Definition: WPS4.cpp:164
void createDocument(WPSEntry const &entry, libwps::SubDocumentType type)
creates a document for a comment entry and then send the data
Definition: WPS4.cpp:329
void newPage(int number)
adds a new page
Definition: WPS4.cpp:283
bool readDocWindowsInfo(WPSEntry const &entry)
reads the additional windows info
Definition: WPS4.cpp:894
bool checkInFile(long pos)
return true if the pos is in the file, update the file size if need
Definition: WPS4.cpp:224
The class which parses text zones in a pc MS Works document v1-4.
Definition: WPS4Text.h:65
shared_ptr< WPS4ParserInternal::State > m_state
the internal state
Definition: WPS4.h:150
Definition: WPSPageSpan.h:42
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
void sendObject(Vec2f const &size, int id)
sends an object with given id ( via its WPS4Graph )
Definition: WPS4.cpp:310
bool createOLEStructures()
tries to parse the different OLE zones ( except the main zone )
Definition: WPS4.cpp:432
~WPS4Parser()
destructor
Definition: WPS4.cpp:159

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