OOFILE  1.9
oofadorn.h
Go to the documentation of this file.
1 #ifndef H_OOFADORN
2 #define H_OOFADORN
3 // ===========================================================================
4 // oofadorn.h 1996 A.D. Software All rights reserved.
5 // ===========================================================================
6 //
7 
8 #ifndef H_OOF2
9  #include "oof2.h"
10 #endif
11 #ifndef H_OOFXMLDB
12  #include "oofxmldb.h" // need to know oofSerializable
13 #endif
14 
15 #ifndef _H_OOFREPFWD
16  #include "oofrepFwd.h"
17 #endif
18 
33 
34 public:
35  enum AdornerContextCode {drawBefore, drawAfter, drawDuring};
36  enum AdornerCellCode {startStop, startContinue, continueStop, continueContinue};
37 
38  oofAdorner();
39  oofAdorner(const oofAdorner&);
40  virtual ~oofAdorner();
41  virtual oofAdorner* clone() const=0;
42 
43  AdornerContextCode drawWhen() { return mWhenCode; };
44  virtual void draw( oofRepDrawable *drawable, unsigned long height, unsigned long width );
45  virtual void drawcell( int x, int y, OOF_mixColumnarBand *drawable, unsigned long height, unsigned long width, AdornerCellCode overrunCode=startStop );
46 
47  // multi-method dispatch to factories for rendering report objects
48  // ****** one for each environment *****
49  // Note: don't use pure virtuals as some subclasses may not implement
50  virtual void makeRender(const oofRepMacEnv&);
51  virtual void makeRender(const oofRepWinEnv&);
52  virtual void makeRender(const oofRepTextEnv&);
53  virtual void makeRender(const oofRepRTFEnv&);
54  virtual void makeRender(const oofRepHTMLEnv&);
55  virtual void makeRender(const oofRepCSVEnv&);
56  virtual void makeRender(const oofRepTSVEnv&);
57  virtual void makeRender(const oofRepXMLEnv&);
58 
59 protected:
60  enum AdornerContextCode mWhenCode;
62 };
63 
64 
71 public:
74  const oofAdornerList& operator=(const oofAdornerList&);
75  void adopt(oofAdornerList&);
76  ~oofAdornerList();
77  oofAdornerList* clone();
78 
79 
80  void start();
81  bool more() const;
82  void next();
83  unsigned long count() const;
84  oofAdorner* operator()();
85  oofAdorner* current();
86  oofAdorner* value(unsigned long) const;
87  void append(oofAdorner* adoptedAdorner);
88  oofAdornerList& operator<<(oofAdorner* adoptedAdorner);
89 
90 private:
91 // data storage
92  OOF_ExpandableLongArray mAdorners;
93 };
94 
95 
96 // ----------------------------------------------------------------
97 
103 public:
104 // uses default copy ctor
105  virtual ~OOF_mixAdornable() {}
106  oofAdornerList& adorners();
107 
108  bool hasAdorners() const;
109 
110 private:
111  oofAdornerList mAdorners;
112 };
113 
114 
115 // ----------------------------------------------------------------
116 //
117 
123 public:
124  virtual oofAdornerRender* clone(const oofAdorner* newOwner) const=0;
125  virtual void draw( oofRepDrawable *drawable, unsigned long height, unsigned long width ) = 0;
126  virtual void drawcell( int x, int y, OOF_mixColumnarBand* drawable, unsigned long height, unsigned long width, oofAdorner::AdornerCellCode overrunCode=oofAdorner::startStop );
127  virtual void finishConstruction() {};
128 };
129 
130 
131 // ----------------------------------------------------------------
132 // B o r d e r A d o r n e r
133 
141 public:
142  enum BorderCode {oneThin, twoThin, threeThin, oneThinOneThick, oneThickoneThin, oneThinOneThickOneThin};
143 
144  oofBorderAdorner( BorderCode borderType , oofAdorner::AdornerContextCode whenCode = oofAdorner::drawBefore );
146 // use default copy ctor
147  virtual ~oofBorderAdorner() {};
148  virtual oofAdorner* clone() const;
149 
150  BorderCode borderType() const { return mBorderType; };
151  void borderType(BorderCode inType) { mBorderType=inType; };
152 
153  // Access functions for border edges
154  void leftStyle( oofBorderAdorner::BorderCode inBorderType ) { mLeftStyle = inBorderType; };
155  oofBorderAdorner::BorderCode leftStyle() { return mLeftStyle; };
156 
157  void rightStyle( oofBorderAdorner::BorderCode inBorderType ) { mRightStyle = inBorderType; };
158  oofBorderAdorner::BorderCode rightStyle() { return mRightStyle; };
159 
160  void topStyle( oofBorderAdorner::BorderCode inBorderType ) { mTopStyle = inBorderType; };
161  oofBorderAdorner::BorderCode topStyle() { return mTopStyle; };
162 
163  void bottomStyle( oofBorderAdorner::BorderCode inBorderType ) { mBottomStyle = inBorderType; };
164  oofBorderAdorner::BorderCode bottomStyle() { return mBottomStyle; };
165 
166 // multi-method dispatch to factories for rendering report objects
167  virtual void makeRender(const oofRepMacEnv&);
168  virtual void makeRender(const oofRepWinEnv&);
169  virtual void makeRender(const oofRepTextEnv&);
170  virtual void makeRender(const oofRepRTFEnv&);
171  virtual void makeRender(const oofRepHTMLEnv&);
172  virtual void makeRender(const oofRepCSVEnv&);
173  virtual void makeRender(const oofRepTSVEnv&);
174  virtual void makeRender(const oofRepXMLEnv&);
175 
176 // serialization methods
177  static void registerSerializable();
178  static oofSerializable* makeAdorner (const oofString&);
179  virtual oofString serialize() const ;
180  virtual oofString signature() const;
181 
182 private:
183 // data storage
184  BorderCode mBorderType;
185 
186  BorderCode mLeftStyle;
187  BorderCode mRightStyle;
188  BorderCode mTopStyle;
189  BorderCode mBottomStyle;
190 };
191 
197 protected:
199 
200 // data storage
201  oofBorderAdorner* mOwner;
202 friend class oofBorderAdorner; // owner and creator class
203 };
204 
205 
207 
208 // ----------------------------------------------------------------
209 // S h a d i n g A d o r n e r
210 
218 public:
219  oofShadingAdorner( unsigned short percentage, oofAdorner::AdornerContextCode whenCode = oofAdorner::drawBefore );
221 // use default copy ctor
222  virtual ~oofShadingAdorner() {};
223  virtual oofAdorner* clone() const;
224 
225  //unsigned short percentage( void ) const { return mPercentage; }; // 0 - white , 100 - black
226  unsigned short red( void ) const { return mRed; };
227  unsigned short green( void ) const { return mGreen; };
228  unsigned short blue( void ) const { return mBlue; };
229 
230 // multi-method dispatch to factories for rendering report objects
231  virtual void makeRender(const oofRepMacEnv&);
232  virtual void makeRender(const oofRepWinEnv&);
233  virtual void makeRender(const oofRepTextEnv&);
234  virtual void makeRender(const oofRepRTFEnv&);
235  virtual void makeRender(const oofRepHTMLEnv&);
236  virtual void makeRender(const oofRepCSVEnv&);
237  virtual void makeRender(const oofRepTSVEnv&);
238  virtual void makeRender(const oofRepXMLEnv&); //dg 22/2/99
239 
240 // serialization methods
241  static void registerSerializable();
242  static oofSerializable* makeAdorner (const oofString&);
243  virtual oofString serialize() const;
244  virtual oofString signature() const;
245 
246 protected:
247  unsigned short mRed, mGreen, mBlue;
248  // more junior programmer crap - why didn't he use oofColor?
249 };
250 
256 protected:
258 
259 // data storage
260  oofShadingAdorner* mOwner;
261 friend class oofShadingAdorner; // owner and creator class
262 };
263 
264 
266 
267 // ----------------------------------------------------------------
268 // B a n d S h a d i n g A d o r n e r
269 
276 public:
277  oofBandShadingAdorner( unsigned short percentage, oofAdorner::AdornerContextCode whenCode = oofAdorner::drawBefore );
279 // use default copy ctor
281  virtual oofAdorner* clone() const;
282 
283  unsigned short percentage() const { return mPercentage; };
284 
285 // multi-method dispatch to factories for rendering report objects
286  virtual void makeRender(const oofRepMacEnv&);
287  virtual void makeRender(const oofRepWinEnv&);
288  virtual void makeRender(const oofRepTextEnv&);
289  virtual void makeRender(const oofRepRTFEnv&);
290  virtual void makeRender(const oofRepHTMLEnv&);
291  virtual void makeRender(const oofRepCSVEnv&);
292  virtual void makeRender(const oofRepTSVEnv&);
293  virtual void makeRender(const oofRepXMLEnv&);//dg 22/2/99
294 
295 // serialization methods
296  static void registerSerializable();
297  static oofSerializable* makeAdorner (const oofString&);
298  virtual oofString serialize() const;
299  virtual oofString signature() const;
300 
301 private:
302  unsigned short mPercentage; // 0 - white , 100 - black
303 };
304 
305 
311 protected:
313 
314 // data storage
315  oofBandShadingAdorner* mOwner;
316 friend class oofBandShadingAdorner; // owner and creator class
317 };
318 
319 
327 public:
328  OOF_adornerHolder(const oofString& id, oofAdorner* firstAdorner=0);
329 
330  virtual oofString name() const;
331  oofAdornerList& adorners();
332 
333 private:
334  const oofString mID;
335  oofAdornerList mAdorners;
336 };
337 
338 
339 // -------------------------------------------------------
340 // O O F _ a d o r n e r H o l d e r
341 // -------------------------------------------------------
342 inline oofAdornerList&
344 {
345  return mAdorners;
346 }
347 
348 
349 
350 // -------------------------------------------------------
351 // O O F _ m i x A d o r n a b l e
352 // -------------------------------------------------------
353 inline oofAdornerList&
355 {
356  return mAdorners;
357 }
358 
359 
360 inline bool
362 {
363  return (mAdorners.count()>0);
364 }
365 
366 
367 // -------------------------------------------------------
368 // o o f A d o r n e r L i s t
369 // -------------------------------------------------------
370 inline void
372 {
373  mAdorners.start();
374 }
375 
376 
377 inline bool
379 {
380  return mAdorners.more();
381 }
382 
383 
384 inline void
386 {
387  mAdorners.next();
388 }
389 
390 
391 inline unsigned long
393 {
394  return mAdorners.count();
395 }
396 
397 
398 inline oofAdorner*
400 {
401  oofAdorner* ret = (oofAdorner*) mAdorners(); // safe downcast
402  return ret;
403 }
404 
405 
406 inline oofAdorner*
408 {
409  oofAdorner* ret = (oofAdorner*) mAdorners(); // safe downcast
410  return ret;
411 }
412 
413 
414 inline oofAdorner*
415 oofAdornerList::value(unsigned long index) const
416 {
417  oofAdorner* ret = (oofAdorner*) mAdorners.value(index); // safe downcast
418  return ret;
419 }
420 
421 
422 inline oofAdornerList&
424 {
425  append(adoptedAdorner);
426  return *this;
427 }
428 
429 #endif
virtual oofString serialize() const
Definition: oofxmldb.cpp:293
Mix in adorners with report objects (used mainly in oofrep.h).
Definition: oofadorn.h:102
void topStyle(oofBorderAdorner::BorderCode inBorderType)
Definition: oofadorn.h:160
Base for adorners specifying background shading for simple bands.
Definition: oofadorn.h:275
Specify output to simple spaced text stream.
Definition: oofrptxt.h:31
Abstract base for anything drawn on report.
Definition: oofrep.h:860
Convenient mixin if your band is rendered in columns with custom drawing.
Definition: oofrep.h:980
Base class for objects that can be serialised out to XML Serialisation allows you to have custom calc...
Definition: oofxmldb.h:28
Base for specifying Win32 GUI drawing environment.
Definition: oofrpWin.h:46
Base for adorners specifying background shading for simple bands.
Definition: oofadorn.h:255
oofShadingAdorner_Render(oofShadingAdorner *b)
Definition: oofadorn.h:257
unsigned long count() const
Definition: oofarray.h:126
oofAdornerList & adorners()
Definition: oofadorn.h:354
virtual ~oofShadingAdorner()
Definition: oofadorn.h:222
oofAdornerList & operator<<(oofAdorner *adoptedAdorner)
Definition: oofadorn.h:423
AdornerContextCode
Definition: oofadorn.h:35
void borderType(BorderCode inType)
Definition: oofadorn.h:151
virtual ~oofBandShadingAdorner()
Definition: oofadorn.h:280
List of adorners attached to report element.
Definition: oofadorn.h:70
void start()
Definition: oofadorn.h:371
Abstract base rendering engine for the adorner model.
Definition: oofadorn.h:122
bool hasAdorners() const
Definition: oofadorn.h:361
Specify output to HTML stream.
Definition: oofrpHTM.h:27
Forward declare common report-writer classes.
unsigned long count() const
Definition: oofadorn.h:392
virtual ~oofBorderAdorner()
Definition: oofadorn.h:147
oofBorderAdorner::BorderCode bottomStyle()
Definition: oofadorn.h:164
bool more() const
Definition: oofadorn.h:378
Abstract base for rendering oofBorderAdorner on specific oofRepEnvironment.
Definition: oofadorn.h:196
oofAdorner * value(unsigned long) const
Definition: oofadorn.h:415
oofBorderAdorner::BorderCode rightStyle()
Definition: oofadorn.h:158
BorderCode borderType() const
Definition: oofadorn.h:150
Base for specifying Macintosh GUI drawing environment.
Definition: oofrepMac.h:51
unsigned short mRed
Definition: oofadorn.h:247
unsigned short green(void) const
Definition: oofadorn.h:227
oofAdorner * operator()()
Definition: oofadorn.h:399
void append(oofAdorner *adoptedAdorner)
Definition: oofadorn.cpp:101
AdornerContextCode drawWhen()
Definition: oofadorn.h:43
unsigned short red(void) const
Definition: oofadorn.h:226
virtual void makeRender(const oofRepMacEnv &)
Definition: oofadorn.cpp:167
Base class used to refer to main OOFILE classes and provide base reflective API.
Definition: oof1.h:49
virtual ~OOF_mixAdornable()
Definition: oofadorn.h:105
void next()
Definition: oofadorn.h:385
Array of longs which expands automatically as you write to cells.
Definition: oofarray.h:21
virtual oofString name() const
Definition: oof1.cpp:349
oofAdornerRender * mRender
Definition: oofadorn.h:61
void leftStyle(oofBorderAdorner::BorderCode inBorderType)
Definition: oofadorn.h:154
Portable highly capable string class.
Definition: oofstr.h:101
virtual oofAdorner * clone() const =0
unsigned short percentage() const
Definition: oofadorn.h:283
AdornerCellCode
Definition: oofadorn.h:36
oofBorderAdorner::BorderCode leftStyle()
Definition: oofadorn.h:155
OOFILE_EXPORT std::ostream & operator<<(std::ostream &, OOF_IndexOptions)
Base for adorners specifying background shading for grids.
Definition: oofadorn.h:217
void rightStyle(oofBorderAdorner::BorderCode inBorderType)
Definition: oofadorn.h:157
virtual oofString signature() const =0
oofAdorner * current()
Definition: oofadorn.h:407
Base object to derive adorners from.
Definition: oofadorn.h:32
Specify output to XML stream.
Definition: oofrpXML.h:57
bool more() const
Definition: oofarray.h:147
virtual void finishConstruction()
Definition: oofadorn.h:127
void bottomStyle(oofBorderAdorner::BorderCode inBorderType)
Definition: oofadorn.h:163
Base for adorners specifying borders for grids.
Definition: oofadorn.h:140
Specify output to Comma-Separated-Values stream.
Definition: oofrpCSV.h:30
unsigned short blue(void) const
Definition: oofadorn.h:228
Specify output to Tab-Separated-Values stream.
Definition: oofrpTSV.h:31
Specify output to MS Word-compatible Rich Text stream.
Definition: oofrpRTF.h:31
Holding space for adorner when reading report.
Definition: oofadorn.h:326
Abstract base for rendering oofBandShadingAdorner on specific oofRepEnvironment.
Definition: oofadorn.h:310
oofAdornerList & adorners()
Definition: oofadorn.h:343
#define OOFREP_EXPORT
Prefix for report writer classes to enable optional DLL linking.
Definition: oof0.h:189
unsigned long value(unsigned long index) const
Definition: oofarray.cpp:243
oofBorderAdorner::BorderCode topStyle()
Definition: oofadorn.h:161