Debian Codegraph @

src/lib/ReadySetGoParser.hxx

raw
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 ([email protected])
18 * Copyright (C) 2002,2004 Marc Maurer ([email protected])
19 * Copyright (C) 2004-2006 Fridrich Strba ([email protected])
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent ([email protected])
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 READYSETGO_PARSER
35 # define READYSETGO_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
47 namespace ReadySetGoParserInternal
48 {
49 struct State;
50 }
51
52 class ReadySetGoGraph;
53 class ReadySetGoStyleManager;
54
55 /** \brief the main class to read a ReadySetGo 1.0,2.1,3.0,4.0,4.5,6.0 file
56 *
57 * \note as I found a bunch of 7.7 demo files, I try to make the parser to accept them
58 * without garanty
59 */
60 class ReadySetGoParser final : public MWAWGraphicParser
61 {
62 friend class ReadySetGoGraph;
63 friend class ReadySetGoStyleManager;
64 public:
65 //! constructor
66 ReadySetGoParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
67 //! destructor
68 ~ReadySetGoParser() final;
69
70 //! checks if the document header is correct (or not)
71 bool checkHeader(MWAWHeader *header, bool strict=false) final;
72
73 //! the main parse function
74 void parse(librevenge::RVNGDrawingInterface *documentInterface) final;
75
76 // interface with sub parser
77
78 /** returns true if the file is a design studio 2 file
79
80 \note in this case, version() will return 6
81 */
82 bool isDesignStudioFile() const;
83
84 protected:
85 //! creates the listener which will be associated to the document
86 void createDocument(librevenge::RVNGDrawingInterface *documentInterface);
87
88 protected:
89 //! finds the different objects zones
90 bool createZones();
91 //! try to read the document header: v3
92 bool readDocument();
93 //! try to read an unknown list of IDs: v3
94 bool readIdsList();
95 //! try to read the glossary text list: v4
96 bool readGlossary();
97 //! try to read the glossary object list: v6
98 bool readObjectGlossary();
99 //! try to read an unknown font zone: v6
100 bool readFontsUnknown();
101 //! try to read an unknown zone: v6
102 bool readZone11();
103
104 // Intermediate level
105
106 //! try to read the print info zone
107 bool readPrintInfo();
108
109 //
110 // low level
111 //
112
113 //
114 // data
115 //
116 //! the graph parser
117 std::shared_ptr<ReadySetGoGraph> m_graphParser;
118 //! the style manager
119 std::shared_ptr<ReadySetGoStyleManager> m_styleManager;
120 //! the state
121 std::shared_ptr<ReadySetGoParserInternal::State> m_state;
122 };
123 #endif
124 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: