OOFILE  1.9
oofPrnWn.cpp
Go to the documentation of this file.
1 // oofPrnWn.cpp - MS-Windows implementation for oofRepWinGUIPreviewMFC
3 //
4 // COPYRIGHT 1996 A.D. Software, All rights reserved
5 
6 #include "stdafx.h"
7 
8 #include "oof1.h"
9 #include "oof3.h"
10 #include "oofram.h"
11 #include "oofrep.h"
12 #include "oofrect.h"
13 #include "oofmacro.h"
14 #include "oofDraw.h"
15 #include "oofPrnWn.h"
16 
17 #ifdef OOF_MEM_DEBUG_LAST_INCLUDE
18  #include OOF_MEM_DEBUG_LAST_INCLUDE
19 #endif
20 
21 #ifndef OOF_NO_STDLIB
22  #ifndef std
23  using namespace std;
24  #endif
25 #endif
26 
27 
28 // -------------------------------------------------------
29 // o o f R e p W i n G U I P r e v i e w M F C
30 // -------------------------------------------------------
31 
33  : oofRepWinEnv(),
34  mPaperRect(0,0,0,0),
35  mBuildingPage(0),
36  mCurrentTextStyle(0),
37  mParentWnd(0),
38  mCurrentPage(0)
39 {
40  if(!pageSetup) {
41  // Get the default print record - for pagesizing, etc.
42  PAGESETUPDLG ps;
44  setPageSetup(&ps);
45  } else
46  setPageSetup(pageSetup);
47 
48  mFinished = FALSE;
49 }
50 
52 {
53  if(!mFinished)
54  oofRepWinGUIPreviewMFC::finish(); // call our version, NOT a virtual override because we're in dtor
55 
56  oofCurrentDraw::deleteInfoDC();
57  delete mCurrentTextStyle;
58 }
59 
60 void
62 {
63  PRINTDLG printDlg;
64 
65  memset(ps, 0, sizeof(PAGESETUPDLG));
66  memset(&printDlg, '\0', sizeof(printDlg));
67  bool successfulInit = false;
68  CWinApp* pApp = AfxGetApp();
69  if (pApp != NULL && pApp->GetPrinterDeviceDefaults(&printDlg)) {
70  POINT paperSize;
71  VERIFY(oofRepWinPrint::getPaperSize(printDlg.hDevNames, printDlg.hDevMode, &paperSize));
72  if (paperSize.x!=0 && paperSize.y!=0) { // some dodgy drivers return zero!
73  ps->ptPaperSize.x = paperSize.x * 10;
74  ps->ptPaperSize.y = paperSize.y * 10;
75  ps->Flags = PSD_INHUNDREDTHSOFMILLIMETERS;
76  successfulInit = true;
77  } // got valid paper size
78  }
79 
80  if (!successfulInit) { // old-fashioned default from driver
81  ps->Flags = PSD_RETURNDEFAULT |
82  PSD_MARGINS |
83  PSD_DEFAULTMINMARGINS |
84  PSD_INTHOUSANDTHSOFINCHES;
85  ::PageSetupDlg(ps);
86  }
87 }
88 
89 
90 void
91 oofRepWinGUIPreviewMFC::setPageSetup(PAGESETUPDLG* pageSetup)
92 {
93  int newRight, newBottom;
94 
95 
96  if (pageSetup->Flags & PSD_INTHOUSANDTHSOFINCHES) {
97  newRight = hienglish2pts(pageSetup->ptPaperSize.x);
98  newBottom = hienglish2pts(pageSetup->ptPaperSize.y);
99  }
100  else {
101  assert(pageSetup->Flags & PSD_INHUNDREDTHSOFMILLIMETERS);
102  newRight = himetric2pts(pageSetup->ptPaperSize.x);
103  newBottom = himetric2pts(pageSetup->ptPaperSize.y);
104  }
105 
106 /*
107  HDC ic = oofCurrentDraw::getInfoDC();
108  if (pageSetup->Flags & PSD_INTHOUSANDTHSOFINCHES) {
109  newRight = hienglish2logical(pageSetup->ptPaperSize.x, ic);
110  newBottom = hienglish2logical(pageSetup->ptPaperSize.y, ic);
111  }
112  else {
113  assert(pageSetup->Flags & PSD_INHUNDREDTHSOFMILLIMETERS);
114  newRight = himetric2logical(pageSetup->ptPaperSize.x, ic);
115  newBottom = himetric2logical(pageSetup->ptPaperSize.y, ic);
116  }
117 */
118  mPaperRect = oofRect(0, 0, newRight, newBottom-16); // ASD 2003-02-04 hack that makes page footer visiblein 100% and fitPage mode
119 // mMargin = pageSetup->rtMargin;
120 
121 /*
122  // We need to adjust for the reverse Y axis in MM_HIENGLISH or MM_HIMETRIC.
123  // Because mPaperHimetric has been transformed twice (if at all), the effect is cancelled.
124  mPaperRect.transform(1, -1);
125  mMargin.transform(1, -1);
126 */
127 }
128 
129 void
131 {
132  mFinished = FALSE;
133  startPage();
134 }
135 
136 void
138 {
139  endPage();
140  mFinished = TRUE;
141 }
142 
143 void
145 {
146  mBuildingPage = new oofRepPage();
147 
148  oofCurrentDraw::makeInfoDC();
149 }
150 
151 void
153 {
154  if (mBuildingPage) {
155  mPages.appendPage(mBuildingPage);
156  mBuildingPage = 0; // adopted
157  // dirty the text style to force selecting the current font when starting
158  // a new page
159  }
160  changeTextStyle(NULL);
161 }
162 
163 
164 void
166 {
167  assert(!mFinished); // Make sure someone hasn't finished up already !
168  endPage();
169  startPage();
170 }
171 
172 
173 void
175 {
176  if (inStyle == NULL) {
177  delete mCurrentTextStyle;
178  mCurrentTextStyle = 0;
179  }
180  else {
181  bool changedStyle = false;
182  if (mCurrentTextStyle) {
183  if (!(*mCurrentTextStyle==*inStyle)) { // only set if different
184  changedStyle = true;
185  *mCurrentTextStyle = *inStyle; // copy without reallocation
186  }
187  }
188  else {
189  changedStyle = true;
190  mCurrentTextStyle = inStyle->clone();
191  } // if current style
192  // draw & record style regardless of whether we changed it.
193  // we may be recording a style to guard against a custom drawer changing the display properties and bypassing
194  // our text style mechanism
195  drawWithTextStyle(inStyle);
196  if (oofRepPage::currentlyConstructing()) // allow for us to be called at page replay time, when we would NOT add another element!
198  } //lint !e550 changedStyle not accessed, presume there for conditional breakpoints
199 }
200 
201 
202 void
204 {
205  ASSERT(style);
206  HDC dc = oofCurrentDraw::getCurrentDC();
207 
208  LOGFONT lf = style->getLogFont();
209 // const int pixelsXY = ::GetDeviceCaps(ic, LOGPIXELSY);
210  lf.lfHeight = -style->fontSize(); // -MulDiv(style->fontSize(), pixelsXY, 72);
211  HFONT hFont = oofTextDrawer::createFontIndirect(&lf);
212 
213  if (hFont != NULL) {
214  oofTextDrawer::selectFont(dc, hFont); //lint !e534 ignore return
215  }
216  if (dc != NULL) {
217  // Set the foreground colour for text drawing
218  VERIFY( CLR_INVALID != ::SetTextColor(dc, style->color()) );
219  } // have a DC
220 }
221 
222 
223 /*void
224 oofRepWinGUIPreviewMFC::moveToVerticalPos(unsigned long pos)
225 {
226  MoveTo(0,pos);
227 }
228 */ // See comments in oofRepEnvironment
229 
230 unsigned long
232 {
233  return mPaperRect.height();
234 }
235 
236 unsigned long
238 {
239 // NOT YET IMPLEMENTED
240 /* disabled 98/05/11 due to side-effects from initial settings
241 // update margin settings to match Windows margins we had copied earlier
242  oofRepSettings* localSet = oofRep::currentReport()->getLocalSettings();
243  localSet->leftMargin(mMargin.left);
244  localSet->rightMargin(mMargin.right);
245  localSet->topMargin(mMargin.top);
246  localSet->bottomMargin(mMargin.bottom);
247 */
248 
249 // preset width from settings dialog
250  return mPaperRect.width();
251 }
252 
253 void
254 oofRepWinGUIPreviewMFC::drawPageBorder( long inTop, long inLeft, long inBottom, long inRight )
255 {
256  oofRect theLine;
257 
258  theLine.set(inLeft,inTop,inRight,inBottom);
259 
261 
262  theLine.set(inLeft-2,inTop-2,inRight+2,inBottom+2);
264 
265  theLine.set(inLeft-3,inTop-3,inRight+3,inBottom+3);
267 
268  theLine.set(inLeft-5,inTop-5,inRight+5,inBottom+5);
270 }
271 
272 
273 void
274 oofRepWinGUIPreviewMFC::drawPage(HDC inDC, unsigned long pageIndex, oofRect inRect)
275 {
276  assert(pageIndex < getNumPages());
277  oofCurrentDraw::makeInfoDC(); // guarantee an info DC exists for redraw
278  oofCurrentDraw::setCurrentDC(inDC);
279 
280  if (!isPrintingEnvironment()) {
281  // 99/02/15 adapt to external scaling
282  CSize clientSize;
283  oofRect pageRect = pageRectPts();
284  const long inWidth = inRect.width();
285  const int pixelsX = ::GetDeviceCaps(inDC, LOGPIXELSX);
286  const long inWidthPts = ::MulDiv(inWidth, 72, pixelsX);
287  const double scaleDivisor = double(inWidthPts) / pageRect.width();
288 
289 // emulate the setting that's just occurred in the call to setCurrentDC
290 // but with scaling
291  const int horzres = ::GetDeviceCaps(inDC, HORZRES);
292  const int horzsize = ::GetDeviceCaps(inDC, HORZSIZE); // always mm
293  const int vertres = ::GetDeviceCaps(inDC, VERTRES);
294  const int vertsize = ::GetDeviceCaps(inDC, VERTSIZE);
295 
296  const double devHorDPI = 25.4*horzres/horzsize;
297  const double devVertDPI = 25.4*vertres/vertsize;
298 
299  const int horDP10i = int(10 * devHorDPI);
300  const int vertDP10i = int(10 * devVertDPI);
301  assert(horDP10i<32767); // safe for Win95
302  assert(vertDP10i<32767); // safe for Win95
303  SIZE oldViewExtent, oldWindowExtent;
304  ::SetMapMode(inDC, MM_ANISOTROPIC);
305  ::SetViewportExtEx(inDC, horDP10i, vertDP10i, &oldViewExtent);
306  const int horizontalAndVertExt = 720/scaleDivisor;
307  ::SetWindowExtEx(inDC, horizontalAndVertExt, horizontalAndVertExt, &oldWindowExtent);
308  }
309 
310  oofTextDrawer::cleanupFont();
311  oofRepPage* thePage = mPages.page(pageIndex);
312  ASSERT(thePage);
313  thePage->draw(inRect);
314  oofCurrentDraw::setCurrentDC(0);
315  mCurrentPage = pageIndex;
316 }
317 
318 
319 // -------------------------------------------------------
320 // o o f R e p W i n P r i n t
321 // -------------------------------------------------------
322 
323 oofRepWinPrint::oofRepWinPrint(const char* docStr, LPPAGESETUPDLG pageSetup, LPPRINTDLG printDlg) :
324  oofRepWinGUIPreviewMFC(pageSetup),
325  mDefaultPrintStr("OOFile report"),
326  mPrintDlg(printDlg),
327  mPrinted(false)
328 {
329  dbConnect_ram tempConnection;
330  tempConnection.newConnection();
331 
332  // set up mDocInfo structure
333  memset(&mDocInfo, '\0', sizeof(DOCINFO));
334  mDocInfo.cbSize = sizeof(DOCINFO);
335  mDocInfo.lpszDocName = docStr != NULL ? docStr : mDefaultPrintStr;
336  mDocInfo.lpszOutput = NULL;
337 
338  oofRepWinGUIPreviewMFC::start(); // not a virtual call until finish ctor
339 }
340 
342 {
343  if (!mPrinted)
344  print();
345 }
346 
347 void oofRepWinPrint::FillInPrintDlg(LPPRINTDLG printDlg) const
348 {
349  printDlg->lStructSize = sizeof(PRINTDLG);
350  printDlg->Flags = PD_NOSELECTION | PD_PAGENUMS | PD_RETURNDC;
351  printDlg->nCopies = 1;
352  printDlg->nFromPage = 1;
353  printDlg->nMinPage = printDlg->nFromPage;
354  printDlg->nToPage = (unsigned short)getNumPages();
355  printDlg->nMaxPage = printDlg->nToPage;
356 }
357 
359 {
360  mPrinted = true;
361 
362  finish();
363 
364  PRINTDLG printDlg;
365  LPPRINTDLG pd = mPrintDlg;
366 
367  if (pd == NULL) {
368  memset(&printDlg, '\0', sizeof(printDlg));
369 
370  FillInPrintDlg(&printDlg);
371 
372  if (!::PrintDlg(&printDlg))
373  return;
374  else
375  pd = &printDlg;
376  }
377  else {
378  pd->nCopies = max(1, pd->nCopies);
379 
380  if (pd->hDC == NULL) {
381  // printer DC has to be obtained, so fill in the required fields
382  FillInPrintDlg(pd);
383 
384  if (!::PrintDlg(pd))
385  return;
386  }
387  }
388 
389  assert(pd != NULL);
390  assert(pd->hDC != NULL);
391 
392  RECT pageRect;
393  GetLogicalPageRect(&pageRect, pd->hDC);
394 
395  unsigned int firstPage = 0;
396  unsigned int lastPage = getNumPages();
397 
398  if (pd->Flags & PD_PAGENUMS) {
399  firstPage = max(0, pd->nFromPage-1); // 0-based index
400  lastPage = min(lastPage, pd->nToPage);
401  }
402 
403  if (::StartDoc(pd->hDC, &mDocInfo) > 0) {
404  // handle collated copies
405  for (WORD colCopy = 0; colCopy < (pd->Flags & PD_COLLATE ? pd->nCopies : 1); colCopy++) {
406  for (unsigned long i = firstPage; i < lastPage; i++) {
407  PrintPage(i, &pageRect, pd);
408  }
409  }
410  ::EndDoc(pd->hDC);
411  }
412 
413  // delete the DC
414  VERIFY(::DeleteDC(pd->hDC));
415  // print() might be called multiple times, so set hDC to NULL
416  pd->hDC = NULL;
417 }
418 
419 void oofRepWinPrint::PrintPage(unsigned long pageNo, const LPRECT pageRect, LPPRINTDLG pd)
420 {
421  // handle noncollated copies
422  for (WORD nonColCopy = 0; nonColCopy < (pd->Flags & PD_COLLATE ? 1 : pd->nCopies); nonColCopy++) {
423  // Set the mapping mode that will convert the report's dimension from screen
424  // into the printer resolution. We needn't do that for the enhanced metafile
425  // as it allows the sizing directly via pageRect. We have to set the mapping
426  // mode for each page individually.
427  if (::StartPage(pd->hDC) > 0) {
428  VERIFY(setPrinterMappingMode(pd->hDC));
429  drawPage(pd->hDC, pageNo, pageRect);
430  ::EndPage(pd->hDC);
431  }
432 /* {
433 #ifdef OOFILE_USE_OLDMETAFILE
434  // Set the mapping mode that will convert the report's dimension from screen
435  // into the printer resolution. We needn't do that for the enhanced metafile
436  // as it allows the sizing directly via pageRect. We have to set the mapping
437  // mode for each page individually.
438  VERIFY(setPrinterMappingMode(pd->hDC));
439  ::PlayMetaFile(pd->hDC, hmf);
440 #else
441  ::PlayEnhMetaFile(pd->hDC, hemf, pageRect);
442 #endif
443  ::EndPage(pd->hDC);
444  }
445 */
446  } // loop number of copies
447 }
448 
449 
450 void
451 oofRepWinPrint::GetLogicalPageRect(LPRECT rect, HDC dc) const
452 {
453  rect->top = 0;
454  rect->left = 0;
455  rect->right = ::GetDeviceCaps(dc, HORZRES);
456  rect->bottom = ::GetDeviceCaps(dc, VERTRES);
457 
458  ::DPtoLP(dc, (POINT*)rect, 2);
459 }
460 
462 {
463  pDC->SetMapMode(MM_ANISOTROPIC);
464 
465  CWinApp* pApp = AfxGetApp();
466  ASSERT(pApp != NULL);
467 
468  PRINTDLG printDlg;
469  memset(&printDlg, '\0', sizeof(printDlg));
470 
471  if (pApp->GetPrinterDeviceDefaults(&printDlg))
472  {
473  POINT paperSize;
474  VERIFY(getPaperSize(printDlg.hDevNames, printDlg.hDevMode, &paperSize));
475 
476  CDC ic;
477  VERIFY(ic.CreateIC("DISPLAY", NULL, NULL, NULL));
478 
479  ic.SetMapMode(MM_HIMETRIC);
480  // paperSize is in tens of millimetres, but we need hundreds of millimetres
481  POINT paperRect = {paperSize.x * 10, paperSize.y * 10};
482  // convert paperRect into screen points
483  ic.LPtoDP(&paperRect);
484  // adjust the paper height
485  paperRect.y *= -1;
486 
487  // set the transforming mapping mode
488  pDC->SetWindowExt(paperRect.x, paperRect.y);
489  pDC->SetViewportExt(pDC->GetDeviceCaps(HORZRES), pDC->GetDeviceCaps(VERTRES));
490 
491  return TRUE;
492  }
493  else
494  return FALSE;
495 }
496 
498 {
499  CDC* pDC = CDC::FromHandle(hDC);
500  BOOL bRetVal = setPrinterMappingMode(pDC);
501  pDC->Detach();
502 
503  return bRetVal;
504 }
505 
506 BOOL oofRepWinPrint::getPaperSize(HANDLE hDevNames, HANDLE hDevMode, LPPOINT paperSize)
507 {
508  LPDEVNAMES lpDevNames = (LPDEVNAMES)::GlobalLock(hDevNames);
509  LPDEVMODE lpDevMode = (LPDEVMODE)::GlobalLock(hDevMode);
510 
511  if (lpDevNames == NULL || lpDevMode == NULL)
512  return FALSE;
513 
514  // get relationship between portrait and landscape orientations
515  // (0, 90 or 270 degrees)
516  DWORD dwOrientRel = ::DeviceCapabilities(
517  (LPTSTR)lpDevNames + lpDevNames->wDeviceOffset,
518  (LPTSTR)lpDevNames + lpDevNames->wOutputOffset,
519  DC_ORIENTATION,
520  NULL,
521  lpDevMode);
522 
523  const bool hasAbsolutePaperDimension = (lpDevMode->dmFields & DM_PAPERLENGTH) != 0;
524  const bool hasOrientation = (lpDevMode->dmFields & DM_ORIENTATION) != 0;
525 
526  BOOL retVal = TRUE;
527 
528  // if there is absolute paper dimension specified then use it as it overrides
529  // the dmPaperSize field
530  if (hasAbsolutePaperDimension) {
531  paperSize->x = lpDevMode->dmPaperWidth;
532  paperSize->y = lpDevMode->dmPaperLength;
533  }
534  else {
535  // if the absolute paper dimension isn't specified, get the paperSize from
536  // the dmPaperSize field of current DEVMODE structure
537  retVal = getPaperSizeFromSymbolicValue(lpDevMode->dmPaperSize, paperSize);
538  }
539 
540  // swap width and height if LANDSCAPE is specified
541  if (retVal && hasOrientation &&
542  lpDevMode->dmOrientation == DMORIENT_LANDSCAPE && dwOrientRel != 0)
543  {
544  LONG tmp = paperSize->x;
545  paperSize->x = paperSize->y;
546  paperSize->y = tmp;
547  }
548 
549  ::GlobalUnlock(hDevMode);
550  ::GlobalUnlock(hDevNames);
551 
552  return retVal;
553 }
554 
555 BOOL oofRepWinPrint::getPaperSizeFromSymbolicValue(short paperSizeID, LPPOINT paperSize)
556 {
557  static paperSizeLookup paperSizeArray[] = {
558  DMPAPER_LETTER /* Letter 8 1/2 x 11 in */, INCHENTRY(8.5, 11),
559  DMPAPER_LETTERSMALL /* Letter Small 8 1/2 x 11 in */, INCHENTRY(8.5, 11),
560  DMPAPER_TABLOID /* Tabloid 11 x 17 in */, INCHENTRY(11, 17),
561  DMPAPER_LEDGER /* Ledger 17 x 11 in */, INCHENTRY(17, 11),
562  DMPAPER_LEGAL /* Legal 8 1/2 x 14 in */, INCHENTRY(8.5, 14),
563  DMPAPER_STATEMENT /* Statement 5 1/2 x 8 1/2 in */, INCHENTRY(5.5, 8.5),
564  DMPAPER_EXECUTIVE /* Executive 7 1/4 x 10 1/2 in */, INCHENTRY(7.25,10.5),
565  DMPAPER_A3 /* A3 297 x 420 mm */, MMENTRY(297, 420),
566  DMPAPER_A4 /* A4 210 x 297 mm */, MMENTRY(210, 297),
567  DMPAPER_A4SMALL /* A4 Small 210 x 297 mm */, MMENTRY(210, 297),
568  DMPAPER_A5 /* A5 148 x 210 mm */, MMENTRY(148, 210),
569  DMPAPER_B4 /* B4 (JIS) 250 x 354 */, MMENTRY(250, 354),
570  DMPAPER_B5 /* B5 (JIS) 182 x 257 mm */, MMENTRY(182, 257),
571  DMPAPER_FOLIO /* Folio 8 1/2 x 13 in */, INCHENTRY(8.5, 13),
572  DMPAPER_QUARTO /* Quarto 215 x 275 mm */, MMENTRY(215, 275),
573  DMPAPER_10X14 /* 10x14 in */, INCHENTRY(10, 14),
574  DMPAPER_11X17 /* 11x17 in */, INCHENTRY(11, 17),
575  DMPAPER_NOTE /* Note 8 1/2 x 11 in */, INCHENTRY(8.5, 11),
576  DMPAPER_ENV_9 /* Envelope #9 3 7/8 x 8 7/8 */, INCHENTRY(3.875, 8.875),
577  DMPAPER_ENV_10 /* Envelope #10 4 1/8 x 9 1/2 */, INCHENTRY(4.125, 9.5),
578  DMPAPER_ENV_11 /* Envelope #11 4 1/2 x 10 3/8 */, INCHENTRY(4.5, 10.375),
579  DMPAPER_ENV_12 /* Envelope #12 4 \276 x 11 */, INCHENTRY(4, 11),
580  DMPAPER_ENV_14 /* Envelope #14 5 x 11 1/2 */, INCHENTRY(5, 11.5),
581  DMPAPER_CSHEET /* C size sheet */, INCHENTRY(0,0),
582  DMPAPER_DSHEET /* D size sheet */, INCHENTRY(0,0),
583  DMPAPER_ESHEET /* E size sheet */, INCHENTRY(0,0),
584  DMPAPER_ENV_DL /* Envelope DL 110 x 220mm */, MMENTRY(110, 220),
585  DMPAPER_ENV_C5 /* Envelope C5 162 x 229 mm */, MMENTRY(162, 229),
586  DMPAPER_ENV_C3 /* Envelope C3 324 x 458 mm */, MMENTRY(324, 458),
587  DMPAPER_ENV_C4 /* Envelope C4 229 x 324 mm */, MMENTRY(229, 324),
588  DMPAPER_ENV_C6 /* Envelope C6 114 x 162 mm */, MMENTRY(114, 162),
589  DMPAPER_ENV_C65 /* Envelope C65 114 x 229 mm */, MMENTRY(114, 229),
590  DMPAPER_ENV_B4 /* Envelope B4 250 x 353 mm */, MMENTRY(250, 353),
591  DMPAPER_ENV_B5 /* Envelope B5 176 x 250 mm */, MMENTRY(176, 250),
592  DMPAPER_ENV_B6 /* Envelope B6 176 x 125 mm */, MMENTRY(176, 125),
593  DMPAPER_ENV_ITALY /* Envelope 110 x 230 mm */, MMENTRY(110, 230),
594  DMPAPER_ENV_MONARCH /* Envelope Monarch 3.875 x 7.5 in */, INCHENTRY(3.875, 7.5),
595  DMPAPER_ENV_PERSONAL/* 6 3/4 Envelope 3 5/8 x 6 1/2 in */, INCHENTRY(3.625, 6.5),
596  DMPAPER_FANFOLD_US /* US Std Fanfold 14 7/8 x 11 in */, INCHENTRY(14.875, 11),
597  DMPAPER_FANFOLD_STD_GERMAN/* German Std Fanfold 8 1/2 x 12 in */, INCHENTRY(8.5, 12),
598  DMPAPER_FANFOLD_LGL_GERMAN/* German Legal Fanfold 8 1/2 x 13 in */, INCHENTRY(8.5, 13)
599 #if (WINVER >= 0x0400)
600  , // comma to continue above
601  DMPAPER_ISO_B4 /* B4 (ISO) 250 x 353 mm */, MMENTRY(250, 353),
602  DMPAPER_JAPANESE_POSTCARD/* Japanese Postcard 100 x 148 mm */, MMENTRY(100, 148),
603  DMPAPER_9X11 /* 9 x 11 in */, INCHENTRY(9, 11),
604  DMPAPER_10X11 /* 10 x 11 in */, INCHENTRY(10, 11),
605  DMPAPER_15X11 /* 15 x 11 in */, INCHENTRY(15, 11),
606  DMPAPER_ENV_INVITE /* Envelope Invite 220 x 220 mm */, MMENTRY(220, 220),
607  DMPAPER_LETTER_EXTRA/* Letter Extra 9 \275 x 12 in */, INCHENTRY(9, 12),
608  DMPAPER_LEGAL_EXTRA /* Legal Extra 9 \275 x 15 in */, INCHENTRY(9, 15),
609  DMPAPER_TABLOID_EXTRA/* Tabloid Extra 11.69 x 18 in */, INCHENTRY(11.69, 18),
610  DMPAPER_A4_EXTRA /* A4 Extra 9.27 x 12.69 in */, INCHENTRY(9.27, 12.69),
611  DMPAPER_LETTER_TRANSVERSE/* Letter Transverse 8 \275 x 11 in */, INCHENTRY(8, 11),
612  DMPAPER_A4_TRANSVERSE/* A4 Transverse 210 x 297 mm */, MMENTRY(210, 297),
613  DMPAPER_LETTER_EXTRA_TRANSVERSE/* Letter Extra Transverse 9\275 x 12 in*/, INCHENTRY(9, 12),
614  DMPAPER_A_PLUS /* SuperA/SuperA/A4 227 x 356 mm */, MMENTRY(227, 356),
615  DMPAPER_B_PLUS /* SuperB/SuperB/A3 305 x 487 mm */, MMENTRY(305, 487),
616  DMPAPER_LETTER_PLUS /* Letter Plus 8.5 x 12.69 in */, INCHENTRY(8.5, 12.69),
617  DMPAPER_A4_PLUS /* A4 Plus 210 x 330 mm */, MMENTRY(210, 330),
618  DMPAPER_A5_TRANSVERSE/* A5 Transverse 148 x 210 mm */, MMENTRY(148, 210),
619  DMPAPER_B5_TRANSVERSE/* B5 (JIS) Transverse 182 x 257 mm */, MMENTRY(182, 257),
620  DMPAPER_A3_EXTRA /* A3 Extra 322 x 445 mm */, MMENTRY(322, 445),
621  DMPAPER_A5_EXTRA /* A5 Extra 174 x 235 mm */, MMENTRY(174, 235),
622  DMPAPER_B5_EXTRA /* B5 (ISO) Extra 201 x 276 mm */, MMENTRY(201, 276),
623  DMPAPER_A2 /* A2 420 x 594 mm */, MMENTRY(420, 594),
624  DMPAPER_A3_TRANSVERSE/* A3 Transverse 297 x 420 mm */, MMENTRY(297, 420),
625  DMPAPER_A3_EXTRA_TRANSVERSE/* A3 Extra Transverse 322 x 445 mm */, MMENTRY(322, 445)
626 #endif /* WINVER >= 0x0400 */
627  };
628 
629  const int lookupNumItems = sizeof(paperSizeArray) / sizeof(paperSizeLookup);
630 
631  for (int i=0; i<lookupNumItems; i++) {
632  if (paperSizeArray[i].paperSizeID == paperSizeID) {
633  paperSize->x = paperSizeArray[i].width;
634  paperSize->y = paperSizeArray[i].height;
635  return TRUE;
636  }
637  }
638 
639  return FALSE;
640 }
Cross-platform way to specify rectangle with Mac-style setter.
Definition: oofRect.h:39
Database backend for a single RAM-resident table.
Definition: oofram.h:26
MFC base class for applications.
virtual bool isPrintingEnvironment() const
Definition: oofrep2.cpp:1232
oofRepPage * page(unsigned long) const
Definition: oofrep.h:2752
typedef LONG(ctDECL *ctComparativeKeySearch)(COUNT
Base for specifying Win32 GUI drawing environment.
Definition: oofrpWin.h:46
void drawWithTextStyle(oofRepTextStyle *)
Definition: oofPrnWn.cpp:203
virtual unsigned long calcPageHeight()
Definition: oofPrnWn.cpp:231
virtual void changeTextStyle(oofRepTextStyle *)
Definition: oofPrnWn.cpp:174
static BOOL setPrinterMappingMode(CDC *pDC)
Definition: oofPrnWn.cpp:461
void FillInPrintDlg(LPPRINTDLG printDlg) const
Definition: oofPrnWn.cpp:347
static void recordElement(const oofRepTextStyle *copiedStyle)
Definition: oofrpWin.cpp:1299
static BOOL getPaperSize(HANDLE hDevNames, HANDLE hDevMode, LPPOINT paperSize)
Definition: oofPrnWn.cpp:506
virtual void drawPageBorder(long top, long left, long bottom, long right)
Definition: oofPrnWn.cpp:254
macros that define user tables and relationship classes.
#define INCHENTRY(x, y)
Conversion used in oofRepWinPrint::getPaperSizeFromSymbolicValue.
Definition: oofPrnWn.h:21
int width()
Definition: oofRect.h:71
virtual unsigned long calcPageWidth()
Definition: oofPrnWn.cpp:237
GUI report-writer layer of OOFILE database.
unsigned short fontSize() const
Definition: oofrep.h:2548
static void initDefaultPageSetup(PAGESETUPDLG *)
Definition: oofPrnWn.cpp:61
void GetLogicalPageRect(LPRECT rect, HDC dc) const
Definition: oofPrnWn.cpp:451
DOCINFO mDocInfo
Definition: oofPrnWn.h:135
virtual oofRepTextStyle * clone() const
Definition: oofrep1.cpp:1733
void drawPage(HDC, unsigned long pageIndex, oofRect)
Definition: oofPrnWn.cpp:274
static oofRepPage * currentlyConstructing()
Definition: oofrep.h:2783
LPPRINTDLG mPrintDlg
Definition: oofPrnWn.h:137
int height()
Definition: oofRect.h:73
void setPageSetup(PAGESETUPDLG *pageSetup)
Definition: oofPrnWn.cpp:91
virtual void drawPageBreak()
Definition: oofPrnWn.cpp:165
void appendPage(oofRepPage *adoptedPage)
Definition: oofrep.h:2759
const char * mDefaultPrintStr
Definition: oofPrnWn.h:136
void PrintPage(unsigned long pageNo, const LPRECT pageRect, LPPRINTDLG pd)
Definition: oofPrnWn.cpp:419
const oofColor & color() const
Definition: oofrep.h:2570
oofRepWinPrint(const char *docStr=NULL, LPPAGESETUPDLG pageSetup=NULL, LPPRINTDLG printDlg=NULL)
Definition: oofPrnWn.cpp:323
Specify MS Windows GUI drawing environment previewed in MFC window.
Definition: oofPrnWn.h:34
Cross-platform specification of text style.
Definition: oofrep.h:732
static BOOL getPaperSizeFromSymbolicValue(short paperSizeID, LPPOINT paperSize)
Definition: oofPrnWn.cpp:555
unsigned long getNumPages() const
Definition: oofPrnWn.h:153
oofRepWinGUIPreviewMFC(PAGESETUPDLG *pageSetup=NULL)
Definition: oofPrnWn.cpp:32
virtual void newConnection(const char *connectionName=0)
Definition: oofram.cpp:82
#define MMENTRY(x, y)
Conversion used in oofRepWinPrint::getPaperSizeFromSymbolicValue.
Definition: oofPrnWn.h:26
virtual oofRect * pageRectPts()
Definition: oofPrnWn.h:51
void set(int left, int top, int right, int bottom)
Definition: oofRect.cpp:80
int hienglish2pts(int inPts)
Definition: oofrpWin.h:35
Single page in a report writer preview window.
Definition: oofrep.h:1758
static void recordElement(int x, int y, int right, int bottom)
Definition: oofrpWin.cpp:1413
int himetric2pts(int inPts)
Definition: oofrpWin.h:34
void draw(const oofRect &)
Definition: oofrep2.cpp:1448