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.

85 lines
2.3KB

  1. /* This file is part of the KDE project
  2. Copyright 2004 Tomas Mecir <mecirt@gmail.com>
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public
  5. License as published by the Free Software Foundation; either
  6. version 2 of the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public License
  12. along with this library; see the file COPYING.LIB. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  14. * Boston, MA 02110-1301, USA.
  15. */
  16. #ifndef KSPREAD_DEPENDENCIES
  17. #define KSPREAD_DEPENDENCIES
  18. #include <tqvaluelist.h>
  19. #include "kspread_util.h"
  20. namespace KSpread
  21. {
  22. class Sheet;
  23. struct DependencyList;
  24. /** Range dependency - stores information about one dependency of one cell on
  25. one range of cells. */
  26. struct RangeDependency {
  27. int cellrow, cellcolumn;
  28. Sheet *cellsheet;
  29. Range range;
  30. };
  31. /**
  32. This class manages dependencies.
  33. No need to inherit from DocBase here, at least not yet.
  34. TODO: describe how it works and why there are two types of dependencies
  35. */
  36. class DependencyManager {
  37. public:
  38. /** constructor */
  39. DependencyManager (Sheet *s);
  40. /** destructor */
  41. ~DependencyManager ();
  42. /** clear all data */
  43. void reset ();
  44. /** handle the fact that cell's contents have changed */
  45. void cellChanged (const Point &cell);
  46. /** handle the fact that a range has been changed */
  47. void rangeChanged (const Range &range);
  48. /** handle the fact that a range list has been changed */
  49. void rangeListChanged (const RangeList &rangeList);
  50. /** a named area was somehow modified */
  51. void areaModified (const TQString &name);
  52. /** get dependencies of a cell */
  53. RangeList getDependencies (const Point &cell);
  54. /** get cells depending on this cell, either through normal or range dependency */
  55. TQValueList<Point> getDependants (const Point &cell);
  56. protected:
  57. /** local d-pointer */
  58. DependencyList *deps;
  59. friend class DependencyList;
  60. };
  61. //end of namespace
  62. }
  63. #endif // KSPREAD_DEPENDENCIES