kspread
BindingModel.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright 2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net> 00003 Copyright (C) 2008 Thomas Zander <zander@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KSPREAD_BINDING_MODEL 00022 #define KSPREAD_BINDING_MODEL 00023 00024 #include <KoChartModel.h> 00025 #include <KoTableInterface.h> 00026 00027 #include <QAbstractTableModel> 00028 00029 namespace KSpread 00030 { 00031 class Binding; 00032 00033 class BindingModel : public QAbstractTableModel, public KoChart::ChartModel, public KoTable::ModelExtension 00034 { 00035 Q_OBJECT 00036 Q_INTERFACES(KoChart::ChartModel KoTable::ModelExtension) 00037 public: 00038 BindingModel(Binding* binding, QObject *parent = 0); 00039 00040 // QAbstractTableModel interface 00041 virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; 00042 virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const; 00043 virtual int columnCount( const QModelIndex& parent = QModelIndex() ) const; 00044 virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const; 00045 00046 // KoChart::ChartModel interface 00047 virtual QHash<QString, QVector<QRect> > cellRegion() const; 00048 virtual bool setCellRegion(const QString& regionName); 00049 virtual bool isCellRegionValid(const QString& regionName) const; 00050 00051 // ModelExtension interface 00052 virtual QString regionAddress() const; 00053 00054 const Region& region() const; 00055 void setRegion(const Region& region); 00056 00057 void emitDataChanged(const QRect& range); 00058 void emitChanged(const Region& region); 00059 00060 signals: 00061 void changed(const Region& region); 00062 00063 private: 00064 Region m_region; 00065 Binding* m_binding; 00066 }; 00067 00068 } // namespace KSpread 00069 00070 #endif // KSPREAD_BINDING_MODEL
