ClarisWksSpreadsheet.hxx Source File documentation

ClarisWksSpreadsheet.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 Claris Works text document ( spreadsheet part )
36 *
37 */
38 #ifndef CLARIS_WKS_SPREADSHEET
39 # define CLARIS_WKS_SPREADSHEET
40
41 #include <list>
42 #include <string>
43 #include <vector>
44
45 #include "MWAWEntry.hxx"
46 #include "MWAWSubDocument.hxx"
47
48 #include "MWAWDebug.hxx"
49 #include "MWAWInputStream.hxx"
50
51 #include "MWAWParser.hxx"
52
53 #include "ClarisWksStruct.hxx"
54
55 namespace ClarisWksSpreadsheetInternal
56 {
57 struct Spreadsheet;
58 struct Field;
59 struct State;
60 }
61
62 class ClarisWksDocument;
63 class ClarisWksParser;
64
70 class ClarisWksSpreadsheet
71 {
72 friend class ClarisWksParser;
73
74 public:
76 explicit ClarisWksSpreadsheet(ClarisWksDocument &document);
78 virtual ~ClarisWksSpreadsheet();
79
81 int version() const;
82
84 int numPages() const;
85
87 std::shared_ptr<ClarisWksStruct::DSET> readSpreadsheetZone
88 (ClarisWksStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
90 bool canSendSpreadsheetAsGraphic(int) const
91 {
92 return false;
93 }
95 bool sendSpreadsheet(int number, MWAWListenerPtr listener);
97 bool sendSpreadsheetAsTable(int number, MWAWListenerPtr listener);
98
99 protected:
100 //
101 // Intermediate level
102 //
103
105 bool readZone1(ClarisWksSpreadsheetInternal::Spreadsheet &sheet);
107 bool readRowHeightZone(ClarisWksSpreadsheetInternal::Spreadsheet &sheet);
108
109 //
110 // low level
111 //
112
113 private:
114 ClarisWksSpreadsheet(ClarisWksSpreadsheet const &orig) = delete;
115 ClarisWksSpreadsheet &operator=(ClarisWksSpreadsheet const &orig) = delete;
116
117 protected:
118 //
119 // data
120 //
121
123 ClarisWksDocument &m_document;
124
126 MWAWParserStatePtr m_parserState;
127
129 std::shared_ptr<ClarisWksSpreadsheetInternal::State> m_state;
130
132 MWAWParser *m_mainParser;
133 };
134 #endif
135 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
ClarisWksSpreadsheet::operator=
ClarisWksSpreadsheet & operator=(ClarisWksSpreadsheet const &orig)=delete
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
ClarisWksSpreadsheet::sendSpreadsheetAsTable
bool sendSpreadsheetAsTable(int number, MWAWListenerPtr listener)
sends the zone data to the listener (if it exists )
Definition: ClarisWksSpreadsheet.cxx:583
ClarisWksDbaseContent::Record::m_borders
int m_borders
the border in v1-3 spreadsheet
Definition: ClarisWksDbaseContent.hxx:123
ClarisWksDbaseContent::Record::m_font
MWAWFont m_font
the font ( in v1-3 spreadsheet)
Definition: ClarisWksDbaseContent.hxx:121
MWAWCellContent::m_textEntry
MWAWEntry m_textEntry
the cell string
Definition: MWAWCell.hxx:489
ClarisWksSpreadsheet::numPages
int numPages() const
returns the number of pages
Definition: ClarisWksSpreadsheet.cxx:165
MWAWDocument::MWAW_K_SPREADSHEET
@ MWAW_K_SPREADSHEET
spreadsheet
Definition: MWAWDocument.hxx:86
ClarisWksSpreadsheet::readSpreadsheetZone
std::shared_ptr< ClarisWksStruct::DSET > readSpreadsheetZone(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry, bool &complete)
reads the zone Text DSET
Definition: ClarisWksSpreadsheet.cxx:177
ClarisWksDbaseContent::Record::m_content
MWAWCellContent m_content
the content
Definition: ClarisWksDbaseContent.hxx:113
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:129
ClarisWksSpreadsheetInternal::State
Internal: the state of a ClarisWksSpreadsheet.
Definition: ClarisWksSpreadsheet.cxx:133
ClarisWksStruct.hxx
libmwaw::DebugFile::addDelimiter
void addDelimiter(long pos, char c)
adds a not breaking delimiter in position pos
Definition: MWAWDebug.cxx:73
MWAWCellContent::setValue
void setValue(double value)
sets the double value
Definition: MWAWCell.hxx:458
MWAWCell::F_DATE
@ F_DATE
Definition: MWAWCell.hxx:56
ClarisWksDbaseContent::Record::updateFormulaCells
void updateFormulaCells(MWAWVec2i const &removeDelta)
update the formula cell (removing delta to each position)
Definition: ClarisWksDbaseContent.cxx:1505
ClarisWksStruct::readStructZone
bool readStructZone(MWAWParserState &parserState, char const *zoneName, bool hasEntete)
try to read a structured zone with unknown content
Definition: ClarisWksStruct.cxx:162
ClarisWksDbaseContent::Record::m_hAlign
MWAWCell::HorizontalAlignment m_hAlign
the cell alignment : by default nothing
Definition: ClarisWksDbaseContent.hxx:109
MWAWCell::setPosition
void setPosition(MWAWVec2i posi)
set the cell positions : 0,0 -> A1, 0,1 -> A2
Definition: MWAWCell.hxx:189
MWAWCell::setHAlignment
void setHAlignment(HorizontalAlignment align)
sets the horizontal alignment
Definition: MWAWCell.hxx:281
MWAWCellContent::isValueSet
bool isValueSet() const
returns true if the value has been setted
Definition: MWAWCell.hxx:464
MWAWTable.hxx
MWAWListener::Spreadsheet
@ Spreadsheet
Definition: MWAWListener.hxx:56
ClarisWksDbaseContent::Record::m_backgroundColor
MWAWColor m_backgroundColor
the background color
Definition: ClarisWksDbaseContent.hxx:119
libmwaw::BottomBit
@ BottomBit
Definition: libmwaw_internal.hxx:178
MWAWEntry.hxx
MWAWFontConverter.hxx
ClarisWksSpreadsheet.hxx
ClarisWksSpreadsheet::ClarisWksSpreadsheet
ClarisWksSpreadsheet(ClarisWksSpreadsheet const &orig)=delete
ClarisWksSpreadsheetInternal::State::m_spreadsheetMap
std::map< int, std::shared_ptr< Spreadsheet > > m_spreadsheetMap
a map zoneId to spreadsheet
Definition: ClarisWksSpreadsheet.cxx:140
ClarisWksSpreadsheetInternal::Spreadsheet::getRowHeight
float getRowHeight(int row) const
returns the row size in point
Definition: ClarisWksSpreadsheet.cxx:76
MWAWCell::setFormat
void setFormat(Format const &format)
set the cell format
Definition: MWAWCell.hxx:242
ClarisWksSpreadsheetInternal::Spreadsheet::m_content
std::shared_ptr< ClarisWksDbaseContent > m_content
the data
Definition: ClarisWksSpreadsheet.cxx:125
MWAWCell::setBackgroundColor
void setBackgroundColor(MWAWColor color)
sets the background color
Definition: MWAWCell.hxx:332
ClarisWksDocument
main document information used to create a ClarisWorks file
Definition: ClarisWksDocument.hxx:74
ClarisWksSpreadsheet::m_mainParser
MWAWParser * m_mainParser
the main parser;
Definition: ClarisWksSpreadsheet.hxx:132
ClarisWksSpreadsheet
the main class to read the text part of Claris Works file
Definition: ClarisWksSpreadsheet.hxx:71
libmwaw::DebugFile::addNote
void addNote(char const *note)
adds a note in the file, in actual position
Definition: MWAWDebug.cxx:59
ClarisWksDbaseContent
small structure used to parse main content of a spreadsheet/database zone
Definition: ClarisWksDbaseContent.hxx:58
MWAWCell::setFont
void setFont(MWAWFont const &font, bool isDefault=false)
sets the fonts
Definition: MWAWCell.hxx:258
ClarisWksSpreadsheet::sendSpreadsheet
bool sendSpreadsheet(int number, MWAWListenerPtr listener)
sends the zone data to the listener (if it exists )
Definition: ClarisWksSpreadsheet.cxx:474
ClarisWksStruct
namespace to store the main structure which appears in a ClarisDraw/ClarisWorks file
Definition: ClarisWksStruct.cxx:50
MWAWCell::setVAlignment
void setVAlignment(VerticalAlignment align)
sets the vertical alignment
Definition: MWAWCell.hxx:292
MWAWCell.hxx
Defines MWAWCell (cell content and format)
MWAWTable::TableDimBit
@ TableDimBit
Definition: MWAWTable.hxx:56
ClarisWksDbaseContent::Record
struct which stores a record in ClarisWksDbaseContent
Definition: ClarisWksDbaseContent.hxx:86
ClarisWksSpreadsheet::~ClarisWksSpreadsheet
virtual ~ClarisWksSpreadsheet()
destructor
Definition: ClarisWksSpreadsheet.cxx:156
MWAWSubDocument.hxx
ClarisWksSpreadsheet::m_document
ClarisWksDocument & m_document
the document
Definition: ClarisWksSpreadsheet.hxx:123
MWAWSpreadsheetListener
This class contents the main functions needed to create a spreadsheet processing Document.
Definition: MWAWSpreadsheetListener.hxx:66
ClarisWksSpreadsheetInternal::Spreadsheet
Internal the spreadsheet.
Definition: ClarisWksSpreadsheet.cxx:61
ClarisWksStyleManager.hxx
ClarisWksSpreadsheet::readRowHeightZone
bool readRowHeightZone(ClarisWksSpreadsheetInternal::Spreadsheet &sheet)
try to read the row height zone
Definition: ClarisWksSpreadsheet.cxx:420
MWAWBorder
a border
Definition: libmwaw_internal.hxx:333
ClarisWksStruct::DSET::m_fileType
int m_fileType
the type ( 0: text, -1: graphic, ...)
Definition: ClarisWksStruct.hxx:189
ClarisWksSpreadsheetInternal::Spreadsheet::Spreadsheet
Spreadsheet(ClarisWksStruct::DSET const &dset=ClarisWksStruct::DSET())
Definition: ClarisWksSpreadsheet.cxx:63
MWAWCell::VALIGN_BOTTOM
@ VALIGN_BOTTOM
Definition: MWAWCell.hxx:134
ClarisWksDocument.hxx
MWAWCellContent::m_value
double m_value
the cell value
Definition: MWAWCell.hxx:485
MWAWEntry::length
long length() const
returns the length of the zone
Definition: MWAWEntry.hxx:93
MWAWTable
a class used to recreate the table structure using cell informations, ....
Definition: MWAWTable.hxx:52
ClarisWksStruct::Struct::readHeader
bool readHeader(MWAWInputStreamPtr input, bool strict=false)
try to read the header
Definition: ClarisWksStruct.cxx:72
libmwaw::RightBit
@ RightBit
Definition: libmwaw_internal.hxx:178
MWAWVec2< int >
MWAWDebug.hxx
ClarisWksSpreadsheetInternal::Spreadsheet::getRowHeight
float getRowHeight(int row, int &numRepeated) const
returns the height of a row in point and updated repeated row
Definition: ClarisWksSpreadsheet.cxx:83
MWAWEntry::begin
long begin() const
returns the begin offset
Definition: MWAWEntry.hxx:83
ClarisWksDocument::readStructCellZone
bool readStructCellZone(char const *zoneName, bool hasEntete, std::vector< MWAWVec2i > &res)
try to read a structured zone list of cells
Definition: ClarisWksDocument.cxx:2379
MWAWTable::setColsSize
void setColsSize(std::vector< float > const &cSize)
define the columns size (in point)
Definition: MWAWTable.hxx:133
ClarisWksStruct::DSET
main structure which correspond to a document part
Definition: ClarisWksStruct.hxx:87
ClarisWksSpreadsheetInternal
Internal: the structures of a ClarisWksSpreadsheet.
Definition: ClarisWksSpreadsheet.cxx:59
ClarisWksStruct::DSET::DSET
DSET()
constructor
Definition: ClarisWksStruct.hxx:99
MWAWEntry::end
long end() const
returns the end offset
Definition: MWAWEntry.hxx:88
libmwaw::LeftBit
@ LeftBit
Definition: libmwaw_internal.hxx:178
ClarisWksStruct::Struct::m_size
long m_size
the size of the DSET header
Definition: ClarisWksStruct.hxx:69
MWAWParser
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:100
ClarisWksParser
the main class to read a Claris Works file
Definition: ClarisWksParser.hxx:68
ClarisWksSpreadsheet::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: ClarisWksSpreadsheet.hxx:126
ClarisWksStruct::DSET::m_numData
long m_numData
the number of header
Definition: ClarisWksStruct.hxx:180
ClarisWksSpreadsheet::m_state
std::shared_ptr< ClarisWksSpreadsheetInternal::State > m_state
the state
Definition: ClarisWksSpreadsheet.hxx:129
ClarisWksSpreadsheet::readZone1
bool readZone1(ClarisWksSpreadsheetInternal::Spreadsheet &sheet)
try to read the first spreadsheet zone
Definition: ClarisWksSpreadsheet.cxx:353
ClarisWksStruct::DSET::m_dataSz
long m_dataSz
the data size
Definition: ClarisWksStruct.hxx:182
MWAWCell::Format::m_format
FormatType m_format
the cell format : by default unknown
Definition: MWAWCell.hxx:95
ClarisWksSpreadsheetInternal::State::State
State()
constructor
Definition: ClarisWksSpreadsheet.cxx:135
ClarisWksDbaseContent.hxx
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
libmwaw::TopBit
@ TopBit
Definition: libmwaw_internal.hxx:178
libmwaw::DebugFile::addPos
void addPos(long pos)
adds a new position in the file
Definition: MWAWDebug.cxx:53
MWAWCell::setBorders
void setBorders(int wh, MWAWBorder const &border)
sets the cell border: wh=libmwaw::LeftBit|...
Definition: MWAWCell.cxx:382
ClarisWksSpreadsheetInternal::Spreadsheet::~Spreadsheet
~Spreadsheet() final
destructor
Definition: ClarisWksSpreadsheet.cxx:128
MWAWEntry::valid
bool valid() const
returns true if the zone length is positive
Definition: MWAWEntry.hxx:99
MWAWListener.hxx
MWAWSpreadsheetListener.hxx
Defines MWAWSpreadsheetListener: the libmwaw spreadsheet processor listener.
ClarisWksSpreadsheetInternal::Spreadsheet::m_colWidths
std::vector< int > m_colWidths
the columns width
Definition: ClarisWksSpreadsheet.cxx:121
libmwaw::DebugFile
an interface used to insert comment in a binary file, written in ascii form (if debug_with_files is n...
Definition: MWAWDebug.hxx:66
ClarisWksStruct::Struct
a basic structure
Definition: ClarisWksStruct.hxx:53
MWAWInputStream.hxx
MWAWColor::isWhite
bool isWhite() const
return true if the color is white
Definition: libmwaw_internal.hxx:289
MWAWListenerPtr
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:553
MWAWFont.hxx
ClarisWksSpreadsheet::ClarisWksSpreadsheet
ClarisWksSpreadsheet(ClarisWksDocument &document)
constructor
Definition: ClarisWksSpreadsheet.cxx:148
ClarisWksDbaseContent::Record::m_format
MWAWCell::Format m_format
the format
Definition: ClarisWksDbaseContent.hxx:107
MWAWCell
a structure used to define a cell and its format
Definition: MWAWCell.hxx:53
ClarisWksSpreadsheetInternal::Spreadsheet::m_rowHeightMap
std::map< int, int > m_rowHeightMap
a map row to height
Definition: ClarisWksSpreadsheet.cxx:123
ClarisWksStruct::DSET::m_headerSz
long m_headerSz
the header size
Definition: ClarisWksStruct.hxx:184
ClarisWksSpreadsheet::canSendSpreadsheetAsGraphic
bool canSendSpreadsheetAsGraphic(int) const
check if we can send a spreadsheet as graphic
Definition: ClarisWksSpreadsheet.hxx:90
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:838
libmwaw::DebugStream
std::stringstream DebugStream
a basic stream (if debug_with_files is not defined, does nothing)
Definition: MWAWDebug.hxx:61
MWAWParser.hxx
ClarisWksSpreadsheet::version
int version() const
returns the file version
Definition: ClarisWksSpreadsheet.cxx:159