ClarisWksDatabase.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 ( database part )
36  *
37  */
38 #ifndef CLARIS_WKS_DATABASE
39 # define CLARIS_WKS_DATABASE
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 
56 {
57 struct Database;
58 struct Field;
59 struct State;
60 }
61 
62 class ClarisWksDocument;
63 class ClarisWksParser;
65 
72 {
73  friend class ClarisWksParser;
74 
75 public:
77  explicit ClarisWksDatabase(ClarisWksDocument &document);
79  virtual ~ClarisWksDatabase();
80 
82  int version() const;
83 
85  int numPages() const;
86 
88  std::shared_ptr<ClarisWksStruct::DSET> readDatabaseZone
89  (ClarisWksStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
91  bool canSendDatabaseAsGraphic(int) const
92  {
93  return false;
94  }
96  bool sendDatabase(int number, MWAWListenerPtr listener);
97 
98 protected:
99  //
100  // Intermediate level
101  //
104 
107 
110 
111  //
112  // low level
113  //
114 
115 private:
118 
119 protected:
120  //
121  // data
122  //
123 
126 
129 
131  std::shared_ptr<ClarisWksDatabaseInternal::State> m_state;
132 
135 };
136 #endif
137 // 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
MWAWDocument::MWAW_K_DATABASE
@ MWAW_K_DATABASE
database
Definition: MWAWDocument.hxx:87
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
MWAWPosition::Cell
@ Cell
Definition: MWAWPosition.hxx:51
ClarisWksDatabaseInternal::Field::Type
Type
Definition: ClarisWksDatabase.cxx:61
ClarisWksDatabaseInternal::Field::F_PopupMenu
@ F_PopupMenu
Definition: ClarisWksDatabase.cxx:63
MWAWCell::F_BOOLEAN
@ F_BOOLEAN
Definition: MWAWCell.hxx:56
MWAWCellContent::m_textEntry
MWAWEntry m_textEntry
the cell string
Definition: MWAWCell.hxx:489
ClarisWksDatabaseInternal::Field::operator<<
friend std::ostream & operator<<(std::ostream &o, Field const &field)
operator<<
Definition: ClarisWksDatabase.cxx:78
ClarisWksDatabase.hxx
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
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:842
ClarisWksStruct.hxx
ClarisWksDatabaseInternal::Field::F_Formula
@ F_Formula
Definition: ClarisWksDatabase.cxx:62
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
ClarisWksStruct::Struct::m_headerSize
long m_headerSize
the header size
Definition: ClarisWksStruct.hxx:75
ClarisWksDatabase::~ClarisWksDatabase
virtual ~ClarisWksDatabase()
destructor
Definition: ClarisWksDatabase.cxx:276
MWAWCell::F_DATE
@ F_DATE
Definition: MWAWCell.hxx:56
ClarisWksDatabase::readFields
bool readFields(ClarisWksDatabaseInternal::Database &dBase)
try to read the database structure
Definition: ClarisWksDatabase.cxx:474
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
ClarisWksDatabase::version
int version() const
returns the file version
Definition: ClarisWksDatabase.cxx:279
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
MWAWEntry.hxx
ClarisWksDatabase
the main class to read the text part of Claris Works file
Definition: ClarisWksDatabase.hxx:72
ClarisWksDatabaseInternal::Field::m_name
std::string m_name
the field name
Definition: ClarisWksDatabase.cxx:212
MWAWCell::getBasicCellName
static std::string getBasicCellName(MWAWVec2i const &pos)
return the name of a cell (given row and column) : 0,0 -> A1, 0,1 -> A2...
Definition: MWAWCell.cxx:345
ClarisWksDatabase::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: ClarisWksDatabase.hxx:128
ClarisWksDatabaseInternal::Field::m_valuesList
std::vector< MWAWEntry > m_valuesList
list of different value list
Definition: ClarisWksDatabase.cxx:216
ClarisWksDatabaseInternal::Field::m_formula
std::vector< MWAWCellContent::FormulaInstruction > m_formula
the formula
Definition: ClarisWksDatabase.cxx:218
MWAWCell::setFormat
void setFormat(Format const &format)
set the cell format
Definition: MWAWCell.hxx:242
ClarisWksDatabaseInternal::Field::F_Unknown
@ F_Unknown
Definition: ClarisWksDatabase.cxx:61
MWAWCell::F_NUMBER_GENERIC
@ F_NUMBER_GENERIC
Definition: MWAWCell.hxx:58
ClarisWksDocument
main document information used to create a ClarisWorks file
Definition: ClarisWksDocument.hxx:74
ClarisWksDatabase::readDatabaseZone
std::shared_ptr< ClarisWksStruct::DSET > readDatabaseZone(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry, bool &complete)
reads the zone Text DSET
Definition: ClarisWksDatabase.cxx:297
ClarisWksDatabaseInternal::Field::F_RadioButton
@ F_RadioButton
Definition: ClarisWksDatabase.cxx:63
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
ClarisWksDatabaseInternal::Field::F_Number
@ F_Number
Definition: ClarisWksDatabase.cxx:61
ClarisWksStruct
namespace to store the main structure which appears in a ClarisDraw/ClarisWorks file
Definition: ClarisWksStruct.cxx:50
ClarisWksDatabase::ClarisWksDatabase
ClarisWksDatabase(ClarisWksDocument &document)
constructor
Definition: ClarisWksDatabase.cxx:268
ClarisWksDatabaseInternal::Field::F_Checkbox
@ F_Checkbox
Definition: ClarisWksDatabase.cxx:63
ClarisWksDatabaseInternal::Database::~Database
~Database() final
destructor
Definition: ClarisWksDatabase.cxx:247
ClarisWksDatabaseInternal::State::State
State()
constructor
Definition: ClarisWksDatabase.cxx:255
ClarisWksDatabaseInternal::State::m_databaseMap
std::map< int, std::shared_ptr< Database > > m_databaseMap
Definition: ClarisWksDatabase.cxx:260
MWAWCell.hxx
Defines MWAWCell (cell content and format)
ClarisWksDatabaseInternal::Field::m_default
std::string m_default
the default value
Definition: ClarisWksDatabase.cxx:214
ClarisWksDatabase::m_state
std::shared_ptr< ClarisWksDatabaseInternal::State > m_state
the state
Definition: ClarisWksDatabase.hxx:131
ClarisWksDbaseContent::Record
struct which stores a record in ClarisWksDbaseContent
Definition: ClarisWksDbaseContent.hxx:86
ClarisWksDatabaseInternal::Field::m_defType
int m_defType
the local definition type
Definition: ClarisWksDatabase.cxx:208
MWAWSubDocument.hxx
ClarisWksDatabase::m_document
ClarisWksDocument & m_document
the document
Definition: ClarisWksDatabase.hxx:125
ClarisWksStruct::DSET::m_otherChilds
std::vector< int > m_otherChilds
the list of other child
Definition: ClarisWksStruct.hxx:217
MWAWPosition::m_anchorCellName
librevenge::RVNGString m_anchorCellName
the anchor cell name
Definition: MWAWPosition.hxx:272
MWAWCellContent::m_formula
std::vector< FormulaInstruction > m_formula
the formula list of instruction
Definition: MWAWCell.hxx:491
ClarisWksDatabase::ClarisWksDatabase
ClarisWksDatabase(ClarisWksDatabase const &)=delete
MWAWSpreadsheetListener
This class contents the main functions needed to create a spreadsheet processing Document.
Definition: MWAWSpreadsheetListener.hxx:66
ClarisWksStyleManager.hxx
ClarisWksDatabaseInternal::Field::getNumDefault
int getNumDefault(int version) const
Definition: ClarisWksDatabase.cxx:174
ClarisWksDatabaseInternal::Field::isText
bool isText() const
Definition: ClarisWksDatabase.cxx:165
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: MWAWPosition.hxx:48
ClarisWksDatabase::m_mainParser
MWAWParser * m_mainParser
the main parser;
Definition: ClarisWksDatabase.hxx:134
ClarisWksStruct::DSET::m_fileType
int m_fileType
the type ( 0: text, -1: graphic, ...)
Definition: ClarisWksStruct.hxx:189
MWAWEntry::setBegin
void setBegin(long off)
sets the begin offset
Definition: MWAWEntry.hxx:67
ClarisWksDocument.hxx
ClarisWksDatabaseInternal::Field::F_Date
@ F_Date
Definition: ClarisWksDatabase.cxx:61
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
ClarisWksDatabaseInternal::Field::F_Text
@ F_Text
Definition: ClarisWksDatabase.cxx:61
ClarisWksStruct::Struct::readHeader
bool readHeader(MWAWInputStreamPtr input, bool strict=false)
try to read the header
Definition: ClarisWksStruct.cxx:72
MWAWVec2< int >
ClarisWksDatabaseInternal::Field::isFormula
bool isFormula() const
Definition: ClarisWksDatabase.cxx:169
ClarisWksDatabaseInternal::Database::m_content
std::shared_ptr< ClarisWksDbaseContent > m_content
the data
Definition: ClarisWksDatabase.cxx:244
MWAWDebug.hxx
ClarisWksDatabaseInternal::State
Internal: the state of a ClarisWksDatabase.
Definition: ClarisWksDatabase.cxx:253
MWAWEntry::begin
long begin() const
returns the begin offset
Definition: MWAWEntry.hxx:83
MWAWEntry::setLength
void setLength(long l)
sets the zone size
Definition: MWAWEntry.hxx:72
ClarisWksStruct::DSET
main structure which correspond to a document part
Definition: ClarisWksStruct.hxx:87
ClarisWksDbaseContent::Record::m_posToFontMap
std::map< int, MWAWFont > m_posToFontMap
map id to font ( in database)
Definition: ClarisWksDbaseContent.hxx:125
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
ClarisWksDocument::sendDatabasePictZone
bool sendDatabasePictZone(int pictId, MWAWListenerPtr listener=MWAWListenerPtr(), MWAWPosition pos=MWAWPosition())
try to send a database picture
Definition: ClarisWksDocument.cxx:504
ClarisWksStruct::DSET::DSET
DSET()
constructor
Definition: ClarisWksStruct.hxx:99
ClarisWksDatabaseInternal::Field
Definition: ClarisWksDatabase.cxx:59
MWAWCellContent::m_valueSet
bool m_valueSet
true if the value has been set
Definition: MWAWCell.hxx:487
MWAWCellContent::FormulaInstruction::F_Cell
@ F_Cell
Definition: MWAWCell.hxx:398
ClarisWksDatabaseInternal::Field::F_Multimedia
@ F_Multimedia
Definition: ClarisWksDatabase.cxx:64
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
ClarisWksDatabaseInternal::Field::F_FormulaSum
@ F_FormulaSum
Definition: ClarisWksDatabase.cxx:62
MWAWCell::F_NUMBER
@ F_NUMBER
Definition: MWAWCell.hxx:56
MWAWCell::F_TIME
@ F_TIME
Definition: MWAWCell.hxx:56
ClarisWksStruct::Struct::m_size
long m_size
the size of the DSET header
Definition: ClarisWksStruct.hxx:69
ClarisWksDatabaseInternal::Database::Database
Database(ClarisWksStruct::DSET const &dset=ClarisWksStruct::DSET())
constructor
Definition: ClarisWksDatabase.cxx:227
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
ClarisWksDatabaseInternal::Field::F_Time
@ F_Time
Definition: ClarisWksDatabase.cxx:61
ClarisWksStruct::DSET::m_numData
long m_numData
the number of header
Definition: ClarisWksStruct.hxx:180
ClarisWksDatabase::readDefaults
bool readDefaults(ClarisWksDatabaseInternal::Database &dBase)
try to read the default structure
Definition: ClarisWksDatabase.cxx:656
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
ClarisWksDbaseContent.hxx
ClarisWksDatabaseInternal::Field::m_resType
int m_resType
the result type
Definition: ClarisWksDatabase.cxx:210
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
ClarisWksDatabaseInternal
Internal: the structures of a ClarisWksDatabase.
Definition: ClarisWksDatabase.cxx:58
libmwaw::DebugFile::addPos
void addPos(long pos)
adds a new position in the file
Definition: MWAWDebug.cxx:53
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
MWAWSpreadsheetListener.hxx
Defines MWAWSpreadsheetListener: the libmwaw spreadsheet processor listener.
ClarisWksDatabase::operator=
ClarisWksDatabase & operator=(ClarisWksDatabase const &)=delete
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
ClarisWksDocument::readStringList
bool readStringList(char const *zoneName, bool hasEntete, std::vector< std::string > &res)
Definition: ClarisWksDocument.cxx:2095
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
ClarisWksDatabaseInternal::Field::Field
Field()
Definition: ClarisWksDatabase.cxx:66
ClarisWksDatabaseInternal::Database::m_fields
std::vector< Field > m_fields
the list of field
Definition: ClarisWksDatabase.cxx:242
MWAWFont.hxx
MWAWPosition::m_anchorTo
AnchorTo m_anchorTo
anchor position
Definition: MWAWPosition.hxx:270
ClarisWksDatabase::numPages
int numPages() const
returns the number of pages
Definition: ClarisWksDatabase.cxx:285
ClarisWksDatabase::sendDatabase
bool sendDatabase(int number, MWAWListenerPtr listener)
sends the zone data to the listener (if it exists )
Definition: ClarisWksDatabase.cxx:825
ClarisWksStyleManager::CellFormat
the CELL structure a structure related to number/date format
Definition: ClarisWksStyleManager.hxx:151
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:44
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
ClarisWksStruct::DSET::m_headerSz
long m_headerSz
the header size
Definition: ClarisWksStruct.hxx:184
ClarisWksDatabaseInternal::Field::F_ValueList
@ F_ValueList
Definition: ClarisWksDatabase.cxx:63
ClarisWksDatabase::canSendDatabaseAsGraphic
bool canSendDatabaseAsGraphic(int) const
check if we can send a database as graphic
Definition: ClarisWksDatabase.hxx:91
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
ClarisWksDatabase::readLayout
bool readLayout(ClarisWksDatabaseInternal::Database &dBase)
try to read the layout structures
Definition: ClarisWksDatabase.cxx:747
MWAWParser.hxx
ClarisWksDatabaseInternal::Database
Internal: the database of a ClarisWksDatabase.
Definition: ClarisWksDatabase.cxx:225
ClarisWksDatabaseInternal::Field::m_type
Type m_type
Definition: ClarisWksDatabase.cxx:206
MWAWCell::F_TEXT
@ F_TEXT
Definition: MWAWCell.hxx:56

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