DosWord.h Source File documentation

DosWord.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 DOSWORD_H
23 #define DOSWORD_H
24
25 #include <librevenge-stream/librevenge-stream.h>
26 #include "libwps_internal.h"
27 #include "libwps_tools_win.h"
28
29 #include "MSWrite.h"
30 #include "WPSParser.h"
31 #include "WPSEntry.h"
32 #include "WPSPageSpan.h"
33
38 class DosWordParser final : public MSWriteParser
39 {
40 public:
41 DosWordParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header,
42 libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN);
43
44 ~DosWordParser() final;
45
47 bool checkHeader(WPSHeader *header, bool strict=false);
48
49 private:
50 DosWordParser(const DosWordParser &) = delete;
51 DosWordParser &operator=(const DosWordParser &) = delete;
52 libwps_tools_win::Font::Type getFileEncoding(libwps_tools_win::Font::Type hint) final;
53
54 static WPSColor color(int clr);
55
56 void readSECT(uint32_t fcSep, uint32_t fcLim);
57 void readSED() final;
58 void readFFNTB() final;
59 void readCHP(uint32_t fcFirst, uint32_t fcLim, unsigned cch) final;
60 void readPAP(uint32_t fcFirst, uint32_t fcLim, unsigned cch) final;
61 void readSUMD() final;
62 void readFNTB() final;
63
64 void insertSpecial(uint8_t val, uint32_t fc, MSWriteParserInternal::Paragraph::Location location) final;
65 void insertControl(uint8_t val, uint32_t fc) final;
66 };
67
68 #endif /* DOSWORD_H */
69 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
MSWriteParserInternal::Section::m_yaTop
double m_yaTop
Definition: MSWrite.h:112
DosWordParserInternal::HEADER_W_PNBFTB
@ HEADER_W_PNBFTB
Definition: DosWord.cpp:116
DosWordParserInternal::PAP::m_dyaAfter
uint16_t m_dyaAfter
Definition: DosWord.cpp:85
DosWordParserInternal::PAP::m_justification
uint8_t m_justification
Definition: DosWord.cpp:82
WPSParagraph.h
WPS_LE_PUT_GUINT16
#define WPS_LE_PUT_GUINT16(p, v)
Definition: libwps_internal.h:232
MSWriteParserInternal::Section::m_bkc
unsigned m_bkc
Definition: MSWrite.h:110
WPSField
a field
Definition: libwps_internal.h:462
WPSParagraph::m_justify
libwps::Justification m_justify
the justification
Definition: WPSParagraph.h:116
WPS_STRIKEOUT_BIT
#define WPS_STRIKEOUT_BIT
Definition: libwps_internal.h:507
DosWordParserInternal::CHP::m_fStyled
uint8_t m_fStyled
Definition: DosWord.cpp:52
MSWriteParser::m_fileLength
uint32_t m_fileLength
the last file position
Definition: MSWrite.h:185
MSWriteParserInternal::Section::m_startPageNumber
uint16_t m_startPageNumber
Definition: MSWrite.h:116
MSWriteParserInternal::Section::m_xaLeft
double m_xaLeft
Definition: MSWrite.h:114
DosWordParser::insertControl
void insertControl(uint8_t val, uint32_t fc) final
Definition: DosWord.cpp:580
WPSField::PageNumber
@ PageNumber
Definition: libwps_internal.h:465
WPS_BOLD_BIT
#define WPS_BOLD_BIT
Definition: libwps_internal.h:506
MSWriteParserInternal::Font
Definition: MSWrite.h:64
WPSColor::getBlue
unsigned char getBlue() const
returns the green value
Definition: libwps_internal.h:330
DosWordParser::readFFNTB
void readFFNTB() final
Definition: DosWord.cpp:136
DosWordParserInternal::HEADER_W_PNSETB
@ HEADER_W_PNSETB
Definition: DosWord.cpp:115
WPSParagraph::m_margins
double m_margins[3]
the margins
Definition: WPSParagraph.h:101
libwps_tools_win::Font::Type
Type
enum Type
Definition: libwps_tools_win.h:46
MSWriteParserInternal::Section::m_fcLim
uint32_t m_fcLim
Definition: MSWrite.h:109
WPS_LE_GET_GUINT16
#define WPS_LE_GET_GUINT16(p)
Definition: libwps_internal.h:223
MSWriteParserInternal::Font::m_special
bool m_special
Definition: MSWrite.h:77
WPS_SUBSCRIPT_BIT
#define WPS_SUBSCRIPT_BIT
Definition: libwps_internal.h:500
MSWriteParserInternal::Paragraph::m_fcFirst
uint32_t m_fcFirst
Definition: MSWrite.h:57
DosWordParserInternal::HEADER_W_PNMAC
@ HEADER_W_PNMAC
Definition: DosWord.cpp:118
DosWordParserInternal::PAP::m_style
uint8_t m_style
Definition: DosWord.cpp:81
DosWordParserInternal::HEADER_W_DTY
@ HEADER_W_DTY
Definition: DosWord.cpp:109
MSWriteParserInternal::Section::m_endFtns
bool m_endFtns
Definition: MSWrite.h:119
DosWordParser::~DosWordParser
~DosWordParser() final
Definition: DosWord.cpp:132
MSWriteParserInternal::Font::m_annotation
bool m_annotation
Definition: MSWrite.h:77
WPS_UNDERLINE_BIT
#define WPS_UNDERLINE_BIT
Definition: libwps_internal.h:508
WPSField::PageNumberNext
@ PageNumberNext
Definition: libwps_internal.h:465
DosWordParserInternal::CHP
Definition: DosWord.cpp:40
MSWriteParser::m_fontList
std::vector< MSWriteParserInternal::Font > m_fontList
Definition: MSWrite.h:189
WPSTabStop::CENTER
@ CENTER
Definition: WPSParagraph.h:39
MSWriteParserInternal::Section::m_dxaGutter
double m_dxaGutter
Definition: MSWrite.h:121
DosWordParserInternal::HEADER_B_ASV
@ HEADER_B_ASV
Definition: DosWord.cpp:120
MSWriteParserInternal::Section::m_yaFooter
double m_yaFooter
Definition: MSWrite.h:118
WPSBorder::Single
@ Single
Definition: libwps_internal.h:399
DosWordParserInternal::HEADER_W_WIDENT
@ HEADER_W_WIDENT
Definition: DosWord.cpp:108
DosWordParser::readSUMD
void readSUMD() final
Definition: DosWord.cpp:635
WPSPageSpan::NEVER
@ NEVER
Definition: WPSPageSpan.h:44
WPS_SUPERSCRIPT_BIT
#define WPS_SUPERSCRIPT_BIT
Definition: libwps_internal.h:499
WPS_ALL_CAPS_BIT
#define WPS_ALL_CAPS_BIT
Definition: libwps_internal.h:512
DosWordParserInternal::CHP::m_unused
uint8_t m_unused
Definition: DosWord.cpp:56
DosWordParserInternal::CHP::CHP
CHP()
Definition: DosWord.cpp:42
DosWordParser
This class parses Microsoft Word for DOS.
Definition: DosWord.h:38
MSWriteParser::m_listener
std::shared_ptr< WPSContentListener > m_listener
Definition: MSWrite.h:195
DosWord.h
WPSBorder::m_width
int m_width
the border width
Definition: libwps_internal.h:450
MSWriteParser::checkFilePosition
bool checkFilePosition(uint32_t pos) const
check if the file position is correct or not
Definition: MSWrite.h:179
MSWriteParserInternal::Paragraph::m_fcLim
uint32_t m_fcLim
Definition: MSWrite.h:57
libwps_tools_win::Font::unicodeString
static librevenge::RVNGString unicodeString(const unsigned char *p, unsigned long size, Type type, bool skipUnknown=true)
converts a list of character in unicode
Definition: libwps_tools_win.cpp:7283
WPSPageSpan::ALL
@ ALL
Definition: WPSPageSpan.h:44
WPSHeader.h
WPSTabStop::Alignment
Alignment
Definition: WPSParagraph.h:39
DosWordParser::readFNTB
void readFNTB() final
Definition: DosWord.cpp:769
MSWriteParser::m_metaData
librevenge::RVNGPropertyList m_metaData
Definition: MSWrite.h:197
DosWordParser::insertSpecial
void insertSpecial(uint8_t val, uint32_t fc, MSWriteParserInternal::Paragraph::Location location) final
Definition: DosWord.cpp:542
DosWordParserInternal::CHP::m_hpsPos
uint8_t m_hpsPos
Definition: DosWord.cpp:57
WPS_DOUBLE_UNDERLINE_BIT
#define WPS_DOUBLE_UNDERLINE_BIT
Definition: libwps_internal.h:505
WPS_ITALICS_BIT
#define WPS_ITALICS_BIT
Definition: libwps_internal.h:502
WPSTabStop
Definition: WPSParagraph.h:37
MSWriteParserInternal::Paragraph::m_skiptab
bool m_skiptab
Definition: MSWrite.h:59
WPSTabStop::RIGHT
@ RIGHT
Definition: WPSParagraph.h:39
WPSHeader::setMajorVersion
void setMajorVersion(int version)
Definition: WPSHeader.h:94
WPS_SMALL_CAPS_BIT
#define WPS_SMALL_CAPS_BIT
Definition: libwps_internal.h:509
DosWordParser::readSECT
void readSECT(uint32_t fcSep, uint32_t fcLim)
Definition: DosWord.cpp:876
WPSColor::getGreen
unsigned char getGreen() const
returns the green value
Definition: libwps_internal.h:340
DosWordParserInternal::PAP::m_dxaFromText
uint16_t m_dxaFromText
Definition: DosWord.cpp:90
MSWriteParserInternal::Font::m_footnote
bool m_footnote
Definition: MSWrite.h:77
MSWriteParserInternal::Section::m_yaHeader
double m_yaHeader
Definition: MSWrite.h:117
MSWriteParserInternal::Paragraph::m_HeaderFooterOccurrence
WPSPageSpan::HeaderFooterOccurrence m_HeaderFooterOccurrence
Definition: MSWrite.h:61
WPS_PAGE_BREAK
#define WPS_PAGE_BREAK
Definition: libwps_internal.h:519
WPSPageSpan::ODD
@ ODD
Definition: WPSPageSpan.h:44
DosWordParserInternal::PAP::TBD::m_chAlign
uint8_t m_chAlign
Definition: DosWord.cpp:101
WPSPageSpan.h
MSWriteParserInternal::Section::m_yaMac
double m_yaMac
Definition: MSWrite.h:111
DosWordParserInternal::PAP::m_dyaLine
uint16_t m_dyaLine
Definition: DosWord.cpp:84
MSWriteParser
This class parses Microsoft Write 3.0 and 3.1.
Definition: MSWrite.h:131
WPSBorder::m_color
WPSColor m_color
the border color
Definition: libwps_internal.h:456
WPSParagraph::m_borderStyle
WPSBorder m_borderStyle
the border style
Definition: WPSParagraph.h:131
DosWordParserInternal::PAP::m_TBD
struct DosWordParserInternal::PAP::TBD m_TBD[20]
DosWordParserInternal::PAP::m_dyaBefore
uint16_t m_dyaBefore
Definition: DosWord.cpp:85
MSWriteParserInternal::Section::m_columns
unsigned m_columns
Definition: MSWrite.h:120
MSWriteParserInternal::Section::m_dxaColumns
double m_dxaColumns
Definition: MSWrite.h:121
DosWordParserInternal::HEADER_W_PNSUMD
@ HEADER_W_PNSUMD
Definition: DosWord.cpp:117
DosWordParserInternal::PAP::TBD::m_dxa
uint16_t m_dxa
Definition: DosWord.cpp:99
WPSTabStop::LEFT
@ LEFT
Definition: WPSParagraph.h:39
WPSHeader::setNeedEncoding
void setNeedEncoding(bool needEncoding)
Definition: WPSHeader.h:84
libwps::ParseException
Definition: libwps_internal.h:151
MSWriteParserInternal::Font::m_fcFirst
uint32_t m_fcFirst
Definition: MSWrite.h:76
DosWordParserInternal::HEADER_B_VERSION
@ HEADER_B_VERSION
Definition: DosWord.cpp:119
MSWriteParserInternal::Font::m_fcLim
uint32_t m_fcLim
Definition: MSWrite.h:76
WPS_DEBUG_MSG
#define WPS_DEBUG_MSG(M)
Definition: libwps_internal.h:134
libwps::readU32
uint32_t readU32(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:76
WPSFont::m_color
WPSColor m_color
the font color
Definition: WPSFont.h:91
DosWordParserInternal
Definition: DosWord.cpp:37
DosWordParserInternal::HEADER_W_WTOOL
@ HEADER_W_WTOOL
Definition: DosWord.cpp:110
WPSContentListener.h
MSWriteParserInternal::Paragraph
Definition: MSWrite.h:41
DosWordParserInternal::HEADER_W_PNPARA
@ HEADER_W_PNPARA
Definition: DosWord.cpp:112
WPSHeader
Definition: WPSHeader.h:31
DosWordParserInternal::HEADER_D_FCMAC
@ HEADER_D_FCMAC
Definition: DosWord.cpp:111
DosWordParser::DosWordParser
DosWordParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN)
Definition: DosWord.cpp:126
DosWordParserInternal::PAP::m_shade
uint8_t m_shade
Definition: DosWord.cpp:88
MSWriteParserInternal::Section::m_dyaText
double m_dyaText
Definition: MSWrite.h:113
DosWordParserInternal::PAP::TBD::m_jcTab
uint8_t m_jcTab
Definition: DosWord.cpp:100
WPSTabStop::DECIMAL
@ DECIMAL
Definition: WPSParagraph.h:39
DosWordParser::readSED
void readSED() final
Definition: DosWord.cpp:818
libwps_tools_win::Font::UNKNOWN
@ UNKNOWN
Definition: libwps_tools_win.h:63
WPSField::Date
@ Date
Definition: libwps_internal.h:465
WPSFont.h
WPSEntry.h
DosWordParser::readPAP
void readPAP(uint32_t fcFirst, uint32_t fcLim, unsigned cch) final
Definition: DosWord.cpp:336
WPSFont::m_attributes
uint32_t m_attributes
the font attributes defined as a set of bits
Definition: WPSFont.h:87
MSWriteParserInternal::Paragraph::HEADER
@ HEADER
Definition: MSWrite.h:43
WPS_HIDDEN_BIT
#define WPS_HIDDEN_BIT
Definition: libwps_internal.h:516
MSWriteParser::m_fcMac
uint32_t m_fcMac
Definition: MSWrite.h:186
WPSParser::getInput
RVNGInputStreamPtr & getInput()
Definition: WPSParser.h:47
DosWordParserInternal::PAP::m_rhc
uint8_t m_rhc
Definition: DosWord.cpp:86
MSWriteParser::m_paragraphList
std::vector< MSWriteParserInternal::Paragraph > m_paragraphList
Definition: MSWrite.h:188
MSWriteParser::m_footnotes
std::vector< MSWriteParserInternal::Footnote > m_footnotes
Definition: MSWrite.h:190
DosWordParserInternal::HEADER_W_PNBKMK
@ HEADER_W_PNBKMK
Definition: DosWord.cpp:114
WPSFont::m_size
double m_size
font size
Definition: WPSFont.h:85
MSWriteParserInternal::Section::m_xaMac
double m_xaMac
Definition: MSWrite.h:111
DosWordParser::getFileEncoding
libwps_tools_win::Font::Type getFileEncoding(libwps_tools_win::Font::Type hint) final
Definition: DosWord.cpp:198
libwps_tools_win::Font::CP_437
@ CP_437
Definition: libwps_tools_win.h:46
WPSParagraph::m_border
int m_border
list of bits to indicated a border 1: LeftBorderBit, 2: RightBorderBit, ...
Definition: WPSParagraph.h:129
MSWriteParserInternal::Paragraph::m_firstpage
bool m_firstpage
Definition: MSWrite.h:59
DosWordParser::checkHeader
bool checkHeader(WPSHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: DosWord.cpp:143
DosWordParserInternal::PAP::TBD
Definition: DosWord.cpp:91
WPSHeaderPtr
std::shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:109
DosWordParserInternal::PAP::m_dxaRight
uint16_t m_dxaRight
Definition: DosWord.cpp:84
libwps::readU8
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:40
DosWordParserInternal::PAP::m_dxaLeft
uint16_t m_dxaLeft
Definition: DosWord.cpp:84
MSWriteParserInternal::Paragraph::MAIN
@ MAIN
Definition: MSWrite.h:43
DosWordParserInternal::HEADER_W_CODEPAGE
@ HEADER_W_CODEPAGE
Definition: DosWord.cpp:121
MSWriteParser::m_sections
std::vector< MSWriteParserInternal::Section > m_sections
Definition: MSWrite.h:191
WPSBorder::Type
Type
the line repetition
Definition: libwps_internal.h:399
DosWordParser::color
static WPSColor color(int clr)
Definition: DosWord.cpp:215
MSWriteParserInternal::Footnote
Definition: MSWrite.h:81
MSWriteParserInternal::Font::m_encoding
libwps_tools_win::Font::Type m_encoding
Definition: MSWrite.h:78
libwps_tools_win::Font::getTypeForOEM
static Type getTypeForOEM(int oem)
Definition: libwps_tools_win.cpp:112
libwps_tools_win.h
WPSParser.h
DosWordParser::operator=
DosWordParser & operator=(const DosWordParser &)=delete
DosWordParserInternal::CHP::m_clr
uint8_t m_clr
Definition: DosWord.cpp:58
DosWordParserInternal::CHP::m_fBold
uint8_t m_fBold
Definition: DosWord.cpp:53
MSWriteParserInternal::Paragraph::m_Location
Location m_Location
Definition: MSWrite.h:58
WPSField::Time
@ Time
Definition: libwps_internal.h:465
libwps::readU16
uint16_t readU16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:64
MSWriteParserInternal::Paragraph::FOOTNOTE
@ FOOTNOTE
Definition: MSWrite.h:43
DosWordParserInternal::PAP::m_pos
uint8_t m_pos
Definition: DosWord.cpp:89
DosWordParserInternal::PAP::TBD::TBD
TBD()
Definition: DosWord.cpp:93
WPSBorder::Double
@ Double
Definition: libwps_internal.h:399
DosWordParserInternal::HEADER_W_PNFNTB
@ HEADER_W_PNFNTB
Definition: DosWord.cpp:113
RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
WPSParagraph::m_spacings
double m_spacings[3]
the line spacing
Definition: WPSParagraph.h:107
MSWriteParserInternal::Paragraph::m_headerUseMargin
bool m_headerUseMargin
Definition: MSWrite.h:59
DosWordParserInternal::HeaderOffset
HeaderOffset
Definition: DosWord.cpp:106
MSWriteParser::insertNote
void insertNote(bool annotation, uint32_t fcPos, librevenge::RVNGString &label)
Definition: MSWrite.cpp:1717
WPSBorder::m_type
Type m_type
the border repetition
Definition: libwps_internal.h:448
MSWriteParserInternal::Section::m_dxaText
double m_dxaText
Definition: MSWrite.h:115
DosWordParserInternal::CHP::m_hps
uint8_t m_hps
Definition: DosWord.cpp:54
MSWriteParserInternal::Footnote::m_fcRef
uint32_t m_fcRef
Definition: MSWrite.h:86
libwps::JustificationFull
@ JustificationFull
Definition: libwps_internal.h:249
libwps_internal.h
WPSParagraph::m_breakStatus
int m_breakStatus
a list of bits: 0x1 (unbreakable), 0x2 (do not break after)
Definition: WPSParagraph.h:118
libwps::NoBreakWithNextBit
@ NoBreakWithNextBit
Definition: libwps_internal.h:252
libwps::JustificationLeft
@ JustificationLeft
Definition: libwps_internal.h:249
DosWordParserInternal::PAP::m_border
uint8_t m_border
Definition: DosWord.cpp:87
WPSPageSpan::EVEN
@ EVEN
Definition: WPSPageSpan.h:44
WPSColor::getRed
unsigned char getRed() const
returns the red value
Definition: libwps_internal.h:335
DosWordParserInternal::PAP::m_reserved2
uint8_t m_reserved2[2]
Definition: DosWord.cpp:83
WPSColor
the class to store a color
Definition: libwps_internal.h:280
MSWriteParserInternal::Footnote::m_fcFtn
uint32_t m_fcFtn
Definition: MSWrite.h:86
libwps::NoBreakBit
@ NoBreakBit
Definition: libwps_internal.h:252
libwps_tools_win::Font::getFontType
static Type getFontType(librevenge::RVNGString &name)
returns the type of the font using the fontName
Definition: libwps_tools_win.cpp:39
WPS_COLUMN_BREAK
#define WPS_COLUMN_BREAK
Definition: libwps_internal.h:521
libwps::JustificationCenter
@ JustificationCenter
Definition: libwps_internal.h:249
DosWordParserInternal::CHP::m_fUline
uint8_t m_fUline
Definition: DosWord.cpp:55
DosWordParserInternal::PAP::PAP
PAP()
constructor
Definition: DosWord.cpp:64
DosWordParser::readCHP
void readCHP(uint32_t fcFirst, uint32_t fcLim, unsigned cch) final
Definition: DosWord.cpp:239
WPSParagraph::m_backgroundColor
WPSColor m_backgroundColor
the background color
Definition: WPSParagraph.h:126
MSWriteParserInternal::Paragraph::FOOTER
@ FOOTER
Definition: MSWrite.h:43
libwps::JustificationRight
@ JustificationRight
Definition: libwps_internal.h:250
MSWrite.h
DosWordParserInternal::PAP::m_dxaLeft1
uint16_t m_dxaLeft1
Definition: DosWord.cpp:84
DosWordParserInternal::PAP
Definition: DosWord.cpp:61
MSWriteParserInternal::Section
Definition: MSWrite.h:89
MSWriteParser::m_fontType
libwps_tools_win::Font::Type m_fontType
Definition: MSWrite.h:193
WPSParagraph::m_tabs
std::vector< WPSTabStop > m_tabs
the tabulations
Definition: WPSParagraph.h:113
WPSFont::m_name
librevenge::RVNGString m_name
font name
Definition: WPSFont.h:83
MSWriteParserInternal::Paragraph::Location
Location
Definition: MSWrite.h:43