Main Page
Namespaces
Classes
Files
File List
File Members
MWAWCell.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
/* Define some classes used to store a Cell
35
*/
36
37
#ifndef MWAW_CELL_H
38
# define MWAW_CELL_H
39
40
#include <string>
41
#include <vector>
42
43
#include "
libmwaw_internal.hxx
"
44
45
class
WPXPropertyList;
46
47
class
MWAWTable
;
48
50
class
MWAWCell
51
{
52
public
:
56
enum
HorizontalAlignment
{
HALIGN_LEFT
,
HALIGN_RIGHT
,
HALIGN_CENTER
,
57
HALIGN_FULL
,
HALIGN_DEFAULT
58
};
59
62
enum
VerticalAlignment
{
VALIGN_TOP
,
VALIGN_CENTER
,
VALIGN_BOTTOM
,
VALIGN_DEFAULT
};
63
65
enum
ExtraLine
{
E_None
,
E_Line1
,
E_Line2
,
E_Cross
};
66
68
MWAWCell
() :
m_position
(0,0),
m_numberCellSpanned
(1,1),
m_bdBox
(),
m_bdSize
(),
69
m_hAlign
(
HALIGN_DEFAULT
),
m_vAlign
(
VALIGN_DEFAULT
),
m_bordersList
(),
70
m_backgroundColor
(
MWAWColor
::white()),
m_protected
(false),
71
m_extraLine
(
E_None
),
m_extraLineType
() { }
72
74
virtual
~MWAWCell
() {}
75
77
void
addTo
(WPXPropertyList &propList)
const
;
78
80
friend
std::ostream &
operator<<
(std::ostream &o,
MWAWCell
const
&cell);
81
82
// interface with MWAWTable:
83
88
virtual
bool
send
(
MWAWContentListenerPtr
listener,
MWAWTable
&table);
93
virtual
bool
sendContent
(
MWAWContentListenerPtr
listener,
MWAWTable
&table);
94
95
// position
96
98
Vec2i
const
&
position
()
const
{
99
return
m_position
;
100
}
102
void
setPosition
(
Vec2i
posi) {
103
m_position
= posi;
104
}
105
107
Vec2i
const
&
numSpannedCells
()
const
{
108
return
m_numberCellSpanned
;
109
}
111
void
setNumSpannedCells
(
Vec2i
numSpanned) {
112
m_numberCellSpanned
=numSpanned;
113
}
114
116
Box2f
const
&
bdBox
()
const
{
117
return
m_bdBox
;
118
}
120
void
setBdBox
(
Box2f
box) {
121
m_bdBox
= box;
122
}
123
125
Vec2f
const
&
bdSize
()
const
{
126
return
m_bdSize
;
127
}
129
void
setBdSize
(
Vec2f
sz) {
130
m_bdSize
= sz;
131
}
132
134
static
std::string
getCellName
(
Vec2i
const
&pos,
Vec2b
const
&absolute);
135
137
static
std::string
getColumnName
(
int
col);
138
139
// format
140
142
bool
isProtected
()
const
{
143
return
m_protected
;
144
}
146
void
setProtected
(
bool
fl) {
147
m_protected
= fl;
148
}
149
151
HorizontalAlignment
hAlignement
()
const
{
152
return
m_hAlign
;
153
}
155
void
setHAlignement
(
HorizontalAlignment
align) {
156
m_hAlign
= align;
157
}
158
160
VerticalAlignment
vAlignement
()
const
{
161
return
m_vAlign
;
162
}
164
void
setVAlignement
(
VerticalAlignment
align) {
165
m_vAlign
= align;
166
}
167
169
bool
hasBorders
()
const
{
170
return
m_bordersList
.size() != 0;
171
}
173
std::vector<MWAWBorder>
const
&
borders
()
const
{
174
return
m_bordersList
;
175
}
176
178
void
resetBorders
() {
179
m_bordersList
.resize(0);
180
}
182
void
setBorders
(
int
wh,
MWAWBorder
const
&border);
183
185
MWAWColor
backgroundColor
()
const
{
186
return
m_backgroundColor
;
187
}
189
void
setBackgroundColor
(
MWAWColor
color) {
190
m_backgroundColor
= color;
191
}
193
bool
hasExtraLine
()
const
{
194
return
m_extraLine
!=
E_None
&& !
m_extraLineType
.
isEmpty
();
195
}
197
ExtraLine
extraLine
()
const
{
198
return
m_extraLine
;
199
}
201
MWAWBorder
const
&
extraLineType
()
const
{
202
return
m_extraLineType
;
203
}
205
void
setExtraLine
(
ExtraLine
extrLine,
MWAWBorder
const
&type=
MWAWBorder
()) {
206
m_extraLine
= extrLine;
207
m_extraLineType
=type;
208
}
209
protected
:
211
Vec2i
m_position
;
213
Vec2i
m_numberCellSpanned
;
214
216
Box2f
m_bdBox
;
217
219
Vec2f
m_bdSize
;
220
222
HorizontalAlignment
m_hAlign
;
224
VerticalAlignment
m_vAlign
;
226
std::vector<MWAWBorder>
m_bordersList
;
228
MWAWColor
m_backgroundColor
;
230
bool
m_protected
;
232
ExtraLine
m_extraLine
;
234
MWAWBorder
m_extraLineType
;
235
};
236
237
#endif
238
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Generated on Tue Oct 22 2013 08:24:49 for libmwaw by
doxygen
1.8.4