RagTimeSpreadsheet.hxx
Go to the documentation of this file.
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
/* libmwaw
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
*
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/
/*
* Parser to spreadsheet's part of a RagTime document
*
*/
#ifndef RAGTIME_SPREADSHEET
# define RAGTIME_SPREADSHEET
#include <list>
#include <string>
#include <vector>
#include "libmwaw_internal.hxx"
#include "MWAWCell.hxx"
#include "MWAWDebug.hxx"
#include "MWAWEntry.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWParser.hxx"
namespace RagTimeSpreadsheetInternal
{
struct ComplexBlock;
struct Cell;
struct Spreadsheet;
struct State;
}
class RagTimeParser;
class RagTimeSpreadsheet
{
friend class RagTimeParser;
public:
explicit RagTimeSpreadsheet(RagTimeParser &parser);
virtual ~RagTimeSpreadsheet();
int version() const;
protected:
// generic resource ( used mainly by spreadsheet )
bool getDateTimeFormat(int dtId, std::string &dtFormat) const;
bool readNumericFormat(MWAWEntry &entry);
// specific spreadsheet resource
bool readResource(MWAWEntry &entry);
bool readRsrcSpDo(MWAWEntry &entry);
bool readRsrcSpDI(MWAWEntry &entry);
//
bool readSpreadsheet(MWAWEntry &entry);
bool readSpreadsheetZone9(MWAWEntry const &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet);
bool readSpreadsheetSimpleStructure(MWAWEntry const &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet);
bool readSpreadsheetComplexStructure(MWAWEntry const &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet);
bool readSpreadsheetCellContent(RagTimeSpreadsheetInternal::Cell &cell, long endPos);
bool readSpreadsheetCellDimension(MWAWVec2i const &cellPos, long endPos, RagTimeSpreadsheetInternal::Spreadsheet &sheet);
bool readSpreadsheetCellFormat(MWAWVec2i const &cellPos, long endPos, RagTimeSpreadsheetInternal::Cell &cell);
bool readPositionsList(MWAWEntry const &entry, std::vector<long> &posList, long &lastDataPos);
bool readBlockHeader(MWAWEntry const &entry, RagTimeSpreadsheetInternal::ComplexBlock &block);
bool readSpreadsheetV2(MWAWEntry &entry);
bool readSpreadsheetCellsV2(MWAWEntry &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet);
bool readSpreadsheetExtraV2(MWAWEntry &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet);
bool send(int zId, MWAWPosition const &pos);
void flushExtra();
//
// low level
//
bool readSpreadsheetCellV2(RagTimeSpreadsheetInternal::Cell &cell, long endPos);
bool readFormulaV2(MWAWVec2i const &cellPos, std::vector<MWAWCellContent::FormulaInstruction> &formula, long endPos, std::string &extra);
bool readFormula(MWAWVec2i const &cellPos, std::vector<MWAWCellContent::FormulaInstruction> &formula, long endPos, std::string &extra);
bool readCellInFormulaV2(MWAWVec2i const &pos, bool canBeList, MWAWCellContent::FormulaInstruction &instr, long endPos, std::string &extra);
bool readCellInFormula(MWAWVec2i const &pos, bool canBeList, MWAWCellContent::FormulaInstruction &instr, long endPos, std::string &extra);
bool send(RagTimeSpreadsheetInternal::Spreadsheet &sheet, MWAWSpreadsheetListenerPtr listener);
private:
RagTimeSpreadsheet(RagTimeSpreadsheet const &orig) = delete;
RagTimeSpreadsheet &operator=(RagTimeSpreadsheet const &orig) = delete;
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
std::shared_ptr<RagTimeSpreadsheetInternal::State> m_state;
RagTimeParser *m_mainParser;
};
#endif
// 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:1917
RagTimeSpreadsheet::readSpreadsheetSimpleStructure
bool readSpreadsheetSimpleStructure(MWAWEntry const &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet)
try to read a simple structured spreadsheet zone
Definition RagTimeSpreadsheet.cxx:1686
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:2397
RagTimeSpreadsheet::readPositionsList
bool readPositionsList(MWAWEntry const &entry, std::vector< long > &posList, long &lastDataPos)
try to read a list of position
Definition RagTimeSpreadsheet.cxx:1172
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:1091
RagTimeSpreadsheet::flushExtra
void flushExtra()
flush extra data
Definition RagTimeSpreadsheet.cxx:2590
RagTimeSpreadsheet::~RagTimeSpreadsheet
virtual ~RagTimeSpreadsheet()
destructor
Definition RagTimeSpreadsheet.cxx:436
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:2825
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:2044
RagTimeSpreadsheet::readSpreadsheetCellsV2
bool readSpreadsheetCellsV2(MWAWEntry &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet)
try to read spreadsheet cells :v2
Definition RagTimeSpreadsheet.cxx:1980
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:3145
RagTimeSpreadsheet::send
bool send(int zId, MWAWPosition const &pos)
send a spreadsheet corresponding to zId
Definition RagTimeSpreadsheet.cxx:2565
RagTimeSpreadsheet::RagTimeSpreadsheet
RagTimeSpreadsheet(RagTimeParser &parser)
constructor
Definition RagTimeSpreadsheet.cxx:429
RagTimeSpreadsheet::getDateTimeFormat
bool getDateTimeFormat(int dtId, std::string &dtFormat) const
returns the ith date format or ""
Definition RagTimeSpreadsheet.cxx:449
RagTimeSpreadsheet::readSpreadsheetComplexStructure
bool readSpreadsheetComplexStructure(MWAWEntry const &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet)
try to read a complex structured spreadsheet zone
Definition RagTimeSpreadsheet.cxx:1766
RagTimeSpreadsheet::readSpreadsheetCellFormat
bool readSpreadsheetCellFormat(MWAWVec2i const &cellPos, long endPos, RagTimeSpreadsheetInternal::Cell &cell)
try to read a spreadsheet cell's format
Definition RagTimeSpreadsheet.cxx:1549
RagTimeSpreadsheet::readResource
bool readResource(MWAWEntry &entry)
try to read a SpXX resource
Definition RagTimeSpreadsheet.cxx:703
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:459
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:974
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:2616
RagTimeSpreadsheet::readRsrcSpDo
bool readRsrcSpDo(MWAWEntry &entry)
try to read the SpDo zone (a spreadsheet zone with id=0)
Definition RagTimeSpreadsheet.cxx:1031
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:2947
RagTimeSpreadsheet::readSpreadsheetCellContent
bool readSpreadsheetCellContent(RagTimeSpreadsheetInternal::Cell &cell, long endPos)
try to read a spreadsheet cells content
Definition RagTimeSpreadsheet.cxx:1419
RagTimeSpreadsheet::readSpreadsheetCellDimension
bool readSpreadsheetCellDimension(MWAWVec2i const &cellPos, long endPos, RagTimeSpreadsheetInternal::Spreadsheet &sheet)
try to read a spreadsheet cells dimension
Definition RagTimeSpreadsheet.cxx:1353
RagTimeSpreadsheet::readSpreadsheetZone9
bool readSpreadsheetZone9(MWAWEntry const &entry, RagTimeSpreadsheetInternal::Spreadsheet &sheet)
try to read a the last spreadsheet zone
Definition RagTimeSpreadsheet.cxx:1639
RagTimeSpreadsheet::readSpreadsheet
bool readSpreadsheet(MWAWEntry &entry)
try to read a spreadsheet zone: v3-...
Definition RagTimeSpreadsheet.cxx:1230
RagTimeSpreadsheet::RagTimeParser
friend class RagTimeParser
Definition RagTimeSpreadsheet.hxx:73
RagTimeSpreadsheet::version
int version() const
returns the file version
Definition RagTimeSpreadsheet.cxx:439
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:295
RagTimeSpreadsheetInternal::State
Internal: the state of a RagTimeSpreadsheet.
Definition RagTimeSpreadsheet.cxx:389