1/* This file is part of the KDE project
2 Copyright 2009 Stefan Nikolaus stefan.nikolaus@kdemail.net
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef CALLIGRA_SHEETS_SHEET_MODEL
21#define CALLIGRA_SHEETS_SHEET_MODEL
22
23#include <QAbstractTableModel>
24
25#include "calligra_sheets_export.h"
26
27class QItemSelectionRange;
28
29namespace Calligra
30{
31namespace Sheets
32{
33class Sheet;
34
35/**
36 * A model for a sheet.
37 * \ingroup Model
38 */
39class CALLIGRA_SHEETS_ODF_EXPORT SheetModel : public QAbstractTableModel
40{
41public:
42 explicit SheetModel(Sheet* sheet);
43 virtual ~SheetModel();
44
45 // QAbstractTableModel interface
46 virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
47 virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
48 virtual Qt::ItemFlags flags(const QModelIndex& index) const;
49 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
50 virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
51 virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
52 virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
53
54 bool setData(const QItemSelectionRange &range, const QVariant &value, int role = Qt::EditRole);
55 bool setData(const QModelIndex &topLeft, const QModelIndex &bottomRight,
56 const QVariant &value, int role = Qt::EditRole);
57
58protected:
59 Sheet* sheet() const;
60
61private:
62 class Private;
63 Private * const d;
64};
65
66} // namespace Sheets
67} // namespace Calligra
68
69#endif // CALLIGRA_SHEETS_SHEET_MODEL
70