CWDbaseContent.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  * The main database content used by Claris Works parser to store spreedsheet/Databese
36  *
37  */
38 #ifndef CW_DBASE_CONTENT
39 # define CW_DBASE_CONTENT
40 
41 #include <iostream>
42 #include <map>
43 #include <vector>
44 
45 #include "libmwaw_internal.hxx"
46 
47 #include "MWAWEntry.hxx"
48 #include "MWAWFont.hxx"
49 
50 // remove me
51 #include "CWStyleManager.hxx"
52 
53 class CWStyleManager;
54 
57 {
58 public:
60  CWDbaseContent(MWAWParserStatePtr parserState, shared_ptr<CWStyleManager> styleManager, bool spreadsheet);
64  bool readContent();
65 
67  bool getExtrema(Vec2i &min, Vec2i &max) const;
69  bool getRecordList(std::vector<int> &list) const;
70 
72  bool send(Vec2i const &pos);
74  void setDatabaseFormats(std::vector<CWStyleManager::CellFormat> const &format);
75 protected:
77  struct Record {
82  }
83 
85  int m_style;
89  long m_resLong;
91  double m_resDouble;
97  int m_format;
99  MWAWFont m_font;
104  };
106  struct Column {
109  }
111  std::map<int,Record> m_idRecordMap;
112  };
113 
115  bool readColumnList();
117  bool readColumn(int c);
119  bool readRecordList(Vec2i const &where, Column &col);
121  bool readRecordSS(Vec2i const &where, long pos, Record &record);
123  bool readRecordSSV1(Vec2i const &where, long pos, Record &record);
125  bool readRecordDB(Vec2i const &where, long pos, Record &record);
126 
128  void send(double val, bool isNotaNumber, CWStyleManager::CellFormat const &format);
129 
134 
138  shared_ptr<CWStyleManager> m_styleManager;
139 
141  std::map<int, Column> m_idColumnMap;
143  std::vector<CWStyleManager::CellFormat> m_dbFormatList;
144 };
145 #endif
146 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
147 
148 
void setDatabaseFormats(std::vector< CWStyleManager::CellFormat > const &format)
set the field format ( for database )
Definition: CWDbaseContent.cxx:72
std::vector< CWStyleManager::CellFormat > m_dbFormatList
the databse format
Definition: CWDbaseContent.hxx:143
std::map< int, Column > m_idColumnMap
a map col id to column
Definition: CWDbaseContent.hxx:141
small structure used to parse main content of a spreadsheet/database zone
Definition: CWDbaseContent.hxx:56
a structure to store the style list and the lookup zone
Definition: CWStyleManager.hxx:59
int m_version
the file version
Definition: CWDbaseContent.hxx:131
Record()
contructor
Definition: CWDbaseContent.hxx:81
MWAWEntry m_resString
the result entry if string
Definition: CWDbaseContent.hxx:95
bool readRecordSS(Vec2i const &where, long pos, Record &record)
try to read a spreadsheet record
Definition: CWDbaseContent.cxx:623
double m_resDouble
the result id double
Definition: CWDbaseContent.hxx:91
bool readRecordDB(Vec2i const &where, long pos, Record &record)
try to read a database record
Definition: CWDbaseContent.cxx:800
MWAWFont m_font
the font ( in v1-3 spreadsheet)
Definition: CWDbaseContent.hxx:99
struct which stores a column in CWDbaseContent
Definition: CWDbaseContent.hxx:106
Definition: CWDbaseContent.hxx:79
shared_ptr< CWStyleManager > m_styleManager
the style manager
Definition: CWDbaseContent.hxx:138
~CWDbaseContent()
destructor
Definition: CWDbaseContent.cxx:68
CWDbaseContent(MWAWParserStatePtr parserState, shared_ptr< CWStyleManager > styleManager, bool spreadsheet)
constructor
Definition: CWDbaseContent.cxx:58
Definition: CWDbaseContent.hxx:79
bool readContent()
try to read the record structure
Definition: CWDbaseContent.cxx:132
bool m_resDoubleNaN
a flag to know if a double result is nan or not
Definition: CWDbaseContent.hxx:93
bool m_isSpreadsheet
a bool to know if this is a spreadsheet or a database
Definition: CWDbaseContent.hxx:133
struct which stores a record in CWDbaseContent
Definition: CWDbaseContent.hxx:77
bool getExtrema(Vec2i &min, Vec2i &max) const
returns the dimension of the read data
Definition: CWDbaseContent.cxx:81
the CELL structure a structure related to number/date format
Definition: CWStyleManager.hxx:144
bool send(Vec2i const &pos)
try to send a cell content to the listener
Definition: CWDbaseContent.cxx:882
Definition: CWDbaseContent.hxx:79
int m_justify
cell justify in v1-3 spreadsheet
Definition: CWDbaseContent.hxx:101
bool getRecordList(std::vector< int > &list) const
returns the list of filled record (for database)
Definition: CWDbaseContent.cxx:109
bool readColumn(int c)
try to read the column structure(COLM): a list of chnk
Definition: CWDbaseContent.cxx:263
bool readColumnList()
try to read the columns list structure(CTAB)
Definition: CWDbaseContent.cxx:197
int m_format
the format ( in a v1-3 spreadsheet)
Definition: CWDbaseContent.hxx:97
bool readRecordSSV1(Vec2i const &where, long pos, Record &record)
try to read a spreadsheet record(v1-v3)
Definition: CWDbaseContent.cxx:395
Type m_resType
the result type
Definition: CWDbaseContent.hxx:87
MWAWParserStatePtr m_parserState
the parser state
Definition: CWDbaseContent.hxx:136
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:356
Definition: CWDbaseContent.hxx:79
int m_borders
the border in v1-3 spreadsheet
Definition: CWDbaseContent.hxx:103
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
std::map< int, Record > m_idRecordMap
a map line (or record id) to record
Definition: CWDbaseContent.hxx:111
Type
different result type
Definition: CWDbaseContent.hxx:79
long m_resLong
the result if int/long
Definition: CWDbaseContent.hxx:89
Column()
constructor
Definition: CWDbaseContent.hxx:108
int m_style
the style if known
Definition: CWDbaseContent.hxx:85
bool readRecordList(Vec2i const &where, Column &col)
try to read a list of records(CHNK)
Definition: CWDbaseContent.cxx:316

Generated on Tue Mar 10 2015 17:32:08 for libmwaw by doxygen 1.8.5