kspread
kspread_types.h
00001 /* 00002 KSpread's code is IMO often hard to read. The cause of this is that there 00003 is no clear distinction between coordinates on the screen and coordinates 00004 in a sheet. Therefore I want to propose to define our own types to refer to 00005 coordinates on the sheet. 00006 This is a quick draft of how it could look like. It is definitely not complete. 00007 So feel free to change it and add comments. The types are very straightforward, 00008 so I think no further comments are needed yet. -- Wilco -- 00009 */ 00010 00011 namespace KSpread 00012 { 00013 00014 typedef Column unsigned long int; 00015 typedef Row unsigned long int; 00016 00017 00018 class Coordinate 00019 { 00020 public: 00021 Coordinate( Row, Column ); 00022 00023 Row row() const { return m_iRow; } 00024 Column column() const { return m_iColumn; } 00025 00026 private: 00027 Row m_iRow; 00028 Column m_iColumn; 00029 }; 00030 00031 00032 class Selection 00033 { 00034 public: 00035 Selection( Coordinate, Coordinate ); 00036 00037 Coordinate begin() const { return m_crdBegin; } 00038 Coordinate end() const { return m_crdEnd; } 00039 00040 private: 00041 Coordinate m_crdBegin; 00042 Coordinate m_crdEnd; 00043 }; 00044 00045 } // namespace KSpread