OOFILE  1.9
oofrep2.cpp
Go to the documentation of this file.
1 // COPYRIGHT 1996 A.D. Software, All rights reserved
2 
3 // report-writer layer of OOFILE database
4 // drawing code (Mac GUI only initially)
5 
6 #include "oofpch_r.h" // for precompilation of report files
7 
8 #ifndef H_OOF3
9  #include "oof3.h"
10 #endif
11 #ifndef H_OOFREP
12  #include "oofrep.h"
13 #endif
14 #ifndef H_OOFSIZE
15  #include "oofsize.h"
16 #endif
17 #include <string.h>
18 #ifndef H_OOFGRPHS
19  #include "oofGrphs.h"
20 #endif
21 #ifndef H_OOFIOS
22  #include "oofios.h"
23 #endif
24 #ifndef H_OOFREPREND
25  #include "oofreprn.h" // abstract renderers
26 #endif
27 #ifndef H_OOFFILES
28  #include "ooffiles.h"
29 #endif
30 
31 #ifdef _Macintosh
32  #ifndef OOF_REP_NO_GUI
33 
34  #ifdef __PowerPlant__
35  #ifndef _H_UStandardFile
36  #include <UStandardFile.h> // want UDesktop PowerPlant 'out' to let us call standard file
37  #endif
38  #endif
39  #if defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON!=0
40  #ifndef __NAVIGATION__
41  #include <Navigation.h>
42  #endif
43  #else
44  #ifndef __STANDARDFILE__
45  #include <StandardFile.h>
46  #endif
47  #endif
48  #ifndef _H_UDesktop
49  #include <UDesktop.h>
50  #endif
51  #endif
52 #endif
53 
54 #ifdef OOF_MEM_DEBUG_LAST_INCLUDE
55  #include OOF_MEM_DEBUG_LAST_INCLUDE
56 #endif
57 
58 #ifndef OOF_NO_STDLIB
59  #ifndef std
60  using namespace std;
61  #endif
62 #endif
63 
64 ostream* oofRepStreamEnv::sOut = 0;
65 oofRepPage* oofRepPage::sCurrentPage=0;
66 
67 // -------------------------------------------------------
68 // O O F _ m i x B a n d W i t h T a b l e W r a p p e r s
69 // -------------------------------------------------------
70 void
72 {
73 }
74 
75 
76 void
78 {
79 }
80 
81 
82 void
84 {
85 }
86 
87 
88 void
90 {
91 }
92 
93 
94 // -------------------------------------------------------
95 // o o f R e p I t e r a b l e T r e e B a n d
96 // -------------------------------------------------------
98  mMaxIterations(1),
99  mCurrentIteration(inMaxIterations+1)
100 {
101 }
102 
103 
106 {
107  return this;
108 }
109 
110 
113 {
114  return this;
115 }
116 
117 
118 bool
120 {
121  return true;
122 }
123 
124 
125 void
127 {
128  mCurrentIteration = 0;
129 }
130 
131 
132 bool
134 {
136 }
137 
138 
139 void
141 {
143 }
144 
145 
146 // -------------------------------------------------------
147 // O O F _ m i x C o lu m n a r B a n d
148 // -------------------------------------------------------
150  mNonEditableFields(0)
151 {}
152 
153 
155 {
156  delete[] mNonEditableFields;
157 }
158 
159 
161  mNonEditableFields(0) // copied below
162 {
163  if (rhs.mNonEditableFields) {
164  const unsigned long numFlags = rhs.numCols();
165  mNonEditableFields = new bool[numFlags];
166  ::memcpy(mNonEditableFields, rhs.mNonEditableFields, numFlags*sizeof(bool));
167  }
168 }
169 
170 
172 OOF_mixColumnarBand::customDrawer(unsigned short zeroBasedCol)
173 {
175  if (zeroBasedCol>=mCustomDrawers.count())
176  ret = 0;
177  else
178  ret = (oofRepCustomViewDrawer*) mCustomDrawers.value(zeroBasedCol); // safe downcast
179  return ret;
180 }
181 
182 
183 void
184 OOF_mixColumnarBand::customDrawer(unsigned short zeroBasedCol, oofRepCustomViewDrawer* adoptedDrawer)
185 {
186  mCustomDrawers[zeroBasedCol] = adoptedDrawer;
187 }
188 
189 
190 void
192 {
193  if (!mNonEditableFields) {
194  const unsigned long numFlags = numCols();
195  mNonEditableFields = new bool[numFlags];
196  ::memset(mNonEditableFields, 0, numFlags*sizeof(bool));
197  }
198  mNonEditableFields[col] = true;
199 }
200 
201 
202 
203 // -------------------------------------------------------
204 // o o f R e p V i e w B a n d
205 // -------------------------------------------------------
206 
207 oofRepViewBand::oofRepViewBand(const dbView& view, bool isBoxed) :
208  mView(new dbView(view)), // copy ctor, so people can use temp objects in calling us
209  mIsBoxed(isBoxed),
210  mTableExtraRender(0),
211  mColHeadersNeedCalc(true)
212 {
213  FinishConstruction();
214 }
215 
216 
223 oofRepViewBand::oofRepViewBand(dbView* adoptedView, bool isBoxed) :
224  mView(adoptedView),
225  mIsBoxed(isBoxed),
226  mTableExtraRender(0),
227  mColHeadersNeedCalc(true)
228 {
229  if (!adoptedView)
230  mView = new dbView;
231  FinishConstruction();
232 }
233 
234 
235 void
236 oofRepViewBand::FinishConstruction()
237 {
238  if( mIsBoxed ) {
240  }
242  const unsigned int numCols = mView->count();
243  for (unsigned int i=0; i<numCols; i++)
244  mCustomDrawers[i] = 0;
245 }
246 
247 
249  mView(new dbView(*rhs.mView)),
250  mIsBoxed(rhs.mIsBoxed),
251 // mHeight(rhs.mHeight),
252  mColHeadersNeedCalc(true)
253 {
254  mTableExtraRender = rhs.mTableExtraRender->finishClone(mRender); // call virtual fix!
255 }
256 
257 
259 {
260  delete mView;
261 }
262 
263 
264 oofRepBand*
266 {
267  return new oofRepViewBand(*this);
268 }
269 
270 
271 dbView*
272 oofRepViewBand::view(unsigned short whichView) const
273 {
274  if (whichView==0)
275  return mView;
276  else
277  return NULL;
278 }
279 
280 
281 void
283 {
284  if (mView && mView->table())
285  mView->table()->start();
286  else
288 }
289 
290 
291 bool
293 {
294  if (mView && mView->table())
295  return mView->table()->more();
296  else
298 }
299 
300 
301 void
303 {
304  if (mView && mView->table())
305  mView->table()->next();
306  else
308 }
309 
310 
313 {
314  return this;
315 }
316 
317 
320 {
321  return this;
322 }
323 
324 #ifndef OOF_REP_NO_GUI
327 {
328  return NULL;
329 }
330 #endif
331 
332 void
334 {
335  assert(mRender);
336  mRender->draw();
337 }
338 
339 void
341 {
342 // central default call for drawing, but still able to be overriden in extreme
343 // cases. Now that all is factored out to the render objects (Strategy pattern)
344 // we shouldn't need to do anything.
345  assert(mTableExtraRender);
346  mTableExtraRender->drawColumnHeaders();
347 }
348 
349 
350 void
352 {
353  assert(mTableExtraRender);
354  mTableExtraRender->startTableBody(mColHeadersNeedCalc);
355  mColHeadersNeedCalc = false;
356 }
357 
358 
359 void
361 {
362  assert(mTableExtraRender);
363  mTableExtraRender->endTableBody();
364 }
365 
366 
367 void
369 {
370  assert(mTableExtraRender);
371  mTableExtraRender->startTableWrapper();
372 }
373 
374 
375 void
377 {
378  assert(mTableExtraRender);
379  mTableExtraRender->endTableWrapper();
380 }
381 
382 
383 int
385 {
386  if (mView)
387  return mView->count();
388  else
389  return 0;
390 }
391 
392 
393 bool
394 oofRepViewBand::lastRow( unsigned long row )
395 {
396  dbTable* viewTable = view()->table(); // OK to be zero!!!!!!
397  if (!viewTable)
398  return true;
399  if( row == (viewTable->count()-1) )
400  return true;
401  else
402  return false;
403 }
404 
405 bool
406 oofRepViewBand::lastCol( unsigned long col )
407 {
408  if( col == (view()->count()-1) )
409  return true;
410  else
411  return false;
412 }
413 
414 
417 {
418  return this;
419 }
420 
421 
422 // -------------------------------------------------------
423 // o o f R e p V i e w B a n d _ R e n d e r
424 // -------------------------------------------------------
425 void
427 {
428  if (oofRep::currentReport()->shouldDrawViewColumnHeaders()) {
429  mDrawnColHeadersThisPage = false;
430  }
431  else
433  CalcColWidths();
434 }
435 
436 
437 
438 void
440 {
441  dbView* view = mOwner->view();
442  oofRep* curRep = oofRep::currentReport();
443  const oofRepSettings* currSettings = curRep->settings();
444  const unsigned short bandIndenting = currSettings->bandIndenting();
445  const short colSepWidth = currSettings->colSepWidth();
446 
447  curRep->changeTextStyle(mOwner->textStyle());
448  unsigned long widthToDivide = curRep->bodyWidth() - (2*bandIndenting);
449  if(mOwner->adorners().count()>0) // allow room assuming adorners do grid?
450  widthToDivide -= colSepWidth;
451 
452  view->colSizer()->calculateWidths(widthToDivide, colSepWidth);
453 }
454 
455 
458 {
459  return (oofRepViewBand_Render*)newClone; // safe downcast
460 }
461 
462 // -------------------------------------------------------
463 // o o f R e p E m p t y R o o t B a n d
464 // -------------------------------------------------------
465 
467  oofRepIterableTreeBand(inMaxIterations)
468 {
469 }
470 
471 
472 oofRepBand*
474 {
475  return new oofRepEmptyRootBand(*this);
476 }
477 
478 
479 void
481 {
482  assert(mRender);
483  mRender->draw();
484 }
485 
486 
487 void
489 {
490  delete mRender;
492 }
493 
494 
495 
496 // -------------------------------------------------------
497 // o o f R e p V i e w B a n d _ A n y R e n d e r
498 // -------------------------------------------------------
501 {
502  return new oofRepEmptyRootBand_AnyRender((oofRepEmptyRootBand*)newOwner); // safe downcast
503 }
504 
505 
506 void
507 oofRepEmptyRootBand_AnyRender::draw() // draws just current record
508 {
509 }
510 
511 
512 
513 // -------------------------------------------------------
514 // o o f R e p L a y o u t B a n d
515 // -------------------------------------------------------
516 
518  mCalcHeight(false),
519  mFixedHeight(0)
520 {
521 }
522 
523 
524 oofRepBand*
526 {
527  return new oofRepLayoutBand(*this);
528 }
529 
530 
531 bool
533 {
534  return true;
535 }
536 
537 
538 void
539 oofRepLayoutBand::BecomeCurrent()
540 {
541  sCurrentLayout = this;
542 }
543 
544 
545 void
547 {
548  BecomeCurrent();
550 }
551 
552 
553 unsigned long
555 {
556  BecomeCurrent(); // so style lookups work
557 
558  // Now the space needed by the band
559  if (!mCalcHeight) {
560  mFixedHeight = mBlocks.fixedHeight();
561  mCalcHeight = true;
562  }
563  return mFixedHeight;
564 }
565 
566 
569 {
570  oofRepFieldBlock* newBlock = new oofRepFieldBlock(&F);
571  mBlocks.append(newBlock);
572  return *this;
573 }
574 
575 
578 {
579  oofRepFieldBlock* newBlock = new oofRepFieldBlock(F);
580  mBlocks.append(newBlock);
581  return *this;
582 }
583 
584 
587 {
588  oofRepTextBlock* newBlock = new oofRepTextBlock(str);
589  mBlocks.append(newBlock);
590  return *this;
591 }
592 
593 
596 {
597  mBlocks.append(adoptedBlock);
598  return *this;
599 }
600 
601 
604 {
605  mBlocks.append(copiedBlock.clone());
606  return *this;
607 }
608 
609 
610 // -------------------------------------------------------
611 // o o f R e p S p a c e B a n d
612 // -------------------------------------------------------
613 
614 oofRepSpaceBand::oofRepSpaceBand(unsigned long heightInPoints) :
615  mHeight(heightInPoints)
616 {
617 }
618 
619 
620 oofRepBand*
622 {
623  return new oofRepSpaceBand(*this);
624 }
625 
626 
627 
628 // -------------------------------------------------------
629 // o o f R e p G r a p h B a n d
630 // -------------------------------------------------------
631 
632 oofRepGraphBand::oofRepGraphBand(oofGraph* inGraphPtr, unsigned long height,
633  unsigned long grHgt, unsigned long grWid, const char* inGraphTitle) :
634  mHeight(height),
635  mGraphPtr(inGraphPtr),
636  mGrHgt(grHgt),
637  mGrWid(grWid),
638  mMinSizePercent(kUseDefaultScalePercent),
639  mSavedGrHgt(grHgt),
640  mSavedGrWid(grWid)
641 {
642  AdjustGraphToBandHeight(height);
643 
644  oofRect theFrame(0,0,mGrWid,mGrHgt); // make sure to use member vars after Adjust...
645  inGraphPtr->setPaneRect(theFrame);
646  if (inGraphTitle)
647  inGraphPtr->setTitle(inGraphTitle);
648 }
649 
650 
652  mHeight(rhs.mHeight),
653  mGraphPtr(0),
654  mGrHgt(rhs.mGrHgt),
655  mGrWid(rhs.mGrWid),
656  mMinSizePercent(rhs.mMinSizePercent),
657  mSavedGrHgt(rhs.mSavedGrHgt),
658  mSavedGrWid(rhs.mSavedGrWid)
659 {
660  assert(rhs.mGraphPtr);
661  if (rhs.mGraphPtr)
662  mGraphPtr = rhs.mGraphPtr->clone();
663 }
664 
665 
667 {
668  delete mGraphPtr;
669 }
670 
671 
672 oofRepBand*
674 {
675  return new oofRepGraphBand(*this);
676 }
677 
678 
679 dbView*
680 oofRepGraphBand::view(unsigned short whichView) const
681 {
682  assert(mGraphPtr);
683  dbView* ret = 0;
684 
685  if (whichView==0)
686  ret = mGraphPtr->getView();
687  else if (whichView==1) {
688  OOF_mixOverlayableGraph* asOverlayable = dynamic_cast<OOF_mixOverlayableGraph*>(mGraphPtr);
689  if (asOverlayable)
690  ret = asOverlayable->getOverlayView();
691  }
692  return ret;
693 }
694 
695 
696 unsigned long
698 {
699  assert(mGraphPtr);
700  unsigned long ret = 0;
701 
702  OOF_mixOverlayableGraph* asOverlayable = dynamic_cast<OOF_mixOverlayableGraph*>(mGraphPtr);
703  if (asOverlayable)
704  ret = asOverlayable->getNumOverlaid();
705  return ret;
706 }
707 
708 
709 void
711 {
712  RestoreDimensions();
714 }
715 
716 
717 void
718 oofRepGraphBand::RestoreDimensions()
719 {
720  mDrawingHeight = mHeight;
721  mGrHgt = mSavedGrHgt;
722  mGrWid = mSavedGrWid;
723 }
724 
725 
726 void
727 oofRepGraphBand::graphHeight( unsigned long grHeight )
728 {
729  mSavedGrHgt = mGrHgt = grHeight;
730 }
731 
732 
733 void
734 oofRepGraphBand::graphWidth( unsigned long grWidth )
735 {
736  mSavedGrWid = mGrWid = grWidth;
737 }
738 
739 
740 void
741 oofRepGraphBand::drawSquished(long& balanceToSave)
742 {
743  RestoreDimensions(); // may be adjusted in AdjustGraphToBandHeight
744  const long availableReduction = mHeight-mMinHeight;
745 
746  long reducedToFit;
747 /*
748 we don't refuse to shrink any more - our caller makes that decision
749  if (availableReduction<balanceToSave) {
750  balanceToSave -= availableReduction;
751  reducedToFit = mMinHeight;
752  }
753  else
754 */
755  {
756  reducedToFit = mHeight - balanceToSave;
757  balanceToSave = 0; // this graph absorbed entire loss
758  }
759 // NOTE this is a pretty weak algorithm that assumes just one graph band
760 // in a keptTogether bandlist will shrink
761 
762  AdjustGraphToBandHeight(reducedToFit);
764 }
765 
766 
767 unsigned long
769 {
770  return mHeight;
771 }
772 
773 
774 unsigned long
776 {
777  return mMinHeight;
778 }
779 
780 
781 void
783 {
784  // need to ensure a font is set before graph sizes
786 
787 // work out min height BEFORE scaling mHeight to report body size
788  unsigned short minSizePercent;
789  if (mMinSizePercent==kUseDefaultScalePercent)
790  minSizePercent = oofRep::currentReport()->settings()->graphBandMinSizePercent();
791  else
792  minSizePercent = mMinSizePercent;
793 
794  assert(minSizePercent<=100);
795  if (minSizePercent<100)
796  mMinHeight = (mHeight*minSizePercent)/100;
797  else
798  mMinHeight = mHeight;
799 
800  const unsigned long bodyHeight = oofRep::currentReport()->bodyHeight();
801  AdjustGraphToBandHeight(bodyHeight); // guarantees will fit page
802 
803  mGraphPtr->finishConstructionWithPresets();
804  if (!mGraphPtr->drawStylesWereSet()) {
806  mGraphPtr->setDrawStyles(tempIter);
807  }
808 }
809 
810 
811 void
812 oofRepGraphBand::AdjustGraphToBandHeight(unsigned long inHeight)
813 {
814  if (mGrHgt>inHeight) {
815  mDrawingHeight = inHeight; // from some contexts, may also change band height
816  unsigned long reduceBy = mGrHgt - mDrawingHeight;
817 // mGrWid -= mGrWid * reduceBy / mGrHgt; // reduce width in proportion to height reduction
818  mGrHgt -= reduceBy;
819  }
820  else if (mDrawingHeight>inHeight)
821  mDrawingHeight = inHeight; // from some contexts, may also change band height
822  if (mMinHeight>mDrawingHeight)
823  mMinHeight = mDrawingHeight;
824 }
825 
826 
827 // -------------------------------------------------------
828 // o o f R e p L i n e B a n d
829 // -------------------------------------------------------
830 
831 oofRepLineBand::oofRepLineBand(unsigned long heightInPoints, bool isGrey ) :
832  mHeight(heightInPoints),
833  mGrey(isGrey)
834 {
835 }
836 
837 
838 oofRepBand*
840 {
841  return new oofRepLineBand(*this);
842 }
843 
844 
845 
846 // -------------------------------------------------------
847 // o o f R e p P i c t B a n d
848 // -------------------------------------------------------
849 
851  OOF_mixPictOwner(adoptedPict)
852 {}
853 
854 
855 oofRepBand*
857 {
858  return new oofRepPictBand(*this);
859 }
860 
861 
862 // -------------------------------------------------------
863 // o o f R e p T e x t B l o c k
864 // -------------------------------------------------------
865 oofRepTextBlock::oofRepTextBlock(const char* text, oofRepTextStyle* adoptedStyle) :
866  oofRepBlock(adoptedStyle),
867  mText(text)
868 {
869  CompleteInit();
870 }
871 
872 
874  oofRepBlock(copiedStyle.clone()),
875  mText(text)
876 {
877  CompleteInit();
878 }
879 
880 
882  oofRepBlock(adoptedStyle),
883  mText(text)
884 {
885  CompleteInit();
886 }
887 
888 
889 /*
890 oofRepTextBlock::oofRepTextBlock(ostream& os, oofRepTextStyle* S) :
891  oofRepBlock(S),
892  mText(os)
893 {
894  CompleteInit();
895 }
896 */
897 
898 void
899 oofRepTextBlock::CompleteInit()
900 {
901  if (mText.lastChar()=='\n') { // remove linefeeds - treat as flag to set moveDownAfter
902  mText.shorten(1);
903  moveDownAfter(true);
904  }
905 }
906 
909 {
910  return new oofRepTextBlock(*this);
911 }
912 
913 
914 oofString
916 {
917  return mText; // but our subclasses will construct their return string
918 }
919 
920 
921 unsigned int
923 {
924  return 1;
925 }
926 
927 
928 oofString
929 oofRepTextBlock::getCellText(bool* outIsEditable, oofString* outLocationName, long row, short col) const
930 {
931  assert(row==0);
932  assert(col==0);
933  if (outIsEditable)
934  *outIsEditable = true; // fixed text always editable
935 
936  if (outLocationName)
937  outLocationName->clear(); // we have no idea where we are!
938 
939  return mText;
940 }
941 
942 
943 void
944 oofRepTextBlock::setCellText(const oofString& inString, long row, short col)
945 {
946 
947  assert(row==0);
948  assert(col==0);
949  mText = inString;
950 }
951 
952 
953 // -------------------------------------------------------
954 // o o f R e p B r a c k e t e d T e x t B l o c k
955 // -------------------------------------------------------
956 oofRepBracketedTextBlock::oofRepBracketedTextBlock(const char* leadingText, const char* trailingText, oofRepTextStyle* adoptedStyle) :
957  oofRepTextBlock(leadingText, adoptedStyle), // leadingText becomes mText in our parent
958  mTrailingText(trailingText)
959 {
960 // NOTE our parent may have already set moveDownAfter due to the leading text having a
961 // trailing linefeed
962  if (mTrailingText.lastChar()=='\n') { // remove linefeeds - treat as flag to set moveDownAfter
964  moveDownAfter(true);
965  }
966 }
967 
968 
969 oofString
971 {
972 // virtual call for subclass to provide the middle!
974 }
975 
976 
977 
978 unsigned int
980 {
981  return 3; // even if no content in leading or trailing, user may want to insert
982 }
983 
984 
985 
986 // -------------------------------------------------------
987 // o o f R e p P i c t B l o c k
988 // -------------------------------------------------------
990  oofRepBlock(adoptedStyle),
991  OOF_mixPictOwner(adoptedPict)
992 {}
993 
994 
997 {
998  return new oofRepPictBlock(*this);
999 }
1000 
1001 
1002 unsigned long
1004 {
1005  unsigned long ret = OOF_mixPictOwner::height();
1006  if (mFixedWidth) { // scale the height to ratio of widths as user constrained
1007  const unsigned long actualWidth = OOF_mixPictOwner::width();
1008  if (mFixedWidth < actualWidth)
1009  ret = ret * mFixedWidth / actualWidth; // scale down
1010 // if pic smaller than specified width do NOT stretch up
1011  }
1012  return ret;
1013 }
1014 
1015 
1016 unsigned long
1018 {
1019  if (mFixedWidth)
1020  return mFixedWidth; // allows block to be constrained, rather than driven by picture
1021  else
1022  return OOF_mixPictOwner::width();
1023 }
1024 
1025 
1026 unsigned int
1028 {
1029  return 1;
1030 }
1031 
1032 
1033 oofString
1034 oofRepPictBlock::getCellText(bool* outIsEditable, oofString* outLocationName, long row, short col) const
1035 {
1036  assert(row==0);
1037  assert(col==0);
1038  if (outIsEditable)
1039  *outIsEditable = false;
1040 
1041  if (outLocationName)
1042  *outLocationName = "picture";
1043 
1044  return picture()->describe();
1045 }
1046 
1047 
1048 // -------------------------------------------------------
1049 // o o f R e p F i e l d B l o c k
1050 // -------------------------------------------------------
1052  oofRepBracketedTextBlock(0, 0, adoptedStyle),
1053  mField(F)
1054 {
1055 }
1056 
1057 
1059 {
1060  mField=0; // for Lint
1061 }
1062 
1064  oofRepBracketedTextBlock(leadingText, 0, adoptedStyle),
1065  mField(F)
1066 {}
1067 
1068 
1069 oofRepFieldBlock::oofRepFieldBlock(const oofString& leadingText, dbField* F, const oofString& trailingText, oofRepTextStyle* adoptedStyle) :
1070  oofRepBracketedTextBlock(leadingText, trailingText, adoptedStyle),
1071  mField(F)
1072 {}
1073 
1074 
1075 oofString
1077 {
1078  return oofString(mField->copyString());
1079 }
1080 
1081 
1082 oofRepBlock*
1084 {
1085  return new oofRepFieldBlock(*this);
1086 }
1087 
1088 
1089 oofString
1090 oofRepFieldBlock::getCellText(bool* outIsEditable, oofString* outLocationName, long row, short col) const
1091 {
1092  assert(row==0);
1093  assert(col<3);
1094 
1095  if (outIsEditable) {
1096  if (col==1)
1097  *outIsEditable = mField->fieldIsStandalone(); // don't let them edit fields on databases
1098  else
1099  *outIsEditable = true; // fixed text always editable
1100  }
1101 
1102  if (outLocationName)
1103  outLocationName->clear(); // we have no idea where we are!
1104 
1105  switch(col) {
1106  case 0 :
1107  return mText;
1108 
1109  case 1 :
1110  return mField->copyString();
1111 
1112  default :
1113  return mTrailingText;
1114  }
1115 }
1116 
1117 
1118 void
1119 oofRepFieldBlock::setCellText(const oofString& inString, long row, short col)
1120 {
1121  assert(row==0);
1122  assert(col<3);
1123 
1124  switch(col) {
1125  case 0 :
1126  mText = inString;
1127  break;
1128 
1129  case 1 :
1130  assert( mField->fieldIsStandalone() );
1131  mField->setString(inString);
1132  break;
1133 
1134  default :
1135  mTrailingText = inString;
1136  }
1137 }
1138 
1139 
1140 // -------------------------------------------------------
1141 // o o f R e p P a g e N o B l o c k
1142 // -------------------------------------------------------
1143 oofRepPageNoBlock::oofRepPageNoBlock(const char* leadingText, const char* trailingText, oofRepTextStyle* adoptedStyle) :
1144  oofRepBracketedTextBlock(leadingText, trailingText, adoptedStyle)
1145 {
1147 }
1148 
1149 
1151  oofRepBracketedTextBlock(leadingText, 0, adoptedStyle)
1152 {
1154 }
1155 
1156 
1157 oofRepPageNoBlock::oofRepPageNoBlock(const oofString& leadingText, const oofString& trailingText, oofRepTextStyle* adoptedStyle) :
1158  oofRepBracketedTextBlock(leadingText, trailingText, adoptedStyle)
1159 {
1161 }
1162 
1163 
1164 oofString
1166 {
1167  char pn[10];
1168  sprintf(pn,"%d",oofRep::currentReport()->pageNumber());
1169  return oofString(pn);
1170 }
1171 
1172 
1173 oofRepBlock*
1175 {
1176  return new oofRepPageNoBlock(*this);
1177 }
1178 
1179 
1180 oofString
1181 oofRepPageNoBlock::getCellText(bool* outIsEditable, oofString* outLocationName, long row, short col) const
1182 {
1183  assert(row==0);
1184  assert(col<3);
1185 
1186  if (outIsEditable)
1187  *outIsEditable = (col!=1); // fixed text always editable, but not page num!
1188 
1189  switch(col) {
1190  case 0 :
1191  if (outLocationName)
1192  *outLocationName = "Page number prefix";
1193  return mText;
1194 
1195  case 1 :
1196  if (outLocationName)
1197  *outLocationName = "Page number";
1198  return MiddleText();
1199 
1200  default :
1201  if (outLocationName)
1202  *outLocationName = "Page number suffix";
1203  return mTrailingText;
1204  }
1205 }
1206 
1207 
1208 void
1209 oofRepPageNoBlock::setCellText(const oofString& inString, long row, short col)
1210 {
1211  assert(row==0);
1212  assert(col==0 || col==2);
1213 
1214  if (col==0)
1215  mText = inString;
1216  else
1217  mTrailingText = inString;
1218 }
1219 
1220 
1221 // -------------------------------------------------------
1222 // o o f R e p E n v i r o n m e n t
1223 // -------------------------------------------------------
1224 bool
1226 {
1227  return true;
1228 }
1229 
1230 
1231 bool
1233 {
1234  return false;
1235 }
1236 
1237 
1238 bool
1240 {
1241  return false;
1242 }
1243 
1244 
1245 void
1247 {
1248 // dummy so overrides not required
1249 }
1250 
1251 
1252 void
1254 {
1255 // dummy so overrides not required
1256 }
1257 
1258 
1259 void
1261 {
1262 // dummy so overrides not required
1263 }
1264 
1265 void
1266 oofRepEnvironment::drawPageBorder( long /*top*/, long /*left*/, long /*bottom*/, long /*right*/ )
1267 {
1268 // dummy so overrides not required
1269 }
1270 
1271 
1272 void
1274 {
1275  drawPageBreak();
1276 }
1277 
1278 
1279 // -------------------------------------------------------
1280 // o o f R e p S t r e a m E n v
1281 // -------------------------------------------------------
1283  mOut(0),
1284  mOwnedofstream(0)
1285 {
1286 }
1287 
1288 
1289 oofRepStreamEnv::oofRepStreamEnv(ostream& os) :
1290  mOut(&os),
1291  mOwnedofstream(0) // dunno what kind of stream, not owned by us anyway
1292 {
1293 }
1294 
1295 
1296 oofRepStreamEnv::oofRepStreamEnv(const char* fileName, bool openBinary)
1297 {
1298  if (openBinary)
1299  mOwnedofstream = new ofstream(fileName, ios::out | ios::binary); // vulnerable to failure
1300  else
1301  mOwnedofstream = new ofstream(fileName); // vulnerable to failure
1302  mOut = mOwnedofstream;
1303  // NOT YET IMPLEMENTED - have exception handling to survive failure to
1304  // produce report
1305 }
1306 
1307 
1309 {
1310  if (mOwnedofstream) {
1311  mOwnedofstream->close(); // Mac libs apparently not closing on deletion, only on app exit
1312  delete mOwnedofstream; // of which mOut & sOut will be a copy
1313  }
1314 }
1315 
1316 
1322 bool
1324 {
1325  bool ret = false;
1326  if (mOut) // got stream
1327  ret = (mOut->good() != 0);
1328  else { // open a file
1329 #ifdef _Macintosh
1330  #ifndef OOF_REP_NO_GUI
1331  #if defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON!=0
1332  OSErr anErr = noErr;
1333  NavReplyRecord reply;
1334  NavDialogOptions dialogOptions;
1335  OSType fileTypeToSave = 'TEXT';
1336  OSType creatorType = 'xAPP';
1337  //NavEventUPP eventProc = NewNavEventProc(myEventProc);
1338 
1339  anErr = NavGetDefaultDialogOptions(&dialogOptions);
1340  if (anErr == noErr){
1341  dialogOptions.dialogOptionFlags ^= kNavAllowStationery; /* No stationery files */
1342  unsigned char* fName = (unsigned char*)&(dialogOptions.savedFileName);
1343  unsigned char** fNameH = &fName;
1344  ::SetString(fNameH,"\pUntitled Report");
1345 
1346 
1347 
1348 
1349  short nothing;
1350  anErr = NavPutFile( (AEDesc *)NULL, &reply, &dialogOptions, (NavEventUPP)NULL,fileTypeToSave, creatorType,&nothing );
1351  if (anErr == noErr && reply.validRecord){
1352  AEKeyword theKeyword;
1353  DescType actualType;
1354  Size actualSize;
1355  FSSpec dstFSSpec;
1356 
1357  anErr = AEGetNthPtr(&(reply.selection), 1, typeFSS,
1358  &theKeyword, &actualType,
1359  &dstFSSpec, sizeof(dstFSSpec),
1360  &actualSize );
1361  if (anErr == noErr){
1362  stSaveDirectory saveDir;
1363  oofDirectory reportDir(dstFSSpec);
1364  reportDir.gotoDirectory();
1365  // convert Mac name from Pascal string to C string
1366  char fileName[63];
1367  size_t nameLen = dstFSSpec.name[0];
1368  memcpy(fileName, &dstFSSpec.name[1], nameLen);
1369  fileName[nameLen] = '\0';
1370  mOut = new ofstream(fileName);
1371  ret = mOut->good();
1372  }
1373  (void) NavDisposeReply(&reply);
1374  }
1375 
1376  }
1377  else
1378  assert(!anErr);// to do add an exception
1379  #else
1380 
1381  StandardFileReply reply;
1382  #ifdef __PowerPlant__
1383  UDesktop::Deactivate(); // PowerPlant 'out' to let us call standard file
1384  #endif
1385  ::StandardPutFile("\pSave As...","\pUntitled Report",&reply);
1386  #ifdef __PowerPlant__
1387  UDesktop::Activate(); // PowerPlant 'out' to let us call standard file
1388  #endif
1389  if (reply.sfGood) { // user clicked Save button
1390  stSaveDirectory saveDir;
1391  oofDirectory reportDir(reply.sfFile);
1392  reportDir.gotoDirectory();
1393  // convert Mac name from Pascal string to C string
1394  char fileName[63];
1395  size_t nameLen = reply.sfFile.name[0];
1396  memcpy(fileName, &reply.sfFile.name[1], nameLen);
1397  fileName[nameLen] = '\0';
1398  mOut = new ofstream(fileName);
1399  ret = mOut->good();
1400  }
1401  #endif // Carbon
1402  #else
1403  assert(0);
1404  #endif // OOF_REP_NO_GUI
1405 #endif // _Macintosh
1406  }
1407  sOut = mOut; // WE ARE NOW ACTIVE!!!! - need a Mutex around the entire rep draw idea
1408  return ret;
1409 }
1410 
1411 // -------------------------------------------------------
1412 // o o f R e p P a g e L i s t
1413 // -------------------------------------------------------
1415 {
1416  deleteAll();
1417 }
1418 
1419 
1420 void
1422 {
1423  const unsigned long numPages = count();
1424  for (unsigned long i=0; i<numPages; i++)
1425  delete page(i);
1426  deleteAllCells();
1427 }
1428 
1429 
1430 // -------------------------------------------------------
1431 // o o f R e p P a g e
1432 // -------------------------------------------------------
1434 {
1435  sCurrentPage = this;
1436 }
1437 
1438 
1440 {
1441  const unsigned long numElements = count();
1442  for (unsigned long i=0; i<numElements; i++)
1443  delete element(i);
1444 }
1445 
1446 
1447 void
1449 {
1450  sCurrentPage = 0; // only used for construction
1451  const unsigned long numElements = count();
1452  for (unsigned long i=0; i<numElements; i++) {
1453  oofDE* theElement = element(i);
1454  theElement->draw();
1455  }
1456 }
1457 
1458 
1459 // -------------------------------------------------------
1460 // o o f T e x t S t y l e D E
1461 // -------------------------------------------------------
1463  mStyle(copiedStyle->clone())
1464 {
1465 }
1466 
1467 
1469 {
1470  delete mStyle;
1471 }
1472 
1473 
1474 
1475 // -------------------------------------------------------
1476 // o o f R e p V i s i t o r
1477 // -------------------------------------------------------
1478 
1480 {
1481  mRep = 0; // make Lint happy, zeroing reference pointer
1482 }
1483 
1484 
1489 void
1491 {
1492  mRep = inRep;
1493 
1494 // we test the count of lists because the overridden visit methods
1495 // may not want to be entered for an empty list - easier to keep that
1496 // test here to save user having to bother
1497 
1498  if (inRep->isMultiReport()) {
1499  oofRepMulti* multiRep = (oofRepMulti*)inRep; // safe downcast
1500  const unsigned long numSections = multiRep->count();
1501  for (unsigned long i=0; i<numSections; i++) {
1502  oofRepSection* theSection = multiRep->section(i);
1503  assert(theSection);
1504  visit(theSection); // recurse each section!
1505  }
1506  }
1507  else { // case for single report
1508  inRep->becomeCurrent(); // set horrible static pointer
1509  inRep->resetIteratingBandLevel();
1510  if (inRep->firstPageHeaders().count()>0)
1512 
1513  if (inRep->firstPageFooters().count()>0)
1515 
1516  if (inRep->pageHeaders().count()>0)
1517  VisitPageHeaders(inRep->pageHeaders());
1518 
1519  if (inRep->pageFooters().count()>0)
1520  VisitPageFooters(inRep->pageFooters());
1521 
1522  oofRepBand* bodyBand = inRep->body();
1523  if (bodyBand) {
1524  VisitComplexBand(bodyBand);
1525  inRep->resetIteratingBandLevel();
1526  }
1527  }
1528 }
1529 
1530 
1531 void
1533 {
1534  VisitBandList(inBands);
1535 }
1536 
1537 
1538 void
1540 {
1541  VisitBandList(inBands);
1542 }
1543 
1544 
1545 void
1547 {
1548  VisitBandList(inBands);
1549 }
1550 
1551 
1552 void
1554 {
1555  VisitBandList(inBands);
1556 }
1557 
1558 
1562 void
1564 {
1565  EnterLevel();
1566  VisitComplexBand(inBand);
1567  LeaveLevel();
1568 }
1569 
1570 
1571 void
1573 {
1574  VisitBandList(inBands);
1575 }
1576 
1577 
1578 void
1580 {
1581  VisitBandList(inBands);
1582 }
1583 
1584 
1585 void
1587 {
1588  VisitBreakList(inBreaks);
1589 }
1590 
1591 
1592 void
1594 {
1595  VisitBreakList(inBreaks);
1596 }
1597 
1598 
1599 void
1601 {
1602  if (inBand->maybeComplexBand())
1603  VisitComplexBand(inBand); // safe downcast
1604  else if (inBand->isLayoutBand())
1605  VisitLayoutBand((oofRepLayoutBand*)inBand); // safe downcast
1606  else
1607  VisitBand(inBand);
1608 }
1609 
1610 
1611 void
1613 {
1614  EnterLevel();
1615  const unsigned long numBands = inBands.count();
1616  for (unsigned long i=0; i<numBands; i++) {
1617  oofRepBand* theBand = inBands.value(i);
1618  assert(theBand);
1619  VisitTypedBand(theBand);
1620  }
1621  LeaveLevel();
1622 }
1623 
1624 
1625 void
1627 {
1628  EnterLevel();
1629  const unsigned long numBreaks = inBreaks.count();
1630  for (unsigned long i=0; i<numBreaks; i++) {
1631  oofRepBreak* theBreak = inBreaks.value(i);
1632  assert(theBreak);
1633  oofRepBand* theBand = theBreak->band();
1634  if (theBand)
1635  VisitTypedBand(theBand);
1636  } // loop breaks
1637  LeaveLevel();
1638 }
1639 
1640 
1641 void
1643 {
1644  const unsigned long numAdorners = inList.count();
1645  if (numAdorners>0) {
1646  EnterLevel();
1647  for (unsigned long i=0; i<numAdorners; i++) {
1648  oofAdorner* theAdorner = inList.value(i);
1649  assert(theAdorner);
1650  VisitAdorner(theAdorner);
1651  }
1652  LeaveLevel();
1653  }
1654 }
1655 
1656 
1657 void
1659 {
1660 // empty default
1661 }
1662 
1663 
1664 void
1666 {
1667  VisitDrawable(inBlock);
1668 }
1669 
1670 
1671 void
1673 {
1674  VisitDrawable(inBand);
1675 }
1676 
1677 
1678 void
1680 {
1681 // empty default
1682 }
1683 
1684 
1689 void
1691 {
1692  VisitBand(inBand);
1693 }
1694 
1695 
1703 void
1705 {
1706  assert(inBand);
1707 
1708  OOF_mixIterableBand* iteratingInterface = inBand->asIterableBand();
1709  OOF_mixBandWithSubBands* subBandInterface = inBand->asBandWithSubBands();
1710  OOF_mixBandWithTableWrappers* tableInterface = inBand->asBandWithTableWrappers();
1711 
1712  if (iteratingInterface)
1714 
1715  if (subBandInterface && subBandInterface->headers().count()>0)
1716  VisitBandHeaders(subBandInterface->headers());
1717 
1718  if (iteratingInterface) {
1719  if (iteratingInterface->headerBreaks().count()>0)
1720  VisitBandHeaderBreaks(iteratingInterface->headerBreaks());
1721  VisitIterableBandBody(inBand);
1722  }
1723  else
1724  VisitBand(inBand);
1725 
1726  if (iteratingInterface && iteratingInterface->footerBreaks().count()>0)
1727  VisitBandFooterBreaks(iteratingInterface->footerBreaks());
1728 
1729  if (subBandInterface && subBandInterface->footers().count()>0)
1730  VisitBandFooters(subBandInterface->footers());
1731 
1732  if (iteratingInterface)
1734 }
1735 
1736 
1737 void
1739 {
1740  VisitBlockList(inBand->blocks());
1741  VisitBand(inBand); // don't forget we are a band in our own right!
1742 }
1743 
1744 
1745 void
1747 {
1748  EnterLevel();
1749  const unsigned long numBlocks = inBlocks.count();
1750  for (unsigned long i=0; i<numBlocks; i++) {
1751  oofRepBlock* theBlock = inBlocks.value(i);
1752  assert(theBlock);
1753  VisitBlock(theBlock);
1754  } // loop blocks
1755  LeaveLevel();
1756 }
1757 
1758 
1759 void
1761 {
1762 // empty default
1763 }
1764 
1765 
1766 void
1768 {
1769 // empty default
1770 }
virtual bool maybeComplexBand() const
Overall guard flag to simplify checks for capabilities.
Definition: oofrep2.cpp:119
virtual dbView * view(unsigned short whichView=0) const
Request a dbView which may be the source of data for the item.
Definition: oofrep2.cpp:680
virtual void VisitFirstPageFooters(oofRepBandList &)
Definition: oofrep2.cpp:1539
oofRepBreak * value(unsigned long) const
Definition: oofrep.h:2495
oofRepBreakList & footerBreaks()
Definition: oofrep.h:2124
void incrementIteratingBandLevel()
Call when visiting tree enters band implementing OOF_mixIterableBand.
Definition: oofrep.h:2025
blockAlignT mAlignment
Definition: oofrep.h:1436
void colSizer(oofColSizer *adoptedSizer)
Definition: oofsize.cpp:71
Cross-platform way to specify rectangle with Mac-style setter.
Definition: oofRect.h:39
void deleteAll()
Definition: oofrep2.cpp:1421
Convenient top-level parent band mixing in all the exotic aspects.
Definition: oofrep.h:1256
unsigned long width()
Definition: oofdraw.h:433
virtual void VisitIterableBandBody(oofRepBand *)
Isolates these bands so more complex visitors can optimise their querying.
Definition: oofrep2.cpp:1690
virtual oofRepBand * clone() const
Definition: oofrep2.cpp:673
Convenient mixin if you want to have a band which iterates and has breaks.
Definition: oofrep.h:918
virtual bool isPrintingEnvironment() const
Definition: oofrep2.cpp:1232
virtual OOF_mixIterableBand * asIterableBand()
Definition: oofrep1.cpp:1547
virtual void drawPageBreak()=0
virtual OOF_mixBandWithTableWrappers * asBandWithTableWrappers()
Definition: oofrep2.cpp:312
virtual ~oofRepGraphBand()
Definition: oofrep2.cpp:666
unsigned long count()
Count records in current selection.
Definition: oof1.h:2017
virtual bool maybeComplexBand() const
Overall guard flag to simplify checks for capabilities.
Definition: oofrep1.cpp:1526
virtual oofRepTextStyle * textStyle() const
Get the text style owned by this object or a default.
Definition: oofrep1.cpp:1827
oofRepBandList & firstPageHeaders()
Definition: oofrep.h:1887
virtual oofRepDrawable * drawableContainingColumns()
Definition: oofrep2.cpp:416
oofRepPage * page(unsigned long) const
Definition: oofrep.h:2752
Empty top band in a report used if composing all in headers.
Definition: oofrep.h:1371
virtual oofString getCellText(bool *outIsEditable=0, oofString *outLocationName=0, long row=0, short col=0) const
Definition: oofrep2.cpp:1090
virtual int numCols() const
Definition: oofrep2.cpp:384
oofRepBandList & footers()
Definition: oofrep.h:2141
virtual void VisitBandHeaderBreaks(oofRepBreakList &)
Definition: oofrep2.cpp:1586
oofRepBracketedTextBlock(const char *leadingText, const char *trailingText, oofRepTextStyle *adoptedStyle=0)
Definition: oofrep2.cpp:956
#define new
Definition: oofDebugNew.h:11
virtual void VisitBody(oofRepBand *)
that top body is likely to be complex so doesn't bother testing.
Definition: oofrep2.cpp:1563
virtual void endTableBody()
Definition: oofrep2.cpp:360
oofRepBreakList & headerBreaks()
Definition: oofrep.h:2117
virtual dbView * view(unsigned short whichView=0) const
Request a dbView which may be the source of data for the item.
Definition: oofrep2.cpp:272
Abstract base for anything drawn on report.
Definition: oofrep.h:860
virtual oofString MiddleText() const
Definition: oofrep2.cpp:1076
Tries to hide the different platforms and version issues with standard IO.
oofRepBandList & pageFooters()
Definition: oofrep.h:1881
Convenient mixin if your band is rendered in columns with custom drawing.
Definition: oofrep.h:980
virtual void startTableWrapper()
Definition: oofrep2.cpp:71
virtual void EnterLevel()
Definition: oofrep2.cpp:1760
virtual void next()
Definition: oofrep2.cpp:302
unsigned long graphWidth() const
Definition: oofrep.h:2679
virtual void VisitBandHeaders(oofRepBandList &)
Definition: oofrep2.cpp:1572
virtual oofRepBlock * clone() const
Definition: oofrep2.cpp:908
oofString mText
Definition: oofrep.h:1483
virtual void endTableWrapper()
Definition: oofreprn.h:116
virtual void draw()
Definition: oofrep.h:821
virtual void endTableBody()
Definition: oofreprn.h:114
oofRepEmptyRootBand_AnyRender(oofRepEmptyRootBand *b)
Definition: oofreprn.h:160
virtual void drawPageBorder(long top, long left, long bottom, long right)
Definition: oofrep2.cpp:1266
dbView * getView()
Definition: oofGrphs.cpp:150
bool fieldIsStandalone() const
Definition: oof3.h:733
void setPaneRect(Rect inRect)
Definition: oofGrphs.cpp:105
virtual void VisitPageFooters(oofRepBandList &)
Definition: oofrep2.cpp:1553
virtual OOF_mixViewExtraRender * finishClone(oofRepRender *newClone) const
Definition: oofrep2.cpp:457
Report that contains list of unrelated other reports as oofRepSection's.
Definition: oofrep.h:677
virtual void setCellText(const oofString &, long row=0, short col=0)
Definition: oofrep2.cpp:1209
oofRepCustomViewDrawer * customDrawer(unsigned short col)
Definition: oofrep2.cpp:172
virtual void startTableBody()
Definition: oofrep2.cpp:351
virtual void VisitBreakList(oofRepBreakList &)
Definition: oofrep2.cpp:1626
unsigned long bodyHeight()
Definition: oofrep.h:1961
virtual oofRepBlock * clone() const =0
oofRepTextStyle * mStyle
Definition: oofrep.h:1805
oofRepBlock * value(unsigned long) const
Definition: oofrep.h:2423
std::ostream * mOut
Definition: oofrep.h:457
bool mDrawnColHeadersThisPage
Definition: oofreprn.h:148
bool drawStylesWereSet() const
Definition: oofGrphs.h:373
void start()
Definition: oof1.cpp:2057
void becomeCurrent()
Definition: oofrep1.cpp:446
oofRepPageNoBlock(const char *leadingText=0, const char *trailingText=0, oofRepTextStyle *adoptedStyle=0)
Definition: oofrep2.cpp:1143
virtual bool more()
Definition: oofrep2.cpp:133
oofString describe() const
Definition: oofdraw.cpp:1262
void drawColumnHeaders()
Definition: oofrep2.cpp:340
unsigned long count() const
Definition: oofarray.h:126
virtual void startTableWrapper()
Definition: oofreprn.h:115
Abstract base for drawing text content with some bracketing text in an oofRepLayoutBand.
Definition: oofrep.h:1490
unsigned long count() const
Definition: oofrep.h:2392
virtual bool canDraw()
Confirm can draw to stream - only used for GUI to choose destination.
Definition: oofrep2.cpp:1323
virtual void draw() const =0
unsigned long graphHeight() const
Definition: oofrep.h:2686
Most commonly used top band in a report.
Definition: oofrep.h:1283
unsigned long count() const
Definition: oofrep.h:2070
oofRepFieldBlock(dbField *, oofRepTextStyle *adoptedStyle=0)
Definition: oofrep2.cpp:1051
unsigned short graphBandMinSizePercent() const
Definition: oofrep3.cpp:575
oofAdornerList & adorners()
Definition: oofadorn.h:354
oofRepBandList & firstPageFooters()
Definition: oofrep.h:1894
unsigned long bodyWidth()
Definition: oofrep.h:1968
virtual bool isLayoutBand() const
Definition: oofrep1.cpp:1533
virtual void VisitAdornerList(oofAdornerList &)
Definition: oofrep2.cpp:1642
unsigned long height()
Definition: oofdraw.h:427
Base rendering class.
Definition: oofrep.h:816
virtual unsigned int countCells() const
Definition: oofrep2.cpp:922
virtual void startTableBody()
Definition: oofrep2.cpp:77
void setDrawStyles(oofDrawStyleSet &)
Definition: oofGrphs.cpp:120
virtual oofString MiddleText() const
Definition: oofrep2.cpp:1165
unsigned long count() const
Definition: oofrep.h:2285
OOF_bitPointer value(unsigned int index) const
Definition: oof1.h:1594
oofRepBand * band() const
Definition: oofrep.h:2513
virtual oofRepRender * clone(const oofRepDrawable *newOwner) const
Definition: oofrep2.cpp:500
Renders an empty band just allowing attached headers etc.
Definition: oofreprn.h:158
virtual void VisitLayoutBand(oofRepLayoutBand *)
Definition: oofrep2.cpp:1738
List of adorners attached to report element.
Definition: oofadorn.h:70
Graph class subclassed to draw different graph types.
Definition: oofGrphs.h:71
virtual ~oofRepStreamEnv()
Definition: oofrep2.cpp:1308
virtual ~OOF_mixColumnarBand()
Definition: oofrep2.cpp:154
bool * mNonEditableFields
owned
Definition: oofrep.h:1013
virtual oofString getCellText(bool *outIsEditable=0, oofString *outLocationName=0, long row=0, short col=0) const
Definition: oofrep2.cpp:929
void setTitle(const char *)
Definition: oofGrphs.cpp:157
virtual void VisitBlockList(oofRepBlockList &)
Definition: oofrep2.cpp:1746
bool more() const
When iterating a selection, are there any more records beyond current.
Definition: oof1.h:1896
virtual oofString getCellText(bool *outIsEditable=0, oofString *outLocationName=0, long row=0, short col=0) const
Definition: oofrep2.cpp:1034
const oofRepSettings * settings() const
Definition: oofrep1.cpp:469
Subclass platform preview environment to intercept for editing hooks.
Definition: oofrepeditx.h:368
unsigned long getNumOverlaid() const
Definition: oofGrphs.h:406
virtual unsigned long width()
Definition: oofrep2.cpp:1017
oofDE * element(unsigned long) const
Definition: oofrep.h:2769
oofRepIterableTreeBand * body(oofRepIterableTreeBand *adoptedBody)
Set the main band from which report hangs.
Definition: oofrep1.cpp:695
virtual void setCellText(const oofString &, long row=0, short col=0)
Definition: oofrep2.cpp:944
virtual void VisitBand(oofRepBand *)
Definition: oofrep2.cpp:1672
virtual unsigned long fixedHeight()
Definition: oofrep2.cpp:1003
void deleteAllCells(bool alwaysDeleteStorage=false)
Effectively delete cells by resetting mNextFreeEntry cursor.
Definition: oofarray.cpp:219
virtual void draw()
central default call for drawing, but still able to be overriden in extreme cases.
Definition: oofrep2.cpp:480
virtual unsigned int countCells() const
Definition: oofrep2.cpp:979
virtual int numCols() const =0
Convenient mixin if you want to have a band with table wrappers.
Definition: oofrep.h:963
virtual unsigned int countCells() const
Definition: oofrep2.cpp:1027
void changeTextStyle(oofRepTextStyle *)
Provide forwarding so report objects that are drawing can affect environment text style...
Definition: oofrep.h:2059
oofPict * picture() const
Definition: oofdraw.h:440
virtual oofGraph * clone() const =0
virtual ~oofTextStyleDE()
Definition: oofrep2.cpp:1468
virtual ~oofRepFieldBlock()
Definition: oofrep2.cpp:1058
oofRepSpaceBand(unsigned long heightToSkip)
Definition: oofrep2.cpp:614
virtual ~oofRepVisitor()
empty virtual dtor because we subclass
Definition: oofrep2.cpp:1479
GUI report-writer layer of OOFILE database.
unsigned long count() const
Definition: oofadorn.h:392
oofRepBlockList & blocks()
Definition: oofrep.h:2718
unsigned long mFixedWidth
Definition: oofrep.h:1435
virtual void VisitBandList(oofRepBandList &)
Definition: oofrep2.cpp:1612
void append(oofRepBlock *adoptedBlock)
Definition: oofrep1.cpp:1999
virtual oofRepBand * clone() const
Definition: oofrep2.cpp:473
Provide an iterable set of fields.
Definition: oofview.h:26
virtual void setString(const char *)
Definition: oof3.h:132
oofRepEmptyRootBand(int numIterations=1)
Definition: oofrep2.cpp:466
oofTextStyleDE(const oofRepTextStyle *copiedStyle)
Definition: oofrep2.cpp:1462
List of bands attached to report or other bands, eg: page headers.
Definition: oofrep.h:292
virtual void finishConstructionWithPresets()
Definition: oofGrphs.cpp:213
virtual oofString text() const
Definition: oofrep2.cpp:970
unsigned short bandIndenting() const
Definition: oofrep3.cpp:326
virtual void startEnvironment()
Definition: oofrep2.cpp:1246
virtual void startTableBody(bool)
Definition: oofreprn.h:113
oofAdorner * value(unsigned long) const
Definition: oofadorn.h:415
Add extra virtual methods used by oofRep::DrawViewBand beyond normal band drawing.
Definition: oofreprn.h:111
virtual void setCellText(const oofString &, long row=0, short col=0)
Definition: oofrep2.cpp:1119
virtual void draw()
central default call for drawing, but still able to be overriden in extreme cases.
Definition: oofrep2.cpp:710
Common set generator generates well-distributed colours.
Definition: oofDStyl.h:131
Top level class for a report.
Definition: oofrep.h:571
virtual void VisitComplexBand(oofRepBand *)
Visit a band which is likely to provide one or more optional interfaces.
Definition: oofrep2.cpp:1704
Convenient mixin if you want to have a band with sub-bands.
Definition: oofrep.h:944
int mCurrentIteration
ranges from 0 up to mMaxIterations-1 whilst iterating report
Definition: oofrep.h:1275
virtual void CalcColWidths()
Definition: oofrep2.cpp:439
void shorten(unsigned short)
Reduce string length by dropChars.
Definition: oofstr.cpp:2396
char lastChar() const
Constant access to last char.
Definition: oofstr.cpp:2285
bool moveDownAfter() const
Indicate if a layout band should start a new row of blocks.
Definition: oofrep.h:2215
virtual OOF_mixBandWithTableWrappers * asBandWithTableWrappers()
Definition: oofrep1.cpp:1561
Abstract base for user column drawer.
Definition: oofrep.h:1239
virtual void MakeAnyRender()
Definition: oofrep2.cpp:488
Abstract base for rendering an oofRepViewBand.
Definition: oofreprn.h:129
virtual void drawSectionBreak()
Definition: oofrep2.cpp:1273
OOF_Dictionary mCustomDrawers
Definition: oofrep.h:1012
virtual void finishConstruction()
null base method occasionally overriden
Definition: oofrep2.cpp:782
virtual void VisitDrawable(oofRepDrawable *)
Definition: oofrep2.cpp:1679
virtual void finishConstruction()
Definition: oofrep2.cpp:426
virtual void VisitBlock(oofRepBlock *)
Definition: oofrep2.cpp:1665
void clear()
Abandon string contents, resetting length.
Definition: oofstr.cpp:2325
virtual oofString getCellText(bool *outIsEditable=0, oofString *outLocationName=0, long row=0, short col=0) const
Definition: oofrep2.cpp:1181
virtual oofRepBand * clone() const
Definition: oofrep2.cpp:265
void VisitTypedBand(oofRepBand *)
Definition: oofrep2.cpp:1600
Specify a fixed height band containing an oofGraph with additional height & width.
Definition: oofrep.h:1080
virtual void endTableWrapper()
Definition: oofrep2.cpp:376
Mixin base for oofGraph's that draw lines as overlays on original bars.
Definition: oofGrphs.h:139
unsigned int count() const
Definition: oof1.h:1498
virtual void next()
Definition: oofrep2.cpp:140
virtual OOF_mixViewExtraRender * finishClone(oofRepRender *newClone) const =0
Base class for persistent tables.
Definition: oof1.h:452
virtual void endTableBody()
Definition: oofrep2.cpp:83
void next()
Next record in the selection becomes current.
Definition: oof1.h:1970
Portable highly capable string class.
Definition: oofstr.h:101
virtual void VisitBandFooters(oofRepBandList &)
Definition: oofrep2.cpp:1579
virtual bool preprocessesPageHeadersAndFooters() const
Definition: oofrep2.cpp:1239
void textStyle(oofRepTextStyle *adoptedStyle)
Set style owned by this object.
Definition: oofrep1.cpp:1804
virtual bool canDraw()
Definition: oofrep2.cpp:1225
void resetIteratingBandLevel()
Quick reset for visitors.
Definition: oofrep.h:2015
oofRepLayoutBand & operator<<(dbField &)
Definition: oofrep2.cpp:568
oofRepBandList & pageHeaders()
Definition: oofrep.h:1874
int mMaxIterations
for simple subclasses that aren't driven by a database selection
Definition: oofrep.h:1274
virtual void drawColumnHeaders()
Definition: oofreprn.h:119
virtual void VisitBandFooterBreaks(oofRepBreakList &)
Definition: oofrep2.cpp:1593
Save the current directory and restore when we leave scope.
Definition: ooffiles.h:362
Settings object for overriding behaviours of an instance of oofRep.
Definition: oofrep.h:173
Specify a fixed-height band that contains a series of oofRepBlock's.
Definition: oofrep.h:1182
Abstract base for a fixed-size block drawn by an oofRepLayoutBand.
Definition: oofrep.h:1408
oofRepViewBand(const dbView &, bool isBoxed=false)
Definition: oofrep2.cpp:207
virtual bool lastCol(unsigned long col)
Definition: oofrep2.cpp:406
virtual OOF_mixColumnarBand * asColumnarBand()
Definition: oofrep2.cpp:319
Cross-platform specification of text style.
Definition: oofrep.h:732
Abstract report-writer drawing element.
Definition: oofrep.h:1681
unsigned long numOverlaid() const
Definition: oofrep2.cpp:697
unsigned short colSepWidth() const
Definition: oofrep3.cpp:421
oofRepBandList & headers()
Definition: oofrep.h:2134
oofRepTextBlock(const char *str=0, oofRepTextStyle *adoptedStyle=0)
Definition: oofrep2.cpp:865
oofRepRender * mRender
Definition: oofrep.h:901
virtual unsigned long fixedHeight()
Definition: oofrep2.cpp:768
Specify a block to draw field contents with some bracketing text in an oofRepLayoutBand.
Definition: oofrep.h:1550
Provides cross-platform directory specification and iteration.
Definition: ooffiles.h:235
virtual void draw()
central default call for drawing, but still able to be overriden in extreme cases.
Definition: oofrep2.cpp:333
virtual OOF_mixBandWithSubBands * asBandWithSubBands()
Definition: oofrep1.cpp:1554
virtual void endTableWrapper()
Definition: oofrep2.cpp:89
Base object to derive adorners from.
Definition: oofadorn.h:32
virtual bool lastRow(unsigned long row)
Definition: oofrep2.cpp:394
virtual void startSection()
Definition: oofrep2.cpp:1253
virtual oofString copyString() const
Definition: oof3.cpp:472
oofRep * mRep
Definition: oofrep.h:546
virtual void start()
Definition: oofrep2.cpp:126
virtual unsigned long fixedHeight()
Definition: oofrep2.cpp:554
virtual OOF_mixIterableBand * asIterableBand()
Definition: oofrep2.cpp:105
oofRepBand * value(unsigned long) const
Definition: oofrep.h:2316
virtual void LeaveLevel()
Definition: oofrep2.cpp:1767
oofRepGraphBand(oofGraph *, unsigned long height, unsigned long grHgt=400, unsigned long grWid=400, const char *inGraphTitle=0)
Definition: oofrep2.cpp:632
static oofRep * currentReport()
Definition: oofrep.h:2003
virtual oofRepBand * clone() const
Definition: oofrep2.cpp:856
virtual oofRepBand * clone() const
Definition: oofrep2.cpp:621
virtual oofRepBlock * clone() const
Definition: oofrep2.cpp:996
Specify a block to draw mono-styled text in an oofRepLayoutBand.
Definition: oofrep.h:1445
virtual void draw()
central default call for drawing, but still able to be overriden in extreme cases.
Definition: oofrep1.cpp:1296
virtual oofRepEditLink * makeEditLink(const oofRepEditingEnv &)
Make an editor for this drawable - by default return a null link.
Definition: oofrep2.cpp:326
virtual bool more()
Definition: oofrep2.cpp:292
oofRepSection * section(unsigned long) const
Definition: oofrep.h:2077
Base for adorners specifying borders for grids.
Definition: oofadorn.h:140
virtual bool isLayoutBand() const
Definition: oofrep2.cpp:532
virtual ~oofRepViewBand()
Definition: oofrep2.cpp:258
virtual oofString MiddleText() const =0
virtual oofString text() const
Definition: oofrep2.cpp:915
oofRepLineBand(unsigned long heightInPoints=2, bool isGrey=true)
Definition: oofrep2.cpp:831
oofRepIterableTreeBand(int inMaxIterations=1)
Definition: oofrep2.cpp:97
virtual void VisitAdorner(oofAdorner *)
Definition: oofrep2.cpp:1658
List of blocks in an oofRepLayoutBand.
Definition: oofrep.h:336
std::ofstream * mOwnedofstream
Definition: oofrep.h:458
oofRepPictBlock(oofPict *adoptedPict, oofRepTextStyle *adoptedStyle=0)
Definition: oofrep2.cpp:989
oofRepViewBand * mOwner
Definition: oofreprn.h:147
void decrementIteratingBandLevel()
Call when visiting tree enters band implementing OOF_mixIterableBand.
Definition: oofrep.h:2035
void ownsContents(bool ownsFlag=true)
Definition: oof1.h:2557
Mixin for classes keeping an oofPict member.
Definition: oofdraw.h:269
void setFieldNonEditable(unsigned short col)
Definition: oofrep2.cpp:191
unsigned long count() const
Definition: oofrep.h:2464
virtual void startTableWrapper()
Definition: oofrep2.cpp:368
virtual oofRepBand * clone() const
Definition: oofrep2.cpp:525
Single page in a report writer preview window.
Definition: oofrep.h:1758
virtual void draw()
central default call for drawing, but still able to be overriden in extreme cases.
Definition: oofrep2.cpp:546
oofString mTrailingText
Definition: oofrep.h:1508
virtual void visit(oofRep *)
Top-level that iterates all the others, encapsulating report structure.
Definition: oofrep2.cpp:1490
oofRepPictBand(oofPict *adoptedPict)
Definition: oofrep2.cpp:850
dbTable * table() const
Definition: oofview.h:109
virtual void drawSquished(long &balanceToSave)
Definition: oofrep2.cpp:741
Calculation attached to an oofRepBand.
Definition: oofrep.h:1604
virtual bool isMultiReport() const
Definition: oofrep1.cpp:438
virtual oofRepBlock * clone() const
Definition: oofrep2.cpp:1174
Base class for persistent fields in dbTable's.
Definition: oof3.h:63
static std::ostream * sOut
Definition: oofrep.h:462
virtual void endEnvironment()
Definition: oofrep2.cpp:1260
virtual void start()
Definition: oofrep2.cpp:282
Abstract base for report bands.
Definition: oofrep.h:1026
Wrapper for a report contained within an oofRepMulti.
Definition: oofrep.h:707
Abstract base classes for report renderers.
void draw(const oofRect &)
Definition: oofrep2.cpp:1448
virtual oofRepBand * clone() const
Definition: oofrep2.cpp:839
List of Breaks attached to a report band.
Definition: oofrep.h:368
unsigned long fixedHeight()
Definition: oofrep1.cpp:2006
dbView * getOverlayView() const
Definition: oofGrphs.h:399
void gotoDirectory() const
Change current dir to this oofDirectory.
virtual void VisitPageHeaders(oofRepBandList &)
Definition: oofrep2.cpp:1546
virtual void VisitFirstPageHeaders(oofRepBandList &)
Definition: oofrep2.cpp:1532
virtual unsigned long minHeight()
Definition: oofrep2.cpp:775
virtual oofRepBlock * clone() const
Definition: oofrep2.cpp:1083
Cross-platform picture representation can load from file or resource and draw.
Definition: oofdraw.h:201
virtual OOF_mixBandWithSubBands * asBandWithSubBands()
Definition: oofrep2.cpp:112