STOFFParser.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/* libstaroffice
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 STOFF_PARSER_H
35#define STOFF_PARSER_H
36
37#include <ostream>
38#include <string>
39#include <vector>
40
41#include "STOFFDebug.hxx"
42#include "STOFFInputStream.hxx"
43
44#include "STOFFEntry.hxx"
45#include "STOFFHeader.hxx"
46#include "STOFFPageSpan.hxx"
47
50{
51public:
70
79
82
83private:
86};
87
90{
91public:
93 virtual ~STOFFParser();
95 virtual bool checkHeader(STOFFHeader *header, bool strict=false) = 0;
96
98 int version() const
99 {
100 return m_parserState->m_version;
101 }
104 {
105 return m_parserState;
106 }
109 {
110 return m_parserState->m_header;
111 }
114 {
115 return m_parserState->m_input;
116 }
119 {
120 return m_parserState->m_pageSpan;
121 }
124 {
125 return m_parserState->m_pageSpan;
126 }
129 {
130 return m_parserState->m_graphicListener;
131 }
134 {
135 return m_parserState->m_spreadsheetListener;
136 }
139 {
140 return m_parserState->m_textListener;
141 }
144 {
145 return m_parserState->m_asciiFile;
146 }
147protected:
151 explicit STOFFParser(STOFFParserStatePtr &state) : m_parserState(state), m_asciiName("") { }
152
154 void setVersion(int vers)
155 {
156 m_parserState->m_version = vers;
157 }
169 void resetTextListener();
171 void setAsciiName(char const *name)
172 {
173 m_asciiName = name;
174 }
176 std::string const &asciiName() const
177 {
178 return m_asciiName;
179 }
180
181private:
186
190 std::string m_asciiName;
191};
192
195{
196public:
198 virtual void parse(librevenge::RVNGTextInterface *documentInterface) = 0;
199protected:
205 ~STOFFTextParser() override;
206};
207
210{
211public:
213 virtual void parse(librevenge::RVNGDrawingInterface *documentInterface);
215 virtual void parse(librevenge::RVNGPresentationInterface *documentInterface);
216protected:
222 ~STOFFGraphicParser() override;
223};
224
227{
228public:
230 virtual void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) = 0;
231protected:
233 STOFFSpreadsheetParser(STOFFInputStreamPtr &input, STOFFHeader *header) : STOFFParser(STOFFParserState::Spreadsheet, input, header) {}
237 ~STOFFSpreadsheetParser() override;
238};
239
240#endif /* STOFFPARSER_H */
241// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Defines STOFFHeader (document's type, version, kind)
Kind
an enum to define the kind of document
Definition: STOFFDocument.hxx:66
virtual class which defines the ancestor of all graphic/presentation zone parser
Definition: STOFFParser.hxx:210
STOFFGraphicParser(STOFFParserStatePtr &state)
constructor using a state
Definition: STOFFParser.hxx:220
~STOFFGraphicParser() override
destructor
Definition: STOFFParser.cxx:111
virtual void parse(librevenge::RVNGDrawingInterface *documentInterface)
virtual function used to parse the input
Definition: STOFFParser.cxx:115
STOFFGraphicParser(STOFFInputStreamPtr &input, STOFFHeader *header)
constructor (protected)
Definition: STOFFParser.hxx:218
a function used by STOFFDocument to store the version of document
Definition: STOFFHeader.hxx:57
A class which defines the page properties.
Definition: STOFFPageSpan.hxx:76
a class to define the parser state
Definition: STOFFParser.hxx:50
~STOFFParserState()
destructor
Definition: STOFFParser.cxx:63
STOFFSpreadsheetListenerPtr m_spreadsheetListener
the spreadsheet listener
Definition: STOFFParser.hxx:76
STOFFTextListenerPtr m_textListener
the text listener
Definition: STOFFParser.hxx:78
STOFFGraphicListenerPtr m_graphicListener
the graphic listener
Definition: STOFFParser.hxx:74
Type
the parser state type
Definition: STOFFParser.hxx:53
@ Graphic
Definition: STOFFParser.hxx:53
@ Presentation
Definition: STOFFParser.hxx:53
@ Spreadsheet
Definition: STOFFParser.hxx:53
@ Text
Definition: STOFFParser.hxx:53
Type m_type
the state type
Definition: STOFFParser.hxx:59
libstoff::DebugFile m_asciiFile
the debug file
Definition: STOFFParser.hxx:81
STOFFDocument::Kind m_kind
the document kind
Definition: STOFFParser.hxx:61
STOFFParserState & operator=(STOFFParserState const &orig)
STOFFListManagerPtr m_listManager
the list manager
Definition: STOFFParser.hxx:72
int m_version
the actual version
Definition: STOFFParser.hxx:63
STOFFParserState(STOFFParserState const &orig)
STOFFInputStreamPtr m_input
the input
Definition: STOFFParser.hxx:65
STOFFPageSpan m_pageSpan
the actual document size
Definition: STOFFParser.hxx:69
STOFFHeader * m_header
the header
Definition: STOFFParser.hxx:67
virtual class which defines the ancestor of all main zone parser
Definition: STOFFParser.hxx:90
int version() const
returns the works version
Definition: STOFFParser.hxx:98
STOFFInputStreamPtr & getInput()
returns the actual input
Definition: STOFFParser.hxx:113
std::string const & asciiName() const
return the ascii file name
Definition: STOFFParser.hxx:176
STOFFSpreadsheetListenerPtr & getSpreadsheetListener()
returns the spreadsheet listener
Definition: STOFFParser.hxx:133
STOFFParser(STOFFParserStatePtr &state)
constructor using a state
Definition: STOFFParser.hxx:151
STOFFParserStatePtr getParserState()
returns the parser state
Definition: STOFFParser.hxx:103
libstoff::DebugFile & ascii()
a DebugFile used to write what we recognize when we parse the document
Definition: STOFFParser.hxx:143
void setGraphicListener(STOFFGraphicListenerPtr &listener)
sets the graphic listener
Definition: STOFFParser.cxx:78
STOFFPageSpan const & getPageSpan() const
returns the actual page dimension
Definition: STOFFParser.hxx:118
void setTextListener(STOFFTextListenerPtr &listener)
sets the text listener
Definition: STOFFParser.cxx:100
void setAsciiName(char const *name)
Debugging: change the default ascii file.
Definition: STOFFParser.hxx:171
void setVersion(int vers)
sets the document's version
Definition: STOFFParser.hxx:154
STOFFParser(const STOFFParser &)
private copy constructor: forbidden
void setSpreadsheetListener(STOFFSpreadsheetListenerPtr &listener)
sets the spreadsheet listener
Definition: STOFFParser.cxx:89
STOFFPageSpan & getPageSpan()
returns the actual page dimension
Definition: STOFFParser.hxx:123
virtual ~STOFFParser()
virtual destructor
Definition: STOFFParser.cxx:74
void resetGraphicListener()
resets the graphic listener
Definition: STOFFParser.cxx:83
STOFFGraphicListenerPtr & getGraphicListener()
returns the graphic listener
Definition: STOFFParser.hxx:128
void resetSpreadsheetListener()
resets the spreadsheet listener
Definition: STOFFParser.cxx:94
virtual bool checkHeader(STOFFHeader *header, bool strict=false)=0
virtual function used to check if the document header is correct (or not)
void resetTextListener()
resets the text listener
Definition: STOFFParser.cxx:105
STOFFParser & operator=(const STOFFParser &)
private operator=: forbidden
STOFFHeader * getHeader()
returns the header
Definition: STOFFParser.hxx:108
STOFFParserStatePtr m_parserState
the parser state
Definition: STOFFParser.hxx:188
std::string m_asciiName
the debug file name
Definition: STOFFParser.hxx:190
STOFFTextListenerPtr & getTextListener()
returns the text listener
Definition: STOFFParser.hxx:138
virtual class which defines the ancestor of all spreadsheet zone parser
Definition: STOFFParser.hxx:227
STOFFSpreadsheetParser(STOFFInputStreamPtr &input, STOFFHeader *header)
constructor (protected)
Definition: STOFFParser.hxx:233
STOFFSpreadsheetParser(STOFFParserStatePtr &state)
constructor using a state
Definition: STOFFParser.hxx:235
virtual void parse(librevenge::RVNGSpreadsheetInterface *documentInterface)=0
virtual function used to parse the input
~STOFFSpreadsheetParser() override
destructor
Definition: STOFFParser.cxx:125
virtual class which defines the ancestor of all text zone parser
Definition: STOFFParser.hxx:195
STOFFTextParser(STOFFInputStreamPtr &input, STOFFHeader *header)
constructor (protected)
Definition: STOFFParser.hxx:201
~STOFFTextParser() override
destructor
Definition: STOFFParser.cxx:129
virtual void parse(librevenge::RVNGTextInterface *documentInterface)=0
virtual function used to parse the input
STOFFTextParser(STOFFParserStatePtr &state)
constructor using a state
Definition: STOFFParser.hxx:203
Definition: STOFFDebug.hxx:211
std::shared_ptr< STOFFGraphicListener > STOFFGraphicListenerPtr
a smart pointer of STOFFGraphicListener
Definition: libstaroffice_internal.hxx:487
std::shared_ptr< STOFFSpreadsheetListener > STOFFSpreadsheetListenerPtr
a smart pointer of STOFFSpreadsheetListener
Definition: libstaroffice_internal.hxx:497
std::shared_ptr< STOFFParserState > STOFFParserStatePtr
a smart pointer of STOFFParserState
Definition: libstaroffice_internal.hxx:495
std::shared_ptr< STOFFListManager > STOFFListManagerPtr
a smart pointer of STOFFListManager
Definition: libstaroffice_internal.hxx:493
std::shared_ptr< STOFFInputStream > STOFFInputStreamPtr
a smart pointer of STOFFInputStream
Definition: libstaroffice_internal.hxx:489
std::shared_ptr< STOFFTextListener > STOFFTextListenerPtr
a smart pointer of STOFFTextListener
Definition: libstaroffice_internal.hxx:501

Generated on Fri Apr 14 2023 04:41:10 for libstaroffice by doxygen 1.9.6