home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 19.ddi / OWLINC.PAK / PREVIEW.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  3.7 KB  |  131 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows - (C) Copyright 1992, 1993 by Borland International
  3. //   include\owl\preview.h
  4. //   Definition of print preview classes
  5. //----------------------------------------------------------------------------
  6. #if !defined(__OWL_PREVIEW_H)
  7. #define __OWL_PREVIEW_H
  8.  
  9. #if !defined(__OWL_WINDOW_H)
  10.   #include <owl\window.h>
  11. #endif
  12.  
  13. #if !defined(__OWL_DC_H)
  14.   #include <owl\dc.h>
  15. #endif
  16.  
  17. class _OWLCLASS TPrintout;
  18. class _OWLCLASS TPrinter;
  19.  
  20. //
  21. // class TPreviewPage
  22. // ----- ------------
  23. //
  24. class _OWLCLASS TPreviewPage : public TWindow {
  25.   public:
  26.     TPreviewPage(TWindow*   parent,
  27.                  TPrintout& printout,
  28.                  TPrintDC&  prndc,
  29.                  TSize&     printExtent,
  30.                  int        pagenum = 1);
  31.  
  32.     void  SetPageNumber(int newNum) {PageNum = newNum; if (HWindow) Invalidate();}
  33.     void  Paint(TDC& dc, BOOL, TRect& clip);
  34.  
  35.   protected:
  36.     int        PageNum;
  37.     TSize      PrintExtent;
  38.     TPrintout& Printout;
  39.     TPrintDC&  PrintDC;
  40.  
  41.     void  EvSize(UINT sizeType, TSize& size);
  42.  
  43.   DECLARE_RESPONSE_TABLE(TPreviewPage);
  44.   DECLARE_CASTABLE;
  45. };
  46.  
  47. //
  48. // class TPrintPreviewDC
  49. // ----- ---------------
  50. //
  51. class _OWLCLASS TPrintPreviewDC : public TPrintDC {
  52.   public:
  53.     TPrintPreviewDC(TDC&         screen,
  54.                     TPrintDC&    printdc,
  55.                     const TRect& client,
  56.                     const TRect& clip);
  57.    ~TPrintPreviewDC();
  58.  
  59.     //
  60.     // override virtual TDC select & restore functions
  61.     //
  62.     void  SelectObject(const TFont& newFont);
  63.     void  SelectStockObject(int index);
  64.     void  RestoreFont();
  65.     int   GetDeviceCaps(int index) const;
  66.  
  67.     //
  68.     // Dual DC synchronizing functions
  69.     //
  70.     virtual void SyncFont();
  71.     virtual void ReScale();
  72.     virtual void ReOrg();
  73.  
  74.     //
  75.     // override virtual TDC color matching functions
  76.     //
  77.     TColor  SetBkColor(TColor color);
  78.     TColor  SetTextColor(TColor color);
  79.  
  80.     //
  81.     // override virtual TDC viewport & window mapping functions
  82.     //
  83.     int   SetMapMode(int mode);
  84.     BOOL  SetViewportOrg(const TPoint& origin, TPoint far* oldOrg=0);
  85.     BOOL  OffsetViewportOrg(const TPoint& delta, TPoint far* oldOrg=0);
  86.  
  87.     BOOL  SetViewportExt(const TSize& extent, TSize far* oldExtent=0);
  88.     BOOL  ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom,
  89.                            TSize far* oldExtent=0);
  90.  
  91.     BOOL  SetWindowExt(const TSize& extent, TSize far* oldExtent=0);
  92.     BOOL  ScaleWindowExt(int xNum, int xDenom, int yNum, int yDenom,
  93.                          TSize far* oldExtent=0);
  94.  
  95.     //
  96.     // Screen device point to Logical point conversions
  97.     //
  98.     BOOL  SDPtoLP(TPoint* points, int count = 1) const;
  99.     BOOL  SDPtoLP(TRect& rect) const;
  100.     BOOL  LPtoSDP(TPoint* points, int count = 1) const;
  101.     BOOL  LPtoSDP(TRect& rect) const;
  102.  
  103.   protected:
  104.     HFONT     PrnFont;              // Handle of current font in the printer dc
  105.     TPrintDC& PrnDC;                // DC for the printer we are previewing
  106.     TFont*    CurrentPreviewFont;   // font object in PrnDC used during preview
  107.  
  108.     HDC   GetAttributeHDC() const;
  109. };
  110.  
  111. inline BOOL
  112. TPrintPreviewDC::SDPtoLP(TPoint* points, int count) const {
  113.   return ::DPtoLP(HDC(Handle), points, count);
  114. }
  115.  
  116. inline BOOL
  117. TPrintPreviewDC::SDPtoLP(TRect& rect) const {
  118.   return SDPtoLP(rect, 2);
  119. }
  120.  
  121. inline BOOL
  122. TPrintPreviewDC::LPtoSDP(TPoint* points, int count) const {
  123.   return ::LPtoDP(HDC(Handle), points, count);
  124. }
  125.  
  126. inline BOOL
  127. TPrintPreviewDC::LPtoSDP(TRect& rect) const {
  128.   return LPtoSDP(rect, 2);
  129. }
  130. #endif  // __OWL_PREVIEW_H
  131.