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 {
51 
52 public:
55 
56 
58  void parse(librevenge::RVNGTextInterface *const documentInterface);
59 
60 private:
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;
96 
97  shared_ptr<WPSContentListener> m_listener; /* the listener (if set)*/
98 
101 };
102 
103 #endif /* MS_WRITE_H */
104 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
std::vector< MSWriteParserInternal::Font > m_fontList
Definition: MSWrite.h:92
Definition: MSWrite.cpp:37
bool readString(std::string &res, unsigned long lastPos)
Definition: MSWrite.cpp:1063
std::vector< MSWriteParserInternal::Paragraph > m_paragraphList
Definition: MSWrite.h:91
std::vector< librevenge::RVNGString > m_fonts
Definition: MSWrite.h:93
void readFFNTB()
Definition: MSWrite.cpp:351
void readCHP()
Definition: MSWrite.cpp:681
bool m_FooterPage1
Definition: MSWrite.h:100
void parse(librevenge::RVNGTextInterface *const documentInterface)
Definition: MSWrite.cpp:1597
Definition: WPSParser.h:35
Type
enum Type
Definition: libwps_tools_win.h:46
MSWriteParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::WIN3_WEUROPE)
Definition: MSWrite.cpp:301
bool processStaticOLE(librevenge::RVNGBinaryData &, std::string &mimetype, WPSPosition &pos, unsigned long lastPos)
Definition: MSWrite.cpp:1441
Internal: the subdocument of a MSWriteParser.
Definition: MSWrite.cpp:40
WPSEntry m_Main
Definition: MSWrite.h:99
shared_ptr< WPSContentListener > m_listener
Definition: MSWrite.h:97
shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:108
libwps_tools_win::Font::Type m_fontType
Definition: MSWrite.h:95
void processEmbeddedOLE(WPSPosition &pos, unsigned long lastPos)
Definition: MSWrite.cpp:1498
unsigned insertString(const unsigned char *str, unsigned size, libwps_tools_win::Font::Type type)
Definition: MSWrite.cpp:1017
Definition: MSWrite.cpp:188
void readFIB()
Definition: MSWrite.cpp:325
void readSECT()
Definition: MSWrite.cpp:448
WPSEntry m_Header
Definition: MSWrite.h:99
WPSPageSpan m_pageSpan
Definition: MSWrite.h:94
uint32_t m_fcMac
Definition: MSWrite.h:89
shared_ptr< WPSContentListener > createListener(librevenge::RVNGTextInterface *interface)
Definition: MSWrite.cpp:831
This class parses Microsoft Write 3.0 and 3.1.
Definition: MSWrite.h:46
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
bool processDIB(librevenge::RVNGBinaryData &bmpdata, unsigned size)
Definition: MSWrite.cpp:1398
bool checkFilePosition(uint32_t pos) const
check if the file position is correct or not
Definition: MSWrite.h:82
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
void readPAP()
Definition: MSWrite.cpp:530
Definition: WPSPageSpan.h:38
WPSEntry m_Footer
Definition: MSWrite.h:99
void findZones()
Definition: MSWrite.cpp:781
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
MSWriteParser & operator=(const MSWriteParser &)
bool m_HeaderPage1
Definition: MSWrite.h:100
~MSWriteParser()
Definition: MSWrite.cpp:321
bool processWMF(librevenge::RVNGBinaryData &wmfdata, unsigned size)
Definition: MSWrite.cpp:1578
Definition: libwps_tools_win.h:52
uint32_t m_fileLength
the last file position
Definition: MSWrite.h:88
void processObject(WPSPosition &pos, unsigned long lastPos)
Definition: MSWrite.cpp:1104
void readText(WPSEntry e)
Definition: MSWrite.cpp:867
Definition: MSWrite.cpp:176

Generated on Thu Jan 21 2016 02:26:19 for libwps by doxygen 1.8.9.1