File indexing completed on 2024-12-08 12:56:11
0001 /* 0002 * Copyright (c) 2010 Carlos Licea <carlos@kdab.com> 0003 * 0004 * This library is free software; you can redistribute it and/or modify 0005 * it under the terms of the GNU Lesser General Public License as published 0006 * by the Free Software Foundation; either version 2.1 of the License, or 0007 * (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public License 0015 * along with this program; if not, write to the Free Software 0016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0017 */ 0018 0019 #ifndef KOTABLE_H 0020 #define KOTABLE_H 0021 0022 class KoColumn; 0023 class KoRow; 0024 class KoCell; 0025 #include "KoTblStyle.h" 0026 0027 class KoXmlWriter; 0028 class KoGenStyles; 0029 0030 #include "koodf2_export.h" 0031 0032 #include <QMap> 0033 #include <QVector> 0034 #include <QPair> 0035 0036 /** 0037 * \class KoTable 0038 * \brief This represents a table in an ODF element. 0039 * Note that, at least for now, the class is meant to be used 0040 * only to write tables and as such lacks much of the functionality 0041 * needed to read written tables. 0042 * 0043 * All the pointers returned by this class are guaranteed to be not-null. 0044 * Do note, however, that there's no way to clear a cell, row or column. 0045 * 0046 * The KoTable owns all the pointer objects returned by 0047 * its methods. 0048 **/ 0049 0050 class KOODF2_EXPORT KoTable 0051 { 0052 public: 0053 KOSTYLE_DECLARE_SHARED_POINTER(KoTable) 0054 0055 KoTable(); 0056 ~KoTable(); 0057 0058 KoRow* rowAt(int row); 0059 int rowCount() const; 0060 0061 KoColumn* columnAt(int column); 0062 int columnCount() const; 0063 0064 KoCell* cellAt(int row, int column); 0065 0066 void saveOdf(KoXmlWriter& writer, KoGenStyles& styles); 0067 0068 KoTblStyle::Ptr tableStyle(); 0069 void setTableStyle(KoTblStyle::Ptr style); 0070 0071 // KoTableTemplate* tableTemplate(); 0072 // void setTableTemplate(KoTableTemplate* tableTemplate); 0073 // TableTemplateFlags templateFlags(); 0074 // void setTemplateFlags(TableTemplateFlags templateFlags); 0075 0076 bool printable() const; 0077 void setPrintable(bool printable); 0078 0079 // void setPrintRange(CellRange cellRange); 0080 // CellRange printRange() const; 0081 0082 void setName(const QString& name); 0083 QString name() const; 0084 0085 void setProtected(bool isProtected); 0086 bool isPprotected() const; 0087 0088 void setProtectionKey(const QString &password, const QString &protectionAlgorithmUri = QLatin1String("http://www.w3.org/2000/09/xmldsig#sha1")); 0089 QString protectionKey() const; 0090 QString protectionalgorithm() const; 0091 0092 private: 0093 QVector<KoColumn*> m_columns; 0094 QVector<KoRow*> m_rows; 0095 0096 QMap<QPair<int,int>, KoCell*> m_cells; 0097 0098 int m_rowCount; 0099 int m_columnCount; 0100 0101 KoTblStyle::Ptr m_style; 0102 // KoTableTemplate* m_template; 0103 // TableTemplateFlags m_templateFlags; 0104 0105 bool m_printable; 0106 // CellRange m_printRange; 0107 QString m_name; 0108 0109 bool m_protected; 0110 QString m_protectionKey; 0111 QString m_protectionAlgorithm; 0112 }; 0113 0114 #endif