filters
format.h
00001 00002 /* 00003 ** Header file for inclusion with kword_xml2latex.c 00004 ** 00005 ** Copyright (C) 2002 Robert JACOLIN 00006 ** 00007 ** This library is free software; you can redistribute it and/or 00008 ** modify it under the terms of the GNU Library General Public 00009 ** License as published by the Free Software Foundation; either 00010 ** version 2 of the License, or (at your option) any later version. 00011 ** 00012 ** This library is distributed in the hope that it will be useful, 00013 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 ** Library General Public License for more details. 00016 ** 00017 ** To receive a copy of the GNU Library General Public License, write to the 00018 ** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 ** 00021 */ 00022 00023 #ifndef __KSPREAD_LATEX_FORMAT_H__ 00024 #define __KSPREAD_LATEX_FORMAT_H__ 00025 00026 #include <qtextstream.h> 00027 #include <qstring.h> 00028 #include <qcolor.h> 00029 #include "xmlparser.h" 00030 #include "pen.h" 00031 00032 /***********************************************************************/ 00033 /* Class: Format */ 00034 /***********************************************************************/ 00035 00036 class Column; 00037 class Row; 00038 00042 class Format: public XmlParser 00043 { 00044 long _align; 00045 long _alignY; 00046 QColor _bgColor; 00047 long _multirow; 00048 bool _verticalText; 00049 double _angle; 00050 QColor _brushColor; 00051 int _brushStyle; 00052 int _indent; 00053 bool _dontprinttext; 00054 00055 /* pen */ 00056 double _penWidth; 00057 int _penStyle; 00058 QColor _penColor; 00059 00060 /* font */ 00061 int _size; 00062 QString _family; 00063 int _weight; 00064 00065 /* borders */ 00066 Pen *_bottomBorder; 00067 Pen *_topBorder; 00068 Pen *_leftBorder; 00069 Pen *_rightBorder; 00070 00071 /* */ 00072 bool _isValidFormat; 00073 00074 public: 00082 Format(); 00083 00084 /* 00085 * Destructor 00086 * 00087 * Nothing to do 00088 */ 00089 virtual ~Format(); 00090 00094 long getMultirow() const { return _multirow; } 00095 long getAlign() const { return _align; } 00096 long getAlignY() const { return _alignY; } 00097 QColor getBgColor() const { return _bgColor; } 00098 bool getVerticalText() const { return _verticalText; } 00099 double getAngle() const { return _angle; } 00100 QColor getBrushColor() const { return _brushColor; } 00101 int getBrushStyle() const { return _brushStyle; } 00102 int getIndent() const { return _indent; } 00103 bool getDontPrintText() const { return _dontprinttext; } 00104 00105 bool hasBorder() const { return (hasTopBorder() || hasBottomBorder() || hasLeftBorder() || hasRightBorder()); } 00106 bool hasTopBorder() const; 00107 //Pen* getTopBorder() const { return _topBorder; } 00108 bool hasBottomBorder() const; 00109 //Pen* getBottomBorder() const { return _bottomBorder; } 00110 bool hasLeftBorder() const; 00111 //Pen* getLeftBorder() const { return _leftBorder; } 00112 bool hasRightBorder() const; 00113 //Pen* getRightBorder() const { return _rightBorder; } 00114 00115 /* pen */ 00116 double getPenWidth() const { return _penWidth; } 00117 int getPenStyle() const { return _penStyle; } 00118 QColor getPenColor() const { return _penColor; } 00119 00120 /* font */ 00121 int getFontSize() const { return _size; } 00122 QString getFontFamily() const { return _family; } 00123 int getFontWeight() const { return _weight; } 00124 bool isValidFormat() const { return _isValidFormat; } 00125 00129 void setAlign(long a) { _align = a; } 00130 void setAlignY(long a) { _alignY = a; } 00131 void setBgColor(QColor b) { _bgColor = b; } 00132 void setMultirow(long mr) { _multirow = mr; } 00133 void setVerticalText(bool vt) { _verticalText = vt; } 00134 void setAngle(double a) { _angle = a; } 00135 void setBrushColor(QString bc) { _brushColor.setNamedColor(bc); } 00136 void setBrushStyle(int bs) { _brushStyle = bs; } 00137 void setIndent(int indent) { _indent = indent; } 00138 void setDontPrintText(bool dpt) { _dontprinttext = dpt; } 00139 00140 /* pen */ 00141 void setPenWidth(double pw) { _penWidth = pw; } 00142 void setPenStyle(int ps) { _penStyle = ps; } 00143 void setPenColor(QString pc) { _penColor.setNamedColor(pc); } 00144 00145 /* font */ 00146 void setFontSize(int s) { _size = s; } 00147 void setFontFamily(QString f) { _family = f; } 00148 void setFontWeight(int w) { _weight = w; } 00149 00157 virtual void analyse(const QDomNode); 00158 virtual void analysePen(const QDomNode); 00159 virtual void analyseFont(const QDomNode); 00160 00169 void generate(QTextStream& out, Column* col = NULL, Row* row = NULL); 00170 00174 void generateTextFormat(QTextStream& out, QString text); 00175 00183 void generateColor(QTextStream& out); 00184 }; 00185 00186 #endif /* __KSPREAD_LATEX_FORMAT_H__ */