]> err.no Git - sope/blob - sope-appserver/WEExtensions/WETableCalcMatrix.h
milli => micro
[sope] / sope-appserver / WEExtensions / WETableCalcMatrix.h
1 /*
2   Copyright (C) 2000-2004 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #ifndef __WETableCalcMatrix_H__
24 #define __WETableCalcMatrix_H__
25
26 #import <Foundation/NSObject.h>
27 #import <Foundation/NSMapTable.h>
28 #import <Foundation/NSRange.h>
29
30 @class NSArray;
31
32 /*
33   Object to calculate HTML Table based charts, eg the
34   Appointment week-overview.
35 */
36
37 @interface WETableCalcMatrixSpan : NSObject
38 {
39   id      object;
40   NSRange range;
41 }
42
43 + (id)spanWithObject:(id)_obj range:(NSRange *)_range;
44 - (id)initWithObject:(id)_obj range:(NSRange *)_range;
45
46 /* accessors */
47
48 - (id)object;
49 - (NSRange)range;
50
51 /* calculates accessors */
52
53 - (BOOL)startsAtIndex:(unsigned)_idx;
54 - (BOOL)occupiesIndex:(unsigned)_idx;
55 - (unsigned)size;
56
57 @end
58
59 @interface WETableCalcMatrix : NSObject
60 {
61   void           *matrix;
62   unsigned short width;
63   unsigned short height;
64   NSMapTable     *objToPos;
65   id             delegate;  /* non-retained */
66   BOOL           columnCheck;
67   BOOL           rowCheck;
68 }
69
70 - (id)initWithSize:(unsigned)_width:(unsigned)_height;
71
72 /* static accessors */
73
74 - (unsigned)width;
75 - (unsigned)height;
76
77 - (void)setDelegate:(id)_delegate;
78 - (id)delegate;
79
80 /* clearing the structure */
81
82 - (void)removeAllObjects;
83
84 /* adding objects */
85
86 - (void)placeObjects:(NSArray *)_objects;
87 - (void)placeObject:(id)_object;
88
89 /* calculating */
90
91 - (NSArray *)objectsInColumn:(unsigned)_x;
92 - (NSArray *)objectsInRow:(unsigned)_y;
93 - (NSArray *)spansOfColumn:(unsigned)_x;
94 - (NSArray *)spansOfRow:(unsigned)_y;
95 - (NSArray *)columnSpans;
96 - (NSArray *)rowSpans;
97
98 @end
99
100 @interface NSObject(WETableCalcMatrixDelegate)
101
102 /* method for optimizing matrix scan (not required) */
103
104 - (BOOL)tableCalcMatrix:(WETableCalcMatrix *)_matrix
105   shouldProcessColumn:(unsigned)_x
106   forObject:(id)_object;
107 - (BOOL)tableCalcMatrix:(WETableCalcMatrix *)_matrix
108   shouldProcessRow:(unsigned)_y
109   forObject:(id)_object;
110
111 /* shall the object be placed at the specified coordinate ? */
112
113 - (BOOL)tableCalcMatrix:(WETableCalcMatrix *)_matrix
114   shouldPlaceObject:(id)_object
115   atPosition:(unsigned)_x:(unsigned)_y;
116
117 /* define if you want to create own span objects */
118
119 - (id)tableCalcMatrix:(WETableCalcMatrix *)_matrix
120   spanForObject:(id)_object
121   range:(NSRange)_range;
122
123 @end
124
125 #endif /* __WETableCalcMatrix_H__ */