GreatWksParser.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 GREAT_WKS_PARSER
35 # define GREAT_WKS_PARSER
36 
37 #include <string>
38 #include <vector>
39 
40 #include <librevenge/librevenge.h>
41 
42 #include "MWAWDebug.hxx"
43 
44 #include "MWAWParser.hxx"
45 
46 namespace GreatWksParserInternal
47 {
48 struct State;
49 class SubDocument;
50 }
51 
52 class GreatWksDocument;
53 
57 {
59 public:
63  virtual ~GreatWksParser();
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 init();
74 
76  void createDocument(librevenge::RVNGTextInterface *documentInterface);
77 
79  void newPage(int number);
80 
81  // interface with the text parser
82 
86  bool sendHF(int id);
87 
88 protected:
90  bool createZones();
91 
92  //
93  // low level
94  //
95 
97  bool readDocInfo();
98 
99  //
100  // data
101  //
102 
104  shared_ptr<GreatWksParserInternal::State> m_state;
105 
107  shared_ptr<GreatWksDocument> m_document;
108 };
109 #endif
110 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
GreatWksParserInternal::SubDocument::~SubDocument
virtual ~SubDocument()
destructor
Definition: GreatWksParser.cxx:126
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
MWAWTextParser
virtual class which defines the ancestor of all text zone parser
Definition: MWAWParser.hxx:296
GreatWksParser::createDocument
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition: GreatWksParser.cxx:268
GreatWksParser::m_document
shared_ptr< GreatWksDocument > m_document
the main document
Definition: GreatWksParser.hxx:107
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
GreatWksParserInternal::State::getSection
MWAWSection getSection() const
returns a section
Definition: GreatWksParser.cxx:81
MWAWHeaderFooter::HEADER
@ HEADER
Definition: MWAWPageSpan.hxx:48
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:127
libmwaw::DebugFile::addDelimiter
void addDelimiter(long pos, char c)
adds a not breaking delimiter in position pos
Definition: MWAWDebug.cxx:73
GreatWksParser::~GreatWksParser
virtual ~GreatWksParser()
destructor
Definition: GreatWksParser.cxx:184
MWAWHeaderFooter::Type
Type
the header/footer type
Definition: MWAWPageSpan.hxx:48
MWAWHeaderFooter::EVEN
@ EVEN
Definition: MWAWPageSpan.hxx:50
MWAWTextListener
This class contents the main functions needed to create a Word processing Document.
Definition: MWAWTextListener.hxx:65
MWAWSection::m_columnSeparator
MWAWBorder m_columnSeparator
the vertical separator between columns
Definition: MWAWSection.hxx:104
libmwaw::DebugFile::open
bool open(std::string const &filename)
opens/creates a file to store a result
Definition: MWAWDebug.cxx:46
GreatWksDocument::GetMainSection
MWAWSection(MWAWParser::* GetMainSection)() const
callback used to return the main section
Definition: GreatWksDocument.hxx:171
GreatWksParser::readDocInfo
bool readDocInfo()
read the DocInfo block ( many unknown data )
Definition: GreatWksParser.cxx:372
MWAWPageSpan::setMarginBottom
void setMarginBottom(const double marginBottom)
set the page bottom margin
Definition: MWAWPageSpan.hxx:202
GreatWksParser
the main class to read a GreatWorks text file
Definition: GreatWksParser.hxx:57
MWAWParser::version
int version() const
returns the works version
Definition: MWAWParser.hxx:108
GreatWksParserInternal::State::m_actPage
int m_actPage
the actual page
Definition: GreatWksParser.cxx:111
MWAWPrinter.hxx
GreatWksParserInternal
Internal: the structures of a GreatWksParser.
Definition: GreatWksParser.cxx:59
MWAWPageSpan::setMarginLeft
void setMarginLeft(const double marginLeft)
set the page left margin
Definition: MWAWPageSpan.hxx:187
MWAWHeaderFooter::m_subDocument
MWAWSubDocumentPtr m_subDocument
the document data
Definition: MWAWPageSpan.hxx:89
GreatWksParserInternal::SubDocument::SubDocument
SubDocument(GreatWksParser &pars, MWAWInputStreamPtr input, int zoneId)
Definition: GreatWksParser.cxx:122
GreatWksParserInternal::SubDocument::parse
void parse(MWAWListenerPtr &listener, libmwaw::SubDocumentType type)
the parser function
Definition: GreatWksParser.cxx:144
MWAWParser::getTextListener
MWAWTextListenerPtr & getTextListener()
returns the text listener
Definition: MWAWParser.hxx:145
libmwaw::DebugFile::addNote
void addNote(char const *note)
adds a note in the file, in actual position
Definition: MWAWDebug.cxx:59
GreatWksParserInternal::State::m_columnsWidth
std::vector< double > m_columnsWidth
the columns dimension
Definition: GreatWksParser.cxx:106
MWAWSubDocument
abstract class used to store a subdocument (with a comparison function)
Definition: MWAWSubDocument.hxx:42
GreatWksDocument::NewPage
void(MWAWParser::* NewPage)(int page)
callback used to send a page break
Definition: GreatWksDocument.hxx:173
MWAWParser::ascii
libmwaw::DebugFile & ascii()
a DebugFile used to write what we recognize when we parse the document
Definition: MWAWParser.hxx:195
MWAWHeaderFooter
a class which stores the header/footer data
Definition: MWAWPageSpan.hxx:45
GreatWksParserInternal::State::m_hfFlags
bool m_hfFlags[4]
flags to define header/footer (titlePage, l/rPage, header, footer)
Definition: GreatWksParser.cxx:108
MWAWParser::asciiName
std::string const & asciiName() const
return the ascii file name
Definition: MWAWParser.hxx:232
MWAWSubDocument.hxx
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
GreatWksParserInternal::State
Internal: the state of a GreatWksParser.
Definition: GreatWksParser.cxx:63
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
MWAWRSRCParser.hxx
MWAWPosition.hxx
MWAWDocument::MWAW_K_TEXT
@ MWAW_K_TEXT
word processing file
Definition: MWAWDocument.hxx:82
GreatWksGraph.hxx
GreatWksParserInternal::State::m_headerHeight
int m_headerHeight
the header height if known
Definition: GreatWksParser.cxx:113
GreatWksParser.hxx
MWAWBorder
a border
Definition: libmwaw_internal.hxx:314
MWAWSection::m_columns
std::vector< Column > m_columns
the different column
Definition: MWAWSection.hxx:100
GreatWksParser::parse
void parse(librevenge::RVNGTextInterface *documentInterface)
virtual function used to parse the input
Definition: GreatWksParser.cxx:235
libmwaw::DOC_HEADER_FOOTER
@ DOC_HEADER_FOOTER
Definition: libmwaw_internal.hxx:178
MWAWListener::PageBreak
@ PageBreak
Definition: MWAWListener.hxx:58
MWAWHeaderFooter::ODD
@ ODD
Definition: MWAWPageSpan.hxx:50
MWAWSection
a class which stores section properties
Definition: MWAWSection.hxx:46
libmwaw::ParseException
Definition: libmwaw_internal.hxx:142
MWAWDebug.hxx
GreatWksParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: GreatWksParser.cxx:500
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:57
MWAWParser::getPageSpan
MWAWPageSpan const & getPageSpan() const
returns the actual page dimension
Definition: MWAWParser.hxx:160
GreatWksParser::init
void init()
inits all internal variables
Definition: GreatWksParser.cxx:188
GreatWksParserInternal::State::m_hasColSep
bool m_hasColSep
true if columns have columns separator
Definition: GreatWksParser.cxx:110
GreatWksDocument.hxx
GreatWksParserInternal::State::State
State()
constructor
Definition: GreatWksParser.cxx:65
GreatWksParserInternal::SubDocument::operator!=
virtual bool operator!=(MWAWSubDocument const &doc) const
operator!=
Definition: GreatWksParser.cxx:165
GreatWksParserInternal::State::m_footerHeight
int m_footerHeight
the footer height if known
Definition: GreatWksParser.cxx:114
MWAWPageSpan::setMarginTop
void setMarginTop(const double marginTop)
set the page top margin
Definition: MWAWPageSpan.hxx:197
GreatWksParserInternal::State::m_numPages
int m_numPages
the number of page of the final document
Definition: GreatWksParser.cxx:111
MWAWHeaderFooter::FOOTER
@ FOOTER
Definition: MWAWPageSpan.hxx:48
MWAWParser::getParserState
MWAWParserStatePtr getParserState()
returns the parser state
Definition: MWAWParser.hxx:113
GreatWksParser::m_state
shared_ptr< GreatWksParserInternal::State > m_state
the state
Definition: GreatWksParser.hxx:104
MWAWHeader.hxx
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:503
GreatWksParser::newPage
void newPage(int number)
adds a new page
Definition: GreatWksParser.cxx:219
MWAWHeaderFooter::ALL
@ ALL
Definition: MWAWPageSpan.hxx:50
GreatWksParser::getMainSection
MWAWSection getMainSection() const
return the main section
Definition: GreatWksParser.cxx:206
GreatWksParserInternal::SubDocument
Internal: the subdocument of a GreatWksParser.
Definition: GreatWksParser.cxx:120
GreatWksDocument
the main class to read/store generic data of a GreatWorks document
Definition: GreatWksDocument.hxx:61
MWAWParser::getInput
MWAWInputStreamPtr & getInput()
returns the actual input
Definition: MWAWParser.hxx:123
MWAWTextListener.hxx
GreatWksParser::createZones
bool createZones()
finds the different objects zones
Definition: GreatWksParser.cxx:332
GreatWksParserInternal::State::numHeaderFooters
int numHeaderFooters() const
returns the number of expected header/footer zones
Definition: GreatWksParser.cxx:71
libmwaw::Right
@ Right
Definition: libmwaw_internal.hxx:166
GreatWksParserInternal::SubDocument::m_id
int m_id
the subdocument id
Definition: GreatWksParser.cxx:141
MWAWSubDocument::m_parser
MWAWParser * m_parser
the main zone parser
Definition: MWAWSubDocument.hxx:75
MWAWSection.hxx
GreatWksText.hxx
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
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
libmwaw::Left
@ Left
Definition: libmwaw_internal.hxx:166
MWAWPageSpan::setMargins
void setMargins(double margin, int wh=libmwaw::LeftBit|libmwaw::RightBit|libmwaw::TopBit|libmwaw::BottomBit)
set all the margins
Definition: MWAWPageSpan.hxx:207
GreatWksParser::sendHF
bool sendHF(int id)
try to send the i^th header/footer
Definition: GreatWksParser.cxx:211
GreatWksParser::GreatWksParser
GreatWksParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: GreatWksParser.cxx:178
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
GreatWksParserInternal::SubDocument::operator==
virtual bool operator==(MWAWSubDocument const &doc) const
operator!==
Definition: GreatWksParser.cxx:131
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
MWAWParser::resetTextListener
void resetTextListener()
resets the listener
Definition: MWAWParser.cxx:151

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