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:
58  };
59 
63 
66 
70  m_backgroundColor(MWAWColor::white()), m_protected(false),
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 
152  return m_hAlign;
153  }
156  m_hAlign = align;
157  }
158 
161  return m_vAlign;
162  }
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 
186  return m_backgroundColor;
187  }
190  m_backgroundColor = color;
191  }
193  bool hasExtraLine() const {
195  }
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:
214 
217 
220 
226  std::vector<MWAWBorder> m_bordersList;
235 };
236 
237 #endif
238 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
void setPosition(Vec2i posi)
set the cell positions : 0,0 -&gt; A1, 0,1 -&gt; A2
Definition: MWAWCell.hxx:102
Box2f m_bdBox
the cell bounding box (unit in point)
Definition: MWAWCell.hxx:216
friend std::ostream & operator<<(std::ostream &o, MWAWCell const &cell)
operator&lt;&lt;
Definition: MWAWCell.cxx:162
MWAWBorder m_extraLineType
extra line type
Definition: MWAWCell.hxx:234
void setBdBox(Box2f box)
set the bdbox (unit point)
Definition: MWAWCell.hxx:120
Vec2i m_numberCellSpanned
the cell spanned : by default (1,1)
Definition: MWAWCell.hxx:213
void setBackgroundColor(MWAWColor color)
sets the background color
Definition: MWAWCell.hxx:189
MWAWCell()
constructor
Definition: MWAWCell.hxx:68
void setHAlignement(HorizontalAlignment align)
sets the horizontal alignement
Definition: MWAWCell.hxx:155
HorizontalAlignment hAlignement() const
returns the horizontal alignement
Definition: MWAWCell.hxx:151
bool hasBorders() const
return true if the cell has some border
Definition: MWAWCell.hxx:169
void setProtected(bool fl)
returns true if the cell is protected
Definition: MWAWCell.hxx:146
Vec2f const & bdSize() const
bdbox size accessor
Definition: MWAWCell.hxx:125
Definition: MWAWCell.hxx:62
std::vector< MWAWBorder > m_bordersList
the cell border MWAWBorder::Pos
Definition: MWAWCell.hxx:226
VerticalAlignment m_vAlign
the vertical cell alignement : by default nothing
Definition: MWAWCell.hxx:224
static std::string getCellName(Vec2i const &pos, Vec2b const &absolute)
return the name of a cell (given row and column) : 0,0 -&gt; A1, 0,1 -&gt; A2
Definition: MWAWCell.cxx:126
Box2f const & bdBox() const
bdbox accessor
Definition: MWAWCell.hxx:116
a class used to recreate the table structure using cell informations, ....
Definition: MWAWTable.hxx:53
bool m_protected
cell protected
Definition: MWAWCell.hxx:230
static std::string getColumnName(int col)
return the column name
Definition: MWAWCell.cxx:116
void setVAlignement(VerticalAlignment align)
sets the vertical alignement
Definition: MWAWCell.hxx:164
ExtraLine extraLine() const
returns the extra lines
Definition: MWAWCell.hxx:197
HorizontalAlignment
the default horizontal alignement.
Definition: MWAWCell.hxx:56
a structure used to define a cell and its format
Definition: MWAWCell.hxx:50
the class to store a color
Definition: libmwaw_internal.hxx:166
MWAWColor backgroundColor() const
returns the background color
Definition: MWAWCell.hxx:185
Definition: MWAWCell.hxx:65
void addTo(WPXPropertyList &propList) const
adds to the propList
Definition: MWAWCell.cxx:45
virtual ~MWAWCell()
destructor
Definition: MWAWCell.hxx:74
a border
Definition: libmwaw_internal.hxx:237
void setBdSize(Vec2f sz)
set the bdbox size(unit point)
Definition: MWAWCell.hxx:129
void setNumSpannedCells(Vec2i numSpanned)
sets the number of spanned cells : Vec2i(1,1) means 1 cellule
Definition: MWAWCell.hxx:111
virtual bool sendContent(MWAWContentListenerPtr listener, MWAWTable &table)
function called when the content of a cell must be send to the listener, ie.
Definition: MWAWCell.cxx:248
HorizontalAlignment m_hAlign
the cell alignement : by default nothing
Definition: MWAWCell.hxx:222
ExtraLine
an enum to defined potential internal line: E_Line1=TL to RB, E_Line2=BL to RT
Definition: MWAWCell.hxx:65
Definition: MWAWCell.hxx:62
Definition: MWAWCell.hxx:57
Vec2f m_bdSize
the cell bounding size : unit point
Definition: MWAWCell.hxx:219
void setExtraLine(ExtraLine extrLine, MWAWBorder const &type=MWAWBorder())
sets the extraline
Definition: MWAWCell.hxx:205
ExtraLine m_extraLine
extra line
Definition: MWAWCell.hxx:232
void resetBorders()
reset the border
Definition: MWAWCell.hxx:178
Definition: MWAWCell.hxx:65
Vec2i const & position() const
position accessor
Definition: MWAWCell.hxx:98
Definition: MWAWCell.hxx:62
VerticalAlignment vAlignement() const
returns the vertical alignement
Definition: MWAWCell.hxx:160
Definition: MWAWCell.hxx:57
shared_ptr< MWAWContentListener > MWAWContentListenerPtr
a smart pointer of MWAWContentListener
Definition: libmwaw_internal.hxx:340
MWAWColor m_backgroundColor
the backgroung color
Definition: MWAWCell.hxx:228
bool hasExtraLine() const
returns true if we have some extra lines
Definition: MWAWCell.hxx:193
virtual bool send(MWAWContentListenerPtr listener, MWAWTable &table)
function called when a cell is send by MWAWTable to send a cell to a listener.
Definition: MWAWCell.cxx:239
Definition: MWAWCell.hxx:65
std::vector< MWAWBorder > const & borders() const
return the cell border: libmwaw::Left | ...
Definition: MWAWCell.hxx:173
MWAWBorder const & extraLineType() const
returns the extra line border
Definition: MWAWCell.hxx:201
VerticalAlignment
the default vertical alignement.
Definition: MWAWCell.hxx:62
Vec2i const & numSpannedCells() const
returns the number of spanned cells
Definition: MWAWCell.hxx:107
Definition: MWAWCell.hxx:56
Definition: MWAWCell.hxx:62
Definition: MWAWCell.hxx:65
Definition: MWAWCell.hxx:56
bool isProtected() const
returns true if the cell is protected
Definition: MWAWCell.hxx:142
Definition: MWAWCell.hxx:56
Vec2i m_position
the cell row and column : 0,0 -&gt; A1, 0,1 -&gt; A2
Definition: MWAWCell.hxx:211
void setBorders(int wh, MWAWBorder const &border)
sets the cell border: wh=libmwaw::Left|...
Definition: MWAWCell.cxx:139
bool isEmpty() const
returns true if the border is empty
Definition: libmwaw_internal.hxx:250

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