Debian Codegraph @

src/lib/ActaParser.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 ACTA_PARSER
35 # define ACTA_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 ActaParserInternal
48 {
49 class SubDocument;
50 struct State;
51 }
52
53 class ActaText;
54
55 /** \brief the main class to read a Acta file
56 */
57 class ActaParser final : public MWAWTextParser
58 {
59 friend class ActaParserInternal::SubDocument;
60 friend class ActaText;
61 public:
62 //! constructor
63 ActaParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
64 //! destructor
65 ~ActaParser() final;
66
67 //! checks if the document header is correct (or not)
68 bool checkHeader(MWAWHeader *header, bool strict=false) final;
69
70 // the main parse function
71 void parse(librevenge::RVNGTextInterface *documentInterface) final;
72
73 protected:
74 //! inits all internal variables
75 void init();
76
77 //! creates the listener which will be associated to the document
78 void createDocument(librevenge::RVNGTextInterface *documentInterface);
79
80 //! returns the page left top point ( in inches)
81 MWAWVec2f getPageLeftTop() const;
82 //! adds a new page
83 void newPage(int number);
84
85 // interface with the text parser
86
87 //! returns a list to be used in the text
88 std::shared_ptr<MWAWList> getMainList();
89
90 protected:
91 //! finds the different objects zones
92 bool createZones();
93
94 //! read the resource fork zone
95 bool readRSRCZones();
96
97 //! read the end file data zones
98 bool readEndDataV3();
99
100 //! sends the header/footer data
101 void sendHeaderFooter();
102
103 //! read a PrintInfo block ( PSET resource block )
104 bool readPrintInfo(MWAWEntry const &entry);
105
106 //! read the window position ( WSIZ resource block )
107 bool readWindowPos(MWAWEntry const &entry);
108
109 //! read the label type
110 bool readLabel(MWAWEntry const &entry);
111
112 //! read the Header/Footer property (QHDR block)
113 bool readHFProperties(MWAWEntry const &entry);
114
115 //! read the QOPT resource block (small print change )
116 bool readOption(MWAWEntry const &entry);
117
118 //
119 // low level
120 //
121
122 //! return the input input
123 MWAWInputStreamPtr rsrcInput();
124
125 //! a DebugFile used to write what we recognize when we parse the document in rsrc
126 libmwaw::DebugFile &rsrcAscii();
127
128 //
129 // data
130 //
131
132 //! the state
133 std::shared_ptr<ActaParserInternal::State> m_state;
134
135 //! the text parser
136 std::shared_ptr<ActaText> m_textParser;
137 };
138 #endif
139 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: