MouseWrtParser.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2 
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33 
34 #ifndef MOUSE_WRT_PARSER
35 # define MOUSE_WRT_PARSER
36 
37 #include <vector>
38 
39 #include "MWAWDebug.hxx"
40 #include "MWAWInputStream.hxx"
41 
42 #include "MWAWParser.hxx"
43 
44 namespace MouseWrtParserInternal
45 {
46 struct State;
47 class SubDocument;
48 }
49 
56 {
58 
59 public:
63  virtual ~MouseWrtParser();
64 
66  bool checkHeader(MWAWHeader *header, bool strict=false);
67 
68  // the main parse function
69  void parse(librevenge::RVNGTextInterface *documentInterface);
70 
71 protected:
73  void createDocument(librevenge::RVNGTextInterface *documentInterface);
74 
76  bool createZones();
77 
79  bool readCharPLCs(long sz);
81  bool readParagraphPLCs(long sz);
83  bool readPrintInfo();
85  bool readDocumentInfo(long sz);
86 
87  // low level
88 
90  bool readFont(MWAWFont &font, int &cPos);
91 
93  void newPage(int number);
95  int computeNumPages();
97  bool sendMainZone();
99  bool sendZone(int number);
100 
101 protected:
102  //
103  // data
104  //
106  shared_ptr<MouseWrtParserInternal::State> m_state;
107 };
108 #endif
109 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
MWAWParagraph::m_justify
MWAWVariable< Justification > m_justify
the justification
Definition: MWAWParagraph.hxx:161
MWAWTextParser
virtual class which defines the ancestor of all text zone parser
Definition: MWAWParser.hxx:296
MouseWrtParserInternal::State::m_text
MWAWEntry m_text
the main text entry
Definition: MouseWrtParser.cxx:104
MouseWrtParserInternal::State::State
State()
constructor
Definition: MouseWrtParser.cxx:91
MWAWTextListenerPtr
shared_ptr< MWAWTextListener > MWAWTextListenerPtr
a smart pointer of MWAWTextListener
Definition: libmwaw_internal.hxx:519
MWAWPageSpan::setPageSpan
void setPageSpan(const int pageSpan)
set the page span ( default 1)
Definition: MWAWPageSpan.hxx:262
MouseWrtParser
the main class to read a MouseWrite file
Definition: MouseWrtParser.hxx:56
MWAWHeaderFooter::HEADER
@ HEADER
Definition: MWAWPageSpan.hxx:48
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:127
MouseWrtParserInternal::Zone
Internal: class to store zone information of a MouseWrtParser.
Definition: MouseWrtParser.cxx:60
MouseWrtParserInternal::Paragraph::Paragraph
Paragraph(int id=0)
constructor
Definition: MouseWrtParser.cxx:77
libmwaw::DebugFile::addDelimiter
void addDelimiter(long pos, char c)
adds a not breaking delimiter in position pos
Definition: MWAWDebug.cxx:73
MouseWrtParserInternal::Zone::Zone
Zone()
constructor
Definition: MouseWrtParser.cxx:62
MouseWrtParserInternal::State::m_paraPLCMap
std::map< int, Paragraph > m_paraPLCMap
the map position to paraPLC
Definition: MouseWrtParser.cxx:102
MWAWParagraph::m_writingMode
MWAWVariable< libmwaw::WritingMode > m_writingMode
the writing mode
Definition: MWAWParagraph.hxx:165
MWAWParagraph::m_tabs
MWAWVariable< std::vector< MWAWTabStop > > m_tabs
the tabulations
Definition: MWAWParagraph.hxx:156
MouseWrtParserInternal::Zone::m_writingHebrew
bool m_writingHebrew
flag to know if the writing is reverted
Definition: MouseWrtParser.cxx:68
MouseWrtParserInternal::SubDocument::operator==
virtual bool operator==(MWAWSubDocument const &doc) const
operator!==
Definition: MouseWrtParser.cxx:123
MWAWFont::boldBit
@ boldBit
Definition: MWAWFont.hxx:182
MWAWTextListener
This class contents the main functions needed to create a Word processing Document.
Definition: MWAWTextListener.hxx:65
libmwaw::DebugFile::open
bool open(std::string const &filename)
opens/creates a file to store a result
Definition: MWAWDebug.cxx:46
MWAWTabStop::CENTER
@ CENTER
Definition: MWAWParagraph.hxx:48
MWAWParagraph::setInterline
void setInterline(double value, librevenge::RVNGUnit unit, LineSpacingType type=Fixed)
set the interline
Definition: MWAWParagraph.hxx:123
MouseWrtParserInternal::SubDocument
Internal: the subdocument of a MouseWrtParser.
Definition: MouseWrtParser.cxx:112
MWAWPageSpan::setMarginBottom
void setMarginBottom(const double marginBottom)
set the page bottom margin
Definition: MWAWPageSpan.hxx:202
MouseWrtParserInternal::State::m_blockSizes
long m_blockSizes[5]
the first zone's size
Definition: MouseWrtParser.cxx:98
MouseWrtParser::m_state
shared_ptr< MouseWrtParserInternal::State > m_state
the state
Definition: MouseWrtParser.hxx:106
MWAWFontConverter.hxx
MWAWEmbeddedObject
small class use to define a embedded object
Definition: libmwaw_internal.hxx:425
MouseWrtParser::readParagraphPLCs
bool readParagraphPLCs(long sz)
reads the paragraph plc zone: zone 2
Definition: MouseWrtParser.cxx:430
MouseWrtParser::MouseWrtParser
MouseWrtParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: MouseWrtParser.cxx:166
MouseWrtParser::sendMainZone
bool sendMainZone()
tries to send the main text zone
Definition: MouseWrtParser.cxx:728
MWAWPrinter.hxx
MouseWrtParser::newPage
void newPage(int number)
adds a new page
Definition: MouseWrtParser.cxx:179
MWAWParagraph
class to store the paragraph properties
Definition: MWAWParagraph.hxx:82
MWAWPageSpan::setMarginLeft
void setMarginLeft(const double marginLeft)
set the page left margin
Definition: MWAWPageSpan.hxx:187
MWAWFont::Line::Simple
@ Simple
Definition: MWAWFont.hxx:49
MouseWrtParserInternal::SubDocument::m_id
int m_id
the subdocument id
Definition: MouseWrtParser.cxx:133
MWAWHeaderFooter::m_subDocument
MWAWSubDocumentPtr m_subDocument
the document data
Definition: MWAWPageSpan.hxx:89
libmwaw::PrinterInfo
the AppleŠ printer information : TPrint
Definition: MWAWPrinter.hxx:82
MWAWDocument::MWAW_T_MOUSEWRITE
@ MWAW_T_MOUSEWRITE
MouseWrite: v1.
Definition: MWAWDocument.hxx:192
MouseWrtParserInternal::Paragraph::m_picture
bool m_picture
flag to know if this is a picture
Definition: MouseWrtParser.cxx:85
MWAWParser::getTextListener
MWAWTextListenerPtr & getTextListener()
returns the text listener
Definition: MWAWParser.hxx:145
MouseWrtParser::createDocument
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition: MouseWrtParser.cxx:224
MWAWPageSpan::getPageWidth
double getPageWidth() const
returns the page width (form width without margin )
Definition: MWAWPageSpan.hxx:151
libmwaw::DebugFile::addNote
void addNote(char const *note)
adds a note in the file, in actual position
Definition: MWAWDebug.cxx:59
MWAWSubDocument
abstract class used to store a subdocument (with a comparison function)
Definition: MWAWSubDocument.hxx:42
MWAWParagraph::m_margins
MWAWVariable< double > m_margins[3]
the margins
Definition: MWAWParagraph.hxx:142
MouseWrtParser::createZones
bool createZones()
finds the different objects zones
Definition: MouseWrtParser.cxx:259
MWAWParser::ascii
libmwaw::DebugFile & ascii()
a DebugFile used to write what we recognize when we parse the document
Definition: MWAWParser.hxx:195
MWAWFont::embossBit
@ embossBit
Definition: MWAWFont.hxx:182
MouseWrtParserInternal::State::m_charPLCMap
std::map< int, MWAWFont > m_charPLCMap
the map position to charPLC
Definition: MouseWrtParser.cxx:100
MWAWHeaderFooter
a class which stores the header/footer data
Definition: MWAWPageSpan.hxx:45
MWAWParser::asciiName
std::string const & asciiName() const
return the ascii file name
Definition: MWAWParser.hxx:232
MWAWTabStop
class to store a tab use by MWAWParagraph
Definition: MWAWParagraph.hxx:46
MWAWSubDocument.hxx
MWAWPageSpan::setFormLength
void setFormLength(const double formLength)
set the total page length
Definition: MWAWPageSpan.hxx:172
MouseWrtParserInternal::Zone::m_text
MWAWEntry m_text
the text entry
Definition: MouseWrtParser.cxx:70
libmwaw::SubDocumentType
SubDocumentType
Definition: libmwaw_internal.hxx:178
libmwaw::DebugFile::reset
void reset()
writes the current file and reset to zero
Definition: MWAWDebug.hxx:85
MWAWFont::m_extra
std::string m_extra
extra data
Definition: MWAWFont.hxx:552
MWAWParser::getMainListener
MWAWListenerPtr getMainListener()
returns the main listener
Definition: MWAWParser.cxx:108
MWAWParagraph::JustificationCenter
@ JustificationCenter
Definition: MWAWParagraph.hxx:87
MouseWrtParserInternal::SubDocument::parse
void parse(MWAWListenerPtr &listener, libmwaw::SubDocumentType type)
the parser function
Definition: MouseWrtParser.cxx:136
MWAWFont::shadowBit
@ shadowBit
Definition: MWAWFont.hxx:183
MWAWParser::setTextListener
void setTextListener(MWAWTextListenerPtr &listener)
sets the text listener
Definition: MWAWParser.cxx:146
MWAWParser::setAsciiName
void setAsciiName(char const *name)
Debugging: change the default ascii file.
Definition: MWAWParser.hxx:227
MWAWParagraph.hxx
libmwaw::DebugFile::skipZone
void skipZone(long beginPos, long endPos)
skips the file zone defined by beginPos-endPos
Definition: MWAWDebug.hxx:105
MWAWFont::getDebugString
std::string getDebugString(shared_ptr< MWAWFontConverter > &converter) const
returns a string which can be used for debugging
Definition: MWAWFont.cxx:181
MWAWRSRCParser.hxx
MWAWVec2::y
T y() const
second element
Definition: libmwaw_internal.hxx:620
libmwaw::Debug::dumpFile
bool dumpFile(librevenge::RVNGBinaryData &data, char const *fileName)
a debug function to store in a datafile in the current directory WARNING: this function erase the fil...
Definition: MWAWDebug.cxx:197
MWAWPageSpan::setFormWidth
void setFormWidth(const double formWidth)
set the total page width
Definition: MWAWPageSpan.hxx:177
MWAWPosition.hxx
MWAWVec2::x
T x() const
first element
Definition: libmwaw_internal.hxx:615
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: MWAWPosition.hxx:48
MouseWrtParserInternal::State::m_actPage
int m_actPage
the actual page
Definition: MouseWrtParser.cxx:96
MouseWrtParser.hxx
MouseWrtParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: MouseWrtParser.cxx:322
MWAWEntry::length
long length() const
returns the length of the zone
Definition: MWAWEntry.hxx:82
MouseWrtParserInternal::State
Internal: the state of a MouseWrtParser.
Definition: MouseWrtParser.cxx:89
MWAWListener::PageBreak
@ PageBreak
Definition: MWAWListener.hxx:58
MWAWVec2< int >
MWAWPictMac.hxx
MWAWTabStop::m_alignment
Alignment m_alignment
the alignment ( left, center, ...)
Definition: MWAWParagraph.hxx:73
libmwaw::ParseException
Definition: libmwaw_internal.hxx:142
MWAWDebug.hxx
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:57
MWAWEntry::begin
long begin() const
returns the begin offset
Definition: MWAWEntry.hxx:72
MWAWParser::getPageSpan
MWAWPageSpan const & getPageSpan() const
returns the actual page dimension
Definition: MWAWParser.hxx:160
MouseWrtParser::readDocumentInfo
bool readDocumentInfo(long sz)
reads the document info zone: zone 4
Definition: MouseWrtParser.cxx:562
MWAWTabStop::m_position
double m_position
the tab position
Definition: MWAWParagraph.hxx:71
MWAWFont::setId
void setId(int newId)
sets the font id
Definition: MWAWFont.hxx:243
MouseWrtParserInternal::SubDocument::operator!=
virtual bool operator!=(MWAWSubDocument const &doc) const
operator!=
Definition: MouseWrtParser.cxx:153
MouseWrtParserInternal::Zone::m_font
MWAWFont m_font
the font
Definition: MouseWrtParser.cxx:66
MouseWrtParserInternal::Paragraph::m_paragraph
MWAWParagraph m_paragraph
the paragraph
Definition: MouseWrtParser.cxx:83
MouseWrtParserInternal
Internal: the structures of a MouseWrtParser.
Definition: MouseWrtParser.cxx:57
MWAWPageSpan::setMarginTop
void setMarginTop(const double marginTop)
set the page top margin
Definition: MWAWPageSpan.hxx:197
libmwaw::PrinterInfo::read
bool read(MWAWInputStreamPtr input)
reads the struture in a file
Definition: MWAWPrinter.cxx:218
MWAWHeaderFooter::FOOTER
@ FOOTER
Definition: MWAWPageSpan.hxx:48
MWAWPosition::Char
@ Char
Definition: MWAWPosition.hxx:51
MWAWParser::getParserState
MWAWParserStatePtr getParserState()
returns the parser state
Definition: MWAWParser.hxx:113
MWAWHeader.hxx
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:503
MWAWFont::setSize
void setSize(float sz, bool isRelative=false)
sets the font size
Definition: MWAWFont.hxx:254
MWAWHeaderFooter::ALL
@ ALL
Definition: MWAWPageSpan.hxx:50
MouseWrtParser::sendZone
bool sendZone(int number)
tries to send the header/footer zone
Definition: MouseWrtParser.cxx:877
MWAWFont::italicBit
@ italicBit
Definition: MWAWFont.hxx:182
MWAWParagraph::m_marginsUnit
MWAWVariable< librevenge::RVNGUnit > m_marginsUnit
the margins INCH, ...
Definition: MWAWParagraph.hxx:144
MWAWParser::getInput
MWAWInputStreamPtr & getInput()
returns the actual input
Definition: MWAWParser.hxx:123
MouseWrtParser::readFont
bool readFont(MWAWFont &font, int &cPos)
try to read a font
Definition: MouseWrtParser.cxx:403
MouseWrtParser::readCharPLCs
bool readCharPLCs(long sz)
reads the char plc zone: zone 0
Definition: MouseWrtParser.cxx:373
MouseWrtParserInternal::Paragraph
Internal: class to store paragraph information of a MouseWrtParser.
Definition: MouseWrtParser.cxx:75
MWAWTextListener.hxx
MouseWrtParser::readPrintInfo
bool readPrintInfo()
reads the print info zone: zone 3
Definition: MouseWrtParser.cxx:675
MWAWSubDocument::m_parser
MWAWParser * m_parser
the main zone parser
Definition: MWAWSubDocument.hxx:75
MWAWParagraph::JustificationFull
@ JustificationFull
Definition: MWAWParagraph.hxx:87
MWAWParagraph::JustificationRight
@ JustificationRight
Definition: MWAWParagraph.hxx:88
MouseWrtParser::computeNumPages
int computeNumPages()
computes the number of page
Definition: MouseWrtParser.cxx:645
libmwaw::DebugFile::addPos
void addPos(long pos)
adds a new position in the file
Definition: MWAWDebug.cxx:53
libmwaw::DebugFile::setStream
void setStream(MWAWInputStreamPtr ip)
resets the input
Definition: MWAWDebug.hxx:73
MWAWPageSpan::setMarginRight
void setMarginRight(const double marginRight)
set the page right margin
Definition: MWAWPageSpan.hxx:192
MWAWEntry::valid
bool valid() const
returns true if the zone length is positive
Definition: MWAWEntry.hxx:88
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:513
MWAWPageSpan::setHeaderFooter
void setHeaderFooter(MWAWHeaderFooter const &headerFooter)
add a header/footer on some page
Definition: MWAWPageSpan.cxx:223
MouseWrtParserInternal::Paragraph::m_id
int m_id
the paragraph id
Definition: MouseWrtParser.cxx:81
MWAWInputStream.hxx
MWAWHeader::reset
void reset(MWAWDocument::Type type, int vers, Kind kind=MWAWDocument::MWAW_K_TEXT)
resets the data
Definition: MWAWHeader.hxx:82
MouseWrtParserInternal::State::m_zones
Zone m_zones[2]
the header and the footer zone
Definition: MouseWrtParser.cxx:106
MWAWFont.hxx
MWAWPosition::m_anchorTo
AnchorTo m_anchorTo
anchor position
Definition: MWAWPosition.hxx:254
MWAWBox2< int >
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:44
libmwaw::WritingRightTop
@ WritingRightTop
Definition: libmwaw_internal.hxx:175
MouseWrtParserInternal::SubDocument::SubDocument
SubDocument(MouseWrtParser &pars, MWAWInputStreamPtr input, int zoneId)
Definition: MouseWrtParser.cxx:114
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:781
libmwaw::DebugStream
std::stringstream DebugStream
a basic stream (if debug_with_files is not defined, does nothing)
Definition: MWAWDebug.hxx:61
MWAWListenerPtr
shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:505
MWAWParser.hxx
MouseWrtParserInternal::SubDocument::~SubDocument
virtual ~SubDocument()
destructor
Definition: MouseWrtParser.cxx:118
MWAWFont::setUnderlineStyle
void setUnderlineStyle(Line::Style style=Line::None, bool doReset=true)
sets the underline style ( by default, we also reset the style)
Definition: MWAWFont.hxx:445
MWAWSubDocument::m_input
shared_ptr< MWAWInputStream > m_input
the input
Definition: MWAWSubDocument.hxx:77
MWAWPageSpan
A class which defines the page properties.
Definition: MWAWPageSpan.hxx:96
MouseWrtParser::~MouseWrtParser
virtual ~MouseWrtParser()
destructor
Definition: MouseWrtParser.cxx:172
MWAWParser::resetTextListener
void resetTextListener()
resets the listener
Definition: MWAWParser.cxx:151
MouseWrtParserInternal::State::m_numPages
int m_numPages
the number of page of the final document
Definition: MouseWrtParser.cxx:96
MWAWFont::setFlags
void setFlags(uint32_t fl)
sets the font attributes bold, ...
Definition: MWAWFont.hxx:304
MouseWrtParser::parse
void parse(librevenge::RVNGTextInterface *documentInterface)
virtual function used to parse the input
Definition: MouseWrtParser.cxx:195

Generated on Wed Jun 17 2020 06:30:11 for libmwaw by doxygen 1.8.18