OOFILE  1.9
oofrpRTF.cpp
Go to the documentation of this file.
1 // COPYRIGHT 1997 A.D. Software, All rights reserved
2 
3 // report-writer layer of OOFILE database
4 // renderer factories & renderers for RTF output
5 
6 #include "oofpch_r.h" // for precompilation of report files
7 
8 #ifndef H_OOF3
9  #include "oof3.h" // knows a bit about fields
10 #endif
11 #ifndef H_OOFREP
12  #include "oofrep.h"
13 #endif
14 #ifndef H_OOFREPRTF
15  #include "oofrpRTF.h"
16 #endif
17 #ifndef H_OOFGRPHS
18  #include "oofGrphs.h"
19 #endif
20 #ifndef H_OOFIOS
21  #include "oofios.h"
22 #endif
23 #ifndef _Windows
24  typedef unsigned char BYTE;
25 #endif
26 
27 #if OOF_USE_ANSI_STREAMS
28  #include <iomanip>
29 #else
30  #include <iomanip.h>
31 #endif
32 
33 #ifdef OOF_MEM_DEBUG_LAST_INCLUDE
34  #include OOF_MEM_DEBUG_LAST_INCLUDE
35 #endif
36 
37 #ifndef OOF_NO_STDLIB
38  #ifndef std
39  using namespace std;
40  #endif
41 #endif
42 
43 
44 
45 //const int kPageWidth = 8560; // page width in twips (1 twip is 1/10th of a point)
46 //bool onceOnly = true; // true - hasn't been written yet.
47 
48 
49 // ---------------------------------------
50 // o o f R e p R T F E n v
51 // ---------------------------------------
52 
54 
56 {
57 }
58 
59 
60 oofRepRTFEnv::oofRepRTFEnv(ostream& os) :
61  oofRepStreamEnv(os)
62 {
63 }
64 
65 
66 oofRepRTFEnv::oofRepRTFEnv(const char* fileName) :
67  oofRepStreamEnv(fileName)
68 {
69 }
70 
71 
72 void
74 {
75 // now the magic bit.
76 // by dereferencing this, we make an overriding function match against the virtual
77 // method that takes an oofRepRTFEnv&.
78 // The implication is that, if we add an environment, each drawable must have a makeRender
79 // added to match, or it will not be rendered (the base empty method will be invoked).
80 
81 // eg: if we need to handle printing and previewing differently on the Mac, we would end up
82 // with a makeRender(const oofRepMacPrint&) and makeRender(const oofRepMacGUIPreviewPP&)
83 // for each oofRepDrawable
84 
85 // The alternative would be to have each environment know each drawable. That is far
86 // less extensible - users can add their own drawables that we wouldn't know about,
87 // so the environment classes wouldn't be closed for extension.
88  drawable->makeRender(*this);
89 }
90 
91 void
93 {
94  drawable->makeRender(*this);
95 }
96 
97 // a little bit of RTTI which can be used to record what kind of render last
98 // used, and could be used in switches if the above virtual multiple dispatch
99 // technique wasn't being used instead
102 {
103  return eRenderType;
104 }
105 
106 
107 void
109 {
110  *mOut << "\\page";
111 }
112 
113 
114 
115 void
117 {
118 }
119 
120 
121 unsigned short
123 {
124  return 12;
125 }
126 
127 
128 unsigned long
130 {
131  // return the value in pixels (use twips() to change to RTF twips)
132  return 840; // // in A4. for US paper use 792
133 }
134 
135 
136 unsigned long
138 {
139  // return the value in pixels (use twips() to change to RTF twips)
140  return 590; // in A4. for US paper use 576;
141 }
142 
143 
148 void
150 {
151 
152 // New section properties
153  if (mSectionNumber>0)
154  *mOut << "}\\sect ";
155  else // 1st section or sole section in report
156  *mOut << "\\sectd ";// reset to default section properties
157 
158  *mOut << "{\\pgnstart" << oofRep::currentReport()->startingPageNumber() << "\\pgnrestart"<< "}" << endl;
159 
160 // header and footer position
161  const unsigned long spaceAboveHeader = oofRep::currentReport()->settings()->topMargin();
162  const unsigned long spaceBelowFooter = oofRep::currentReport()->settings()->bottomMargin();
163  *mOut << "\\headery" << twips(spaceAboveHeader) << endl;
164  *mOut << "\\footery" << twips(spaceBelowFooter) << endl;
165 
166 // handle title page
167  if ((oofRep::currentReport()->firstPageHeaders().count()>0)||(oofRep::currentReport()->firstPageFooters().count()>0))
168  *mOut << "\\titlepg" << endl;
169 
170 // define page headers
171  *mOut << "{\\header\n";
173  *mOut << "}\n";
174 
175 // define page footers
176  *mOut << "{\\footer\n";
178  *mOut << "}\n";
179 
180 
181  if (oofRep::currentReport()->firstPageHeaders().count()>0){
182  *mOut << "{\\headerf\n";
184  *mOut << "}\n";
185  }
186 
187 
188  if (oofRep::currentReport()->firstPageFooters().count()>0){
189  *mOut << "{\\footerf\n";
191  *mOut << "}\n";
192 
193 
194  }
195 
196  // open header block
197  *mOut << "{\n";
198 
199 
200  mSectionNumber++;
201 }
202 
203 
209 void
211 {
212  // RTF Header
213  // version 1
214  // ansi character set
215  // default font number 0
216  *mOut << "{\\rtf1\\ansi\\deff0" << endl;
217 
218 #ifdef OOF_DEBUG
219 // must put this one after the RTF header so Word etc. can tell we are an RTF doc
220  oofRepStreamEnv::out() << "{\\comment oofRepRTFEnv::startEnvironment}\n";
221 #endif
222 
223  // Font table
224  *mOut << "{\\fonttbl";
225 
226  // Loop for all fonts adding them to the document like this:
227 // for( unsigned int foo=0; foo<numFonts; foo++ ) {
228 // mOut << "{\\f" << foo << "\\fnil " << fontName << ";}";
229 // // NOT YET IMPLEMENTED:
230 // // mOut << "{\\f" << foo << "\\f" << fontFamily() << ' ' << fontName() << ";}";
231 // }
232  // However, at the moment we'll use just one font, although varying size and style on the fly
233  *mOut << "{\\f21\\fswiss Helvetica;}";
234 
235  // Finish font table
236  *mOut << "}" << endl;
237 
238  // Colour table
239  // In the future it might be nice to loop for all colours used in the doc
240  *mOut << "{\\colortbl"
241  << "\\red0\\green0\\blue0;"
242  << "\\red0\\green0\\blue255;"
243  << "\\red0\\green255\\blue255;"
244  << "\\red0\\green255\\blue0;"
245  << "\\red255\\green0\\blue255;"
246  << "\\red255\\green0\\blue0;"
247  << "\\red255\\green255\\blue0;"
248  << "\\red255\\green255\\blue255;}" << endl;
249 
250  // Style Sheet
251  // In the future it might be nice to loop for all styles used in the doc
252  *mOut << "{\\stylesheet{\\fs20 \\snext0Normal;}}" << endl;
253 
254  // Info
255  *mOut << "{\\info{\\author OOFile Report Writer}}" << endl;
256 
257 // define page width and height otherwise RTF will be Word default, NOT current printer
258 // default (ie: will behave as if 8x11 even if A4 selected, until choose Page Setup
259  *mOut << "\\paperw" << twips(oofRep::currentReport()->pageWidth()) << endl;
260  *mOut << "\\paperh" << twips(oofRep::currentReport()->pageHeight()) << endl;
261 
262 // define page margins, otherwise end up with whatever defaults user has set
263  *mOut << "\\margl" << twips(oofRep::currentReport()->settings()->leftMargin()) << endl;
264  *mOut << "\\margr" << twips(oofRep::currentReport()->settings()->rightMargin()) << endl;
265 // top and bottom must be defined in terms of our page margins PLUS pageheader or footer height
266 // using negative numbers makes them "Exactly" the height, instead of the "At Least" which
267 // won't give us a consistent margin above the headers
268  const unsigned long spaceAboveHeader = oofRep::currentReport()->settings()->topMargin();
269  const unsigned long headerHeightPixels = oofRep::currentReport()->pageHeaders().fixedHeight() + spaceAboveHeader;
270  *mOut << "\\margt" << twips(headerHeightPixels) << endl;
271 
272  const unsigned long spaceBelowFooter = oofRep::currentReport()->settings()->bottomMargin();
273  const unsigned long footerHeightPixels = oofRep::currentReport()->pageFooters().fixedHeight() + spaceBelowFooter;
274  *mOut << "\\margb" << twips(footerHeightPixels) << endl;
275 
276  mSectionNumber=0;
277  if (!oofRep::currentReport()->isMultiReport())
278  startSection();
279 }
280 
281 
282 void
284 {
285 #ifdef OOF_DEBUG
286  oofRepStreamEnv::out() << "{\\comment oofRepRTFEnv::endEnvironment}\n";
287 #endif
288  *mOut << "}\\sect}";
289 }
290 
291 
292 bool
294 {
295  return true;
296 }
297 
298 
303 oofString
305 {
306  int index = 0;
307  int destIndex = 0;
308  char currentChar;
309  const char * theString = srcString;
310  unsigned int numberOfEntities = 0;
311  unsigned int newBufferSize = 0;
312  char * newBuffer;
313  while((currentChar = theString[index++])!='\0'){
314  if((currentChar=='\\')||(currentChar=='{')||(currentChar=='}'))
315  numberOfEntities++;
316  }
317  if(numberOfEntities){
318  oofString res;
319  newBufferSize = numberOfEntities + index + 1;
320  newBuffer = new char[newBufferSize];
321 
322  index = 0;
323  while((currentChar = theString[index++])!='\0'){
324  switch(currentChar){
325  case '\\':
326  newBuffer[destIndex++] = '\\';
327  newBuffer[destIndex++] = '\\';
328 
329  break;
330  case '{':
331  newBuffer[destIndex++] = '\\';
332  newBuffer[destIndex++] = '{';
333 
334  break;
335  case '}':
336  newBuffer[destIndex++] = '\\';
337  newBuffer[destIndex++] = '}';
338  break;
339  default:
340  newBuffer[destIndex++] = currentChar;
341 
342  break;
343  }
344  }
345  newBuffer[destIndex] = '\0';
346  res.adopt(newBuffer);
347  return res;
348  } // any entities
349  else
350  return srcString;
351 }
352 
353 
354 void
355 oofRepRTFEnv::encodeToRTFStream(std::ostream& os, const char* theText)
356 {
357 
358  unsigned long index=0;
359  char currentChar;
360  while((currentChar = theText[index++])!= '\0'){
361  switch(currentChar){
362  case '{':
363  os << '\\{';
364 
365  break;
366  case '}':
367  os << '\\}';
368  break;
369  case '\\':
370  os << '\\\\';
371  break;
372  default:
373  os << currentChar;
374  }
375  }
376 }
377 
378 
382 void
383 oofRepRTFEnv::writeWrappedRTFasHexData(std::ostream& os, const char* inBuf, const unsigned int inBufLen)
384 {
385 // Save the streams old characteristics for restoration later
386 #if defined __MWERKS__ & __MWERKS__ >= 0x2301
387  std::ios_base::fmtflags oldFlags;
388 #else
389  int oldFlags;
390 #endif
391 // oldFlags = os.flags(ios::right|ios::hex|ios::uppercase);
392  oldFlags = os.flags(ios::right|ios::hex);
393 
394 // send wrapped data out
395  int wrap = 0; // wrap every 255 characters, NOT words
396  for( unsigned int i = 0; i < inBufLen; i++ ) {
397  BYTE data = inBuf[i];
398 // const unsigned short data = inBuf[i]; stupid stupid Andy changed earlier BYTE code to unsigned short
399 // so it wouldn't need to be cast below but that changed the hex being written! Assume some sign-extension happening.
400  os << setw(2) << setfill('0') << (unsigned short)data;
401  const int kWrapAt=127;
402  wrap++;
403  if( wrap >= kWrapAt ) {
404  os << endl;
405  wrap = 0;
406  }
407  } // wrapped output loop
408 
409  // Restore the stream to its old characteristics
410  os.flags( oldFlags );
411 }
412 
413 
419 void
420 oofRepRTFEnv::encodeToRTFStream(std::ostream& os, oofPict* inPict, int inWidthPixels, int inHeightPixels)
421 {
422 #ifdef _Macintosh
423  assert(!"need to merge in Mac picture drawing code here"); //lint !e506 constant Boolean
424 #elif defined(_Windows)
425  const int inWidthTwips = twips(inWidthPixels);
426  const int inHeightTwips = twips(inHeightPixels);
427  assert(inWidthPixels>0);
428  assert(inHeightPixels>0);
429 
430  os << "\\pard {"; // new para and group
431  if (false && inPict->hasJPEG()) {
432  os
433  << "\\pict\\jpegblip" // Device-Dependent, p 28 RTF 1.3 Spec
434  << "\\picw" << inWidthPixels
435  << "\\picwgoal" << inWidthTwips // yes the Goal values are in twips but size in pixels for Mac pict or bitmap
436  << "\\pich" << inHeightPixels
437  << "\\pichgoal" << inHeightTwips
438  << endl;
439  writeWrappedRTFasHexData(os, inPict->bufOfJPEG(), inPict->bytesInJPEG()); // cast from BYTE* to char*
440 
441  }
442  else if (false /*ngBitmapsNotMetafiles()*/) {
443  // Output the RTF bitmap header
444  os
445  << "\\pict\\wbitmap0" // Device-Dependent, p 28 RTF 1.3 Spec
446  << "\\wbmplanes1" // fixed value number of planes
447  << "\\picw" << inWidthPixels
448  << "\\picwgoal" << inWidthTwips // yes the Goal values are in twips but size in pixels for Mac pict or bitmap
449  << "\\pich" << inHeightPixels
450  << "\\pichgoal" << inHeightTwips
451  << endl;
452  oofDIB* pDIB = 0; // TEST HACK inPict->DIB();
453 // assert(pDIB);
454  if (pDIB) {
455  }
456  else { // fake output for release versions
457  COLORREF color = RGB(0,0,0);
458  // in-memory bitmap will be created
459  HBITMAP hTempBM = ::CreateBitmap(
460  inWidthPixels, // bitmap width, in pixels
461  inHeightPixels, // bitmap height, in pixels
462  1, // number of color planes used by device
463  1, // number of bits required to identify a color
464  &color // pointer to array containing color data
465  );
466 
467 // assert(hTempBM != NULL);
468  if (hTempBM) {
469  BITMAP bm;
470  int nRetVal = ::GetObject(hTempBM, sizeof(bm), &bm);
471  assert(nRetVal != 0);
472 
473  int bmpSize = bm.bmWidthBytes * bm.bmHeight * bm.bmPlanes;
474 
475  BYTE* buf = new BYTE[bmpSize];
476  DWORD dwRetVal = ::GetBitmapBits(hTempBM, bmpSize, buf);
477  assert(dwRetVal != 0);
478 
479  writeWrappedRTFasHexData(os, (const char*)buf, bmpSize); // cast from BYTE* to char*
480  delete buf;
481 
482  BOOL bRetVal = ::DeleteObject(hTempBM);
483  assert(bRetVal);
484  } // created hTempBM
485  } // fake output bitmap
486  }
487  else {// output as a metafile!!!
488  HDC hRefDC = ::CreateDC("DISPLAY", NULL, NULL, NULL);
489  // coordinate conversion from Platform SDK Help for CreateEnhMetaFile
490  // Convert client coordinates to .01-mm units.
491  // Use iWidthMM, iWidthPels, iHeightMM, and
492  // iHeightPels to determine the number of
493  // .01-millimeter units per pixel in the x-
494  // and y-directions.
495 
496  RECT boundRect;
497  boundRect.left = 0;
498  boundRect.top = 0;
499 // boundRect.right = (boundRect.right * iiWidthMM * 100)/inWidthPixels;
500 // boundRect.bottom = (boundRect.bottom * iHeightMM * 100)/inHeightPixels;
501  boundRect.right = (inWidthPixels*2540)/72; // our pixels are 72dpi in reports
502  boundRect.bottom = (inHeightPixels*2540)/72;
503  HDC hMetaFile = ::CreateEnhMetaFile(hRefDC, NULL, &boundRect, NULL);
504 // HDC hMetaFile = ::CreateMetaFile(NULL);
505 
506 // hack to just do gray square
507 // ::MoveToEx(hMetaFile, 0, 0, NULL);
508 // ::FillRect(hMetaFile, theLine, (HBRUSH)GetStockObject(GRAY_BRUSH));
509  {
510  assert(inPict);
511  inPict->draw(0 ,0, inWidthTwips, inHeightTwips, false /* not on printer*/, hMetaFile);
512  }
513  HENHMETAFILE hEnhMeta = ::CloseEnhMetaFile(hMetaFile);
514 // HMETAFILE hMeta = ::CloseMetaFile(hMetaFile);
515 
516 // *** finished constructing our Metafile, now stream out to RTF
517 
518  UINT cbBuffer = ::GetWinMetaFileBits(hEnhMeta, 0, NULL, MM_TEXT, hRefDC);
519 // UINT cbBuffer = ::GetMetaFileBitsEx(hMeta, 0, NULL);
520  BYTE* buf = new BYTE[cbBuffer];
521  assert(buf != NULL);
522 
523  cbBuffer = ::GetWinMetaFileBits(hEnhMeta, cbBuffer, buf, MM_TEXT, hRefDC);
524 // cbBuffer = ::GetMetaFileBitsEx(hMeta, cbBuffer, buf);
525 
526 //
527  // Output the RTF metafile header
528  os
529  << "\\pict\\wmetafile8" // 1 indicates MM_TEXT
530  << "\\picbmp" // metafile contains a bitmap
531  << "\\picbpp24" // FIXME:AD needs to be actual bit depth
532  << "\\picw" << inWidthTwips
533  << "\\pich" << inHeightTwips
534  << endl;
535 
536  writeWrappedRTFasHexData(os, (const char*)buf, cbBuffer);
537  ::DeleteEnhMetaFile((HENHMETAFILE)hMetaFile);
538 // ::DeleteObject(hRefDC);
539 // ::DeleteMetaFile(hMeta);
540  }
541 #endif // _Windows
542 
543 // closing paragraph after previous output
544  oofRepStreamEnv::out() << "} \\pard \\par" << endl;
545 
546 }
547 
548 // -------------------------------------------------------
549 // r e n d e r f a c t o r i e s
550 // -------------------------------------------------------
551 void
553 {
554  delete mRender; // assume if we're called and have existing it's wrong type
555  oofRepViewBand_Render* theRender = new oofRepViewBand_RTFRender(this);
556  mRender = theRender;
557  mTableExtraRender = theRender;
559 }
560 
561 
562 void
564 {
565  MakeAnyRender();
566 }
567 
568 void
570 {
571  delete mRender;
573 }
574 
575 
576 void
578 {
579  delete mRender;
581 }
582 
583 
584 void
586 {
587  delete mRender;
588  mRender = new oofRepLineBand_RTFRender(this);
589 }
590 
591 
592 void
594 {
595  delete mRender;
596  mRender = new oofRepPictBand_RTFRender(this);
597 }
598 
599 
600 void
602 {
603  delete mRender;
605 }
606 
607 
608 void
610 {
611  delete mRender;
613 }
614 
615 
616 void
618 {
619  delete mRender;
621 }
622 
623 void
625 {
626  delete mRender;
628 }
629 
630 // -------------------------------------------------------
631 // o o f R e p V i e w B a n d _R T F R e n d e r
632 // -------------------------------------------------------
635 {
636  return new oofRepViewBand_RTFRender((oofRepViewBand*)newOwner); // safe downcast
637 }
638 
639 void
640 oofRepViewBand_RTFRender::draw() // draws just current record
641 {
642 #ifdef OOF_DEBUG
643  oofRepStreamEnv::out() << "{\\comment oofRepViewBand_RTFRender::draw}\n";
644 #endif
645  assert(mOwner);
646  dbView* view = mOwner->view();
647  bool isBoxed = mOwner->isBoxed();
648  unsigned int numflds = view->count();
649 
650  // Microsoft Word 5.1a apparently demands repetitive rtf definitions or it crashes.
651  // Thus where in some cases it would be briefer and more logical to allow
652  // rows to inherit from previous rows, it's "safer" to be verbose.
653 
656  }
657 
658  // Standard table opener (for each row, including the column headers)
659  oofRepStreamEnv::out() << "\\trowd \\trgaph80\\trleft-80" << endl;
660 
661  view->start();
662 
663  // Make shading/border statements for each column
664  unsigned long accumCellMargin = 0;
665  for( unsigned int colNum=0; colNum<(numflds-1); colNum++ ) {
666  if( isBoxed ) {
667  oofRepStreamEnv::out() << "\\clbrdrt\\brdrs \\clbrdrl\\brdrs \\clbrdrb\\brdrs \\clbrdrr\\brdrs" << endl;
668  }
669  oofRepStreamEnv::out() << "\\clshdng0\\cellx";
670  accumCellMargin += view->colSizer()->width(colNum) + oofRep::currentReport()->settings()->colSepWidth();
671  oofRepStreamEnv::out() << twips( accumCellMargin ) << endl;
672  }
673  // last column stretches to the far edge of the page
674  if( isBoxed ) {
675  oofRepStreamEnv::out() << "\\clbrdrt\\brdrs \\clbrdrl\\brdrs \\clbrdrb\\brdrs \\clbrdrr\\brdrs" << endl;
676  }
677  oofRepStreamEnv::out() << "\\clshdng0\\cellx";
678  oofRepStreamEnv::out() << twips(oofRep::currentReport()->bodyWidth()) << endl;
679 
680  oofRepStreamEnv::out() << "\\pard\\plain \\intbl" << endl;
681 
682  { // ES - we need new scope for colNum, otherwise MSVC reports error - redefinition of colNum
683  for( unsigned int colNum=0; colNum<numflds; colNum++ ) {
684 
685  oofColSizer::colAlignT alignment = view->colSizer()->alignment(colNum);
686  // Cope with natural alignment
687  if(alignment==oofColSizer::alignNatural)
688  alignment = oofColSizer::naturalAlignmentForField(view->field(colNum).fieldType());
689 
690  switch(alignment){
691  case (oofColSizer::alignLeft):{
692  oofRepStreamEnv::out() << "\\ql";
693  }
694  break;
695 
696  case (oofColSizer::alignRight):{
697  oofRepStreamEnv::out() << "\\qr";
698  }
699  break;
700 
701  case (oofColSizer::alignCentre):{
702  oofRepStreamEnv::out() << "\\qc";
703  }
704  break;
705 
706  case (oofColSizer::alignJust):{
707  oofRepStreamEnv::out() << "\\qj";
708  }
709  break;
710  }
711 
712 // WARNING \q directives ignored in cells if included inside the {}
713 
714  oofRepStreamEnv::out() << "{";
715 
716  // Output font size and style information
717  int theSize = mOwner->textStyle()->fontSize();
718  int theStyle = mOwner->textStyle()->fontStyle();
719 
720 // NOT YET IMPLEMENTED - condense & extend ignored
721  if( theStyle & shadow ) { oofRepStreamEnv::out() << "\\shad";}
722  if( theStyle & outline ) { oofRepStreamEnv::out() << "\\outl";}
723  if( theStyle & underline ) { oofRepStreamEnv::out() << "\\ul";}
724  if( theStyle & italic ) { oofRepStreamEnv::out() << "\\i";}
725  if( theStyle & bold ) { oofRepStreamEnv::out() << "\\b"; }
726 
727  oofRepStreamEnv::out() << "\\fs" << 2*theSize; // font size
728 
729  oofRepStreamEnv::out() << "\\f21 "; // Helvetica ... NOT YET IMPLEMENTED - honor fontname
730 
731  // Scan the output for new lines whilst outputting
732  const oofString buf = oofRepRTFEnv::encodeRTFString( mOwner->view()->field(colNum).copyString() );
733  const char* runner = buf;
734 
735  while( *runner != '\0' ) {
736  if( (*runner == 0x0D) /* CR - for PC and Unix */ ||
737  (*runner == 0x0A) /* LF - for Mac */ )
738  oofRepStreamEnv::out() << "\n\\line ";
739  else
740  oofRepStreamEnv::out() << *runner;
741  runner++;
742  }
743  oofRepStreamEnv::out() << "}\\cell " << endl;
744  }
745  }
746 
747  // Finish off the table row
748  oofRepStreamEnv::out() << "\\pard \\intbl \\row" << endl;
749 }
750 
751 
752 void
754 {
756  if( oofRep::currentReport()->shouldDrawViewColumnHeaders() ) {
757 #ifdef OOF_DEBUG
758  oofRepStreamEnv::out() << "{\\comment oofRepViewBand_RTFRender::drawColumnHeaders}\n";
759 #endif
760 
761  assert(mOwner);
762  dbView* view = mOwner->view();
763  bool isBoxed = mOwner->isBoxed();
764  unsigned int numflds = view->count();
765 
766  // Standard table opener (for each row)
767  oofRepStreamEnv::out() << "\\trowd \\trgaph80\\trleft-80" << endl;
768 
769  view->start();
770 
771  // Make shading/border statements for each column
772  unsigned long accumCellMargin = 0;
773  for( unsigned int colNum=0; colNum<(numflds-1); colNum++ ) {
774  if( isBoxed ) {
775  oofRepStreamEnv::out() << "\\clbrdrt\\brdrs \\clbrdrl\\brdrs \\clbrdrb\\brdrs \\clbrdrr\\brdrs" << endl;
776  }
777  oofRepStreamEnv::out() << "\\clshdng0\\cellx";
778  accumCellMargin += view->colSizer()->width(colNum) + oofRep::currentReport()->settings()->colSepWidth();
779  oofRepStreamEnv::out() << twips( accumCellMargin ) << endl;
780  }
781  // last column stretches to the far edge of the page
782  if( isBoxed ) {
783  oofRepStreamEnv::out() << "\\clbrdrt\\brdrs \\clbrdrl\\brdrs \\clbrdrb\\brdrs \\clbrdrr\\brdrs" << endl;
784  }
785  oofRepStreamEnv::out() << "\\clshdng0\\cellx";
786  oofRepStreamEnv::out() << twips(oofRep::currentReport()->bodyWidth()) << endl;
787 
788  oofRepStreamEnv::out() << "\\pard\\plain \\intbl " << endl;
789 
790  { // ES - we need new scope for colNum, otherwise MSVC reports error - redefinition of colNum
791  for( unsigned int colNum=0; colNum<numflds; colNum++ ) {
792 
793  oofColSizer::colAlignT alignment = view->colSizer()->alignment(colNum);
794  // Cope with natural alignment
795  if(alignment==oofColSizer::alignNatural)
796  alignment = oofColSizer::naturalAlignmentForField(view->field(colNum).fieldType());
797 
798  switch(alignment){
799  case (oofColSizer::alignLeft):{
800  oofRepStreamEnv::out() << "\\ql";
801  }
802  break;
803 
804  case (oofColSizer::alignRight):{
805  oofRepStreamEnv::out() << "\\qr";
806  }
807  break;
808 
809  case (oofColSizer::alignCentre):{
810  oofRepStreamEnv::out() << "\\qc";
811  }
812  break;
813 
814  case (oofColSizer::alignJust):{
815  oofRepStreamEnv::out() << "\\qj";
816  }
817  break;
818  }
819 
820 // WARNING \q directives ignored in cells if included inside the {}
821 
822  oofRepStreamEnv::out() << "{";
823 
824  // Output font size and style information
825  int theSize = mOwner->textStyle()->fontSize();
826  //int theStyle = mOwner->textStyle()->fontStyle();
827 
828  // THIS IS A HACK, FIX THE MAC RENDERER THEN DUPLICATE EFFECT HERE
829  int theStyle = 1;
830 
831 // NOT YET IMPLEMENTED - condense & extend ignored
832  if( theStyle & shadow ) { oofRepStreamEnv::out() << "\\shad";}
833  if( theStyle & outline ) { oofRepStreamEnv::out() << "\\outl";}
834  if( theStyle & underline ) { oofRepStreamEnv::out() << "\\ul";}
835  if( theStyle & italic ) { oofRepStreamEnv::out() << "\\i";}
836  if( theStyle & bold ) { oofRepStreamEnv::out() << "\\b"; }
837 
838  oofRepStreamEnv::out() << "\\fs" << 2*theSize; // font size
839 
840  oofRepStreamEnv::out() << "\\f21 "; // Helvetica
841 
842  // Scan the output for new lines
843  OOF_String buf = mOwner->view()->getHeading(colNum);
844  const char* runner = buf;
845  while( *runner != '\0' ) {
846  if( (*runner == 0x0D) /* CR - for PC and Unix */ ||
847  (*runner == 0x0A) /* LF - for Mac */ )
848  oofRepStreamEnv::out() << "\n\\par \\intbl ";
849  else
850  oofRepStreamEnv::out() << *runner;
851  runner++;
852  }
853  oofRepStreamEnv::out() << "}\\cell " << endl;
854  }
855  }
856 
857  // Finish off the table row
858  oofRepStreamEnv::out() << "\\pard \\intbl \\row" << endl;
859  }
860 }
861 
862 
863 // -------------------------------------------------------
864 // o o f R e p L a y o u t B a n d _R T F R e n d e r
865 // -------------------------------------------------------
868 {
869  return new oofRepLayoutBand_RTFRender((oofRepLayoutBand*)newOwner); // safe downcast
870 }
871 
872 
878 void
880 {
881  if (mTabs.count()>0)
882  return; // need to call mTabs.clear() if want to regenerate list
883 
884  oofRepBlockList& blocks = mOwner->blocks();
885  blocks.start();
886 
887  int rowNumber = 0;
888  const int rightMarginTwips = twips(oofRep::currentReport()->bodyWidth());
889  bool justEndedRow = false;
890  unsigned long stopTwipsSinceLeftMargin = 0;
891  while( blocks.more() ) {
892  oofRepBlock* theBlock = blocks();
893  if ( theBlock->align()==oofRepBlock::alignCentre ) {
894  mTabs[rowNumber].append( oofRepTabStop(rightMarginTwips/2, oofRepTabStop::eCentred) );
895  }
896  if( theBlock->moveDownAfter() ) {
897  justEndedRow = true;
898  mTabs[rowNumber].append( oofRepTabStop(rightMarginTwips, oofRepTabStop::eRight) );
899  rowNumber++;
900  stopTwipsSinceLeftMargin = 0;
901  }
902  else {
903  const unsigned long blockFixedWidth = theBlock->fixedWidth();
904  if (blockFixedWidth>0) { // need a tabstop for the next block
905  stopTwipsSinceLeftMargin += twips(blockFixedWidth);
906  mTabs[rowNumber].append( oofRepTabStop(stopTwipsSinceLeftMargin) );
907  }
908  }
909 
910  blocks.next();
911  } // while blocks
912  if (!justEndedRow) { // last row needs finishing off
913  mTabs[rowNumber].append( oofRepTabStop(rightMarginTwips, oofRepTabStop::eRight) );
914  }
915 
916 
917 }
934 void
936 {
937  GenerateTabList();
938 
939 #ifdef OOF_DEBUG
940  oofRepStreamEnv::out() << "{\\comment oofRepLayoutBand_RTFRender::draw}\n";
941 #endif
942  assert(mOwner);
943  oofRepBlockList& blocks = mOwner->blocks();
944 // oofRep::currentReport()->changeTextStyle(blocks()->textStyle());
945 
946  oofRepStreamEnv::out() << "\\pard";
947 
948  blocks.start();
949 
950  int rowNumber = 0;
951  bool wroteTabAfterLastBlock = false;
952  mTabs[rowNumber].writeTabDefinitionsInRTF(oofRepStreamEnv::out());
953  while( blocks.more() ) {
954 
955  oofRepBlock * theBlock = blocks();
956 
957  // Output font size and style information
958  int theSize = blocks()->textStyle()->fontSize();
959  int theStyle = blocks()->textStyle()->fontStyle();
960 
961  oofRepStreamEnv::out() << "{";
962 
963 // NOT YET IMPLEMENTED - condense & extend ignored
964  if( theStyle & shadow ) { oofRepStreamEnv::out() << "\\shad";}
965  if( theStyle & outline ) { oofRepStreamEnv::out() << "\\outl";}
966  if( theStyle & underline ) { oofRepStreamEnv::out() << "\\ul";}
967  if( theStyle & italic ) { oofRepStreamEnv::out() << "\\i";}
968  if( theStyle & bold ) { oofRepStreamEnv::out() << "\\b"; }
969 
970  oofRepStreamEnv::out() << "\\fs" << 2*theSize; // font size
971 
972  oofRepStreamEnv::out() << "\\f21 "; // Helvetica
973 
974  if (wroteTabAfterLastBlock) { // previous block wrote tab
975  wroteTabAfterLastBlock = false;
976  }
977  else { // if no tab before this item need one for right or centred
978  if( ( theBlock->align()==oofRepBlock::alignRight ) || ( theBlock->align()==oofRepBlock::alignCentre ) ) {
979  oofRepStreamEnv::out() << "\\tab ";
980  }
981  }
982  theBlock->draw();
983 
984  oofRepStreamEnv::out() << "}";
985 
986  if( theBlock->moveDownAfter() ) {
987  oofRepStreamEnv::out() << "\\par \n\\pard";
988  rowNumber++;
989  mTabs[rowNumber].writeTabDefinitionsInRTF(oofRepStreamEnv::out());
990  }
991  else {
992  const unsigned long FixedWidth = theBlock->fixedWidth();
993  if (FixedWidth>0) { // need a tabstop for the next block
994  oofRepStreamEnv::out() << "\\tab ";
995  wroteTabAfterLastBlock = true;
996  }
997  }
998 
999  blocks.next();
1000  } // while blocks
1001  oofRepStreamEnv::out() << "\\par " << endl;
1002 }
1003 
1004 
1005 // -------------------------------------------------------
1006 // o o f R e p L i n e B a n d _R T F R e n d e r
1007 // -------------------------------------------------------
1008 oofRepRender*
1010 {
1011  return new oofRepLineBand_RTFRender((oofRepLineBand*)newOwner); // safe downcast
1012 }
1013 
1014 void
1016 {
1017 #ifdef OOF_DEBUG
1018  oofRepStreamEnv::out() << "{\\comment oofRepLineBand_RTFRender::draw}\n";
1019 #endif
1020 #ifdef _Macintosh
1021  assert(mOwner);
1022  unsigned long fixedHeight = mOwner->fixedHeight();
1023 
1024  // bodyWidth is in pixels
1025  Rect theLine={0,0,fixedHeight,oofRep::currentReport()->bodyWidth()};
1026 
1027  RgnHandle saveClipRgn = ::NewRgn(); // restores changes to current grafport
1028 
1029  ::GetClip( saveClipRgn ); // save current grafport
1030  ClipRect(&theLine);
1031 
1032  PicHandle hPic = ::OpenPicture(&theLine); // start drawing the line
1033 
1034  #if defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON!=0
1035  Pattern drawPat;
1036  if(1 ) // nasty hack to draw gray lines instead of black - need user settings!
1037  {
1038  ::FillRect(&theLine,::GetQDGlobalsGray(&drawPat));
1039  ::PenPat(::GetQDGlobalsGray(&drawPat));
1040  } else {
1041  ::FillRect(&theLine,::GetQDGlobalsBlack(&drawPat));
1042  ::PenPat(::GetQDGlobalsBlack(&drawPat));
1043  }
1044  #else
1045  if(1 ) // nasty hack to draw gray lines instead of black - need user settings!
1046  {
1047  ::FillRect(&theLine,&qd.gray);
1048  ::PenPat(&qd.gray);
1049  } else {
1050  ::FillRect(&theLine,&qd.black);
1051  ::PenPat(&qd.black);
1052  }
1053  #endif
1054  ::FrameRect(&theLine);
1055 
1056  ::ClosePicture(); // finish drawing the line
1057 #if defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON!=0
1058  ::PenPat(::GetQDGlobalsBlack(&drawPat));
1059 #else
1060  ::PenPat(&qd.black);
1061 #endif
1062  ::SetClip( saveClipRgn ); // restore previous value
1063  ::DisposeRgn( saveClipRgn ); // not needed any more
1064 
1065  // Output the RTF macpict header
1067  << "\\pard {\\pict\\macpict"
1068  << "\\picw" << theLine.right
1069  << "\\pich" << theLine.bottom
1070  << "\\pichgoal" << twips(theLine.bottom)
1071 
1072  << endl;
1073 
1074  HLock( (Handle)hPic ); // don't go away now...
1075 
1076  // PICT format reference: Inside Macintosh: Imaging With QuickDraw A-24
1077  // read in bits from the handle
1078  unsigned char opcode;
1079  unsigned char* bitsPointer = (unsigned char *)(*hPic);
1080 
1081  // In case the pict's size is greater than 32K it is necessary to
1082  // use this method instead of grabbing the first 2 bytes.
1083  int picSize = GetHandleSize( (Handle)hPic );
1084 
1085  // Save the streams old characteristics for restoration later
1086 #if defined __MWERKS__ & __MWERKS__ >= 0x2301
1087  std::ios_base::fmtflags oldFlags;
1088 #else
1089  int oldFlags;
1090 #endif
1091  oldFlags = oofRepStreamEnv::out().flags(ios::right|ios::hex|ios::uppercase);
1092 
1093  int wrap=0; // wrap every 60 words
1094  for( int word=0; word < picSize; word++ ) {
1095  opcode = *bitsPointer;
1096  bitsPointer++;
1097 
1098  oofRepStreamEnv::out() << setw(2) << setfill('0') << (unsigned short)opcode;
1099 
1100  wrap++;
1101  if( wrap >= 60 ) {
1102  oofRepStreamEnv::out() << endl;
1103  wrap=0;
1104  }
1105  }
1106 
1107  // Restore the stream to it's old characteristics
1108  oofRepStreamEnv::out().flags( oldFlags );
1109 
1110  // Should be 0xFF for End-Of-Pic opcode
1111  assert( opcode == 0xFF );
1112 
1113  HUnlock( (Handle)hPic );
1114  KillPicture( hPic );
1115 
1116  oofRepStreamEnv::out() << "} \\pard \\par" << endl;
1117 
1118 #elif defined _Windows
1119  assert(mOwner);
1120 /* unsigned long fixedHeight = mOwner->fixedHeight();
1121 
1122  // bodyWidth is in pixels
1123  oofRect theLine(0,0,oofRep::currentReport()->bodyWidth(),fixedHeight);
1124  // initial color;
1125  COLORREF color = RGB(0,0,0);
1126  // in-memory bitmap will be created
1127  HBITMAP hBmpLine = ::CreateBitmap(
1128  oofRep::currentReport()->bodyWidth(), // bitmap width, in pixels
1129  fixedHeight, // bitmap height, in pixels
1130  1, // number of color planes used by device
1131  1, // number of bits required to identify a color
1132  &color // pointer to array containing color data
1133  );
1134 
1135  assert(hBmpLine != NULL);
1136 
1137  // Output the RTF bitmap header
1138  oofRepStreamEnv::out()
1139  << "\\pard {\\pict\\wbitmap0"
1140  << "\\picw" << theLine.right
1141  << "\\pich" << theLine.bottom
1142  << endl;
1143 
1144  BITMAP bm;
1145  int nRetVal = ::GetObject(hBmpLine, sizeof(bm), &bm);
1146  assert(nRetVal != 0);
1147 
1148  int bmpSize = bm.bmWidthBytes * bm.bmHeight * bm.bmPlanes;
1149 
1150  BYTE* buf = new BYTE[bmpSize];
1151  DWORD dwRetVal = ::GetBitmapBits(hBmpLine, bmpSize, buf);
1152  assert(dwRetVal != 0);
1153 
1154  BYTE data;
1155 
1156  // Save the streams old characteristics for restoration later
1157 #if defined __MWERKS__ & __MWERKS__ == 0x2301
1158  std::ios_base::fmtflags oldFlags;
1159 #else
1160  int oldFlags;
1161 #endif
1162  oldFlags = oofRepStreamEnv::out().flags(ios::right|ios::hex|ios::uppercase);
1163 
1164  int wrap = 0; // wrap every 60 words
1165  for( int i = 0; i < bmpSize; i++ ) {
1166  data = buf[i];
1167 
1168  oofRepStreamEnv::out() << setw(2) << setfill('0') << (unsigned short)data;
1169 
1170  wrap++;
1171  if( wrap >= 60 ) {
1172  oofRepStreamEnv::out() << endl;
1173  wrap = 0;
1174  }
1175  }
1176 
1177  // Restore the stream to it's old characteristics
1178  oofRepStreamEnv::out().flags( oldFlags );
1179 
1180  oofRepStreamEnv::out() << "} \\pard \\par" << endl;
1181 
1182  delete buf;
1183 
1184  BOOL bRetVal = ::DeleteObject(hBmpLine);
1185  assert(bRetVal);
1186 */
1187  unsigned long fixedHeight = mOwner->fixedHeight();
1188 
1189  // bodyWidth is in pixels
1190  oofRect theLine(0,0,twips(oofRep::currentReport()->bodyWidth()),twips(fixedHeight));
1191 
1192 // HDC hRefDC = ::CreateDC("DISPLAY", NULL, NULL, NULL);
1193 // HDC hMetaFile = ::CreateEnhMetaFile(hRefDC, NULL, theLine, NULL);
1194  HDC hMetaFile = ::CreateMetaFile(NULL);
1195 
1196  ::MoveToEx(hMetaFile, 0, 0, NULL);
1197  ::FillRect(hMetaFile, theLine, (HBRUSH)GetStockObject(GRAY_BRUSH));
1198 // HENHMETAFILE hEnhMeta = ::CloseEnhMetaFile(hMetaFile);
1199  HMETAFILE hMeta = ::CloseMetaFile(hMetaFile);
1200 
1201 // UINT cbBuffer = ::GetWinMetaFileBits(hEnhMeta, 0, NULL, MM_TEXT, hRefDC);
1202  UINT cbBuffer = ::GetMetaFileBitsEx(hMeta, 0, NULL); // get size with first call, null pointer to buffer
1203  BYTE* buf = new BYTE[cbBuffer];
1204  assert(buf != NULL);
1205 
1206 // cbBuffer = ::GetWinMetaFileBits(hEnhMeta, cbBuffer, buf, MM_TEXT, hRefDC);
1207  cbBuffer = ::GetMetaFileBitsEx(hMeta, cbBuffer, buf); // fill buffer
1208 
1209 //
1210  // Output the RTF metafile header
1212  << "\\pard {\\pict\\wmetafile1"
1213  << "\\picw" << theLine.right
1214  << "\\pich" << theLine.bottom
1215  << "\\picwgoal" << theLine.right
1216  << "\\pichgoal" << theLine.bottom
1217  << endl;
1218 
1219  oofRepRTFEnv::writeWrappedRTFasHexData(oofRepStreamEnv::out(), (const char*)buf, cbBuffer);
1220 #if 0
1221  BYTE data;
1222  // Save the streams old characteristics for restoration later
1223 #if defined __MWERKS__ & __MWERKS__ == 0x2301
1224  std::ios_base::fmtflags oldFlags;
1225 #else
1226  int oldFlags;
1227 #endif
1228  oldFlags = oofRepStreamEnv::out().flags(ios::right|ios::hex|ios::uppercase);
1229 
1230  int wrap = 0; // wrap every 60 words
1231  for( int i = 0; (unsigned int)i < cbBuffer; i++ ) {
1232  data = buf[i];
1233 
1234  oofRepStreamEnv::out() << setw(2) << setfill('0') << (unsigned short)data;
1235 
1236  wrap++;
1237  if( wrap >= 60 ) {
1238  oofRepStreamEnv::out() << endl;
1239  wrap = 0;
1240  }
1241  }
1242 
1243  // Restore the stream to it's old characteristics
1244  oofRepStreamEnv::out().flags( oldFlags );
1245 
1246 #endif
1247  oofRepStreamEnv::out() << "} \\pard \\par" << endl;
1248  delete buf;
1249 // ::DeleteEnhMetaFile(hEnhMeta);
1250 // ::DeleteObject(hRefDC);
1251  ::DeleteMetaFile(hMeta);
1252 #endif
1253 }
1254 
1255 
1256 // -------------------------------------------------------
1257 // o o f R e p P i c t B a n d _R T F R e n d e r
1258 // -------------------------------------------------------
1259 oofRepRender*
1261 {
1262  return new oofRepPictBand_RTFRender((oofRepPictBand*)newOwner); // safe downcast
1263 }
1264 
1269 void
1271 {
1272 #ifdef OOF_DEBUG
1273  oofRepStreamEnv::out() << "{\\comment oofRepPictBand_RTFRender::draw}\n";
1274 #endif
1275  assert(mOwner);
1276  const int drawWidth = oofRep::currentReport()->bodyWidth();
1277  const int drawHeight = mOwner->fixedHeight();
1279 }
1280 
1281 // -------------------------------------------------------
1282 // o o f R e p S p a c e B a n d _R T F R e n d e r
1283 // -------------------------------------------------------
1284 oofRepRender*
1286 {
1287  return new oofRepSpaceBand_RTFRender((oofRepSpaceBand*)newOwner); // safe downcast
1288 }
1289 
1290 
1291 void
1293 {
1294 #ifdef OOF_DEBUG
1295  oofRepStreamEnv::out() << "{\\comment oofRepSpaceBand_RTFRender::draw}\n";
1296 #endif
1297  assert(mOwner);
1298  oofRepStreamEnv::out() << "\\pard \\sl-" << twips(mOwner->fixedHeight()) << "\n\\par \\pard" << endl;
1299 // minus sign means exactly
1300 }
1301 
1302 
1303 // -------------------------------------------------------
1304 // o o f R e p G r a p h B a n d _R T F R e n d e r
1305 // -------------------------------------------------------
1306 oofRepRender*
1308 {
1309  return new oofRepGraphBand_RTFRender((oofRepGraphBand*)newOwner); // safe downcast
1310 }
1311 
1316 void
1318 {
1319 #ifdef OOF_DEBUG
1320  oofRepStreamEnv::out() << "{\\comment oofRepGraphBand_RTFRender::draw}\n";
1321 #endif
1322 #ifdef _Macintosh
1323 
1324  assert(mOwner);
1325  unsigned long graphHeight = mOwner->graphHeight();
1326  unsigned long graphWidth = mOwner->graphWidth();
1327  Rect theFrame;
1328 
1329  unsigned long width=oofRep::currentReport()->bodyWidth();
1330  if (graphWidth>width) {
1331 // STUPID BUG double shrinkBy = (graphWidth - width)/graphWidth;
1332  double shrinkBy = 1.0 - double(graphWidth - width)/graphWidth;
1333  graphWidth = width;
1334  graphHeight = graphHeight * shrinkBy;
1335  }
1337  << "\\pard \\qc {\\pict\\macpict"
1338  << "\\picw" << graphWidth
1339  << "\\pich" << graphHeight
1340  << endl;
1341 
1343  SetRect(&theFrame,0,0,graphWidth,graphHeight); // left, top, right, bottom - bloody SetRect!!!
1344  OffsetRect(&theFrame,(width-graphWidth)/2,0);
1345 
1346 
1347  OffsetRect(&theFrame,oofRep::currentReport()->settings()->leftMargin(),
1348  oofRep::currentReport()->currentVerticalPos());
1349 
1350  RgnHandle saveClipRgn = NewRgn(); // restores changes to current grafport
1351 
1352  GetClip( saveClipRgn ); // save current grafport
1353  mOwner->graph()->setPaneRect(theFrame);
1354  ClipRect(&theFrame);
1355 
1356  PicHandle hPic = OpenPicture(&theFrame);
1357  mOwner->graph()->draw();
1358  ClosePicture();
1359 
1360  SetClip( saveClipRgn ); // restore previous value
1361  DisposeRgn( saveClipRgn ); // not needed any more
1362 
1363  HLock( (Handle)hPic ); // don't go away now...
1364 
1365  // PICT format reference: Inside Macintosh: Imaging With QuickDraw A-24
1366  // read in bits from the handle
1367  unsigned char opcode;
1368  unsigned char* bitsPointer = (unsigned char *)(*hPic);
1369 
1370  // In case the pict's size is greater than 32K it is necessary to
1371  // use this method instead of grabbing the first 2 bytes.
1372  int picSize = GetHandleSize( (Handle)hPic );
1373 
1374  // Save the streams old characteristics for restoration later
1375 #if defined __MWERKS__ & __MWERKS__ >= 0x2301
1376  std::ios_base::fmtflags oldFlags;
1377 #else
1378  int oldFlags;
1379 #endif
1380  oldFlags = oofRepStreamEnv::out().flags(ios::right|ios::hex|ios::uppercase);
1381 
1382  int wrap=0; // wrap every 60 words
1383  for( int word=0; word < picSize; word++ ) {
1384  opcode = *bitsPointer;
1385  bitsPointer++;
1386 
1387  oofRepStreamEnv::out() << setw(2) << setfill('0') << (unsigned short)opcode;
1388 
1389  wrap++;
1390  if( wrap >= 60 ) {
1391  oofRepStreamEnv::out() << endl;
1392  wrap=0;
1393  }
1394  }
1395 
1396  // Restore the stream to it's old characteristics
1397  oofRepStreamEnv::out().flags( oldFlags );
1398 
1399  // Should be 0xFF for End-Of-Pic opcode
1400  assert( opcode == 0xFF );
1401 
1402  HUnlock( (Handle)hPic );
1403 
1404  oofRepStreamEnv::out() << "}\\par " << endl;
1405 
1406 #elif defined _Windows
1407 /* old crap
1408  unsigned long width=oofRep::currentReport()->bodyWidth();
1409  if (graphWidth>width) {
1410  double shrinkBy = 1.0 - double(graphWidth - width)/graphWidth;
1411  graphWidth = width;
1412  graphHeight = graphHeight * shrinkBy;
1413  }
1414 
1415  oofRect theFrame;
1416 
1417  theFrame.set(0,0,graphWidth,graphHeight);
1418  theFrame.offset((width-graphHeight)/2, 0);
1419  theFrame.offset(oofRep::currentReport()->settings()->leftMargin(),
1420  oofRep::currentReport()->currentVerticalPos());
1421 */
1422  assert(mOwner);
1423  const unsigned long fixedHeight = mOwner->fixedHeight();
1424  const unsigned long bodyWidth = oofRep::currentReport()->bodyWidth();
1425  const unsigned long graphWidth = mOwner->graphWidth();
1426  const unsigned long graphHeight = mOwner->graphHeight();
1427 
1428  assert(mOwner->graphWidth()>0);
1429  unsigned long graphLeft, graphRight, graphBottom, graphTop;
1430  if (bodyWidth > graphWidth) {
1431  graphLeft = (bodyWidth-graphWidth)/2;
1432  graphRight = graphWidth+graphLeft;
1433  }
1434  else {
1435  graphLeft = 0;
1436  graphRight = bodyWidth;
1437  }
1438  if (fixedHeight > graphHeight) {
1439  graphTop = (fixedHeight-graphHeight)/2;
1440  graphBottom = graphTop+graphHeight;
1441  }
1442  else {
1443  graphTop = 0;
1444  graphBottom = fixedHeight;
1445  }
1446  oofRect theFrame(graphLeft,graphTop,graphRight ,graphBottom);
1447 // const bool usingWin32s = oofRuntimeEnv::runtimeEnv()==oofRuntimeEnv::Win32s;
1448 // if (usingWin32s)
1449  {
1450  // create the standard in-memory metafile
1451  HDC hMetaFile = ::CreateMetaFile(NULL);
1452  oofCurrentDraw::setCurrentDC(hMetaFile);
1453 
1454  ::MoveToEx(hMetaFile, 0, 0, NULL);
1455  // redraw the graph to create this metafile
1456 // ::SetMapMode(hMetaFile, MM_TWIPS);
1457 
1459  mOwner->graph()->setPaneRect(theFrame);
1460  mOwner->graph()->draw();
1461  HMETAFILE hMeta = ::CloseMetaFile(hMetaFile);
1462  oofCurrentDraw::setCurrentDC(0);
1463 
1464  UINT cbBuffer = ::GetMetaFileBitsEx(hMeta, 0, NULL);
1465  BYTE* buf = new BYTE[cbBuffer];
1466  assert(buf != NULL);
1467  cbBuffer = ::GetMetaFileBitsEx(hMeta, cbBuffer, buf);
1468 
1469  const unsigned long outWidth = theFrame.right;
1470  const unsigned long outHeight = theFrame.bottom;
1471  const unsigned long outGoalWidth = theFrame.right;
1472  const unsigned long outGoalHeight = theFrame.bottom;
1473 
1474  // Output the RTF metafile header
1476 // << "\\pard {\\pict\\wmetafile8" // MM_ANISOTROPIC
1477  << "\\pard {\\pict\\wmetafile1" // MM_TEXT
1478  << "\\picw" << outWidth
1479  << "\\pich" << outHeight
1480  << "\\picwgoal" << twips(outGoalWidth)
1481  << "\\pichgoal" << twips(outGoalHeight)
1482  << endl;
1483 
1484  BYTE data;
1485  // Save the streams old characteristics for restoration later
1486 #if defined __MWERKS__ & __MWERKS__ == 0x2301
1487  std::ios_base::fmtflags oldFlags;
1488 #else
1489  int oldFlags;
1490 #endif
1491  oldFlags = oofRepStreamEnv::out().flags(ios::right|ios::hex|ios::uppercase);
1492 
1493  int wrap = 0; // wrap every 60 words
1494  for( unsigned int i = 0; i < cbBuffer; i++ ) {
1495  data = buf[i];
1496 
1497  oofRepStreamEnv::out() << setw(2) << setfill('0') << (unsigned short)data;
1498 
1499  wrap++;
1500  if( wrap >= 60 ) {
1501  oofRepStreamEnv::out() << endl;
1502  wrap = 0;
1503  }
1504  }
1505 
1506  // Restore the stream to it's old characteristics
1507  oofRepStreamEnv::out().flags( oldFlags );
1508 
1509  oofRepStreamEnv::out() << "} \\pard \\par" << endl;
1510  //
1511  delete buf;
1512  ::DeleteMetaFile(hMeta);
1513  } // win32s so use old metafile
1514 #if 0
1515  else {
1516  HDC hRefDC = ::CreateDC("DISPLAY", NULL, NULL, NULL);
1517  HDC hMetaFile = ::CreateEnhMetaFile(hRefDC, NULL, theFrame, NULL);
1518  oofCurrentDraw::setCurrentDC(hMetaFile);
1519 
1520  ::MoveToEx(hMetaFile, 0, 0, NULL);
1521  // redraw the graph to create this metafile
1523  mOwner->graph()->setPaneRect(theFrame);
1524  mOwner->graph()->draw();
1525 
1526  HENHMETAFILE hEnhMeta = ::CloseEnhMetaFile(hMetaFile);
1527  oofCurrentDraw::setCurrentDC(0);
1528 
1529  UINT cbBuffer = ::GetWinMetaFileBits(hEnhMeta, 0, NULL, MM_TEXT, hRefDC);
1530  BYTE* buf = new BYTE[cbBuffer];
1531  assert(buf != NULL);
1532 
1533  cbBuffer = ::GetWinMetaFileBits(hEnhMeta, cbBuffer, buf, MM_TEXT, hRefDC);
1534 
1535  // Output the RTF metafile header
1536  ENHMETAHEADER hMetaHeader;
1537  UINT nRetVal = ::GetEnhMetaFileHeader(hEnhMeta, sizeof(ENHMETAHEADER), &hMetaHeader);
1538  const unsigned long outWidth = hMetaHeader.rclBounds.right;
1539  const unsigned long outHeight = hMetaHeader.rclBounds.bottom;
1540  const unsigned long outGoalWidth = hMetaHeader.rclFrame.right;
1541  const unsigned long outGoalHeight = hMetaHeader.rclFrame.bottom;
1542 
1544  << "\\pard {\\pict\\wmetafile1" // MM_TEXT
1545 // << "\\pard {\\pict\\wmetafile3" // MM_LOMETRIC
1546  << "\\picw" << outWidth
1547  << "\\pich" << outHeight
1548 // << "\\picwgoal" << outGoalWidth
1549 // << "\\pichgoal" << outGoalHeight
1550  << endl;
1551 
1552  BYTE data;
1553  // Save the streams old characteristics for restoration later
1554 #if defined __MWERKS__ & __MWERKS__ == 0x2301
1555  std::ios_base::fmtflags oldFlags;
1556 #else
1557  int oldFlags;
1558 #endif
1559  oldFlags = oofRepStreamEnv::out().flags(ios::right|ios::hex|ios::uppercase);
1560 
1561  int wrap = 0; // wrap every 60 words
1562  for( unsigned int i = 0; i < cbBuffer; i++ ) {
1563  data = buf[i];
1564 
1565  oofRepStreamEnv::out() << setw(2) << setfill('0') << (unsigned short)data;
1566 
1567  wrap++;
1568  if( wrap >= 60 ) {
1569  oofRepStreamEnv::out() << endl;
1570  wrap = 0;
1571  }
1572  }
1573 
1574  // Restore the stream to it's old characteristics
1575  oofRepStreamEnv::out().flags( oldFlags );
1576 
1577  oofRepStreamEnv::out() << "} \\pard \\par" << endl;
1578  //
1579  delete buf;
1580  ::DeleteEnhMetaFile(hEnhMeta);
1581  ::DeleteObject(hRefDC);
1582  } // output enhanced
1583 #endif
1584 
1585 /* INFO FROM RTF STANDARD VERSION 1.3, found from
1586 MSDN library Product Documentation, Applications, Word for Windows 6.0
1587 
1588 Picture Size, Scaling, and Cropping
1589 
1590 \ picwN xExt field if the picture is a Windows metafile; picture width in pixels if the picture is a bitmap or from QuickDraw.
1591 \ pichN yExt field if the picture is a Windows metafile; picture height in pixels if the picture is a bitmap or from QuickDraw.
1592 \ picwgoalN Desired width of the picture in twips.
1593 \ pichgoalN Desired height of the picture in twips.
1594 \ picscalexN Horizontal scaling value; the N argument is a value representing a percentage (the default is 100).
1595 \ picscaleyN Vertical scaling value; the N argument is a value representing a percentage (the default is 100).
1596 \ picscaled Scales the picture to fit within the specified frame; used only with \ macpict pictures.
1597 \ piccroptN Top cropping value in twips; a positive value crops toward the center of the picture; a negative value crops away from the center, adding a space border around picture (the default is 0).
1598 \ piccropbN Bottom cropping value in twips; a positive value crops toward the center of the picture; a negative value crops away from the center, adding a space border around picture (the default is 0).
1599 \ piccroplN Left cropping value in twips; a positive value crops toward the center of the picture; a negative value crops away from the center, adding a space border around picture (the default is 0).
1600 \ piccroprN Right cropping value in twips; a positive value crops toward the center of the picture; a negative value crops away from the center, adding a space border around picture (the default is 0).
1601 
1602 
1603 Trailing digit on wmetafile indicates mapping mode
1604  Type N argument
1605 
1606 MM_TEXT 1
1607 MM_LOMETRIC 2
1608 MM_HIMETRIC 3
1609 MM_LOENGLISH 4
1610 MM_HIENGLISH 5
1611 MM_TWIPS 6
1612 MM_ISOTROPIC 7
1613 MM_ANISOTROPIC 8
1614 
1615 After standard metafile editing in Word, something like
1616 \wmetafile8\picw12581\pich9245\picwgoal7133\pichgoal5241
1617 */
1618 #endif
1619 }
1620 
1621 
1622 // -------------------------------------------------------
1623 // o o f R e p T e x t B l o c k _R T F R e n d e r
1624 // -------------------------------------------------------
1625 oofRepRender*
1627 {
1628  return new oofRepTextBlock_RTFRender((oofRepTextBlock*)newOwner); // safe downcast
1629 }
1630 
1631 
1632 void
1634 {
1635 #ifdef OOF_DEBUG
1636  oofRepStreamEnv::out() << "{\\comment oofRepTextBlock_RTFRender::draw}\n";
1637 #endif
1638  //oofRepStreamEnv::out() << mOwner->text();
1639  assert(mOwner);
1641 }
1642 
1643 
1644 // -------------------------------------------------------
1645 // o o f R e p P i c t B l o c k _R T F R e n d e r
1646 // -------------------------------------------------------
1647 oofRepRender*
1649 {
1650  return new oofRepPictBlock_RTFRender((oofRepPictBlock*)newOwner); // safe downcast
1651 }
1652 
1653 
1654 void
1656 {
1657 #ifdef OOF_DEBUG
1658  oofRepStreamEnv::out() << "{\\comment oofRepPictBlock_RTFRender::draw}\n";
1659 #endif
1660  assert(mOwner);
1661  const int drawWidth = mOwner->width();
1662  const int drawHeight = mOwner->fixedHeight();
1664 }
1665 
1666 // -------------------------------------------------------
1667 // o o f R e p P a g e N o B l o c k _R T F R e n d e r
1668 // -------------------------------------------------------
1669 oofRepRender*
1671 {
1672  return new oofRepPageNoBlock_RTFRender((oofRepPageNoBlock*)newOwner); // safe downcast
1673 }
1674 
1675 
1676 void
1678 {
1679 #ifdef OOF_DEBUG
1680  oofRepStreamEnv::out() << "{\\comment oofRepPageNoBlock_RTFRender::draw}\n";
1681 #endif
1682  assert(mOwner);
1683  oofRepStreamEnv::out() << mOwner->leadingText() <<"\\chpgn " << mOwner->trailingText();
1684 
1685 // DON'T WANT ACTUAL PAGE NUMBERS HARDCODED, AS WORD DOES ITS OWN BREAKS
1686 // char pn[10];
1687 // sprintf(pn,"%d",oofRep::currentReport()->pageNumber());
1688 
1689 // oofRepStreamEnv::out() << pn << mOwner->trailingText();
1690 }
1691 
1692 // -------------------------------------------------------
1693 // o o f R e p T a b S t o p
1694 // -------------------------------------------------------
1699 void
1701 {
1702  if (mTabType==eRight)
1703  os << "\\tqr"; // prefix with a tab type
1704  else if (mTabType==eCentred)
1705  os << "\\tqc";
1706  os << "\\tx" << mTwipsFromLeftMargin;
1707 }
1708 
1709 
1710 // -------------------------------------------------------
1711 // o o f R e p T a b S t o p L i n e
1712 // -------------------------------------------------------
1713 
1715 {
1716  start();
1717  while (more()) {
1718  oofRepTabStop* theStop = operator()();
1719  assert(theStop);
1720  delete theStop;
1721  next();
1722  }
1723 }
1724 
1725 
1726 void
1728 {
1729  oofRepTabStop* pStop = new oofRepTabStop(copiedStop);
1730  mStops.append((long)pStop);
1731 }
1732 
1733 
1734 void
1736 {
1737  start();
1738  while (more()) {
1739  oofRepTabStop* theStop = operator()();
1740  assert(theStop);
1741  theStop->writeTabDefinitionsInRTF(os);
1742  next();
1743  }
1744 }
1745 
1746 
1747 // -------------------------------------------------------
1748 // o o f R e p T a b S t o p S e t
1749 // -------------------------------------------------------
1750 
1752 {
1753  clear();
1754 }
1755 
1756 
1761 void
1763 {
1764  const unsigned long numLines = mStopLines.count();
1765  for (unsigned long index=0; index<numLines; index++) {
1766  oofRepTabStopList*& theLine = (oofRepTabStopList*&)mStopLines[index];
1767  delete theLine;
1768  theLine = 0;
1769  }
1770 }
1771 
1772 
1774 oofRepTabStopSet::operator[](unsigned long index)
1775 {
1776  oofRepTabStopList*& pList = (oofRepTabStopList*&)mStopLines[index];
1777  if (!pList) {
1778  pList = new oofRepTabStopList; // put the new into the referred cell
1779  assert(pList);
1780  }
1781  return *pList;
1782 }
oofRepPageNoBlock_RTFRender(oofRepPageNoBlock *b)
Definition: oofrpRTF.h:258
unsigned long fixedHeight()
Definition: oofrep1.cpp:1908
Base environment for rendering to a text stream.
Definition: oofrep.h:446
oofString leadingText() const
Definition: oofrep.h:2240
output a \chpgn tag to show page number in body of page.
Definition: oofrpRTF.h:256
void colSizer(oofColSizer *adoptedSizer)
Definition: oofsize.cpp:71
oofRepViewBand_RTFRender(oofRepViewBand *b)
Definition: oofrpRTF.h:221
Cross-platform way to specify rectangle with Mac-style setter.
Definition: oofRect.h:39
void start()
Definition: oof1.h:1505
virtual unsigned long width() const
Definition: oofrep1.cpp:1444
oofRepPictBand * mOwner
Definition: oofreprn.h:97
int twips(int pixels)
Definition: oofrep.h:2805
virtual void makeRender(const oofRepMacEnv &env)
Definition: oofrepMac.cpp:169
oofRepPageNoBlock * mOwner
Definition: oofreprn.h:203
static bool sExportBitmapsNotMetafiles
Due to major import problems with Metafiles in RTF, have default true on this flag.
Definition: oofrpRTF.h:64
virtual unsigned long fixedHeight()
Definition: oofrep.h:2179
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
Tries to hide the different platforms and version issues with standard IO.
oofRepBandList & pageFooters()
Definition: oofrep.h:1881
virtual void makeRender(const oofRepMacEnv &)
Definition: oofrepMac.cpp:137
virtual void draw()
Each layout band is a single paragraph which is assumed to have a right-aligned tab.
Definition: oofrpRTF.cpp:935
oofRepSpaceBand_RTFRender(oofRepSpaceBand *b)
Definition: oofrpRTF.h:151
unsigned long graphWidth() const
Definition: oofrep.h:2679
void next()
Definition: oofrep.h:2385
virtual oofRepRender * clone(const oofRepDrawable *newOwner) const
Definition: oofrpRTF.cpp:1260
void setPaneRect(Rect inRect)
Definition: oofGrphs.cpp:105
oofRepTabStopList & operator[](unsigned long index)
Definition: oofrpRTF.cpp:1774
void drawFirstPageFooters()
Definition: oofrep1.cpp:651
oofRepSpaceBand * mOwner
Definition: oofreprn.h:31
bool isBoxed() const
Definition: oofrep.h:2100
Macintosh structure for a rectangle.
oofRepLayoutBand * mOwner
Definition: oofreprn.h:69
std::ostream * mOut
Definition: oofrep.h:457
bool mDrawnColHeadersThisPage
Definition: oofreprn.h:148
unsigned char BYTE
Definition: oofrpRTF.cpp:24
virtual oofRepRender * clone(const oofRepDrawable *newOwner) const
Definition: oofrpRTF.cpp:634
virtual unsigned long calcPageWidth()
Definition: oofrpRTF.cpp:137
void drawColumnHeaders()
Definition: oofrep2.cpp:340
unsigned long count() const
Definition: oofarray.h:126
Render an oofRepLineBand by creating an embedded picture.
Definition: oofrpRTF.h:191
const dbField & field(unsigned int) const
Definition: oofview.h:206
unsigned long count() const
Definition: oofrpRTF.h:360
unsigned long graphHeight() const
Definition: oofrep.h:2686
blockAlignT align() const
Definition: oofrep.h:2205
Most commonly used top band in a report.
Definition: oofrep.h:1283
Output picture as appropriate tag based on oofPict image type.
Definition: oofrpRTF.h:205
unsigned short bottomMargin() const
Definition: oofrep3.cpp:401
unsigned long bytesInJPEG() const
Definition: oofdraw.h:416
void draw()
Definition: oofGrphs.cpp:81
virtual void makeRender(const oofRepMacEnv &env)
Definition: oofrepMac.cpp:177
unsigned long bodyWidth()
Definition: oofrep.h:1968
Base rendering class.
Definition: oofrep.h:816
virtual void makeRenderDispatch(oofRepDrawable *) const
Definition: oofrpRTF.cpp:73
Describe an individual tab stop.
Definition: oofrpRTF.h:75
virtual void endEnvironment()
Definition: oofrpRTF.cpp:283
virtual void draw()
Definition: oofrpRTF.cpp:640
void drawFirstPageHeaders()
Definition: oofrep1.cpp:627
const oofRepSettings * settings() const
Definition: oofrep1.cpp:469
List of oofRepTabStop's in a single paragraph.
Definition: oofrpRTF.h:94
virtual unsigned long width()
Definition: oofrep2.cpp:1017
oofRepTabStopSet mTabs
Definition: oofrpRTF.h:182
virtual unsigned long fixedHeight()
Definition: oofrep.h:2736
virtual void changeTextStyle(oofRepTextStyle *)
Definition: oofrpRTF.cpp:116
void writeTabDefinitionsInRTF(std::ostream &)
Definition: oofrpRTF.cpp:1735
static oofString encodeRTFString(const oofString &)
Definition: oofrpRTF.cpp:304
virtual unsigned long fixedHeight()
Definition: oofrep2.cpp:1003
virtual unsigned long calcPageHeight()
Definition: oofrpRTF.cpp:129
bool more() const
Definition: oofrep.h:2378
virtual void makeRender(const oofRepMacEnv &env)
Definition: oofrepMac.cpp:145
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 oofRepRenderT renderType() const
Definition: oofrpRTF.cpp:101
static void encodeToRTFStream(std::ostream &, const char *)
Definition: oofrpRTF.cpp:355
oofRepTextBlock * mOwner
Definition: oofreprn.h:175
GUI report-writer layer of OOFILE database.
oofRepBlockList & blocks()
Definition: oofrep.h:2718
Provide an iterable set of fields.
Definition: oofview.h:26
oofGraph * graph() const
Definition: oofrep.h:2672
virtual oofRepRender * clone(const oofRepDrawable *newOwner) const
Definition: oofrpRTF.cpp:1285
void start()
Definition: oofrep.h:2371
virtual oofRepRender * clone(const oofRepDrawable *newOwner) const
Definition: oofrpRTF.cpp:867
unsigned short topMargin() const
Definition: oofrep3.cpp:382
virtual bool preprocessesPageHeadersAndFooters() const
Definition: oofrpRTF.cpp:293
virtual void finishConstruction()
Definition: oofrep.h:820
oofRepLayoutBand_RTFRender(oofRepLayoutBand *b)
Definition: oofrpRTF.h:176
virtual void makeRender(const oofRepMacEnv &env)
Definition: oofrepMac.cpp:161
static void writeWrappedRTFasHexData(std::ostream &os, const char *inBuf, const unsigned int inBufLen)
Helper function for encodeToRTFStream.
Definition: oofrpRTF.cpp:383
void append(const oofRepTabStop &)
Definition: oofrpRTF.cpp:1727
Iterate block renderers according to the oofRepLayoutBand.
Definition: oofrpRTF.h:174
static std::ostream & out()
Definition: oofrep.h:2727
oofString trailingText() const
Definition: oofrep.h:2247
Write graph as Mac or Win32 picture embedded in RTF.
Definition: oofrpRTF.h:161
void clear()
Delete all the lines we point to.
Definition: oofrpRTF.cpp:1762
unsigned long oofRepRenderT
Definition: oofrep.h:113
virtual void startSection()
called before each section, regardless of settings unlike drawSectionBreak which may not be called if...
Definition: oofrpRTF.cpp:149
void GenerateTabList()
Will generate a set of tabstops for multiple paragraphs based on the blocks in the layout...
Definition: oofrpRTF.cpp:879
bool moveDownAfter() const
Indicate if a layout band should start a new row of blocks.
Definition: oofrep.h:2215
No output renderer.
Definition: oofrpRTF.h:244
virtual void draw()
Draw picture details to RTF document.
Definition: oofrpRTF.cpp:1270
virtual void MakeAnyRender()
Definition: oofrep2.cpp:488
virtual void drawColumnHeaders()
Definition: oofrpRTF.cpp:753
Output pard tag to insert fixed height paragraph as specified by oofRepSpaceBand. ...
Definition: oofrpRTF.h:149
virtual void makeRender(const oofRepMacEnv &)
Definition: oofadorn.cpp:167
oofRepPictBlock * mOwner
Definition: oofreprn.h:189
void drawPageHeaders()
Definition: oofrep1.cpp:596
bool more() const
Definition: oofrpRTF.h:300
Abstract base for rendering an oofRepViewBand.
Definition: oofreprn.h:129
virtual unsigned short heightOfTextStyle(oofRepTextStyle *)
Definition: oofrpRTF.cpp:122
oofRepLineBand * mOwner
Definition: oofreprn.h:83
Specify a fixed height band containing an oofGraph with additional height & width.
Definition: oofrep.h:1080
virtual void drawPageBreak()
Definition: oofrpRTF.cpp:108
unsigned int count() const
Definition: oof1.h:1498
virtual void makeRender(const oofRepMacEnv &env)
Definition: oofrepMac.cpp:122
Portable highly capable string class.
Definition: oofstr.h:101
unsigned long fixedWidth()
Definition: oofrep.h:2229
void textStyle(oofRepTextStyle *adoptedStyle)
Set style owned by this object.
Definition: oofrep1.cpp:1804
void drawPageFooters()
Definition: oofrep1.cpp:620
oofRepBandList & pageHeaders()
Definition: oofrep.h:1874
virtual void makeRender(const oofRepMacEnv &env)
Definition: oofrepMac.cpp:110
virtual void draw()
Draw into the RTF file as picture.
Definition: oofrpRTF.cpp:1317
virtual void makeRender(const oofRepMacEnv &)
Definition: oofrep1.cpp:1334
void append(unsigned long)
Definition: oofarray.cpp:131
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
oofRepGraphBand * mOwner
Definition: oofreprn.h:45
virtual void makeRender(const oofRepXMLEnv &env)
Definition: oofrpXML.cpp:1418
Cross-platform specification of text style.
Definition: oofrep.h:732
unsigned short colSepWidth() const
Definition: oofrep3.cpp:421
oofRepGraphBand_RTFRender(oofRepGraphBand *b)
Definition: oofrpRTF.h:163
oofRepRender * mRender
Definition: oofrep.h:901
unsigned long startingPageNumber() const
Definition: oofrep.h:1926
virtual unsigned long fixedHeight()
Definition: oofrep2.cpp:768
virtual void makeRender(const oofRepMacEnv &env)
Definition: oofrepMac.cpp:153
void writeTabDefinitionsInRTF(std::ostream &)
Write a definition for a single tab.
Definition: oofrpRTF.cpp:1700
virtual oofRepRender * clone(const oofRepDrawable *newOwner) const
Definition: oofrpRTF.cpp:1307
Base object to derive adorners from.
Definition: oofadorn.h:32
int mSectionNumber
Definition: oofrpRTF.h:61
oofRepPictBlock_RTFRender(oofRepPictBlock *b)
Definition: oofrpRTF.h:246
void draw(int x, int y, int right, int bottom, bool onPrinter=false)
Definition: oofdraw.cpp:1370
oofRepTabStop * operator()()
Definition: oofrpRTF.h:321
virtual oofString copyString() const
Definition: oof3.cpp:472
virtual OOF_fieldTypes fieldType() const =0
virtual void makeRender(const oofRepMacEnv &env)
Definition: oofrepMac.cpp:129
static oofRep * currentReport()
Definition: oofrep.h:2003
Specify a block to draw mono-styled text in an oofRepLayoutBand.
Definition: oofrep.h:1445
virtual oofRepRender * clone(const oofRepDrawable *newOwner) const
Definition: oofrpRTF.cpp:1670
virtual void draw()
central default call for drawing, but still able to be overriden in extreme cases.
Definition: oofrep1.cpp:1296
oofRepLineBand_RTFRender(oofRepLineBand *b)
Definition: oofrpRTF.h:193
virtual oofRepRender * clone(const oofRepDrawable *newOwner) const
Definition: oofrpRTF.cpp:1009
virtual oofString text() const
Definition: oofrep2.cpp:915
Specify a fixed height band to draw an oofPict.
Definition: oofrep.h:1649
List of blocks in an oofRepLayoutBand.
Definition: oofrep.h:336
void adopt(char *)
Take ownership of incoming buffer, replacing current contents.
Definition: oofstr.cpp:2299
Specify a fixed height band to draw a horizontal line black or grey in given thickness.
Definition: oofrep.h:1143
oofRepViewBand * mOwner
Definition: oofreprn.h:147
oofRepPictBand_RTFRender(oofRepPictBand *b)
Definition: oofrpRTF.h:207
bool hasJPEG() const
Definition: oofdraw.h:403
Specify a block to draw an oofPict in an oofRepLayoutBand.
Definition: oofrep.h:1516
virtual void startEnvironment()
Setup the start of document including font, color, stylesheet and page dimensions.
Definition: oofrpRTF.cpp:210
Specify output to MS Word-compatible Rich Text stream.
Definition: oofrpRTF.h:31
Specify a block to draw current page number with some bracketing text in an oofRepLayoutBand.
Definition: oofrep.h:1576
virtual oofRepRender * clone(const oofRepDrawable *newOwner) const
Definition: oofrpRTF.cpp:1648
virtual unsigned long fixedHeight()
Definition: oofrep.h:2169
Output encoded text using oofRepRTFEnv::encodeToRTFStream.
Definition: oofrpRTF.h:232
Specify a band which provides a vertical gap on the page.
Definition: oofrep.h:1050
const char * bufOfJPEG() const
Definition: oofdraw.h:409
oofRepTextBlock_RTFRender(oofRepTextBlock *b)
Definition: oofrpRTF.h:234
virtual oofRepRender * clone(const oofRepDrawable *newOwner) const
Definition: oofrpRTF.cpp:1626
Draw oofRepViewBand contents as table.
Definition: oofrpRTF.h:219
Cross-platform picture representation can load from file or resource and draw.
Definition: oofdraw.h:201
static oofColSizer::colAlignT naturalAlignmentForField(OOF_fieldTypes)
Definition: oofsize.cpp:249
oofString getHeading(unsigned int, bool *tellIfOverride=0) const
Definition: oofview.cpp:278