File indexing completed on 2024-05-12 16:35:35

0001 /* This file is part of the KDE project
0002    Copyright 2008 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 KSPREAD_READONLY_REGION_MODEL
0021 #define KSPREAD_READONLY_REGION_MODEL
0022 
0023 #include <QAbstractProxyModel>
0024 
0025 namespace KSpread
0026 {
0027 class Region;
0028 
0029 /**
0030  * A model for a contiguous cell region.
0031  */
0032 class ReadOnlyRegionModel : QAbstractProxyModel
0033 {
0034 public:
0035     /**
0036      * Constructor.
0037      */
0038     explicit ReadOnlyRegionModel(const Region &region);
0039 
0040     /**
0041      * Destructor.
0042      */
0043     ~ReadOnlyRegionModel();
0044 
0045     // QAbstractTableModel interface
0046     virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
0047     virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
0048     virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
0049     virtual QModelIndex parent(const QModelIndex& index) const;
0050 
0051     // QAbstractProxyModel interface
0052     virtual QModelIndex mapFromSource(const QModelIndex& sourceIndex) const;
0053     virtual QModelIndex mapToSource(const QModelIndex& proxyIndex) const;
0054 
0055 private:
0056     class Private;
0057     Private * const d;
0058 };
0059 
0060 } // namespace KSpread
0061 
0062 #endif // KSPREAD_READONLY_REGION_MODEL