MultiplanParser.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/*
35 * Parser to convert spreadsheet Multiplan document
36 *
37 */
38#ifndef MULTIPLAN_PARSER
39# define MULTIPLAN_PARSER
40
41#include <vector>
42
43#include "MWAWCell.hxx"
44#include "MWAWDebug.hxx"
45
46#include "MWAWParser.hxx"
47
48 namespace MultiplanParserInternal
49{
50 struct State;
51
52 class SubDocument;
53}
54
60 class MultiplanParser final : public MWAWSpreadsheetParser
61{
62 friend class MultiplanParserInternal::SubDocument;
63 public:
65 MultiplanParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
67 ~MultiplanParser() final;
68
70 bool checkHeader(MWAWHeader *header, bool strict=false) final;
71
73 void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final;
74
75protected:
77 void createDocument(librevenge::RVNGSpreadsheetInterface *documentInterface);
78
80 bool createZones();
81
83 bool readColumnsPos();
85 bool readHeaderFooter();
87 bool readPrinterInfo();
89 bool readPrinterMessage();
90
92 bool readZonesList();
94 bool readZone1(MWAWEntry const &entry);
96 bool readCellDataPosition(MWAWEntry const &entry);
98 bool readLink(int pos, MWAWCellContent::FormulaInstruction &instruction);
100 bool readLinkFilename(int pos, MWAWCellContent::FormulaInstruction &instruction);
102 bool readSharedData(int pos, int cellType, MWAWVec2i const &cellPos, MWAWCellContent &content);
104 bool readName(int pos, MWAWCellContent::FormulaInstruction &instruction);
106 bool readZoneB();
108 bool readZoneC();
109
111 bool sendSpreadsheet();
113 bool sendText(MWAWEntry const &entry);
115 bool sendCell(MWAWVec2i const &cellPos, int pos);
116protected:
118 bool readDouble(double &value);
120 bool readFormula(MWAWVec2i const &cellPos, std::vector<MWAWCellContent::FormulaInstruction> &formula, long endPos, std::string &extra);
121
122 //
123 // data
124 //
125
127 std::shared_ptr<MultiplanParserInternal::State> m_state;
128};
129#endif
130// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWCell.hxx
Defines MWAWCell (cell content and format).
MWAWDebug.hxx
MWAWParser.hxx
MWAWCellContent
small class use to define a sheet cell content
Definition MWAWCell.hxx:394
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition MWAWHeader.hxx:57
MWAWSpreadsheetParser::MWAWSpreadsheetParser
MWAWSpreadsheetParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor (protected)
Definition MWAWParser.hxx:291
MultiplanParserInternal::SubDocument
Internal: the subdocument of a MultiplanParserInternal.
Definition MultiplanParser.cxx:122
MultiplanParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition MultiplanParser.cxx:1368
MultiplanParser::readFormula
bool readFormula(MWAWVec2i const &cellPos, std::vector< MWAWCellContent::FormulaInstruction > &formula, long endPos, std::string &extra)
try to read a formula
Definition MultiplanParser.cxx:1069
MultiplanParser::sendSpreadsheet
bool sendSpreadsheet()
try to send the main spreadsheet
Definition MultiplanParser.cxx:1666
MultiplanParser::readColumnsPos
bool readColumnsPos()
read the columns limits pos
Definition MultiplanParser.cxx:384
MultiplanParser::sendCell
bool sendCell(MWAWVec2i const &cellPos, int pos)
try to send a cell
Definition MultiplanParser.cxx:1454
MultiplanParser::readName
bool readName(int pos, MWAWCellContent::FormulaInstruction &instruction)
reads a name and returns the cell's instruction
Definition MultiplanParser.cxx:802
MultiplanParser::MultiplanParser
MultiplanParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition MultiplanParser.cxx:169
MultiplanParser::sendText
bool sendText(MWAWEntry const &entry)
try to send a text zone
Definition MultiplanParser.cxx:1428
MultiplanParser::readHeaderFooter
bool readHeaderFooter()
read the header/footer strings, ...
Definition MultiplanParser.cxx:269
MultiplanParser::readLinkFilename
bool readLinkFilename(int pos, MWAWCellContent::FormulaInstruction &instruction)
read a link filename
Definition MultiplanParser.cxx:647
MultiplanParser::readSharedData
bool readSharedData(int pos, int cellType, MWAWVec2i const &cellPos, MWAWCellContent &content)
read a shared data
Definition MultiplanParser.cxx:695
MultiplanParser::createDocument
void createDocument(librevenge::RVNGSpreadsheetInterface *documentInterface)
creates the listener which will be associated to the document
Definition MultiplanParser.cxx:213
MultiplanParser::parse
void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final
the main parse function
Definition MultiplanParser.cxx:185
MultiplanParser::readLink
bool readLink(int pos, MWAWCellContent::FormulaInstruction &instruction)
read a link given a position
Definition MultiplanParser.cxx:551
MultiplanParser::~MultiplanParser
~MultiplanParser() final
destructor
Definition MultiplanParser.cxx:178
MultiplanParser::readPrinterInfo
bool readPrinterInfo()
read the printer information
Definition MultiplanParser.cxx:295
MultiplanParser::readCellDataPosition
bool readCellDataPosition(MWAWEntry const &entry)
read the cell data position
Definition MultiplanParser.cxx:516
MultiplanParser::readZonesList
bool readZonesList()
read the spreadsheet zone list
Definition MultiplanParser.cxx:404
MultiplanParser::createZones
bool createZones()
finds the different objects zones
Definition MultiplanParser.cxx:245
MultiplanParser::readZoneB
bool readZoneB()
read an unknown zone
Definition MultiplanParser.cxx:856
MultiplanParser::m_state
std::shared_ptr< MultiplanParserInternal::State > m_state
the state
Definition MultiplanParser.hxx:127
MultiplanParser::readZoneC
bool readZoneC()
read an unknown zone
Definition MultiplanParser.cxx:906
MultiplanParser::readPrinterMessage
bool readPrinterMessage()
read the printer message
Definition MultiplanParser.cxx:362
MultiplanParser::readZone1
bool readZone1(MWAWEntry const &entry)
read an unknown zone: two blocks of 60 bytes
Definition MultiplanParser.cxx:488
MultiplanParser::readDouble
bool readDouble(double &value)
try to read a double value
Definition MultiplanParser.cxx:946
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition libmwaw_internal.hxx:838
MWAWRSRCParserPtr
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition libmwaw_internal.hxx:561
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition libmwaw_internal.hxx:551
MultiplanParserInternal
Internal: the structures of a MultiplanParser.
Definition MultiplanParser.cxx:58
librevenge
Definition MWAWDocument.hxx:57
MultiplanParserInternal::State
Internal: the state of a MultiplanParser.
Definition MultiplanParser.cxx:61