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

0001 /* This file is part of the KDE project
0002    Copyright 2006 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_TABLE_SHAPE
0021 #define CALLIGRA_SHEETS_TABLE_SHAPE
0022 
0023 #include <QObject>
0024 
0025 #include <KoShape.h>
0026 
0027 #define TableShapeId "TableShape"
0028 
0029 namespace Calligra
0030 {
0031 namespace Sheets
0032 {
0033 class Damage;
0034 class Map;
0035 class Sheet;
0036 class SheetView;
0037 
0038 class TableShape : public QObject, public KoShape
0039 {
0040     Q_OBJECT
0041 
0042 public:
0043     explicit TableShape(int columns = 2, int rows = 8);
0044     virtual ~TableShape();
0045 
0046     int columns() const;
0047     int rows() const;
0048     void setColumns(int columns);
0049     void setRows(int rows);
0050 
0051     // KoShape interface
0052     virtual void paint(QPainter& painter, const KoViewConverter& converter, KoShapePaintingContext &paintcontext);
0053     virtual bool loadOdf(const KoXmlElement & element, KoShapeLoadingContext &context);
0054     virtual void saveOdf(KoShapeSavingContext & context) const;
0055     virtual void setSize(const QSizeF &size);
0056 
0057     /**
0058      * \return the map containing the data for this shape
0059      */
0060     Map* map() const;
0061     void setMap(Map *map);
0062 
0063     /**
0064      * \return the sheet containing the data for this shape
0065      */
0066     Sheet* sheet() const;
0067 
0068     SheetView* sheetView() const;
0069 
0070     /**
0071      * Set the current sheet to the sheet with name \p sheetName .
0072      */
0073     void setSheet(const QString& sheetName);
0074 
0075     void setVisibleCellRange(const QRect& cellRange);
0076 
0077 protected:
0078     virtual void shapeChanged(ChangeType type, KoShape *shape = 0);
0079 
0080 private Q_SLOTS:
0081     void handleDamages(const QList<Damage*>& damages);
0082 
0083 private:
0084     Q_DISABLE_COPY(TableShape)
0085 
0086     class Private;
0087     Private * const d;
0088 };
0089 
0090 } // namespace Sheets
0091 } // namespace Calligra
0092 
0093 #endif // CALLIGRA_SHEETS_TABLE_SHAPE