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 "WPSFont.h"
34#include "WPSPageSpan.h"
35#include "WPSParagraph.h"
36
38{
39class SubDocument;
40
54
64
66{
67 Footnote() : m_fcFtn(0), m_fcRef(0) { }
68 uint32_t m_fcFtn, m_fcRef;
69};
70
71struct Section
72{
74 Section() : m_fcLim(0), m_bkc(1), m_yaMac(11), m_xaMac(8.5),
75 m_yaTop(1), m_dyaText(9), m_xaLeft(1.25), m_dxaText(6),
76 m_startPageNumber(0xffff), m_yaHeader(0.75),
77 m_yaFooter(10.25) /* 11-0.75inch*/, m_endFtns(false),
78 m_columns(1), m_dxaColumns(0.5), m_dxaGutter(0.0), m_Main() { }
79 uint32_t m_fcLim;
80 unsigned m_bkc;
82 double m_yaTop;
83 double m_dyaText;
84 double m_xaLeft;
85 double m_dxaText;
87 double m_yaHeader;
88 double m_yaFooter;
90 unsigned m_columns;
93};
94
95}
96
102{
106
107public:
110
111
113 void parse(librevenge::RVNGTextInterface *documentInterface);
114
115private:
118
119 shared_ptr<WPSContentListener> createListener(librevenge::RVNGTextInterface *interface);
120protected:
121 void readStructures();
123 void readFIB();
124 virtual void readFFNTB();
125 void readFOD(unsigned page, void (MSWriteParser::*parseFOD)(uint32_t fcFirst, uint32_t fcLim, unsigned size));
126 virtual void readPAP(uint32_t fcFirst, uint32_t fcLim, unsigned cch);
127 virtual void readCHP(uint32_t fcFirst, uint32_t fcLim, unsigned cch);
128 virtual void readSUMD();
129 virtual void readFNTB();
130 virtual void readSED();
132 int numPages();
133 void processObject(WPSPosition &pos, unsigned long lastPos);
134 bool processDDB(librevenge::RVNGBinaryData &bmpdata, WPSPosition &pos, unsigned width, unsigned height, unsigned byte_width, unsigned planes, unsigned bits_pixel, unsigned size);
135 bool processDIB(librevenge::RVNGBinaryData &bmpdata, unsigned size);
136 bool processWMF(librevenge::RVNGBinaryData &wmfdata, unsigned size);
137 void processEmbeddedOLE(WPSPosition &pos, unsigned long lastPos);
138 bool processStaticOLE(librevenge::RVNGBinaryData &, std::string &mimetype, WPSPosition &pos, unsigned long lastPos);
139 bool readString(std::string &res, unsigned long lastPos);
140 virtual void insertSpecial(uint8_t val, uint32_t fc, MSWriteParserInternal::Paragraph::Location location);
141 virtual void insertControl(uint8_t val, uint32_t fc);
142 void insertNote(bool annotation, uint32_t fcPos, librevenge::RVNGString &label);
143 unsigned insertString(const unsigned char *str, unsigned size, libwps_tools_win::Font::Type type);
144 static void getPageStyle(MSWriteParserInternal::Section &sep, WPSPageSpan &pageSpan);
145 void getHeaderFooters(uint32_t first, MSWriteParserInternal::Section &sep, WPSPageSpan &pageSpan);
147
149 bool checkFilePosition(uint32_t pos) const
150 {
151 return pos<=m_fileLength;
152 }
153 // State
155 uint32_t m_fileLength;
156 uint32_t m_fcMac;
157
158 std::vector<MSWriteParserInternal::Paragraph> m_paragraphList;
159 std::vector<MSWriteParserInternal::Font> m_fontList;
160 std::vector<MSWriteParserInternal::Footnote> m_footnotes;
161 std::vector<MSWriteParserInternal::Section> m_sections;
162 std::vector<librevenge::RVNGString> m_fonts;
164
165 shared_ptr<WPSContentListener> m_listener; /* the listener (if set)*/
166
167 librevenge::RVNGPropertyList m_metaData;
168};
169
170#endif /* MS_WRITE_H */
171/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
Internal: the subdocument of a MSWriteParser.
Definition MSWrite.cpp:42
This class parses Microsoft Write 3.0 and 3.1.
Definition MSWrite.h:102
uint32_t m_fcMac
Definition MSWrite.h:156
virtual void insertControl(uint8_t val, uint32_t fc)
Definition MSWrite.cpp:1073
libwps_tools_win::Font::Type m_fontType
Definition MSWrite.h:163
std::vector< MSWriteParserInternal::Footnote > m_footnotes
Definition MSWrite.h:160
bool processDDB(librevenge::RVNGBinaryData &bmpdata, WPSPosition &pos, unsigned width, unsigned height, unsigned byte_width, unsigned planes, unsigned bits_pixel, unsigned size)
Definition MSWrite.cpp:1266
std::vector< MSWriteParserInternal::Font > m_fontList
Definition MSWrite.h:159
void readStructures()
Definition MSWrite.cpp:1660
MSWriteParser(const MSWriteParser &)
void readText(WPSEntry e, MSWriteParserInternal::Paragraph::Location location)
Definition MSWrite.cpp:897
virtual libwps_tools_win::Font::Type getFileEncoding(libwps_tools_win::Font::Type hint)
Definition MSWrite.cpp:287
std::vector< librevenge::RVNGString > m_fonts
Definition MSWrite.h:162
void processObject(WPSPosition &pos, unsigned long lastPos)
Definition MSWrite.cpp:1157
bool processDIB(librevenge::RVNGBinaryData &bmpdata, unsigned size)
Definition MSWrite.cpp:1451
void readFOD(unsigned page, void(MSWriteParser::*parseFOD)(uint32_t fcFirst, uint32_t fcLim, unsigned size))
Definition MSWrite.cpp:524
unsigned insertString(const unsigned char *str, unsigned size, libwps_tools_win::Font::Type type)
Definition MSWrite.cpp:1100
std::vector< MSWriteParserInternal::Paragraph > m_paragraphList
Definition MSWrite.h:158
virtual void insertSpecial(uint8_t val, uint32_t fc, MSWriteParserInternal::Paragraph::Location location)
Definition MSWrite.cpp:1067
std::vector< MSWriteParserInternal::Section > m_sections
Definition MSWrite.h:161
virtual void readFFNTB()
Definition MSWrite.cpp:321
void readFIB()
Definition MSWrite.cpp:295
static void getPageStyle(MSWriteParserInternal::Section &sep, WPSPageSpan &pageSpan)
Definition MSWrite.cpp:477
void insertNote(bool annotation, uint32_t fcPos, librevenge::RVNGString &label)
Definition MSWrite.cpp:1688
void processEmbeddedOLE(WPSPosition &pos, unsigned long lastPos)
Definition MSWrite.cpp:1551
bool readString(std::string &res, unsigned long lastPos)
Definition MSWrite.cpp:1116
void startSection(MSWriteParserInternal::Section &section)
Definition MSWrite.cpp:1725
shared_ptr< WPSContentListener > m_listener
Definition MSWrite.h:165
librevenge::RVNGPropertyList m_metaData
Definition MSWrite.h:167
virtual void readCHP(uint32_t fcFirst, uint32_t fcLim, unsigned cch)
Definition MSWrite.cpp:678
uint32_t m_fileLength
the last file position
Definition MSWrite.h:155
MSWriteParser & operator=(const MSWriteParser &)
virtual void readPAP(uint32_t fcFirst, uint32_t fcLim, unsigned cch)
Definition MSWrite.cpp:579
void parse(librevenge::RVNGTextInterface *documentInterface)
Definition MSWrite.cpp:1735
void getHeaderFooters(uint32_t first, MSWriteParserInternal::Section &sep, WPSPageSpan &pageSpan)
Definition MSWrite.cpp:734
bool processWMF(librevenge::RVNGBinaryData &wmfdata, unsigned size)
Definition MSWrite.cpp:1631
virtual void readSED()
Definition MSWrite.cpp:419
~MSWriteParser()
Definition MSWrite.cpp:283
virtual void readSUMD()
Definition MSWrite.cpp:1650
virtual void readFNTB()
Definition MSWrite.cpp:1655
shared_ptr< WPSContentListener > createListener(librevenge::RVNGTextInterface *interface)
Definition MSWrite.cpp:872
bool processStaticOLE(librevenge::RVNGBinaryData &, std::string &mimetype, WPSPosition &pos, unsigned long lastPos)
Definition MSWrite.cpp:1494
bool checkFilePosition(uint32_t pos) const
check if the file position is correct or not
Definition MSWrite.h:149
basic class to store an entry in a file This contained :
Definition WPSEntry.h:39
define the font properties
Definition WPSFont.h:37
Definition WPSPageSpan.h:39
HeaderFooterOccurrence
Definition WPSPageSpan.h:44
Definition WPSParser.h:36
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
@ WIN3_WEUROPE
Definition libwps_tools_win.h:52
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition libwps_internal.h:88
shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition libwps_internal.h:110
Definition MSWrite.cpp:39
some Windows© classes and tools
Definition libwps_tools_win.cpp:32
Definition MSWrite.h:56
bool m_annotation
Definition MSWrite.h:61
uint32_t m_fcLim
Definition MSWrite.h:60
uint32_t m_fcFirst
Definition MSWrite.h:60
bool m_special
Definition MSWrite.h:61
libwps_tools_win::Font::Type m_encoding
Definition MSWrite.h:62
Font()
Definition MSWrite.h:57
bool m_footnote
Definition MSWrite.h:61
Definition MSWrite.h:66
Footnote()
Definition MSWrite.h:67
uint32_t m_fcFtn
Definition MSWrite.h:68
uint32_t m_fcRef
Definition MSWrite.h:68
Definition MSWrite.h:42
bool m_headerUseMargin
Definition MSWrite.h:50
bool m_graphics
Definition MSWrite.h:50
uint32_t m_fcLim
Definition MSWrite.h:48
bool m_skiptab
Definition MSWrite.h:50
WPSPageSpan::HeaderFooterOccurrence m_HeaderFooterOccurrence
Definition MSWrite.h:52
Location m_Location
Definition MSWrite.h:49
Paragraph()
Definition MSWrite.h:44
bool m_firstpage
Definition MSWrite.h:50
Location
Definition MSWrite.h:43
@ FOOTNOTE
Definition MSWrite.h:43
@ FOOTER
Definition MSWrite.h:43
@ HEADER
Definition MSWrite.h:43
@ MAIN
Definition MSWrite.h:43
uint32_t m_fcFirst
Definition MSWrite.h:48
double m_interLine
Definition MSWrite.h:51
Definition MSWrite.h:72
double m_xaLeft
Definition MSWrite.h:84
double m_dyaText
Definition MSWrite.h:83
unsigned m_columns
Definition MSWrite.h:90
double m_xaMac
Definition MSWrite.h:81
unsigned m_bkc
Definition MSWrite.h:80
uint16_t m_startPageNumber
Definition MSWrite.h:86
double m_yaHeader
Definition MSWrite.h:87
double m_yaMac
Definition MSWrite.h:81
double m_dxaGutter
Definition MSWrite.h:91
Section()
constructor
Definition MSWrite.h:74
double m_dxaText
Definition MSWrite.h:85
double m_yaFooter
Definition MSWrite.h:88
double m_yaTop
Definition MSWrite.h:82
bool m_endFtns
Definition MSWrite.h:89
uint32_t m_fcLim
Definition MSWrite.h:79
double m_dxaColumns
Definition MSWrite.h:91
WPSEntry m_Main
Definition MSWrite.h:92
class to store the paragraph properties
Definition WPSParagraph.h:55

Generated on Wed Nov 29 2023 19:00:10 for libwps by doxygen 1.9.8