KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.0KB

  1. /*
  2. KSpread's code is IMO often hard to read. The cause of this is that there
  3. is no clear distinction between coordinates on the screen and coordinates
  4. in a sheet. Therefore I want to propose to define our own types to refer to
  5. coordinates on the sheet.
  6. This is a quick draft of how it could look like. It is definitely not complete.
  7. So feel free to change it and add comments. The types are very straightforward,
  8. so I think no further comments are needed yet. -- Wilco --
  9. */
  10. namespace KSpread
  11. {
  12. typedef Column unsigned long int;
  13. typedef Row unsigned long int;
  14. class Coordinate
  15. {
  16. public:
  17. Coordinate( Row, Column );
  18. Row row() const { return m_iRow; }
  19. Column column() const { return m_iColumn; }
  20. private:
  21. Row m_iRow;
  22. Column m_iColumn;
  23. };
  24. class Selection
  25. {
  26. public:
  27. Selection( Coordinate, Coordinate );
  28. Coordinate begin() const { return m_crdBegin; }
  29. Coordinate end() const { return m_crdEnd; }
  30. private:
  31. Coordinate m_crdBegin;
  32. Coordinate m_crdEnd;
  33. };
  34. } // namespace KSpread