ClarisWksDbaseContent.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 CLARIS_WKS_DBASE_CONTENT
39 # define CLARIS_WKS_DBASE_CONTENT
40 
41 #include <iostream>
42 #include <map>
43 #include <set>
44 #include <vector>
45 
46 #include "libmwaw_internal.hxx"
47 
48 #include "MWAWCell.hxx"
49 #include "MWAWEntry.hxx"
50 #include "MWAWFont.hxx"
51 
53 
54 class ClarisWksDocument;
55 
58 {
59 public:
60  struct Record;
61 
63  ClarisWksDbaseContent(ClarisWksDocument &document, bool spreadsheet);
67  bool readContent();
68 
70  bool getExtrema(MWAWVec2i &min, MWAWVec2i &max) const;
72  bool getRecordList(std::vector<int> &list) const;
74  bool getColumnList(int row, std::vector<int> &list) const;
75 
77  bool get(MWAWVec2i const &pos, Record &data) const;
79  bool send(MWAWVec2i const &pos);
81  void setDatabaseFormats(std::vector<ClarisWksStyleManager::CellFormat> const &format);
83  struct Record {
85  Record() : m_style(-1), m_format(), m_hAlign(MWAWCell::HALIGN_DEFAULT), m_fileFormat(0),
87  {
88  }
90  void updateFormulaCells(MWAWVec2i const &removeDelta);
92  int m_style;
111  };
112 protected:
114  struct Column {
117  {
118  }
120  std::map<int,Record> m_idRecordMap;
121  };
122 
124  bool readColumnList();
126  bool readColumn(int c);
128  bool readRecordList(MWAWVec2i const &where, Column &col);
130  bool readRecordSS(MWAWVec2i const &where, long pos, Record &record);
132  bool readRecordSSV1(MWAWVec2i const &where, long pos, Record &record);
134  bool readRecordDB(MWAWVec2i const &where, long pos, Record &record);
135 
137  void send(double val, bool isNotaNumber, ClarisWksStyleManager::CellFormat const &format);
138 
139  //
140  // low level
141  //
142 
146  bool readString(long endPos, std::string &res);
148  bool readNumber(long endPos, double &res, bool &isNan);
150  bool readFormula(MWAWVec2i const &cPos, long endPos,
151  std::vector<MWAWCellContent::FormulaInstruction> &formula, std::string &error);
153  void updateCellPositionsSet() const;
154 
159 
164 
166  std::map<int, Column> m_idColumnMap;
168  mutable std::set<MWAWVec2i> m_positionSet;
170  std::vector<ClarisWksStyleManager::CellFormat> m_dbFormatList;
171 };
172 #endif
173 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
174 
175 

Generated on Tue Mar 1 2016 23:42:41 for libmwaw by doxygen 1.8.4