Debian Codegraph @

src/lib/WingzParser.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 /*
35 * Parser to convert spreadsheet ClarisResolve/Wingz document
36 *
37 */
38 #ifndef WINGZ_PARSER
39 # define WINGZ_PARSER
40
41 #include <vector>
42
43 #include "MWAWDebug.hxx"
44
45 #include "MWAWParser.hxx"
46
47 namespace WingzParserInternal
48 {
49 struct State;
50 }
51
52 class WingzGraph;
53
54 /** \brief the main class to read a Claris Resolve or a Wingz document
55 *
56 * \note need more files to be sure to treat all documents, ie. as
57 * some flags (defining the following type's field) can appear in many
58 * structures, only having a lot of documents can allow to find all
59 * this type's fields...
60 *
61 */
62 class WingzParser final : public MWAWSpreadsheetParser
63 {
64 friend class WingzGraph;
65 public:
66 //! constructor
67 WingzParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
68 //! destructor
69 ~WingzParser() final;
70
71 //! checks if the document header is correct (or not)
72 bool checkHeader(MWAWHeader *header, bool strict=false) final;
73
74 //! the main parse function
75 void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final;
76
77 // interface with WingzGraph
78
79 //! returns the page position corresponding to a cell and its relative position(in percent)
80 MWAWVec2f getPosition(MWAWVec2i const &cell, MWAWVec2f const &relPos) const;
81 protected:
82 //! inits all internal variables
83 void init();
84
85 //! creates the listener which will be associated to the document
86 void createDocument(librevenge::RVNGSpreadsheetInterface *documentInterface);
87
88 //! try to send the main spreadsheet
89 bool sendSpreadsheet();
90
91 //! finds the different objects zones
92 bool createZones();
93
94 //! read the print info zone
95 bool readPrintInfo();
96
97 //
98 // low level
99 //
100
101 //! read the preference zone ( the first zone)
102 bool readPreferences();
103 //! read the spreadshet zone
104 bool readSpreadsheet();
105 //! read some spreadsheet size (col/row size or page break)
106 bool readSpreadsheetSize();
107 //! read a page break zone
108 bool readSpreadsheetPBreak();
109 //! read a style in a spreadsheet
110 bool readSpreadsheetStyle();
111 //! read a spreadsheet cell name
112 bool readSpreadsheetCellName();
113 //! read a formula in a spreadsheet
114 bool readFormula();
115 //! read a spreadsheet list of cell
116 bool readSpreadsheetCellList();
117 //! read a spreadsheet unknown zone 5
118 bool readSpreadsheetZone5();
119 //! read a macro in a text zone ( some graphic zone)
120 bool readMacro();
121
122 //! try to decode an encrypted input
123 bool decodeEncrypted();
124 //! try to find the next spreadsheet zone
125 bool findNextZone(int lastType=0);
126 protected:
127 //
128 // data
129 //
130
131 //! the state
132 std::shared_ptr<WingzParserInternal::State> m_state;
133
134 //! the graph parser
135 std::shared_ptr<WingzGraph> m_graphParser;
136 };
137 #endif
138 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: