Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
3.2 KiB

  1. #pragma once
  2. // forward declaration to make things easy
  3. class CAnnotationSet;
  4. typedef struct
  5. {
  6. SIZE szImage;
  7. ULONG xDPI;
  8. ULONG yDPI;
  9. DWORD dwDelay;
  10. } PageInfo;
  11. typedef struct
  12. {
  13. DWORD dwID;
  14. RECT rc;
  15. HBITMAP hbm;
  16. HPALETTE hPal;
  17. HDC hdc;
  18. HPALETTE hPalOld;
  19. HBITMAP hbmOld;
  20. } Buffer;
  21. void DeleteBuffer(Buffer * pBuf);
  22. class CDecodeTask : public CRunnableTask
  23. {
  24. public:
  25. static HRESULT Create(IStream * pstrm, LPCWSTR pszFilename, UINT iItem, IShellImageDataFactory * pFactory, HWND hwnd, IRunnableTask ** pTask);
  26. STDMETHOD(RunInitRT)();
  27. inline BOOL IsEditable() { return (_fEditable); }
  28. inline BOOL IsMultipage() { return (!_fAnimated && (_cImages > 1)); }
  29. inline BOOL IsFirstPage() { return (0==_iCurrent); }
  30. inline BOOL IsLastPage() { return (_iCurrent == _cImages-1); }
  31. inline BOOL IsAnimated() { return (_fAnimated); }
  32. inline BOOL IsExtendedPixelFmt () { return _fExtendedPF; }
  33. LPCWSTR GetName() { return _pszFilename; }
  34. BOOL GetSize(SIZE * psz);
  35. BOOL GetResolution(ULONG * px, ULONG * py);
  36. DWORD GetDelay();
  37. BOOL PrevPage();
  38. BOOL NextPage();
  39. BOOL NextFrame();
  40. BOOL SelectPage(ULONG nPage);
  41. BOOL ChangePage(CAnnotationSet& pAnnotations);
  42. HRESULT Print(BOOL fShowUI, LPWSTR szPrinterName, HWND hwndOwner);
  43. HRESULT Rotate(DWORD dwAngle);
  44. HRESULT Lock(IShellImageData ** ppSID);
  45. HRESULT Unlock();
  46. BOOL DisplayName(LPTSTR psz, UINT cch);
  47. // general image data
  48. ULONG _cImages;
  49. ULONG _iCurrent;
  50. BOOL _fAnimated;
  51. BOOL _fEditable;
  52. GUID _guidFormat;
  53. UINT _iItem;
  54. BOOL _fIsReadOnly;
  55. HRESULT _hr;
  56. // properties of page _iCurrent
  57. PageInfo * _ppi;
  58. private:
  59. CDecodeTask();
  60. ~CDecodeTask();
  61. HRESULT _Initialize(IStream * pstrm, LPCWSTR pszFilename, UINT iItem, IShellImageDataFactory * pFactory, HWND hwnd);
  62. // initialization info
  63. IStream *_pstrm;
  64. LPWSTR _pszFilename;
  65. IShellImageDataFactory * _pfactory;
  66. HWND _hwndNotify;
  67. // protected data
  68. CRITICAL_SECTION _cs;
  69. IShellImageData *_pSID;
  70. SHFILEINFO _sfi;
  71. BOOL _fExtendedPF;
  72. };
  73. class CDrawTask : public CRunnableTask, public IShellImageDataAbort
  74. {
  75. public:
  76. // CRunnableTask
  77. static HRESULT Create(CDecodeTask * pImageData, COLORREF clr, RECT & rcSrc, RECT & rcDest, HWND hwnd, ULONG uMsg, IRunnableTask ** ppTask);
  78. STDMETHOD(RunInitRT)() { return S_OK; }
  79. STDMETHOD(InternalResumeRT)();
  80. // *** IUnknown ***
  81. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  82. STDMETHODIMP_(ULONG) AddRef(void) { return CRunnableTask::AddRef(); }
  83. STDMETHODIMP_(ULONG) Release(void) { return CRunnableTask::Release(); }
  84. // *** IShellImageDataAbort ***
  85. STDMETHOD(QueryAbort)();
  86. private:
  87. CDrawTask();
  88. ~CDrawTask();
  89. HRESULT _Initialize(CDecodeTask * pImageData, COLORREF clr, RECT & rcSrc, RECT & rcDest, HWND hwnd, ULONG uMsg);
  90. static BOOL _Abort(void *pvRef);
  91. CDecodeTask * _pImgData;
  92. DWORD _dwPage;
  93. COLORREF _clrBkgnd;
  94. RECT _rcSrc;
  95. Buffer * _pBuf;
  96. HWND _hwndNotify;
  97. ULONG _uMsgNotify;
  98. };