Main Page
Namespaces
Classes
Files
File List
File Members
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
56
class
CWDbaseContent
57
{
58
public
:
60
CWDbaseContent
(
MWAWParserStatePtr
parserState, shared_ptr<CWStyleManager> styleManager,
bool
spreadsheet);
62
~CWDbaseContent
();
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
{
79
enum
Type
{
R_Unknown
,
R_Long
,
R_Double
,
R_String
};
81
Record
() :
m_style
(-1),
m_resType
(
R_Unknown
),
m_resLong
(0),
m_resDouble
(0),
m_resDoubleNaN
(false),
m_resString
(),
m_format
(0),
m_font
(3,9),
m_justify
(0),
m_borders
(0) {
82
}
83
85
int
m_style
;
87
Type
m_resType
;
89
long
m_resLong
;
91
double
m_resDouble
;
93
bool
m_resDoubleNaN
;
95
MWAWEntry
m_resString
;
97
int
m_format
;
99
MWAWFont
m_font
;
101
int
m_justify
;
103
int
m_borders
;
104
};
106
struct
Column
{
108
Column
() :
m_idRecordMap
() {
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
131
int
m_version
;
133
bool
m_isSpreadsheet
;
134
136
MWAWParserStatePtr
m_parserState
;
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
Generated on Sat Apr 26 2014 04:35:17 for libmwaw by
doxygen
1.8.3.1