ActaParser.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 ACTA_PARSER
35 # define ACTA_PARSER
36 
37 #include <string>
38 #include <vector>
39 
40 #include <librevenge/librevenge.h>
41 
42 #include "MWAWDebug.hxx"
43 #include "MWAWInputStream.hxx"
44 
45 #include "MWAWParser.hxx"
46 
47 namespace ActaParserInternal
48 {
49 class SubDocument;
50 struct State;
51 }
52 
53 class ActaText;
54 
57 class ActaParser : public MWAWTextParser
58 {
60  friend class ActaText;
61 public:
63  ActaParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
65  virtual ~ActaParser();
66 
68  bool checkHeader(MWAWHeader *header, bool strict=false);
69 
70  // the main parse function
71  void parse(librevenge::RVNGTextInterface *documentInterface);
72 
73 protected:
75  void init();
76 
78  void createDocument(librevenge::RVNGTextInterface *documentInterface);
79 
81  MWAWVec2f getPageLeftTop() const;
83  void newPage(int number);
84 
85  // interface with the text parser
86 
88  shared_ptr<MWAWList> getMainList();
89 
90 protected:
92  bool createZones();
93 
95  bool readRSRCZones();
96 
98  bool readEndDataV3();
99 
101  void sendHeaderFooter();
102 
104  bool readPrintInfo(MWAWEntry const &entry);
105 
107  bool readWindowPos(MWAWEntry const &entry);
108 
110  bool readLabel(MWAWEntry const &entry);
111 
113  bool readHFProperties(MWAWEntry const &entry);
114 
116  bool readOption(MWAWEntry const &entry);
117 
118  //
119  // low level
120  //
121 
124 
127 
128  //
129  // data
130  //
131 
133  shared_ptr<ActaParserInternal::State> m_state;
134 
136  shared_ptr<ActaText> m_textParser;
137 };
138 #endif
139 // 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
ActaParserInternal::State::State
State()
constructor
Definition: ActaParser.cxx:194
ActaParserInternal::Option
Internal: class used to store the optional preferences in ActaParser.
Definition: ActaParser.cxx:160
ActaParserInternal::Printing::isEmpty
bool isEmpty() const
returns true if the header is empty
Definition: ActaParser.cxx:113
ActaParser::readWindowPos
bool readWindowPos(MWAWEntry const &entry)
read the window position ( WSIZ resource block )
Definition: ActaParser.cxx:778
MWAWParagraph::m_justify
MWAWVariable< Justification > m_justify
the justification
Definition: MWAWParagraph.hxx:161
MWAWListManagerPtr
shared_ptr< MWAWListManager > MWAWListManagerPtr
a smart pointer of MWAWListManager
Definition: libmwaw_internal.hxx:507
MWAWTextParser
virtual class which defines the ancestor of all text zone parser
Definition: MWAWParser.hxx:296
ActaParserInternal::Printing::m_font
MWAWFont m_font
the font
Definition: ActaParser.cxx:153
MWAWParser::getFontConverter
MWAWFontConverterPtr & getFontConverter()
returns the font converter
Definition: MWAWParser.hxx:150
ActaParser::readRSRCZones
bool readRSRCZones()
read the resource fork zone
Definition: ActaParser.cxx:533
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
ActaParserInternal::Printing::operator<<
friend std::ostream & operator<<(std::ostream &o, Printing const &print)
operator<<
Definition: ActaParser.cxx:134
MWAWHeaderFooter::HEADER
@ HEADER
Definition: MWAWPageSpan.hxx:48
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:127
MWAWListLevel::m_suffix
librevenge::RVNGString m_suffix
string which follows the number if we have an ordered level
Definition: MWAWList.hxx:98
ActaParserInternal
Internal: the structures of a ActaParser.
Definition: ActaParser.cxx:58
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:785
ActaParserInternal::State::m_label
Label m_label
the list type
Definition: ActaParser.cxx:203
ActaParserInternal::State::m_printerPreferences
Printing m_printerPreferences
the printer preferences
Definition: ActaParser.cxx:199
MWAWField::m_DTFormat
std::string m_DTFormat
the date/time format using strftime format if defined
Definition: libmwaw_internal.hxx:386
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
ActaParserInternal::State::m_title
std::string m_title
the title (if defined)
Definition: ActaParser.cxx:201
ActaParserInternal::Label::operator!=
bool operator!=(Label const &lbl) const
operator=!
Definition: ActaParser.cxx:95
MWAWListLevel::NONE
@ NONE
Definition: MWAWList.hxx:46
libmwaw::DebugFile::open
bool open(std::string const &filename)
opens/creates a file to store a result
Definition: MWAWDebug.cxx:46
MWAWListLevel::LOWER_ALPHA
@ LOWER_ALPHA
Definition: MWAWList.hxx:46
MWAWEntry::id
int id() const
returns the id
Definition: MWAWEntry.hxx:153
ActaParserInternal::SubDocument::operator==
virtual bool operator==(MWAWSubDocument const &doc) const
operator!==
Definition: ActaParser.cxx:233
MWAWPageSpan::setMarginBottom
void setMarginBottom(const double marginBottom)
set the page bottom margin
Definition: MWAWPageSpan.hxx:202
ActaParserInternal::Printing::Printing
Printing()
constructor
Definition: ActaParser.cxx:107
MWAWFontConverter.hxx
libmwaw::appendUnicode
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer)
adds an unicode character to a string
Definition: libmwaw_internal.cxx:63
ActaParser::getMainList
shared_ptr< MWAWList > getMainList()
returns a list to be used in the text
Definition: ActaParser.cxx:309
MWAWFontConverterPtr
shared_ptr< MWAWFontConverter > MWAWFontConverterPtr
a smart pointer of MWAWFontConverter
Definition: libmwaw_internal.hxx:495
ActaParserInternal::Label
Internal: class used to store a list type in ActaParser.
Definition: ActaParser.cxx:61
MWAWParser::version
int version() const
returns the works version
Definition: MWAWParser.hxx:108
MWAWPrinter.hxx
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
ActaParser::init
void init()
inits all internal variables
Definition: ActaParser.cxx:273
MWAWFont::Line::Simple
@ Simple
Definition: MWAWFont.hxx:49
ActaParserInternal::Label::operator==
bool operator==(Label const &lbl) const
operator==
Definition: ActaParser.cxx:90
MWAWListLevel::UPPER_ALPHA
@ UPPER_ALPHA
Definition: MWAWList.hxx:46
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_ACTA
@ MWAW_T_ACTA
Acta (v2 and Classic v1)
Definition: MWAWDocument.hxx:101
MWAWEntry::setParsed
void setParsed(bool ok=true) const
sets the flag m_parsed to true or false
Definition: MWAWEntry.hxx:115
ActaParser::readOption
bool readOption(MWAWEntry const &entry)
read the QOPT resource block (small print change )
Definition: ActaParser.cxx:880
MWAWParser::getTextListener
MWAWTextListenerPtr & getTextListener()
returns the text listener
Definition: MWAWParser.hxx:145
ActaParserInternal::SubDocument::operator!=
virtual bool operator!=(MWAWSubDocument const &doc) const
operator!=
Definition: ActaParser.cxx:224
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
ActaParser::readEndDataV3
bool readEndDataV3()
read the end file data zones
Definition: ActaParser.cxx:601
MWAWParser::ascii
libmwaw::DebugFile & ascii()
a DebugFile used to write what we recognize when we parse the document
Definition: MWAWParser.hxx:195
ActaParserInternal::SubDocument::~SubDocument
virtual ~SubDocument()
destructor
Definition: ActaParser.cxx:221
MWAWFont::embossBit
@ embossBit
Definition: MWAWFont.hxx:182
MWAWHeaderFooter
a class which stores the header/footer data
Definition: MWAWPageSpan.hxx:45
ActaParser::readLabel
bool readLabel(MWAWEntry const &entry)
read the label type
Definition: ActaParser.cxx:807
MWAWField::Date
@ Date
Definition: libmwaw_internal.hxx:371
MWAWParser::asciiName
std::string const & asciiName() const
return the ascii file name
Definition: MWAWParser.hxx:232
ActaParserInternal::Option::m_flags
int m_flags
the flags
Definition: ActaParser.cxx:187
MWAWSubDocument.hxx
MWAWPageSpan::setFormLength
void setFormLength(const double formLength)
set the total page length
Definition: MWAWPageSpan.hxx:172
ActaParser::m_textParser
shared_ptr< ActaText > m_textParser
the text parser
Definition: ActaParser.hxx:136
ActaParser::ActaParser
ActaParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: ActaParser.cxx:263
libmwaw::SubDocumentType
SubDocumentType
Definition: libmwaw_internal.hxx:178
ActaParserInternal::SubDocument
Internal: the subdocument of a ActaParser.
Definition: ActaParser.cxx:215
libmwaw::DebugFile::reset
void reset()
writes the current file and reset to zero
Definition: MWAWDebug.hxx:85
ActaParser.hxx
MWAWParagraph::JustificationCenter
@ JustificationCenter
Definition: MWAWParagraph.hxx:87
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
MWAWListLevel::UPPER_ROMAN
@ UPPER_ROMAN
Definition: MWAWList.hxx:47
ActaParser::~ActaParser
virtual ~ActaParser()
destructor
Definition: ActaParser.cxx:269
MWAWFont::getDebugString
std::string getDebugString(shared_ptr< MWAWFontConverter > &converter) const
returns a string which can be used for debugging
Definition: MWAWFont.cxx:181
ActaParserInternal::State::m_actPage
int m_actPage
the actual page
Definition: ActaParser.cxx:206
MWAWRSRCParser.hxx
MWAWVec2::y
T y() const
second element
Definition: libmwaw_internal.hxx:620
MWAWParser::getRSRCParser
MWAWRSRCParserPtr & getRSRCParser()
returns the rsrc parser
Definition: MWAWParser.hxx:190
ActaParserInternal::State::m_footerHeight
int m_footerHeight
the footer height if known
Definition: ActaParser.cxx:209
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
ActaParser::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition: ActaParser.cxx:286
ActaParser::createZones
bool createZones()
finds the different objects zones
Definition: ActaParser.cxx:518
ActaText.hxx
MWAWParser::setVersion
void setVersion(int vers)
sets the document's version
Definition: MWAWParser.hxx:206
MWAWEntry::length
long length() const
returns the length of the zone
Definition: MWAWEntry.hxx:82
MWAWListener::PageBreak
@ PageBreak
Definition: MWAWListener.hxx:58
ActaParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: ActaParser.cxx:910
ActaParser::readHFProperties
bool readHFProperties(MWAWEntry const &entry)
read the Header/Footer property (QHDR block)
Definition: ActaParser.cxx:830
MWAWVec2< float >
ActaParser::parse
void parse(librevenge::RVNGTextInterface *documentInterface)
virtual function used to parse the input
Definition: ActaParser.cxx:406
ActaParserInternal::State
Internal: the state of a ActaParser.
Definition: ActaParser.cxx:192
libmwaw::ParseException
Definition: libmwaw_internal.hxx:142
ActaParserInternal::Printing::m_flags
int m_flags[2]
the flags
Definition: ActaParser.cxx:155
MWAWDebug.hxx
ActaParser
the main class to read a Acta file
Definition: ActaParser.hxx:58
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
ActaParser::newPage
void newPage(int number)
adds a new page
Definition: ActaParser.cxx:390
MWAWListLevel::LOWER_ROMAN
@ LOWER_ROMAN
Definition: MWAWList.hxx:47
MWAWFont::setId
void setId(int newId)
sets the font id
Definition: MWAWFont.hxx:243
ActaParserInternal::Printing::operator!=
bool operator!=(Printing const &print) const
operator=!
Definition: ActaParser.cxx:129
ActaParserInternal::Label::Label
Label(int type=-1)
constructor
Definition: ActaParser.cxx:63
MWAWField
a field
Definition: libmwaw_internal.hxx:369
MWAWField::PageNumber
@ PageNumber
Definition: libmwaw_internal.hxx:371
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
MWAWParser::getParserState
MWAWParserStatePtr getParserState()
returns the parser state
Definition: MWAWParser.hxx:113
ActaParserInternal::State::m_stringLabel
std::string m_stringLabel
the custom label (if defined)
Definition: ActaParser.cxx:205
ActaParserInternal::Label::m_type
int m_type
the label type
Definition: ActaParser.cxx:100
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
MWAWListLevel::m_bullet
librevenge::RVNGString m_bullet
the bullet if we have an bullet level
Definition: MWAWList.hxx:99
MWAWList.hxx
MWAWListLevel::DECIMAL
@ DECIMAL
Definition: MWAWList.hxx:46
ActaParserInternal::SubDocument::SubDocument
SubDocument(ActaParser &pars, MWAWInputStreamPtr input)
Definition: ActaParser.cxx:217
ActaParserInternal::State::m_headerHeight
int m_headerHeight
the header height if known
Definition: ActaParser.cxx:208
MWAWFont::italicBit
@ italicBit
Definition: MWAWFont.hxx:182
MWAWParser::getInput
MWAWInputStreamPtr & getInput()
returns the actual input
Definition: MWAWParser.hxx:123
ActaParserInternal::Label::operator<<
friend std::ostream & operator<<(std::ostream &o, Label const &lbl)
operator<<
Definition: ActaParser.cxx:65
MWAWTextListener.hxx
MWAWListLevel::BULLET
@ BULLET
Definition: MWAWList.hxx:46
MWAWSubDocument::m_parser
MWAWParser * m_parser
the main zone parser
Definition: MWAWSubDocument.hxx:75
MWAWListLevel
small structure to keep information about a list level
Definition: MWAWList.hxx:44
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
MWAWListLevel::m_type
Type m_type
the type of the level
Definition: MWAWList.hxx:86
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
MWAWListLevel::m_numBeforeLabels
int m_numBeforeLabels
the number of label to show before this
Definition: MWAWList.hxx:88
libmwaw::DebugFile
an interface used to insert comment in a binary file, written in ascii form (if debug_with_files is n...
Definition: MWAWDebug.hxx:66
MWAWListLevel::m_labelAfterSpace
double m_labelAfterSpace
the minimum distance between the label and the text
Definition: MWAWList.hxx:91
ActaParserInternal::Option::operator<<
friend std::ostream & operator<<(std::ostream &o, Option const &opt)
operator<<
Definition: ActaParser.cxx:164
ActaParser::readPrintInfo
bool readPrintInfo(MWAWEntry const &entry)
read a PrintInfo block ( PSET resource block )
Definition: ActaParser.cxx:724
ActaParserInternal::Option::Option
Option(int flags=0)
constructor
Definition: ActaParser.cxx:162
MWAWInputStream.hxx
MWAWHeader::reset
void reset(MWAWDocument::Type type, int vers, Kind kind=MWAWDocument::MWAW_K_TEXT)
resets the data
Definition: MWAWHeader.hxx:82
ActaParser::sendHeaderFooter
void sendHeaderFooter()
sends the header/footer data
Definition: ActaParser.cxx:467
MWAWPageSpan::setMargins
void setMargins(double margin, int wh=libmwaw::LeftBit|libmwaw::RightBit|libmwaw::TopBit|libmwaw::BottomBit)
set all the margins
Definition: MWAWPageSpan.hxx:207
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:44
MWAWListLevel::m_prefix
librevenge::RVNGString m_prefix
string which preceedes the number if we have an ordered level
Definition: MWAWList.hxx:97
MWAWField::Title
@ Title
Definition: libmwaw_internal.hxx:371
ActaParserInternal::Printing
Internal: class used to store the printing preferences in ActaParser.
Definition: ActaParser.cxx:105
ActaParser::createDocument
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition: ActaParser.cxx:435
ActaText
the main class to read the text part of Acta Text file
Definition: ActaText.hxx:58
ActaParserInternal::Printing::operator==
bool operator==(Printing const &print) const
operator==
Definition: ActaParser.cxx:118
ActaParser::ActaText
friend class ActaText
Definition: ActaParser.hxx:60
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
ActaParserInternal::SubDocument::parse
void parse(MWAWListenerPtr &listener, libmwaw::SubDocumentType type)
the parser function
Definition: ActaParser.cxx:244
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
MWAWPageSpan
A class which defines the page properties.
Definition: MWAWPageSpan.hxx:96
ActaParser::getPageLeftTop
MWAWVec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition: ActaParser.cxx:299
MWAWParser::resetTextListener
void resetTextListener()
resets the listener
Definition: MWAWParser.cxx:151
ActaParser::rsrcAscii
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition: ActaParser.cxx:291
MWAWFont::setFlags
void setFlags(uint32_t fl)
sets the font attributes bold, ...
Definition: MWAWFont.hxx:304
ActaParser::m_state
shared_ptr< ActaParserInternal::State > m_state
the state
Definition: ActaParser.hxx:133
ActaParserInternal::State::m_numPages
int m_numPages
the number of page of the final document
Definition: ActaParser.cxx:206

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