ScriptWriterParser.hxx Source File documentation

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
49namespace ScriptWriterParserInternal
50{
51struct Frame;
52struct HFData;
53struct Page;
54struct State;
55
56class SubDocument;
57}
58
64 class ScriptWriterParser final : public MWAWTextParser
65{
66 friend class ScriptWriterParserInternal::SubDocument;
67
68public:
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
80protected:
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);
121protected:
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:
MWAWDebug.hxx
MWAWEntry.hxx
MWAWInputStream.hxx
MWAWParser.hxx
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWFont
Class to store font.
Definition MWAWFont.hxx:44
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition MWAWHeader.hxx:57
MWAWTextParser::MWAWTextParser
MWAWTextParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor (protected)
Definition MWAWParser.hxx:307
ScriptWriterParserInternal::SubDocument
Internal: the subdocument of a ScriptWriterParser.
Definition ScriptWriterParser.cxx:255
ScriptWriterParser::createZones
bool createZones()
finds the different objects zones
Definition ScriptWriterParser.cxx:402
ScriptWriterParser::m_state
std::shared_ptr< ScriptWriterParserInternal::State > m_state
the state
Definition ScriptWriterParser.hxx:127
ScriptWriterParser::parse
void parse(librevenge::RVNGTextInterface *documentInterface) final
virtual function used to parse the input
Definition ScriptWriterParser.cxx:328
ScriptWriterParser::readPage
bool readPage(ScriptWriterParserInternal::Page &page)
try to read page
Definition ScriptWriterParser.cxx:1005
ScriptWriterParser::~ScriptWriterParser
~ScriptWriterParser() final
destructor
Definition ScriptWriterParser.cxx:321
ScriptWriterParser::readFrame
bool readFrame(ScriptWriterParserInternal::Frame &frame)
try to read a frame entry
Definition ScriptWriterParser.cxx:724
ScriptWriterParser::readFont
bool readFont(MWAWFont &font)
try to read a font
Definition ScriptWriterParser.cxx:840
ScriptWriterParser::sendMainZone
bool sendMainZone()
try to send the main text zone
Definition ScriptWriterParser.cxx:1315
ScriptWriterParser::sendText
bool sendText(ScriptWriterParserInternal::Frame const &frame)
try to send a frame text
Definition ScriptWriterParser.cxx:1467
ScriptWriterParser::createDocument
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition ScriptWriterParser.cxx:358
ScriptWriterParser::send
bool send(ScriptWriterParserInternal::HFData const &hf)
try to send a header/footer
Definition ScriptWriterParser.cxx:1346
ScriptWriterParser::readPrintInfo
bool readPrintInfo()
try to read the print information
Definition ScriptWriterParser.cxx:1195
ScriptWriterParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition ScriptWriterParser.cxx:1261
ScriptWriterParser::readTextZone
bool readTextZone()
try to read the main text zone
Definition ScriptWriterParser.cxx:1151
ScriptWriterParser::readHFStyle
bool readHFStyle(std::map< int, MWAWFont > &posToFontMap)
try to read the hf style
Definition ScriptWriterParser.cxx:928
ScriptWriterParser::ScriptWriterParser
ScriptWriterParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition ScriptWriterParser.cxx:309
ScriptWriterParser::readPicture
bool readPicture(MWAWEntry &entry)
try to read a picture entry
Definition ScriptWriterParser.cxx:1132
ScriptWriterParser::readDocument
bool readDocument()
try to read the document header
Definition ScriptWriterParser.cxx:446
ScriptWriterParser::readCharStyle
bool readCharStyle(ScriptWriterParserInternal::Page &page, int column)
try to read the character style
Definition ScriptWriterParser.cxx:868
MWAWRSRCParserPtr
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition libmwaw_internal.hxx:561
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition libmwaw_internal.hxx:551
ScriptWriterParserInternal
Internal: the structures of a ScriptWriterParser.
Definition ScriptWriterParser.cxx:63
librevenge
Definition MWAWDocument.hxx:57
ScriptWriterParserInternal::Frame
Internal: the frame of a ScriptWriterParser.
Definition ScriptWriterParser.cxx:120
ScriptWriterParserInternal::HFData
Internal: the data of a header footer of a ScriptWriterParser.
Definition ScriptWriterParser.cxx:155
ScriptWriterParserInternal::Page
Internal: the page of a ScriptWriterParser.
Definition ScriptWriterParser.cxx:137
ScriptWriterParserInternal::State
Internal: the state of a ScriptWriterParser.
Definition ScriptWriterParser.cxx:202