Warning, file /office/calligra/braindump/src/DocumentModel.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Copyright (c) 2009 Cyrille Berger <cberger@cberger.net> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; 0007 * either version 2, or (at your option) any later version of the License. 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 * 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 library; see the file COPYING. 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 _DOCUMENT_MODEL_H_ 0021 #define _DOCUMENT_MODEL_H_ 0022 0023 #include "KoDocumentSectionModel.h" 0024 0025 class RootSection; 0026 class Section; 0027 class SectionGroup; 0028 0029 class DocumentModel : public KoDocumentSectionModel 0030 { 0031 Q_OBJECT 0032 public: 0033 enum Role { 0034 SectionPtr = 0x1252BAD 0035 }; 0036 public: 0037 DocumentModel(QObject* parent, RootSection *document); 0038 ~DocumentModel(); 0039 // from QAbstractItemModel 0040 virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; 0041 virtual int columnCount(const QModelIndex& parent = QModelIndex()) const; 0042 virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const; 0043 virtual QModelIndex parent(const QModelIndex& child) const; 0044 virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; 0045 virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); 0046 virtual Qt::ItemFlags flags(const QModelIndex &index) const; 0047 virtual Qt::DropActions supportedDropActions() const; 0048 virtual QStringList mimeTypes() const; 0049 virtual QMimeData* mimeData(const QModelIndexList& indexes) const; 0050 virtual bool dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent); 0051 public: 0052 void removeSection(Section*); 0053 void insertSection(Section*, SectionGroup* parent, Section* before); 0054 void insertSection(Section*, SectionGroup* parent, int _idx); 0055 void changeSectionName(Section* _section, const QString& _name); 0056 public: 0057 QModelIndex index(Section*); 0058 QModelIndex index(SectionGroup*); 0059 Section* dataFromIndex(const QModelIndex& index) const; 0060 void* dataToIndex(Section* section) const; 0061 Q_SIGNALS: 0062 /** 0063 * This signal is emitted when the active section is changed. 0064 */ 0065 void activeSectionChanged(Section* section); 0066 private: 0067 RootSection* m_document; 0068 }; 0069 0070 #endif