WPS4.h Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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 <librevenge-stream/librevenge-stream.h>
28 #include "libwps_internal.h"
29 #include "libwps_tools_win.h"
30
31 #include "WPSParser.h"
32
33 class WPSPageSpan;
34
35 namespace WPS4ParserInternal
36 {
37 class SubDocument;
38 struct State;
39 }
40
41 class WPS4Graph;
42 class WPS4Text;
43
48 class WPS4Parser : public WPSParser
49 {
50 friend class WPS4ParserInternal::SubDocument;
51 friend class WPS4Graph;
52 friend class WPS4Text;
53
54 public:
56 WPS4Parser(RVNGInputStreamPtr &input, WPSHeaderPtr &header);
58 ~WPS4Parser();
60 void parse(librevenge::RVNGTextInterface *documentInterface);
62 bool checkHeader(WPSHeader *header, bool strict=false);
63 protected:
65 bool getColor(int id, uint32_t &color) const;
66
68 void setSizeFile(long sz);
70 bool checkFilePosition(long pos);
71
73 void newPage(int number);
75 void setListener(shared_ptr<WPSContentListener> listener);
76
78 bool createStructures();
80 bool createOLEStructures();
82 shared_ptr<WPSContentListener> createListener(librevenge::RVNGTextInterface *interface);
83
84 // interface with text parser
85
87 float pageHeight() const;
89 float pageWidth() const;
91 int numColumns() const;
93 libwps_tools_win::Font::Type getDocumentFontType() const;
94
98 void createDocument(WPSEntry const &entry, libwps::SubDocumentType type);
100 void createNote(WPSEntry const &entry, librevenge::RVNGString const &label);
102 void createTextBox(WPSEntry const &entry, WPSPosition const &pos, librevenge::RVNGPropertyList &extras);
104 void send(WPSEntry const &entry, libwps::SubDocumentType type);
105
106 // interface with graph parser
107
111 int readObject(RVNGInputStreamPtr input, WPSEntry const &entry);
112
116 void sendObject(Vec2f const &size, int id);
117
118 //
119 // low level
120 //
121
123 bool findZones();
124
128 bool parseEntry(std::string const &name);
129
131 bool readDocDim();
132
134 bool readPrnt(WPSEntry const &entry);
135
140 bool readDocWindowsInfo(WPSEntry const &entry);
141
142 shared_ptr<WPSContentListener> m_listener; /* the listener (if set)*/
144 shared_ptr<WPS4Graph> m_graphParser;
146 shared_ptr<WPS4Text> m_textParser;
148 shared_ptr<WPS4ParserInternal::State> m_state;
149 };
150
151 #endif /* WPS4_H */
152 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPS4Parser::m_graphParser
shared_ptr< WPS4Graph > m_graphParser
the graph parser
Definition: WPS4.h:144
WPS4Parser::WPS4Parser
WPS4Parser(RVNGInputStreamPtr &input, WPSHeaderPtr &header)
constructor
Definition: WPS4.cpp:151
WPS4Parser::parse
void parse(librevenge::RVNGTextInterface *documentInterface)
called by WPSDocument to parse the file
Definition: WPS4.cpp:366
WPS4ParserInternal::SubDocument
Internal: the subdocument of a WPS4Parser.
Definition: WPS4.cpp:45
WPS4Parser::numColumns
int numColumns() const
returns the number of columns
Definition: WPS4.cpp:175
WPS4Parser::pageWidth
float pageWidth() const
returns the page width, ie. paper size less margin (in inches)
Definition: WPS4.cpp:170
libwps_tools_win.h
WPS4Parser::findZones
bool findZones()
finds the different zones (text, print, ...) and updates nameMultiMap
Definition: WPS4.cpp:546
WPSParser.h
WPS4Parser
This class parses Works version 2 through 4.
Definition: WPS4.h:48
WPS4Parser::send
void send(WPSEntry const &entry, libwps::SubDocumentType type)
sends text corresponding to the entry to the listener (via WPS4Text)
Definition: WPS4.cpp:318
WPS4Parser::parseEntry
bool parseEntry(std::string const &name)
parses an entry
Definition: WPS4.cpp:490
WPS4Parser::readDocDim
bool readDocDim()
tries to read the document dimension
Definition: WPS4.cpp:804
WPSParser
Definition: WPSParser.h:35
libwps_tools_win::Font::Type
Type
enum Type
Definition: libwps_tools_win.h:47
WPS4Parser::setListener
void setListener(shared_ptr< WPSContentListener > listener)
set the listener
Definition: WPS4.cpp:241
WPS4Graph
the main class to read/store picture in a Pc MS Works document v1-4
Definition: WPS4Graph.h:56
WPS4Parser::createStructures
bool createStructures()
tries to parse the main zone, ...
Definition: WPS4.cpp:423
WPS4Parser::readObject
int readObject(RVNGInputStreamPtr input, WPSEntry const &entry)
tries to read a picture ( via its WPS4Graph )
Definition: WPS4.cpp:305
WPS4Parser::createNote
void createNote(WPSEntry const &entry, librevenge::RVNGString const &label)
creates a document for a footnote entry with label and then send the data
Definition: WPS4.cpp:345
WPSHeaderPtr
shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:102
WPS4Parser::getDocumentFontType
libwps_tools_win::Font::Type getDocumentFontType() const
returns the document codepage ( if known )
Definition: WPS4.cpp:180
libwps_internal.h
libwps::SubDocumentType
SubDocumentType
Definition: libwps_internal.h:256
WPS4Parser::getColor
bool getColor(int id, uint32_t &color) const
color
Definition: WPS4.cpp:185
libwps_tools_win::Language::name
std::string name(long id)
returns the name given Windows© id
Definition: libwps_tools_win.cpp:942
WPS4Parser::createTextBox
void createTextBox(WPSEntry const &entry, WPSPosition const &pos, librevenge::RVNGPropertyList &extras)
creates a textbox and then send the data
Definition: WPS4.cpp:353
WPS4Parser::m_textParser
shared_ptr< WPS4Text > m_textParser
the text parser
Definition: WPS4.h:146
WPSHeader
Definition: WPSHeader.h:31
WPS4Parser::readPrnt
bool readPrnt(WPSEntry const &entry)
tries to read the printer information
Definition: WPS4.cpp:871
WPS4ParserInternal
Definition: WPS4.cpp:42
RVNGInputStreamPtr
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:81
WPS4Parser::setSizeFile
void setSizeFile(long sz)
sets the file size ( filled by WPS4Text )
Definition: WPS4.cpp:221
WPS4Parser::m_listener
shared_ptr< WPSContentListener > m_listener
Definition: WPS4.h:142
WPS4Parser::pageHeight
float pageHeight() const
returns the page height, ie. paper size less margin (in inches)
Definition: WPS4.cpp:165
WPS4Parser::createDocument
void createDocument(WPSEntry const &entry, libwps::SubDocumentType type)
creates a document for a comment entry and then send the data
Definition: WPS4.cpp:332
WPS4Parser::newPage
void newPage(int number)
adds a new page
Definition: WPS4.cpp:286
WPS4Parser::readDocWindowsInfo
bool readDocWindowsInfo(WPSEntry const &entry)
reads the additional windows info
Definition: WPS4.cpp:943
WPS4Text
The class which parses text zones in a pc MS Works document v1-4.
Definition: WPS4Text.h:65
WPS4Parser::m_state
shared_ptr< WPS4ParserInternal::State > m_state
the internal state
Definition: WPS4.h:148
WPSPageSpan
Definition: WPSPageSpan.h:38
WPS4Parser::checkFilePosition
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition: WPS4.cpp:227
WPS4Parser::checkHeader
bool checkHeader(WPSHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: WPS4.cpp:526
WPSEntry
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:37
Vec2< float >
WPSPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: WPSPosition.h:39
WPS4Parser::createListener
shared_ptr< WPSContentListener > createListener(librevenge::RVNGTextInterface *interface)
creates the main listener
Definition: WPS4.cpp:248
WPS4Parser::sendObject
void sendObject(Vec2f const &size, int id)
sends an object with given id ( via its WPS4Graph )
Definition: WPS4.cpp:313
WPS4Parser::createOLEStructures
bool createOLEStructures()
tries to parse the different OLE zones ( except the main zone )
Definition: WPS4.cpp:440
WPS4Parser::~WPS4Parser
~WPS4Parser()
destructor
Definition: WPS4.cpp:160