kspread
kspread_cluster.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef kspread_cluster_h
00021 #define kspread_cluster_h
00022
00023 #include "kspread_value.h"
00024
00025 #define KSPREAD_CLUSTER_LEVEL1 128
00026 #define KSPREAD_CLUSTER_LEVEL2 256
00027 #define KSPREAD_CLUSTER_MAX (128*256)
00028
00029 class QPoint;
00030
00031 namespace KSpread
00032 {
00033 class Cell;
00034 class ColumnFormat;
00035 class RowFormat;
00036
00072 class Cluster
00073 {
00074 public:
00075 Cluster();
00076 ~Cluster();
00077
00078 Cell* lookup( int x, int y ) const;
00079
00084 void clear();
00085
00090 void insert( Cell* cell, int x, int y );
00094 void remove( int x, int y );
00095
00096 void setAutoDelete( bool );
00097 bool autoDelete() const;
00098
00099 Cell* firstCell() const;
00100
00101 bool shiftRow( const QPoint& marker );
00109 bool shiftColumn( const QPoint& marker );
00110
00115 void unshiftColumn( const QPoint& marker );
00116 void unshiftRow( const QPoint& marker );
00117
00125 bool insertColumn( int col );
00126 bool insertRow( int row );
00127
00135 void removeColumn( int col );
00136 void removeRow( int row );
00137
00142 void clearColumn( int col );
00143 void clearRow( int row );
00144
00149 Value valueRange (int col1, int row1, int col2, int row2) const;
00150
00160 Cell* getFirstCellColumn(int col) const;
00161
00171 Cell* getLastCellColumn(int col) const;
00172
00182 Cell* getFirstCellRow(int row) const;
00183
00193 Cell* getLastCellRow(int row) const;
00194
00204 Cell* getNextCellUp(int col, int row) const;
00205
00215 Cell* getNextCellDown(int col, int row) const;
00216
00227 Cell* getNextCellRight(int col, int row) const;
00228
00239 Cell* getNextCellLeft(int col, int row) const;
00240
00241 private:
00246 bool shiftRow( const QPoint& marker, bool& work );
00247 bool shiftColumn( const QPoint& marker, bool& work );
00248
00249 void unshiftColumn( const QPoint& marker, bool& work );
00250 void unshiftRow( const QPoint& marker, bool& work );
00251
00253 Value makeArray (int col1, int row1, int col2, int row2) const;
00254
00255 Cell*** m_cluster;
00256 Cell* m_first;
00257 bool m_autoDelete;
00258 int m_biggestX, m_biggestY;
00259 };
00260
00261 class ColumnCluster
00262 {
00263 public:
00264 ColumnCluster();
00265 ~ColumnCluster();
00266
00267 const ColumnFormat* lookup( int col ) const;
00268 ColumnFormat* lookup( int col );
00269
00270 void clear();
00271
00272 void insertElement( ColumnFormat*, int col );
00273 void removeElement( int col );
00274
00275 bool insertColumn( int col );
00276 bool removeColumn( int col );
00277
00278 void setAutoDelete( bool );
00279 bool autoDelete() const;
00280
00281 ColumnFormat* first()const { return m_first; }
00282
00283 private:
00284 ColumnFormat*** m_cluster;
00285 ColumnFormat* m_first;
00286 bool m_autoDelete;
00287 };
00288
00289 class RowCluster
00290 {
00291 public:
00292 RowCluster();
00293 ~RowCluster();
00294
00295 const RowFormat* lookup( int col ) const;
00296 RowFormat* lookup( int col );
00297
00298 void clear();
00299
00300 void insertElement( RowFormat*, int row );
00301 void removeElement( int row );
00302
00303 bool insertRow( int row );
00304 bool removeRow( int row );
00305
00306 void setAutoDelete( bool );
00307 bool autoDelete() const;
00308
00309 RowFormat* first()const { return m_first; }
00310
00311 private:
00312 RowFormat*** m_cluster;
00313 RowFormat* m_first;
00314 bool m_autoDelete;
00315 };
00316
00317 }
00318
00319 #endif
|