MSWrite.h Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

MSWrite.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) 2015 Sean Young <sean@mess.org>
11 *
12 * For minor contributions see the git repository.
13 *
14 * Alternatively, the contents of this file may be used under the terms
15 * of the GNU Lesser General Public License Version 2.1 or later
16 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
17 * applicable instead of those above.
18 *
19 * For further information visit http://libwps.sourceforge.net
20 */
21
22 #ifndef MS_WRITE_H
23 #define MS_WRITE_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 #include "WPSEntry.h"
33 #include "WPSPageSpan.h"
34
35 namespace MSWriteParserInternal
36 {
37 class SubDocument;
38 struct Paragraph;
39 struct Font;
40 }
41
46 class MSWriteParser : public WPSParser
47 {
48 friend class MSWriteParserInternal::SubDocument;
49 friend struct MSWriteParserInternal::Paragraph;
50 friend struct MSWriteParserInternal::Font;
51
52 public:
53 MSWriteParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header,
54 libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::WIN3_WEUROPE);
55
56
57 ~MSWriteParser();
58 void parse(librevenge::RVNGTextInterface *const documentInterface);
59
60 private:
61 MSWriteParser(const MSWriteParser &);
62 MSWriteParser &operator=(const MSWriteParser &);
63
64 shared_ptr<WPSContentListener> createListener(librevenge::RVNGTextInterface *interface);
65 void readFIB();
66 void readFFNTB();
67 void readSECT();
68 void readPAP();
69 void readCHP();
70 void findZones();
71 void readText(WPSEntry e);
72 void processObject(WPSPosition &pos, unsigned long lastPos);
73 bool processDDB(librevenge::RVNGBinaryData &bmpdata, WPSPosition &pos, unsigned width, unsigned height, unsigned byte_width, unsigned planes, unsigned bits_pixel, unsigned size);
74 bool processDIB(librevenge::RVNGBinaryData &bmpdata, unsigned size);
75 bool processWMF(librevenge::RVNGBinaryData &wmfdata, unsigned size);
76 void processEmbeddedOLE(WPSPosition &pos, unsigned long lastPos);
77 bool processStaticOLE(librevenge::RVNGBinaryData &, std::string &mimetype, WPSPosition &pos, unsigned long lastPos);
78 bool readString(std::string &res, unsigned long lastPos);
79 unsigned insertString(const unsigned char *str, unsigned size, libwps_tools_win::Font::Type type);
80
82 bool checkFilePosition(uint32_t pos) const
83 {
84 return pos<=m_fileLength;
85 }
86 // State
88 uint32_t m_fileLength;
89 uint32_t m_fcMac;
90
91 std::vector<MSWriteParserInternal::Paragraph> m_paragraphList;
92 std::vector<MSWriteParserInternal::Font> m_fontList;
93 std::vector<librevenge::RVNGString> m_fonts;
94 WPSPageSpan m_pageSpan;
95 libwps_tools_win::Font::Type m_fontType;
96
97 shared_ptr<WPSContentListener> m_listener; /* the listener (if set)*/
98
99 WPSEntry m_Main, m_Header, m_Footer;
100 bool m_HeaderPage1, m_FooterPage1;
101 };
102
103 #endif /* MS_WRITE_H */
104 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
MSWriteParser::m_fontList
std::vector< MSWriteParserInternal::Font > m_fontList
Definition: MSWrite.h:92
MSWriteParserInternal
Definition: MSWrite.cpp:37
MSWriteParser::readString
bool readString(std::string &res, unsigned long lastPos)
Definition: MSWrite.cpp:1063
MSWriteParser::m_paragraphList
std::vector< MSWriteParserInternal::Paragraph > m_paragraphList
Definition: MSWrite.h:91
MSWriteParser::m_fonts
std::vector< librevenge::RVNGString > m_fonts
Definition: MSWrite.h:93
MSWriteParser::readFFNTB
void readFFNTB()
Definition: MSWrite.cpp:351
libwps_tools_win.h
MSWriteParser::readCHP
void readCHP()
Definition: MSWrite.cpp:681
WPSParser.h
MSWriteParser::m_FooterPage1
bool m_FooterPage1
Definition: MSWrite.h:100
MSWriteParser::parse
void parse(librevenge::RVNGTextInterface *const documentInterface)
Definition: MSWrite.cpp:1597
WPSParser
Definition: WPSParser.h:35
libwps_tools_win::Font::Type
Type
enum Type
Definition: libwps_tools_win.h:46
MSWriteParser::MSWriteParser
MSWriteParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::WIN3_WEUROPE)
Definition: MSWrite.cpp:301
MSWriteParser::processStaticOLE
bool processStaticOLE(librevenge::RVNGBinaryData &, std::string &mimetype, WPSPosition &pos, unsigned long lastPos)
Definition: MSWrite.cpp:1441
MSWriteParserInternal::SubDocument
Internal: the subdocument of a MSWriteParser.
Definition: MSWrite.cpp:40
MSWriteParser::m_Main
WPSEntry m_Main
Definition: MSWrite.h:99
MSWriteParser::m_listener
shared_ptr< WPSContentListener > m_listener
Definition: MSWrite.h:97
WPSHeaderPtr
shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:108
MSWriteParser::m_fontType
libwps_tools_win::Font::Type m_fontType
Definition: MSWrite.h:95
libwps_internal.h
WPSEntry.h
MSWriteParser::processEmbeddedOLE
void processEmbeddedOLE(WPSPosition &pos, unsigned long lastPos)
Definition: MSWrite.cpp:1498
MSWriteParser::insertString
unsigned insertString(const unsigned char *str, unsigned size, libwps_tools_win::Font::Type type)
Definition: MSWrite.cpp:1017
MSWriteParserInternal::Font
Definition: MSWrite.cpp:188
WPSPageSpan.h
MSWriteParser::readFIB
void readFIB()
Definition: MSWrite.cpp:325
MSWriteParser::readSECT
void readSECT()
Definition: MSWrite.cpp:448
MSWriteParser::m_Header
WPSEntry m_Header
Definition: MSWrite.h:99
MSWriteParser::m_pageSpan
WPSPageSpan m_pageSpan
Definition: MSWrite.h:94
MSWriteParser::m_fcMac
uint32_t m_fcMac
Definition: MSWrite.h:89
MSWriteParser::createListener
shared_ptr< WPSContentListener > createListener(librevenge::RVNGTextInterface *interface)
Definition: MSWrite.cpp:831
MSWriteParser
This class parses Microsoft Write 3.0 and 3.1.
Definition: MSWrite.h:46
RVNGInputStreamPtr
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
MSWriteParser::processDIB
bool processDIB(librevenge::RVNGBinaryData &bmpdata, unsigned size)
Definition: MSWrite.cpp:1398
MSWriteParser::checkFilePosition
bool checkFilePosition(uint32_t pos) const
check if the file position is correct or not
Definition: MSWrite.h:82
MSWriteParser::processDDB
bool processDDB(librevenge::RVNGBinaryData &bmpdata, WPSPosition &pos, unsigned width, unsigned height, unsigned byte_width, unsigned planes, unsigned bits_pixel, unsigned size)
Definition: MSWrite.cpp:1213
MSWriteParser::readPAP
void readPAP()
Definition: MSWrite.cpp:530
WPSPageSpan
Definition: WPSPageSpan.h:38
MSWriteParser::m_Footer
WPSEntry m_Footer
Definition: MSWrite.h:99
MSWriteParser::findZones
void findZones()
Definition: MSWrite.cpp:781
WPSEntry
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:37
WPSPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: WPSPosition.h:39
MSWriteParser::operator=
MSWriteParser & operator=(const MSWriteParser &)
MSWriteParser::m_HeaderPage1
bool m_HeaderPage1
Definition: MSWrite.h:100
MSWriteParser::~MSWriteParser
~MSWriteParser()
Definition: MSWrite.cpp:321
MSWriteParser::processWMF
bool processWMF(librevenge::RVNGBinaryData &wmfdata, unsigned size)
Definition: MSWrite.cpp:1578
libwps_tools_win::Font::WIN3_WEUROPE
Definition: libwps_tools_win.h:52
MSWriteParser::m_fileLength
uint32_t m_fileLength
the last file position
Definition: MSWrite.h:88
MSWriteParser::processObject
void processObject(WPSPosition &pos, unsigned long lastPos)
Definition: MSWrite.cpp:1104
MSWriteParser::readText
void readText(WPSEntry e)
Definition: MSWrite.cpp:867
MSWriteParserInternal::Paragraph
Definition: MSWrite.cpp:176