StyleParser.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 STYLE_PARSER
35# define STYLE_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
47namespace StyleParserInternal
48{
49struct Picture;
50struct State;
51}
52
55class StyleParser final : public MWAWTextParser
56{
57public:
59 StyleParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
61 ~StyleParser() final;
62
64 bool checkHeader(MWAWHeader *header, bool strict=false) final;
65
66 // the main parse function
67 void parse(librevenge::RVNGTextInterface *documentInterface) final;
68
69protected:
71 void createDocument(librevenge::RVNGTextInterface *documentInterface);
72
74 void newPage(int number);
75
76protected:
78 bool createZones();
80 bool readTypeEntryMap();
82 bool readBackgroundColor(MWAWEntry const &entry);
84 bool readFormats(MWAWEntry const &entry);
86 bool readExtraProperties(MWAWEntry const &entry);
88 bool readFontNames(MWAWEntry const &entry);
91 bool readFontCorr(MWAWEntry const &entry);
93 bool readStyleTable(MWAWEntry const &entry);
95 bool readMargins(MWAWEntry const &entry);
97 bool readPrintInfo(MWAWEntry const &entry);
99 bool readPLCs(MWAWEntry const &entry, bool para);
101 bool readPictures(MWAWEntry const &entry);
103 bool readRules(MWAWEntry const &entry);
105 bool readStat(MWAWEntry const &entry);
107 bool readTabWidth(MWAWEntry const &entry);
109 bool readVersion(MWAWEntry const &entry);
110
112 int computeNumPages(MWAWEntry const &entry, bool unicodeChar) const;
113
115 bool sendText(MWAWEntry const &entry, bool unicodeChar);
118
119 //
120 // data
121 //
123 std::shared_ptr<StyleParserInternal::State> m_state;
124};
125#endif
126// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:57
virtual class which defines the ancestor of all text zone parser
Definition: MWAWParser.hxx:299
the main class to read a Style file
Definition: StyleParser.hxx:56
bool readFormats(MWAWEntry const &entry)
tries to read the format: cfor (v1.9)
Definition: StyleParser.cxx:580
bool readPrintInfo(MWAWEntry const &entry)
tries to read the printer info zone: prec
Definition: StyleParser.cxx:1398
bool readPLCs(MWAWEntry const &entry, bool para)
tries to read the plc zone: runa or para
Definition: StyleParser.cxx:998
int computeNumPages(MWAWEntry const &entry, bool unicodeChar) const
compute the number of page of a zone
Definition: StyleParser.cxx:1543
bool sendText(MWAWEntry const &entry, bool unicodeChar)
try to send the main text
Definition: StyleParser.cxx:1557
bool readPictures(MWAWEntry const &entry)
tries to read the pictures zone: soup
Definition: StyleParser.cxx:1038
std::shared_ptr< StyleParserInternal::State > m_state
the state
Definition: StyleParser.hxx:123
bool readBackgroundColor(MWAWEntry const &entry)
tries to read the background color: bgcl
Definition: StyleParser.cxx:1325
bool readFontNames(MWAWEntry const &entry)
tries to read the font table: fntb (v1.6)
Definition: StyleParser.cxx:421
bool sendPicture(StyleParserInternal::Picture const &pict)
try to send a picture knowing the char position
Definition: StyleParser.cxx:1667
void parse(librevenge::RVNGTextInterface *documentInterface) final
virtual function used to parse the input
Definition: StyleParser.cxx:173
bool readExtraProperties(MWAWEntry const &entry)
tries to read the extra property zone: xprc
Definition: StyleParser.cxx:1121
bool readStat(MWAWEntry const &entry)
tries to read the stat zone: stat
Definition: StyleParser.cxx:1448
bool readStyleTable(MWAWEntry const &entry)
tries to read the style zone: styl
Definition: StyleParser.cxx:502
bool readTabWidth(MWAWEntry const &entry)
tries to read the tab width zone : tabw
Definition: StyleParser.cxx:1484
bool readRules(MWAWEntry const &entry)
tries to read the rule zone: rule
Definition: StyleParser.cxx:812
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition: StyleParser.cxx:1701
bool readMargins(MWAWEntry const &entry)
tries to read the margins zone: marg
Definition: StyleParser.cxx:1354
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition: StyleParser.cxx:201
void newPage(int number)
adds a new page
Definition: StyleParser.cxx:157
bool readTypeEntryMap()
tries to read the main entry map
Definition: StyleParser.cxx:358
bool readVersion(MWAWEntry const &entry)
tries to read the version zone: vers
Definition: StyleParser.cxx:1510
~StyleParser() final
destructor
Definition: StyleParser.cxx:150
bool readFontCorr(MWAWEntry const &entry)
tries to read the font correspondance zone: font, contains the font id, the position in fntb and many...
Definition: StyleParser.cxx:454
bool createZones()
finds the different objects zones
Definition: StyleParser.cxx:231
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:561
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
Internal: the structures of a StyleParser.
Definition: StyleParser.cxx:57
small structure used to store picture data in StyleParser
Definition: StyleParser.cxx:59

Generated on Thu Jan 19 2023 00:00:00 for libmwaw by doxygen 1.9.6