Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef MWAW_CELL_H
00038 # define MWAW_CELL_H
00039
00040 #include <string>
00041 #include <vector>
00042
00043 #include "libmwaw_internal.hxx"
00044
00045 class WPXPropertyList;
00046
00047 class MWAWTable;
00048
00050 class MWAWCell
00051 {
00052 public:
00056 enum HorizontalAlignment { HALIGN_LEFT, HALIGN_RIGHT, HALIGN_CENTER,
00057 HALIGN_FULL, HALIGN_DEFAULT
00058 };
00059
00062 enum VerticalAlignment { VALIGN_TOP, VALIGN_CENTER, VALIGN_BOTTOM, VALIGN_DEFAULT };
00063
00065 enum ExtraLine { E_None, E_Line1, E_Line2, E_Cross };
00066
00068 MWAWCell() : m_position(0,0), m_numberCellSpanned(1,1), m_bdBox(), m_bdSize(),
00069 m_hAlign(HALIGN_DEFAULT), m_vAlign(VALIGN_DEFAULT), m_bordersList(),
00070 m_backgroundColor(MWAWColor::white()), m_protected(false),
00071 m_extraLine(E_None), m_extraLineType() { }
00072
00074 virtual ~MWAWCell() {}
00075
00077 void addTo(WPXPropertyList &propList) const;
00078
00080 friend std::ostream &operator<<(std::ostream &o, MWAWCell const &cell);
00081
00082
00083
00088 virtual bool send(MWAWContentListenerPtr listener, MWAWTable &table);
00093 virtual bool sendContent(MWAWContentListenerPtr listener, MWAWTable &table);
00094
00095
00096
00098 Vec2i const &position() const {
00099 return m_position;
00100 }
00102 void setPosition(Vec2i posi) {
00103 m_position = posi;
00104 }
00105
00107 Vec2i const &numSpannedCells() const {
00108 return m_numberCellSpanned;
00109 }
00111 void setNumSpannedCells(Vec2i numSpanned) {
00112 m_numberCellSpanned=numSpanned;
00113 }
00114
00116 Box2f const &bdBox() const {
00117 return m_bdBox;
00118 }
00120 void setBdBox(Box2f box) {
00121 m_bdBox = box;
00122 }
00123
00125 Vec2f const &bdSize() const {
00126 return m_bdSize;
00127 }
00129 void setBdSize(Vec2f sz) {
00130 m_bdSize = sz;
00131 }
00132
00134 static std::string getCellName(Vec2i const &pos, Vec2b const &absolute);
00135
00137 static std::string getColumnName(int col);
00138
00139
00140
00142 bool isProtected() const {
00143 return m_protected;
00144 }
00146 void setProtected(bool fl) {
00147 m_protected = fl;
00148 }
00149
00151 HorizontalAlignment hAlignement() const {
00152 return m_hAlign;
00153 }
00155 void setHAlignement(HorizontalAlignment align) {
00156 m_hAlign = align;
00157 }
00158
00160 VerticalAlignment vAlignement() const {
00161 return m_vAlign;
00162 }
00164 void setVAlignement(VerticalAlignment align) {
00165 m_vAlign = align;
00166 }
00167
00169 bool hasBorders() const {
00170 return m_bordersList.size() != 0;
00171 }
00173 std::vector<MWAWBorder> const &borders() const {
00174 return m_bordersList;
00175 }
00176
00178 void resetBorders() {
00179 m_bordersList.resize(0);
00180 }
00182 void setBorders(int wh, MWAWBorder const &border);
00183
00185 MWAWColor backgroundColor() const {
00186 return m_backgroundColor;
00187 }
00189 void setBackgroundColor(MWAWColor color) {
00190 m_backgroundColor = color;
00191 }
00193 bool hasExtraLine() const {
00194 return m_extraLine!=E_None && !m_extraLineType.isEmpty();
00195 }
00197 ExtraLine extraLine() const {
00198 return m_extraLine;
00199 }
00201 MWAWBorder const &extraLineType() const {
00202 return m_extraLineType;
00203 }
00205 void setExtraLine(ExtraLine extrLine, MWAWBorder const &type=MWAWBorder()) {
00206 m_extraLine = extrLine;
00207 m_extraLineType=type;
00208 }
00209 protected:
00211 Vec2i m_position;
00213 Vec2i m_numberCellSpanned;
00214
00216 Box2f m_bdBox;
00217
00219 Vec2f m_bdSize;
00220
00222 HorizontalAlignment m_hAlign;
00224 VerticalAlignment m_vAlign;
00226 std::vector<MWAWBorder> m_bordersList;
00228 MWAWColor m_backgroundColor;
00230 bool m_protected;
00232 ExtraLine m_extraLine;
00234 MWAWBorder m_extraLineType;
00235 };
00236
00237 #endif
00238