ClarisWksTable.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 ( table part )
36  *
37  */
38 #ifndef CLARIS_WKS_TABLE
39 # define CLARIS_WKS_TABLE
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 ClarisWksTableInternal
56 {
57 struct Table;
58 struct State;
59 }
60 
61 class ClarisWksDocument;
62 class ClarisWksParser;
63 
70 {
71  friend class ClarisWksDocument;
72  friend class ClarisWksParser;
74 
75 public:
77  explicit ClarisWksTable(ClarisWksDocument &document);
79  virtual ~ClarisWksTable();
80 
82  int version() const;
83 
85  int numPages() const;
86 
88  std::shared_ptr<ClarisWksStruct::DSET> readTableZone
89  (ClarisWksStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
90 
91 protected:
93  bool sendZone(int number);
94 
96  bool askMainToSendZone(int number);
97 
99  void flushExtra();
100 
101  //
102  // Intermediate level
103  //
104 
107 
110 
113 
116 
117 private:
118  ClarisWksTable(ClarisWksTable const &orig) = delete;
119  ClarisWksTable &operator=(ClarisWksTable const &orig) = delete;
120 
121 protected:
122  //
123  // data
124  //
125 
128 
131 
133  std::shared_ptr<ClarisWksTableInternal::State> m_state;
134 
137 };
138 #endif
139 // 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
ClarisWksStruct::DSET::m_id
int m_id
the zone identificator
Definition: ClarisWksStruct.hxx:199
MWAWTable::numCells
int numCells() const
returns the number of cell
Definition: MWAWTable.hxx:113
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
ClarisWksTable
the main class to read the text part of Claris Works file
Definition: ClarisWksTable.hxx:70
ClarisWksStyleManager::KSEN::m_valign
int m_valign
the vertical alignment
Definition: ClarisWksStyleManager.hxx:195
ClarisWksTable::operator=
ClarisWksTable & operator=(ClarisWksTable const &orig)=delete
MWAWGraphicStyle::hasSurfaceColor
bool hasSurfaceColor() const
returns true if the surface is defined
Definition: MWAWGraphicStyle.hxx:421
ClarisWksTableInternal::Border::m_styleId
int m_styleId
the style id
Definition: ClarisWksTable.cxx:85
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:129
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:842
ClarisWksStruct.hxx
libmwaw::DebugFile::addDelimiter
void addDelimiter(long pos, char c)
adds a not breaking delimiter in position pos
Definition: MWAWDebug.cxx:73
MWAWBorder::m_type
Type m_type
the border repetition
Definition: libmwaw_internal.hxx:385
ClarisWksStyleManager::KSEN
the KSEN structure a structure related to paragraph and cell style
Definition: ClarisWksStyleManager.hxx:182
ClarisWksStruct::Struct::m_headerSize
long m_headerSize
the header size
Definition: ClarisWksStruct.hxx:75
ClarisWksTableInternal::Table
the struct which stores the Table
Definition: ClarisWksTable.cxx:133
ClarisWksStruct::readStructZone
bool readStructZone(MWAWParserState &parserState, char const *zoneName, bool hasEntete)
try to read a structured zone with unknown content
Definition: ClarisWksStruct.cxx:162
ClarisWksTableInternal::Table::Table
Table(ClarisWksStruct::DSET const &dset, ClarisWksTable &parser, ClarisWksStyleManager &styleManager)
constructor
Definition: ClarisWksTable.cxx:136
ClarisWksStyleManager::KSEN::m_lineType
MWAWBorder::Style m_lineType
the line type
Definition: ClarisWksStyleManager.hxx:197
ClarisWksTableInternal::Table::m_parser
ClarisWksTable * m_parser
the main parser
Definition: ClarisWksTable.cxx:198
ClarisWksTable::readTablePointers
bool readTablePointers(ClarisWksTableInternal::Table &table)
try to read a list of pointer ( unknown meaning )
Definition: ClarisWksTable.cxx:713
ClarisWksTable::ClarisWksTable
ClarisWksTable(ClarisWksDocument &document)
constructor
Definition: ClarisWksTable.cxx:303
MWAWTable.hxx
ClarisWksTableInternal::Table::m_styleManager
ClarisWksStyleManager * m_styleManager
the style manager
Definition: ClarisWksTable.cxx:200
libmwaw::BottomBit
@ BottomBit
Definition: libmwaw_internal.hxx:178
MWAWEntry.hxx
MWAWFontConverter.hxx
MWAWGraphicStyle::setBackgroundColor
void setBackgroundColor(MWAWColor const &col, float opacity=1)
set the background color
Definition: MWAWGraphicStyle.hxx:447
ClarisWksTableInternal::Table::operator<<
friend std::ostream & operator<<(std::ostream &o, Table const &doc)
operator<<
Definition: ClarisWksTable.cxx:158
ClarisWksTableInternal
Internal: the structures of a ClarisWksTable.
Definition: ClarisWksTable.cxx:60
ClarisWksTableInternal::Table::m_mainPtr
long m_mainPtr
the relative main pointer
Definition: ClarisWksTable.cxx:204
ClarisWksDocument::sendZone
bool sendZone(int zoneId, MWAWListenerPtr listener=MWAWListenerPtr(), MWAWPosition pos=MWAWPosition())
try to send a zone
Definition: ClarisWksDocument.cxx:453
ClarisWksTableInternal::Border
Internal: the border of a ClarisWksTable.
Definition: ClarisWksTable.cxx:62
MWAWBorder::None
@ None
Definition: libmwaw_internal.hxx:335
ClarisWksTable::m_document
ClarisWksDocument & m_document
the document
Definition: ClarisWksTable.hxx:127
MWAWBorder::m_width
double m_width
the border total width in point
Definition: libmwaw_internal.hxx:387
ClarisWksStyleManager::Style::m_ksenId
int m_ksenId
the ksen id
Definition: ClarisWksStyleManager.hxx:236
ClarisWksStyleManager::Style
the structure to store the style in a ClarisWksStyleManager
Definition: ClarisWksStyleManager.hxx:207
ClarisWksDocument
main document information used to create a ClarisWorks file
Definition: ClarisWksDocument.hxx:74
ClarisWksTableInternal::TableCell::TableCell
TableCell(TableCell const &orig)=delete
libmwaw::DebugFile::addNote
void addNote(char const *note)
adds a note in the file, in actual position
Definition: MWAWDebug.cxx:59
MWAWGraphicStyle
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:48
MWAWGraphicStyle::hasLine
bool hasLine() const
returns true if the border is defined
Definition: MWAWGraphicStyle.hxx:410
ClarisWksStruct
namespace to store the main structure which appears in a ClarisDraw/ClarisWorks file
Definition: ClarisWksStruct.cxx:50
ClarisWksTableInternal::Table::m_auxiliaryDetached
bool m_auxiliaryDetached
true if the auxiliary zone is detached
Definition: ClarisWksTable.cxx:206
ClarisWksTable::sendZone
bool sendZone(int number)
sends the zone data to the listener (if it exists )
Definition: ClarisWksTable.cxx:459
ClarisWksTableInternal::Table::Table
Table(Table const &orig)=delete
ClarisWksTableInternal::TableCell::update
void update(Table const &table)
use table to finish updating cell
Definition: ClarisWksTable.cxx:217
ClarisWksTable::m_mainParser
MWAWParser * m_mainParser
the main parser;
Definition: ClarisWksTable.hxx:136
ClarisWksTable::askMainToSendZone
bool askMainToSendZone(int number)
ask the main parser to send a zone
Definition: ClarisWksTable.cxx:320
MWAWCell.hxx
Defines MWAWCell (cell content and format)
ClarisWksStyleManager::KSEN::m_lineRepeat
MWAWBorder::Type m_lineRepeat
the line repetition
Definition: ClarisWksStyleManager.hxx:199
ClarisWksTableInternal::Border::m_position
MWAWVec2i m_position[2]
the origin and the end of edge position : unit librevenge::RVNG_POINT/256
Definition: ClarisWksTable.cxx:83
ClarisWksTable::ClarisWksTable
ClarisWksTable(ClarisWksTable const &orig)=delete
ClarisWksTableInternal::Table::~Table
~Table() final
destructor
Definition: ClarisWksTable.cxx:213
MWAWSubDocument.hxx
ClarisWksTableInternal::TableCell
Internal: a cell inside a ClarisWksTable.
Definition: ClarisWksTable.cxx:92
ClarisWksStruct::DSET::m_otherChilds
std::vector< int > m_otherChilds
the list of other child
Definition: ClarisWksStruct.hxx:217
MWAWGraphicStyle::m_surfaceColor
MWAWColor m_surfaceColor
the surface color
Definition: MWAWGraphicStyle.hxx:518
ClarisWksTable::~ClarisWksTable
virtual ~ClarisWksTable()
destructor
Definition: ClarisWksTable.cxx:311
ClarisWksTable::readTableZone
std::shared_ptr< ClarisWksStruct::DSET > readTableZone(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry, bool &complete)
reads the zone Text DSET
Definition: ClarisWksTable.cxx:338
ClarisWksTable.hxx
ClarisWksStyleManager.hxx
ClarisWksTable::readTableBorders
bool readTableBorders(ClarisWksTableInternal::Table &table)
try to read the table border
Definition: ClarisWksTable.cxx:494
ClarisWksTableInternal::State::m_tableMap
std::map< int, std::shared_ptr< Table > > m_tableMap
map id -> table
Definition: ClarisWksTable.cxx:295
MWAWGraphicStyle::m_lineWidth
float m_lineWidth
the linewidth
Definition: MWAWGraphicStyle.hxx:508
ClarisWksTableInternal::Table::removeChild
void removeChild(int cId, bool normalChild) final
remove a child from a list.
Definition: ClarisWksTable.cxx:167
ClarisWksTableInternal::TableCell::operator=
TableCell & operator=(TableCell const &orig)=delete
MWAWPosition.hxx
ClarisWksStyleManager::Style::m_graphicId
int m_graphicId
the graphic (checkme)
Definition: ClarisWksStyleManager.hxx:238
ClarisWksTableInternal::Border::m_isSent
bool m_isSent
a flag to know if the border is already sent
Definition: ClarisWksTable.cxx:87
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
MWAWCell::VALIGN_BOTTOM
@ VALIGN_BOTTOM
Definition: MWAWCell.hxx:134
ClarisWksDocument.hxx
ClarisWksTable::readTableBordersId
bool readTableBordersId(ClarisWksTableInternal::Table &table)
try to read the table border
Definition: ClarisWksTable.cxx:668
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< float >
ClarisWksTable::version
int version() const
returns the file version
Definition: ClarisWksTable.cxx:315
MWAWDebug.hxx
ClarisWksTableInternal::TableCell::sendContent
bool sendContent(MWAWListenerPtr listener, MWAWTable &table) final
send the cell content to a listener
Definition: ClarisWksTable.cxx:276
MWAWTable::m_cellsList
std::vector< std::shared_ptr< MWAWCell > > m_cellsList
the list of cells
Definition: MWAWTable.hxx:191
ClarisWksTableInternal::TableCell::m_styleId
int m_styleId
the style id
Definition: ClarisWksTable.cxx:123
ClarisWksTableInternal::Border::operator<<
friend std::ostream & operator<<(std::ostream &o, Border const &bord)
operator<<
Definition: ClarisWksTable.cxx:68
MWAWEntry::begin
long begin() const
returns the begin offset
Definition: MWAWEntry.hxx:83
MWAWBox2f
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1193
ClarisWksStruct::DSET
main structure which correspond to a document part
Definition: ClarisWksStruct.hxx:87
ClarisWksTableInternal::Table::m_bordersList
std::vector< Border > m_bordersList
the list of border
Definition: ClarisWksTable.cxx:202
ClarisWksTableInternal::TableCell::TableCell
TableCell()
constructor
Definition: ClarisWksTable.cxx:94
ClarisWksDocument::getStyleManager
std::shared_ptr< ClarisWksStyleManager > getStyleManager()
returns the style manager
Definition: ClarisWksDocument.hxx:134
ClarisWksStruct::readIntZone
bool readIntZone(MWAWParserState &parserState, char const *zoneName, bool hasEntete, int intSz, std::vector< int > &res)
try to read a int structured zone where fSz to the int size: 1(int8), 2(int16), 4(int32)
Definition: ClarisWksStruct.cxx:99
ClarisWksStruct::DSET::DSET
DSET()
constructor
Definition: ClarisWksStruct.hxx:99
MWAWBorder::m_style
Style m_style
the border style
Definition: libmwaw_internal.hxx:380
MWAWCell::VALIGN_CENTER
@ VALIGN_CENTER
Definition: MWAWCell.hxx:134
MWAWEntry::end
long end() const
returns the end offset
Definition: MWAWEntry.hxx:88
ClarisWksStyleManager
a structure to store the style list and the lookup zone
Definition: ClarisWksStyleManager.hxx:61
MWAWGraphicStyle::m_lineColor
MWAWColor m_lineColor
the line color
Definition: MWAWGraphicStyle.hxx:516
ClarisWksTable::m_state
std::shared_ptr< ClarisWksTableInternal::State > m_state
the state
Definition: ClarisWksTable.hxx:133
ClarisWksStyleManager::KSEN::m_lines
int m_lines
an int used to add some oblique line ( or cross )
Definition: ClarisWksStyleManager.hxx:201
MWAWCell::E_Cross
@ E_Cross
Definition: MWAWCell.hxx:137
libmwaw::LeftBit
@ LeftBit
Definition: libmwaw_internal.hxx:178
MWAWBorder::Double
@ Double
Definition: libmwaw_internal.hxx:337
ClarisWksTable::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: ClarisWksTable.cxx:478
ClarisWksStruct::Struct::m_size
long m_size
the size of the DSET header
Definition: ClarisWksStruct.hxx:69
ClarisWksTable::readTableCells
bool readTableCells(ClarisWksTableInternal::Table &table)
try to read the table cells
Definition: ClarisWksTable.cxx:561
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
ClarisWksStruct::DSET::m_numData
long m_numData
the number of header
Definition: ClarisWksStruct.hxx:180
ClarisWksStruct::DSET::m_dataSz
long m_dataSz
the data size
Definition: ClarisWksStruct.hxx:182
ClarisWksTableInternal::Table::get
TableCell * get(int id)
return a cell corresponding to id
Definition: ClarisWksTable.cxx:149
MWAWCell::E_Line1
@ E_Line1
Definition: MWAWCell.hxx:137
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
libmwaw::TopBit
@ TopBit
Definition: libmwaw_internal.hxx:178
ClarisWksTableInternal::TableCell::operator<<
friend std::ostream & operator<<(std::ostream &o, TableCell const &cell)
operator<<
Definition: ClarisWksTable.cxx:107
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
ClarisWksStruct::Struct::m_dataSize
long m_dataSize
the data size
Definition: ClarisWksStruct.hxx:73
MWAWEntry::valid
bool valid() const
returns true if the zone length is positive
Definition: MWAWEntry.hxx:99
MWAWListener.hxx
ClarisWksTableInternal::Table::askMainToSendZone
bool askMainToSendZone(int number)
ask the main parser to send a zone
Definition: ClarisWksTable.cxx:192
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
ClarisWksTableInternal::State
Internal: the state of a ClarisWksTable.
Definition: ClarisWksTable.cxx:288
ClarisWksTable::numPages
int numPages() const
returns the number of pages
Definition: ClarisWksTable.cxx:326
ClarisWksStruct::Struct
a basic structure
Definition: ClarisWksStruct.hxx:53
MWAWInputStream.hxx
MWAWListenerPtr
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:553
ClarisWksTableInternal::Border::Border
Border()
the constructor
Definition: ClarisWksTable.cxx:64
MWAWFont.hxx
MWAWCell::E_Line2
@ E_Line2
Definition: MWAWCell.hxx:137
ClarisWksTableInternal::Table::updateCells
void updateCells()
finish updating all cells
Definition: ClarisWksTable.cxx:184
MWAWTable::get
std::shared_ptr< MWAWCell > get(int id)
returns the i^th cell
Definition: MWAWTable.cxx:122
ClarisWksTableInternal::Table::operator=
Table & operator=(Table const &orig)=delete
MWAWCell
a structure used to define a cell and its format
Definition: MWAWCell.hxx:53
ClarisWksStruct::DSET::m_headerSz
long m_headerSz
the header size
Definition: ClarisWksStruct.hxx:184
MWAWBorder::m_color
MWAWColor m_color
the border color
Definition: libmwaw_internal.hxx:393
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
ClarisWksTable::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: ClarisWksTable.hxx:130
MWAWTable::add
void add(std::shared_ptr< MWAWCell > cell)
add a new cells
Definition: MWAWTable.hxx:86
ClarisWksDocument::forceParsed
void forceParsed(int zoneId)
indicates that a zone is parser
Definition: ClarisWksDocument.cxx:2580
ClarisWksTableInternal::State::State
State()
constructor
Definition: ClarisWksTable.cxx:290
ClarisWksTableInternal::TableCell::m_zoneId
int m_zoneId
the cell zone ( 0 is no content )
Definition: ClarisWksTable.cxx:116
ClarisWksStruct::Struct::m_numData
long m_numData
the number of header
Definition: ClarisWksStruct.hxx:71
ClarisWksTableInternal::TableCell::m_bordersId
std::vector< int > m_bordersId[4]
the list of border id : Left, Top, Right, Bottom
Definition: ClarisWksTable.cxx:121

Generated on Fri Sep 18 2020 18:14:52 for libmwaw by doxygen 1.8.20