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
33class WPSPageSpan;
34
35namespace WPS4ParserInternal
36{
37class SubDocument;
38struct State;
39}
40
41class WPS4Graph;
42class WPS4Text;
43
48class WPS4Parser final : public WPSParser
49{
51 friend class WPS4Graph;
52 friend class WPS4Text;
53
54public:
59 ~WPS4Parser() final;
61 void parse(librevenge::RVNGTextInterface *documentInterface) final;
63 bool checkHeader(WPSHeader *header, bool strict=false);
64protected:
66 bool getColor(int id, WPSColor &color) const;
67
69 void setSizeFile(long sz);
71 bool checkFilePosition(long pos);
72
74 void newPage(int number);
76 void setListener(std::shared_ptr<WPSContentListener> const &listener);
77
79 bool createStructures();
83 std::shared_ptr<WPSContentListener> createListener(librevenge::RVNGTextInterface *interface);
84
85 // interface with text parser
86
88 float pageHeight() const;
90 float pageWidth() const;
92 int numColumns() const;
96 libwps_tools_win::Font::Type getDefaultFontType() const;
98 libwps_tools_win::Font::Type getOEMFontType() const;
99
103 void createDocument(WPSEntry const &entry, libwps::SubDocumentType type);
105 void createNote(WPSEntry const &entry, librevenge::RVNGString const &label);
107 void createTextBox(WPSEntry const &entry, WPSPosition const &pos, librevenge::RVNGPropertyList const &extras);
109 void send(WPSEntry const &entry, libwps::SubDocumentType type);
110
111 // interface with graph parser
112
116 int readObject(RVNGInputStreamPtr input, WPSEntry const &entry);
117
121 void sendObject(WPSPosition const &position, int id);
122
123 //
124 // low level
125 //
126
128 bool findZones();
129
133 bool parseEntry(std::string const &name);
134
136 bool readDocDim();
137
139 bool readPrnt(WPSEntry const &entry);
140
145 bool readDocWindowsInfo(WPSEntry const &entry);
146
147 std::shared_ptr<WPSContentListener> m_listener; /* the listener (if set)*/
149 std::shared_ptr<WPS4Graph> m_graphParser;
151 std::shared_ptr<WPS4Text> m_textParser;
153 std::shared_ptr<WPS4ParserInternal::State> m_state;
154};
155
156#endif /* WPS4_H */
157/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
the main class to read/store picture in a Pc MS Works document v1-4
Definition WPS4Graph.h:57
Internal: the subdocument of a WPS4Parser.
Definition WPS4.cpp:46
libwps_tools_win::Font::Type getOEMFontType() const
returns the document codepage ( given from the file OEM field )
Definition WPS4.cpp:201
friend class WPS4Graph
Definition WPS4.h:51
std::shared_ptr< WPSContentListener > createListener(librevenge::RVNGTextInterface *interface)
creates the main listener
Definition WPS4.cpp:269
bool readDocDim()
tries to read the document dimension
Definition WPS4.cpp:839
void send(WPSEntry const &entry, libwps::SubDocumentType type)
sends text corresponding to the entry to the listener (via WPS4Text)
Definition WPS4.cpp:339
bool checkHeader(WPSHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition WPS4.cpp:545
bool findZones()
finds the different zones (text, print, ...) and updates nameMultiMap
Definition WPS4.cpp:569
std::shared_ptr< WPS4Graph > m_graphParser
the graph parser
Definition WPS4.h:149
libwps_tools_win::Font::Type getDefaultFontType() const
returns the default font type, ie.
Definition WPS4.cpp:194
bool parseEntry(std::string const &name)
parses an entry
Definition WPS4.cpp:509
bool readPrnt(WPSEntry const &entry)
tries to read the printer information
Definition WPS4.cpp:906
int readObject(RVNGInputStreamPtr input, WPSEntry const &entry)
tries to read a picture ( via its WPS4Graph )
Definition WPS4.cpp:326
float pageWidth() const
returns the page width, ie. paper size less margin (in inches)
Definition WPS4.cpp:184
bool getColor(int id, WPSColor &color) const
color
Definition WPS4.cpp:206
std::shared_ptr< WPS4ParserInternal::State > m_state
the internal state
Definition WPS4.h:153
void createTextBox(WPSEntry const &entry, WPSPosition const &pos, librevenge::RVNGPropertyList const &extras)
creates a textbox and then send the data
Definition WPS4.cpp:374
void setSizeFile(long sz)
sets the file size ( filled by WPS4Text )
Definition WPS4.cpp:242
bool createStructures()
tries to parse the main zone, ...
Definition WPS4.cpp:445
std::shared_ptr< WPS4Text > m_textParser
the text parser
Definition WPS4.h:151
bool createOLEStructures()
tries to parse the different OLE zones ( except the main zone )
Definition WPS4.cpp:462
std::shared_ptr< WPSContentListener > m_listener
Definition WPS4.h:147
friend class WPS4Text
Definition WPS4.h:52
int numColumns() const
returns the number of columns
Definition WPS4.cpp:189
WPS4Parser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN)
constructor
Definition WPS4.cpp:161
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:366
void createDocument(WPSEntry const &entry, libwps::SubDocumentType type)
creates a document for a comment entry and then send the data
Definition WPS4.cpp:353
~WPS4Parser() final
destructor
Definition WPS4.cpp:174
void newPage(int number)
adds a new page
Definition WPS4.cpp:307
void sendObject(WPSPosition const &position, int id)
sends an object with given id ( via its WPS4Graph )
Definition WPS4.cpp:334
float pageHeight() const
returns the page height, ie. paper size less margin (in inches)
Definition WPS4.cpp:179
void parse(librevenge::RVNGTextInterface *documentInterface) final
called by WPSDocument to parse the file
Definition WPS4.cpp:387
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition WPS4.cpp:248
void setListener(std::shared_ptr< WPSContentListener > const &listener)
set the listener
Definition WPS4.cpp:262
bool readDocWindowsInfo(WPSEntry const &entry)
reads the additional windows info
Definition WPS4.cpp:978
The class which parses text zones in a pc MS Works document v1-4.
Definition WPS4Text.h:65
Definition WPSContentListener.h:45
basic class to store an entry in a file This contained :
Definition WPSEntry.h:39
Definition WPSHeader.h:32
Definition WPSPageSpan.h:39
WPSParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header)
Definition WPSParser.cpp:30
Class to define the position of an object (textbox, picture, ..) in the document.
Definition WPSPosition.h:40
Type
enum Type
Definition libwps_tools_win.h:46
@ UNKNOWN
Definition libwps_tools_win.h:63
std::shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition libwps_internal.h:109
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition libwps_internal.h:87
Definition WPS4.cpp:43
some Windows© classes and tools
Definition libwps_tools_win.cpp:32
Definition libwps_internal.cpp:39
the state of WPS4
Definition WPS4.cpp:129
the class to store a color
Definition libwps_internal.h:281

Generated on Sat Jul 19 2025 05:24:40 for libwps by doxygen 1.14.0