File indexing completed on 2024-05-12 16:35:14
0001 /* This file is part of the KDE project 0002 Copyright 2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (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 GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef CALLIGRA_SHEETS_DATABASE 0021 #define CALLIGRA_SHEETS_DATABASE 0022 0023 #include <QSharedDataPointer> 0024 #include <QVariant> 0025 0026 #include <KoXmlReader.h> 0027 0028 #include "sheets_odf_export.h" 0029 0030 0031 class KoXmlWriter; 0032 0033 namespace Calligra 0034 { 0035 namespace Sheets 0036 { 0037 class Filter; 0038 class Map; 0039 class Region; 0040 0041 /** 0042 * OpenDocument, 8.6.1 Database Range 0043 */ 0044 class CALLIGRA_SHEETS_ODF_EXPORT Database 0045 { 0046 public: 0047 /** 0048 * Constructor. 0049 * Creates an empty database. 0050 */ 0051 Database(); 0052 0053 /** 0054 * Constructor. 0055 * Creates a database named \p name. 0056 */ 0057 explicit Database(const QString &name); 0058 0059 /** 0060 * Copy Constructor. 0061 */ 0062 Database(const Database& other); 0063 0064 /** 0065 * Destructor. 0066 */ 0067 ~Database(); 0068 0069 /** 0070 * \return \c true if this is the default/empty database 0071 */ 0072 bool isEmpty() const; 0073 0074 /** 0075 * \return the database's name 0076 */ 0077 const QString& name() const; 0078 0079 /** 0080 * Sets the database's name. 0081 */ 0082 void setName(const QString& name); 0083 0084 /** 0085 * \return the database's orientation 0086 */ 0087 Qt::Orientation orientation() const; 0088 0089 /** 0090 * \return \c true if the range contains a header column/row 0091 */ 0092 bool containsHeader() const; 0093 0094 /** 0095 * Sets whether the range contains a header column/row 0096 */ 0097 void setContainsHeader(bool enable); 0098 0099 /** 0100 * \return \c true if filter buttons should be displayed 0101 */ 0102 bool displayFilterButtons() const; 0103 0104 /** 0105 * Sets whether filter buttons should be displayed. 0106 */ 0107 void setDisplayFilterButtons(bool enable); 0108 0109 /** 0110 * \return the actual database cell range 0111 */ 0112 const Region& range() const; 0113 0114 /** 0115 * Sets the actual database cell range. 0116 * \p region has to be contiguous. 0117 */ 0118 void setRange(const Region& region); 0119 0120 const Filter& filter() const; 0121 void setFilter(const Filter& filter); 0122 0123 bool loadOdf(const KoXmlElement& element, const Map* map); 0124 void saveOdf(KoXmlWriter& xmlWriter) const; 0125 0126 void operator=(const Database& other); 0127 bool operator==(const Database& other) const; 0128 bool operator<(const Database& other) const; 0129 0130 void dump() const; 0131 0132 private: 0133 class Private; 0134 QSharedDataPointer<Private> d; 0135 }; 0136 0137 } // namespace Sheets 0138 } // namespace Calligra 0139 0140 Q_DECLARE_METATYPE(Calligra::Sheets::Database) 0141 Q_DECLARE_TYPEINFO(Calligra::Sheets::Database, Q_MOVABLE_TYPE); 0142 0143 #endif // CALLIGRA_SHEETS_DATABASE