Debian Codegraph @

src/lib/JazzSSParser.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 Jazz document and some database
36 *
37 */
38 #ifndef JAZZ_SS_PARSER
39 # define JAZZ_SS_PARSER
40
41 #include <string>
42 #include <vector>
43
44 #include "MWAWCell.hxx"
45 #include "MWAWDebug.hxx"
46
47 #include "MWAWParser.hxx"
48
49 namespace JazzSSParserInternal
50 {
51 struct State;
52
53 class SubDocument;
54 }
55
56 /** \brief the main class to read a Jazz spreadsheet v1 (Lotus) document and some databases.
57 *
58 * \note need more files to be sure to treat all documents
59 *
60 * \note a database is stored as a spreadsheet in the form
61 * [A][B]
62 * [C][empty]
63 * where [B] corresponds to the report's definitions and
64 * [C] corresponds to the database's contents
65 */
66 class JazzSSParser final : public MWAWSpreadsheetParser
67 {
68 friend class JazzSSParserInternal::SubDocument;
69 public:
70 //! constructor
71 JazzSSParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
72 //! destructor
73 ~JazzSSParser() final;
74
75 //! checks if the document header is correct (or not)
76 bool checkHeader(MWAWHeader *header, bool strict=false) final;
77
78 //! the main parse function
79 void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final;
80
81 protected:
82 //! creates the listener which will be associated to the document
83 void createDocument(librevenge::RVNGSpreadsheetInterface *documentInterface);
84
85 //! finds the different objects zones
86 bool createZones();
87
88 //! sends the spreadsheet
89 bool sendSpreadsheet();
90
91 //
92 // low level
93 //
94 //////////////////////// spread sheet //////////////////////////////
95
96 //! reads a query/name/range... data (zone 11)
97 bool readZone11(long endPos);
98 //! reads a cell content data
99 bool readCell(int id, long endPos);
100 //! reads sheet size
101 bool readSheetSize(long endPos);
102 //! read the basic document zones (zone 15): selection, columns' width, default font, preferences...
103 bool readDocument(long endPos);
104
105 /* reads a cell */
106 bool readCell(MWAWVec2i actPos, MWAWCellContent::FormulaInstruction &instr);
107 /* reads a formula */
108 bool readFormula(long endPos, MWAWVec2i const &pos,
109 std::vector<MWAWCellContent::FormulaInstruction> &formula,
110 std::string &error);
111
112 protected:
113
114 //
115 // data
116 //
117
118 //! the state
119 std::shared_ptr<JazzSSParserInternal::State> m_state;
120 };
121 #endif
122 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: