File indexing completed on 2025-02-16 13:49:57
0001 0002 /* 0003 ** Header file for inclusion with words_xml2latex.c 0004 ** 0005 ** Copyright (C) 2002, 2003 Robert JACOLIN 0006 ** 0007 ** This library is free software; you can redistribute it and/or 0008 ** modify it under the terms of the GNU Library General Public 0009 ** License as published by the Free Software Foundation; either 0010 ** version 2 of the License, or (at your option) any later version. 0011 ** 0012 ** This library is distributed in the hope that it will be useful, 0013 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 ** Library General Public License for more details. 0016 ** 0017 ** To receive a copy of the GNU Library General Public License, write to the 0018 ** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 * Boston, MA 02110-1301, USA. 0020 ** 0021 */ 0022 0023 #ifndef __CALLIGRA_SHEETS_LATEX_TABLE_H__ 0024 #define __CALLIGRA_SHEETS_LATEX_TABLE_H__ 0025 0026 #include <QString> 0027 #include <QList> 0028 #include <QTextStream> 0029 0030 #include "xmlparser.h" 0031 #include "config.h" 0032 //#include "cell.h" 0033 0034 class Cell; 0035 class Column; 0036 class Row; 0037 0038 /***********************************************************************/ 0039 /* Class: Table */ 0040 /***********************************************************************/ 0041 0042 /** 0043 * This class hold a table. That is a table of frame (text frame, picture 0044 * frame, ...). It use a special latex package. 0045 * The color table and the border of the tables is not yet supported. 0046 */ 0047 class Table: public XmlParser, Config 0048 { 0049 QList<Row*> _rows; 0050 QList<Column*> _columns; 0051 QList<Cell*> _cells; 0052 0053 /* USEFUL DATA */ 0054 int _maxRow, _maxCol; /* Size of the table (nb of cell) */ 0055 bool _columnNumber; 0056 bool _borders; 0057 bool _hide; 0058 bool _hideZero; 0059 bool _firstletterupper; 0060 bool _grid; 0061 bool _printGrid; 0062 bool _printCommentIndicator; 0063 bool _printFormulaIndicator; 0064 bool _showFormula; 0065 bool _showFormulaIndicator; 0066 bool _lcMode; 0067 QString _name; 0068 0069 /** PAPER DATA */ 0070 QString _format; 0071 QString _orientation; 0072 long _borderRight; 0073 long _borderLeft; 0074 long _borderBottom; 0075 long _borderTop; 0076 0077 public: 0078 /** 0079 * Constructors 0080 * 0081 */ 0082 0083 /** 0084 * Creates a new instance of Table. 0085 */ 0086 Table(); 0087 0088 /* 0089 * Destructor 0090 * 0091 * The destructor must remove the list of frames. 0092 */ 0093 0094 ~Table() override; 0095 0096 /** 0097 * getters 0098 */ 0099 0100 int getMaxRow() const { 0101 return _maxRow; 0102 } 0103 int getMaxColumn() const { 0104 return _maxCol; 0105 } 0106 QString getName() const { 0107 return _name; 0108 } 0109 QString getFormat() const { 0110 return _format; 0111 } 0112 QString getOrientation() const { 0113 return _orientation; 0114 } 0115 long getBorderRight() const { 0116 return _borderRight; 0117 } 0118 long getBorderLeft() const { 0119 return _borderLeft; 0120 } 0121 long getBorderBottom() const { 0122 return _borderBottom; 0123 } 0124 long getBorderTop() const { 0125 return _borderTop; 0126 } 0127 0128 bool isColumnNumber() const { 0129 return _columnNumber; 0130 } 0131 bool isBorders() const { 0132 return _borders; 0133 } 0134 bool isHide() const { 0135 return _hide; 0136 } 0137 bool isHideZero() const { 0138 return _hideZero; 0139 } 0140 bool isFirstletterupper() const { 0141 return _firstletterupper; 0142 } 0143 bool isGrid() const { 0144 return _grid; 0145 } 0146 bool isPrintGrid() const { 0147 return _printGrid; 0148 } 0149 bool isPrintCommentIndicator() const { 0150 return _printCommentIndicator; 0151 } 0152 bool isPrintFormulaIndicator() const { 0153 return _printFormulaIndicator; 0154 } 0155 bool isShowFormula() const { 0156 return _showFormula; 0157 } 0158 bool isShowFormulaIndicator() const { 0159 return _showFormulaIndicator; 0160 } 0161 bool isLCMode() const { 0162 return _lcMode; 0163 } 0164 0165 /** 0166 * setters 0167 */ 0168 void setMaxRow(int r); 0169 void setMaxColumn(int c); 0170 void setName(QString name) { 0171 _name = name; 0172 } 0173 void setFormat(QString format) { 0174 _format = format; 0175 } 0176 void setOrientation(QString orient) { 0177 _orientation = orient; 0178 } 0179 void setBorderRight(long br) { 0180 _borderRight = br; 0181 } 0182 void setBorderLeft(long bl) { 0183 _borderLeft = bl; 0184 } 0185 void setBorderBottom(long bb) { 0186 _borderBottom = bb; 0187 } 0188 void setBorderTop(long bt) { 0189 _borderTop = bt; 0190 } 0191 0192 void setColumnNumber() { 0193 _columnNumber = true; 0194 } 0195 void setBorders() { 0196 _borders = true; 0197 } 0198 void setHide() { 0199 _hide = true; 0200 } 0201 void setHideZero() { 0202 _hideZero = true; 0203 } 0204 void setFirstletterupper() { 0205 _firstletterupper = true; 0206 } 0207 void setGrid() { 0208 _grid = true; 0209 } 0210 void setPrintGrid() { 0211 _printGrid = true; 0212 } 0213 void setPrintCommentIndicator() { 0214 _printCommentIndicator = true; 0215 } 0216 void setPrintFormulaIndicator() { 0217 _printFormulaIndicator = true; 0218 } 0219 void setShowFormula() { 0220 _showFormula = true; 0221 } 0222 void setShowFormulaIndicator() { 0223 _showFormulaIndicator = true; 0224 } 0225 void setLCMode() { 0226 _lcMode = true; 0227 } 0228 0229 /** 0230 * Helpful functions 0231 */ 0232 0233 /** 0234 * Return one specific cell. 0235 * 0236 * @param col Cell column. 0237 * @param row Row cell. 0238 */ 0239 Cell* searchCell(int col, int row); 0240 0241 /** 0242 * Return one specific column which describes the format of the column. 0243 * 0244 * @param col the column. 0245 */ 0246 Column* searchColumn(int col); 0247 0248 /** 0249 * Return one specific row which describes the format of the row. 0250 * 0251 * @param row The row number. 0252 */ 0253 Row* searchRow(int row); 0254 0255 void analyze(const QDomNode); 0256 void analyzePaper(const QDomNode); 0257 void generate(QTextStream&); 0258 0259 private: 0260 void generateCell(QTextStream&, int, int); 0261 void generateTableHeader(QTextStream&); 0262 void generateTopLineBorder(QTextStream&, int); 0263 void generateBottomLineBorder(QTextStream&, int); 0264 }; 0265 0266 #endif /* __CALLIGRA_SHEETS_LATEX_TABLE_H__ */ 0267