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 
38 #ifndef MWAW_CELL_H
39 # define MWAW_CELL_H
40 
41 #include <string>
42 #include <vector>
43 
44 #include "libmwaw_internal.hxx"
45 
46 class WPXPropertyList;
47 
48 class MWAWTable;
49 
51 class MWAWCell
52 {
53 public:
59  };
60 
64 
67 
71  m_backgroundColor(MWAWColor::white()), m_protected(false),
73 
75  virtual ~MWAWCell() {}
76 
78  void addTo(WPXPropertyList &propList) const;
79 
81  friend std::ostream &operator<<(std::ostream &o, MWAWCell const &cell);
82 
83  // interface with MWAWTable:
84 
89  virtual bool send(MWAWContentListenerPtr listener, MWAWTable &table);
94  virtual bool sendContent(MWAWContentListenerPtr listener, MWAWTable &table);
95 
96  // position
97 
99  Vec2i const &position() const {
100  return m_position;
101  }
103  void setPosition(Vec2i posi) {
104  m_position = posi;
105  }
106 
108  Vec2i const &numSpannedCells() const {
109  return m_numberCellSpanned;
110  }
112  void setNumSpannedCells(Vec2i numSpanned) {
113  m_numberCellSpanned=numSpanned;
114  }
115 
117  Box2f const &bdBox() const {
118  return m_bdBox;
119  }
121  void setBdBox(Box2f box) {
122  m_bdBox = box;
123  }
124 
126  Vec2f const &bdSize() const {
127  return m_bdSize;
128  }
130  void setBdSize(Vec2f sz) {
131  m_bdSize = sz;
132  }
133 
135  static std::string getCellName(Vec2i const &pos, Vec2b const &absolute);
136 
138  static std::string getColumnName(int col);
139 
140  // format
141 
143  bool isProtected() const {
144  return m_protected;
145  }
147  void setProtected(bool fl) {
148  m_protected = fl;
149  }
150 
153  return m_hAlign;
154  }
157  m_hAlign = align;
158  }
159 
162  return m_vAlign;
163  }
166  m_vAlign = align;
167  }
168 
170  bool hasBorders() const {
171  return m_bordersList.size() != 0;
172  }
174  std::vector<MWAWBorder> const &borders() const {
175  return m_bordersList;
176  }
177 
179  void resetBorders() {
180  m_bordersList.resize(0);
181  }
183  void setBorders(int wh, MWAWBorder const &border);
184 
187  return m_backgroundColor;
188  }
191  m_backgroundColor = color;
192  }
194  bool hasExtraLine() const {
196  }
199  return m_extraLine;
200  }
202  MWAWBorder const &extraLineType() const {
203  return m_extraLineType;
204  }
206  void setExtraLine(ExtraLine extrLine, MWAWBorder const &type=MWAWBorder()) {
207  m_extraLine = extrLine;
208  m_extraLineType=type;
209  }
210 protected:
215 
218 
221 
227  std::vector<MWAWBorder> m_bordersList;
236 };
237 
238 #endif
239 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
void setPosition(Vec2i posi)
set the cell positions : 0,0 -> A1, 0,1 -> A2
Definition: MWAWCell.hxx:103
Box2f m_bdBox
the cell bounding box (unit in point)
Definition: MWAWCell.hxx:217
friend std::ostream & operator<<(std::ostream &o, MWAWCell const &cell)
operator<<
Definition: MWAWCell.cxx:165
MWAWBorder m_extraLineType
extra line type
Definition: MWAWCell.hxx:235
void setBdBox(Box2f box)
set the bdbox (unit point)
Definition: MWAWCell.hxx:121
Vec2i m_numberCellSpanned
the cell spanned : by default (1,1)
Definition: MWAWCell.hxx:214
void setBackgroundColor(MWAWColor color)
sets the background color
Definition: MWAWCell.hxx:190
MWAWCell()
constructor
Definition: MWAWCell.hxx:69
void setHAlignement(HorizontalAlignment align)
sets the horizontal alignement
Definition: MWAWCell.hxx:156
HorizontalAlignment hAlignement() const
returns the horizontal alignement
Definition: MWAWCell.hxx:152
bool hasBorders() const
return true if the cell has some border
Definition: MWAWCell.hxx:170
void setProtected(bool fl)
returns true if the cell is protected
Definition: MWAWCell.hxx:147
Vec2f const & bdSize() const
bdbox size accessor
Definition: MWAWCell.hxx:126
Definition: MWAWCell.hxx:63
std::vector< MWAWBorder > m_bordersList
the cell border MWAWBorder::Pos
Definition: MWAWCell.hxx:227
VerticalAlignment m_vAlign
the vertical cell alignement : by default nothing
Definition: MWAWCell.hxx:225
static std::string getCellName(Vec2i const &pos, Vec2b const &absolute)
return the name of a cell (given row and column) : 0,0 -> A1, 0,1 -> A2
Definition: MWAWCell.cxx:129
Box2f const & bdBox() const
bdbox accessor
Definition: MWAWCell.hxx:117
a class used to recreate the table structure using cell informations, ....
Definition: MWAWTable.hxx:53
bool m_protected
cell protected
Definition: MWAWCell.hxx:231
static std::string getColumnName(int col)
return the column name
Definition: MWAWCell.cxx:119
void setVAlignement(VerticalAlignment align)
sets the vertical alignement
Definition: MWAWCell.hxx:165
ExtraLine extraLine() const
returns the extra lines
Definition: MWAWCell.hxx:198
HorizontalAlignment
the default horizontal alignement.
Definition: MWAWCell.hxx:57
a structure used to define a cell and its format
Definition: MWAWCell.hxx:51
the class to store a color
Definition: libmwaw_internal.hxx:166
MWAWColor backgroundColor() const
returns the background color
Definition: MWAWCell.hxx:186
Definition: MWAWCell.hxx:66
void addTo(WPXPropertyList &propList) const
adds to the propList
Definition: MWAWCell.cxx:48
virtual ~MWAWCell()
destructor
Definition: MWAWCell.hxx:75
a border
Definition: libmwaw_internal.hxx:237
void setBdSize(Vec2f sz)
set the bdbox size(unit point)
Definition: MWAWCell.hxx:130
void setNumSpannedCells(Vec2i numSpanned)
sets the number of spanned cells : Vec2i(1,1) means 1 cellule
Definition: MWAWCell.hxx:112
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:251
HorizontalAlignment m_hAlign
the cell alignement : by default nothing
Definition: MWAWCell.hxx:223
ExtraLine
an enum to defined potential internal line: E_Line1=TL to RB, E_Line2=BL to RT
Definition: MWAWCell.hxx:66
Definition: MWAWCell.hxx:63
Definition: MWAWCell.hxx:58
Vec2f m_bdSize
the cell bounding size : unit point
Definition: MWAWCell.hxx:220
void setExtraLine(ExtraLine extrLine, MWAWBorder const &type=MWAWBorder())
sets the extraline
Definition: MWAWCell.hxx:206
ExtraLine m_extraLine
extra line
Definition: MWAWCell.hxx:233
void resetBorders()
reset the border
Definition: MWAWCell.hxx:179
Definition: MWAWCell.hxx:66
Vec2i const & position() const
position accessor
Definition: MWAWCell.hxx:99
Definition: MWAWCell.hxx:63
VerticalAlignment vAlignement() const
returns the vertical alignement
Definition: MWAWCell.hxx:161
Definition: MWAWCell.hxx:58
shared_ptr< MWAWContentListener > MWAWContentListenerPtr
a smart pointer of MWAWContentListener
Definition: libmwaw_internal.hxx:340
MWAWColor m_backgroundColor
the backgroung color
Definition: MWAWCell.hxx:229
bool hasExtraLine() const
returns true if we have some extra lines
Definition: MWAWCell.hxx:194
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:242
Definition: MWAWCell.hxx:66
std::vector< MWAWBorder > const & borders() const
return the cell border: libmwaw::Left | ...
Definition: MWAWCell.hxx:174
MWAWBorder const & extraLineType() const
returns the extra line border
Definition: MWAWCell.hxx:202
VerticalAlignment
the default vertical alignement.
Definition: MWAWCell.hxx:63
Vec2i const & numSpannedCells() const
returns the number of spanned cells
Definition: MWAWCell.hxx:108
Definition: MWAWCell.hxx:57
Definition: MWAWCell.hxx:63
Definition: MWAWCell.hxx:66
Definition: MWAWCell.hxx:57
bool isProtected() const
returns true if the cell is protected
Definition: MWAWCell.hxx:143
Definition: MWAWCell.hxx:57
Vec2i m_position
the cell row and column : 0,0 -> A1, 0,1 -> A2
Definition: MWAWCell.hxx:212
void setBorders(int wh, MWAWBorder const &border)
sets the cell border: wh=libmwaw::Left|...
Definition: MWAWCell.cxx:142
bool isEmpty() const
returns true if the border is empty
Definition: libmwaw_internal.hxx:250

Generated on Fri May 23 2014 22:12:55 for libmwaw by doxygen 1.8.7