ScriptWriterParser.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 /*
35  * Parser to convert some Script Writer 1.3 text document
36  *
37  */
38 #ifndef SCRIPT_WRITER_PARSER
39 # define SCRIPT_WRITER_PARSER
40 
41 #include <vector>
42 
43 #include "MWAWDebug.hxx"
44 #include "MWAWEntry.hxx"
45 #include "MWAWInputStream.hxx"
46 
47 #include "MWAWParser.hxx"
48 
50 {
51 struct Frame;
52 struct HFData;
53 struct Page;
54 struct State;
55 
56 class SubDocument;
57 }
58 
64 class ScriptWriterParser final : public MWAWTextParser
65 {
67 
68 public:
70  ScriptWriterParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
72  ~ScriptWriterParser() final;
73 
75  bool checkHeader(MWAWHeader *header, bool strict=false) final;
76 
77  // the main parse function
78  void parse(librevenge::RVNGTextInterface *documentInterface) final;
79 
80 protected:
82  void createDocument(librevenge::RVNGTextInterface *documentInterface);
83 
85  bool createZones();
86 
88  bool readDocument();
90  bool readPrintInfo();
91 
93  bool readFrame(ScriptWriterParserInternal::Frame &frame);
94 
96  bool readCharStyle(ScriptWriterParserInternal::Page &page, int column);
98  bool readPage(ScriptWriterParserInternal::Page &page);
100  bool readTextZone();
102  bool readHFStyle(std::map<int,MWAWFont> &posToFontMap);
103 
105  bool readPicture(MWAWEntry &entry);
107  bool readFont(MWAWFont &font);
108 
109  //
110  // send data
111  //
112 
114  bool send(ScriptWriterParserInternal::HFData const &hf);
116  bool sendText(ScriptWriterParserInternal::Frame const &frame);
118  bool sendMainZone();
120  bool sendText(ScriptWriterParserInternal::Page const &page);
121 protected:
122  //
123  // data
124  //
125 
127  std::shared_ptr<ScriptWriterParserInternal::State> m_state;
128 };
129 #endif
130 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
bool readPage(ScriptWriterParserInternal::Page &page)
try to read page
Definition: ScriptWriterParser.cxx:1006
std::shared_ptr< ScriptWriterParserInternal::State > m_state
the state
Definition: ScriptWriterParser.hxx:127
bool readHFStyle(std::map< int, MWAWFont > &posToFontMap)
try to read the hf style
Definition: ScriptWriterParser.cxx:929
Definition: MWAWDocument.hxx:56
bool createZones()
finds the different objects zones
Definition: ScriptWriterParser.cxx:402
ScriptWriterParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition: ScriptWriterParser.cxx:309
bool readTextZone()
try to read the main text zone
Definition: ScriptWriterParser.cxx:1152
bool readPicture(MWAWEntry &entry)
try to read a picture entry
Definition: ScriptWriterParser.cxx:1133
~ScriptWriterParser() final
destructor
Definition: ScriptWriterParser.cxx:321
bool readFont(MWAWFont &font)
try to read a font
Definition: ScriptWriterParser.cxx:841
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition: ScriptWriterParser.cxx:358
Internal: the structures of a ScriptWriterParser.
Definition: ScriptWriterParser.cxx:62
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:561
Class to store font.
Definition: MWAWFont.hxx:43
virtual class which defines the ancestor of all text zone parser
Definition: MWAWParser.hxx:298
bool readDocument()
try to read the document header
Definition: ScriptWriterParser.cxx:446
void parse(librevenge::RVNGTextInterface *documentInterface) final
virtual function used to parse the input
Definition: ScriptWriterParser.cxx:328
bool readCharStyle(ScriptWriterParserInternal::Page &page, int column)
try to read the character style
Definition: ScriptWriterParser.cxx:869
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
the main class to read a Script Writer 1.3 file
Definition: ScriptWriterParser.hxx:64
bool send(ScriptWriterParserInternal::HFData const &hf)
try to send a header/footer
Definition: ScriptWriterParser.cxx:1347
bool readPrintInfo()
try to read the print information
Definition: ScriptWriterParser.cxx:1196
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition: ScriptWriterParser.cxx:1262
bool sendText(ScriptWriterParserInternal::Frame const &frame)
try to send a frame text
Definition: ScriptWriterParser.cxx:1468
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
bool sendMainZone()
try to send the main text zone
Definition: ScriptWriterParser.cxx:1316
Internal: the subdocument of a ScriptWriterParser.
Definition: ScriptWriterParser.cxx:254
bool readFrame(ScriptWriterParserInternal::Frame &frame)
try to read a frame entry
Definition: ScriptWriterParser.cxx:725

Generated for libmwaw by doxygen 1.8.14