RagTimeSpreadsheet.hxx Source File documentation

RagTimeSpreadsheet.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 spreadsheet's part of a RagTime document
36 *
37 */
38#ifndef RAGTIME_SPREADSHEET
39# define RAGTIME_SPREADSHEET
40
41#include <list>
42#include <string>
43#include <vector>
44
45#include "libmwaw_internal.hxx"
46
47#include "MWAWCell.hxx"
48#include "MWAWDebug.hxx"
49#include "MWAWEntry.hxx"
50#include "MWAWInputStream.hxx"
51
52#include "MWAWParser.hxx"
53
54namespace RagTimeSpreadsheetInternal
55{
56struct ComplexBlock;
57
58struct Cell;
59struct Spreadsheet;
60
61struct State;
62}
63
64class RagTimeParser;
65
71 class RagTimeSpreadsheet
72{
73 friend class RagTimeParser;
74public:
76 explicit RagTimeSpreadsheet(RagTimeParser &parser);
78 virtual ~RagTimeSpreadsheet();
79
81 int version() const;
82
83protected:
84 // generic resource ( used mainly by spreadsheet )
85
87 bool getDateTimeFormat(int dtId, std::string &dtFormat) const;
89 bool readNumericFormat(MWAWEntry &entry);
90
91 // specific spreadsheet resource
92
94 bool readResource(MWAWEntry &entry);
96 bool readRsrcSpDo(MWAWEntry &entry);
98 bool readRsrcSpDI(MWAWEntry &entry);
99
100 //
101
103 bool readSpreadsheet(MWAWEntry &entry);
105 bool readSpreadsheetZone9(MWAWEntry const &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet);
107 bool readSpreadsheetSimpleStructure(MWAWEntry const &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet);
109 bool readSpreadsheetComplexStructure(MWAWEntry const &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet);
110
112 bool readSpreadsheetCellContent(RagTimeSpreadsheetInternal::Cell &cell, long endPos);
114 bool readSpreadsheetCellDimension(MWAWVec2i const &cellPos, long endPos, RagTimeSpreadsheetInternal::Spreadsheet &sheet);
116 bool readSpreadsheetCellFormat(MWAWVec2i const &cellPos, long endPos, RagTimeSpreadsheetInternal::Cell &cell);
117
119 bool readPositionsList(MWAWEntry const &entry, std::vector<long> &posList, long &lastDataPos);
121 bool readBlockHeader(MWAWEntry const &entry, RagTimeSpreadsheetInternal::ComplexBlock &block);
122
124 bool readSpreadsheetV2(MWAWEntry &entry);
126 bool readSpreadsheetCellsV2(MWAWEntry &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet);
128 bool readSpreadsheetExtraV2(MWAWEntry &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet);
129
131 bool send(int zId, MWAWPosition const &pos);
133 void flushExtra();
134
135 //
136 // low level
137 //
138
140 bool readSpreadsheetCellV2(RagTimeSpreadsheetInternal::Cell &cell, long endPos);
142 bool readFormulaV2(MWAWVec2i const &cellPos, std::vector<MWAWCellContent::FormulaInstruction> &formula, long endPos, std::string &extra);
144 bool readFormula(MWAWVec2i const &cellPos, std::vector<MWAWCellContent::FormulaInstruction> &formula, long endPos, std::string &extra);
146 bool readCellInFormulaV2(MWAWVec2i const &pos, bool canBeList, MWAWCellContent::FormulaInstruction &instr, long endPos, std::string &extra);
148 bool readCellInFormula(MWAWVec2i const &pos, bool canBeList, MWAWCellContent::FormulaInstruction &instr, long endPos, std::string &extra);
150 bool send(RagTimeSpreadsheetInternal::Spreadsheet &sheet, MWAWSpreadsheetListenerPtr listener);
151
152private:
153 RagTimeSpreadsheet(RagTimeSpreadsheet const &orig) = delete;
154 RagTimeSpreadsheet &operator=(RagTimeSpreadsheet const &orig) = delete;
155
156protected:
157 //
158 // data
159 //
161 MWAWParserStatePtr m_parserState;
162
164 std::shared_ptr<RagTimeSpreadsheetInternal::State> m_state;
165
167 RagTimeParser *m_mainParser;
168};
169#endif
170// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWCell.hxx
Defines MWAWCell (cell content and format).
MWAWDebug.hxx
MWAWEntry.hxx
MWAWInputStream.hxx
MWAWParser.hxx
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition MWAWPosition.hxx:48
RagTimeParser
the main class to read a RagTime v2-3 file
Definition RagTimeParser.hxx:61
RagTimeSpreadsheet::readSpreadsheetV2
bool readSpreadsheetV2(MWAWEntry &entry)
try to read spreadsheet zone ( a big zone):v2
Definition RagTimeSpreadsheet.cxx:1920
RagTimeSpreadsheet::readSpreadsheetSimpleStructure
bool readSpreadsheetSimpleStructure(MWAWEntry const &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet)
try to read a simple structured spreadsheet zone
Definition RagTimeSpreadsheet.cxx:1689
RagTimeSpreadsheet::RagTimeSpreadsheet
RagTimeSpreadsheet(RagTimeSpreadsheet const &orig)=delete
RagTimeSpreadsheet::readSpreadsheetExtraV2
bool readSpreadsheetExtraV2(MWAWEntry &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet)
try to read spreadsheet end zone (positions, ...) :v2
Definition RagTimeSpreadsheet.cxx:2400
RagTimeSpreadsheet::readPositionsList
bool readPositionsList(MWAWEntry const &entry, std::vector< long > &posList, long &lastDataPos)
try to read a list of position
Definition RagTimeSpreadsheet.cxx:1175
RagTimeSpreadsheet::m_state
std::shared_ptr< RagTimeSpreadsheetInternal::State > m_state
the state
Definition RagTimeSpreadsheet.hxx:164
RagTimeSpreadsheet::readBlockHeader
bool readBlockHeader(MWAWEntry const &entry, RagTimeSpreadsheetInternal::ComplexBlock &block)
try to read a complex bock header
Definition RagTimeSpreadsheet.cxx:1094
RagTimeSpreadsheet::flushExtra
void flushExtra()
flush extra data
Definition RagTimeSpreadsheet.cxx:2593
RagTimeSpreadsheet::~RagTimeSpreadsheet
virtual ~RagTimeSpreadsheet()
destructor
Definition RagTimeSpreadsheet.cxx:439
RagTimeSpreadsheet::readCellInFormulaV2
bool readCellInFormulaV2(MWAWVec2i const &pos, bool canBeList, MWAWCellContent::FormulaInstruction &instr, long endPos, std::string &extra)
try to read a cell in a formula
Definition RagTimeSpreadsheet.cxx:2828
RagTimeSpreadsheet::operator=
RagTimeSpreadsheet & operator=(RagTimeSpreadsheet const &orig)=delete
RagTimeSpreadsheet::readSpreadsheetCellV2
bool readSpreadsheetCellV2(RagTimeSpreadsheetInternal::Cell &cell, long endPos)
try to read a cell :v2
Definition RagTimeSpreadsheet.cxx:2047
RagTimeSpreadsheet::readSpreadsheetCellsV2
bool readSpreadsheetCellsV2(MWAWEntry &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet)
try to read spreadsheet cells :v2
Definition RagTimeSpreadsheet.cxx:1983
RagTimeSpreadsheet::readFormulaV2
bool readFormulaV2(MWAWVec2i const &cellPos, std::vector< MWAWCellContent::FormulaInstruction > &formula, long endPos, std::string &extra)
try to read a formula
Definition RagTimeSpreadsheet.cxx:3148
RagTimeSpreadsheet::send
bool send(int zId, MWAWPosition const &pos)
send a spreadsheet corresponding to zId
Definition RagTimeSpreadsheet.cxx:2568
RagTimeSpreadsheet::RagTimeSpreadsheet
RagTimeSpreadsheet(RagTimeParser &parser)
constructor
Definition RagTimeSpreadsheet.cxx:432
RagTimeSpreadsheet::getDateTimeFormat
bool getDateTimeFormat(int dtId, std::string &dtFormat) const
returns the ith date format or ""
Definition RagTimeSpreadsheet.cxx:452
RagTimeSpreadsheet::readSpreadsheetComplexStructure
bool readSpreadsheetComplexStructure(MWAWEntry const &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet)
try to read a complex structured spreadsheet zone
Definition RagTimeSpreadsheet.cxx:1769
RagTimeSpreadsheet::readSpreadsheetCellFormat
bool readSpreadsheetCellFormat(MWAWVec2i const &cellPos, long endPos, RagTimeSpreadsheetInternal::Cell &cell)
try to read a spreadsheet cell's format
Definition RagTimeSpreadsheet.cxx:1552
RagTimeSpreadsheet::readResource
bool readResource(MWAWEntry &entry)
try to read a SpXX resource
Definition RagTimeSpreadsheet.cxx:706
RagTimeSpreadsheet::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition RagTimeSpreadsheet.hxx:161
RagTimeSpreadsheet::readNumericFormat
bool readNumericFormat(MWAWEntry &entry)
try to read the numeric/date format table zone: FoTa
Definition RagTimeSpreadsheet.cxx:462
RagTimeSpreadsheet::m_mainParser
RagTimeParser * m_mainParser
the main parser;
Definition RagTimeSpreadsheet.hxx:167
RagTimeSpreadsheet::readRsrcSpDI
bool readRsrcSpDI(MWAWEntry &entry)
try to read the SpDI zone (a spreadsheet zone zone with id=0)
Definition RagTimeSpreadsheet.cxx:977
RagTimeSpreadsheet::readCellInFormula
bool readCellInFormula(MWAWVec2i const &pos, bool canBeList, MWAWCellContent::FormulaInstruction &instr, long endPos, std::string &extra)
try to read a cell in a formula
Definition RagTimeSpreadsheet.cxx:2619
RagTimeSpreadsheet::readRsrcSpDo
bool readRsrcSpDo(MWAWEntry &entry)
try to read the SpDo zone (a spreadsheet zone with id=0)
Definition RagTimeSpreadsheet.cxx:1034
RagTimeSpreadsheet::readFormula
bool readFormula(MWAWVec2i const &cellPos, std::vector< MWAWCellContent::FormulaInstruction > &formula, long endPos, std::string &extra)
try to read a formula: v3...
Definition RagTimeSpreadsheet.cxx:2950
RagTimeSpreadsheet::readSpreadsheetCellContent
bool readSpreadsheetCellContent(RagTimeSpreadsheetInternal::Cell &cell, long endPos)
try to read a spreadsheet cells content
Definition RagTimeSpreadsheet.cxx:1422
RagTimeSpreadsheet::readSpreadsheetCellDimension
bool readSpreadsheetCellDimension(MWAWVec2i const &cellPos, long endPos, RagTimeSpreadsheetInternal::Spreadsheet &sheet)
try to read a spreadsheet cells dimension
Definition RagTimeSpreadsheet.cxx:1356
RagTimeSpreadsheet::readSpreadsheetZone9
bool readSpreadsheetZone9(MWAWEntry const &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet)
try to read a the last spreadsheet zone
Definition RagTimeSpreadsheet.cxx:1642
RagTimeSpreadsheet::readSpreadsheet
bool readSpreadsheet(MWAWEntry &entry)
try to read a spreadsheet zone: v3-...
Definition RagTimeSpreadsheet.cxx:1233
RagTimeSpreadsheet::RagTimeParser
friend class RagTimeParser
Definition RagTimeSpreadsheet.hxx:73
RagTimeSpreadsheet::version
int version() const
returns the file version
Definition RagTimeSpreadsheet.cxx:442
libmwaw_internal.hxx
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition libmwaw_internal.hxx:838
MWAWSpreadsheetListenerPtr
std::shared_ptr< MWAWSpreadsheetListener > MWAWSpreadsheetListenerPtr
a smart pointer of MWAWSpreadsheetListener
Definition libmwaw_internal.hxx:563
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition libmwaw_internal.hxx:557
RagTimeSpreadsheetInternal
Internal: the structures of a RagTimeSpreadsheet.
Definition RagTimeSpreadsheet.cxx:60
MWAWCellContent::FormulaInstruction
small class use to define a formula instruction
Definition MWAWCell.hxx:397
RagTimeSpreadsheetInternal::Cell
Internal: a cell of a RagTimeSpreadsheet.
Definition RagTimeSpreadsheet.cxx:223
RagTimeSpreadsheetInternal::ComplexBlock
Internal: header of a complex block of a RagTimeSpreadsheet.
Definition RagTimeSpreadsheet.cxx:185
RagTimeSpreadsheetInternal::Spreadsheet
Internal: a spreadsheet's zone of a RagTimeSpreadsheet.
Definition RagTimeSpreadsheet.cxx:298
RagTimeSpreadsheetInternal::State
Internal: the state of a RagTimeSpreadsheet.
Definition RagTimeSpreadsheet.cxx:392