File indexing completed on 2024-04-28 16:21:17
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_BINDING 0021 #define CALLIGRA_SHEETS_BINDING 0022 0023 #include <QSharedDataPointer> 0024 #include <QVariant> 0025 0026 #include "Region.h" 0027 0028 #include "sheets_odf_export.h" 0029 0030 class QAbstractItemModel; 0031 0032 namespace Calligra 0033 { 0034 namespace Sheets 0035 { 0036 0037 /** 0038 * Abstracts read-only access to the ValueStorage. 0039 * Useful for KoChart (or other apps, that want read-only access to Calligra Sheets' data). 0040 * 0041 * If a cell in the region is updated, the BindingManager informs this Binding, which 0042 * in turn informs the model it holds. 0043 */ 0044 class CALLIGRA_SHEETS_ODF_EXPORT Binding 0045 { 0046 public: 0047 Binding(); 0048 explicit Binding(const Region& region); 0049 Binding(const Binding& other); 0050 ~Binding(); 0051 0052 bool isEmpty() const; 0053 0054 QAbstractItemModel* model() const; 0055 0056 const Region& region() const; 0057 void setRegion(const Region& region); 0058 0059 void update(const Region& region); 0060 0061 void operator=(const Binding& other); 0062 bool operator==(const Binding& other) const; 0063 bool operator<(const Binding& other) const; 0064 0065 private: 0066 class Private; 0067 QExplicitlySharedDataPointer<Private> d; 0068 }; 0069 0070 } // namespace Sheets 0071 } // namespace Calligra 0072 0073 Q_DECLARE_METATYPE(Calligra::Sheets::Binding) 0074 Q_DECLARE_TYPEINFO(Calligra::Sheets::Binding, Q_MOVABLE_TYPE); 0075 0076 #endif // CALLIGRA_SHEETS_BINDING