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.

115 lines
6.1 KiB

  1. // --------------------------------------------------------------------------------
  2. // WebPage.h
  3. // Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  4. // Steven J. Bailey
  5. // --------------------------------------------------------------------------------
  6. #ifndef __WEBPAGE_H
  7. #define __WEBPAGE_H
  8. // -----------------------------------------------------------------------------
  9. // Forward Decls
  10. // -----------------------------------------------------------------------------
  11. class CVirtualStream;
  12. class CMessageTree;
  13. class CActiveUrlRequest;
  14. typedef class CActiveUrlRequest *LPURLREQUEST;
  15. typedef CMessageTree *LPMESSAGETREE;
  16. typedef struct tagTREENODEINFO *LPTREENODEINFO;
  17. // -----------------------------------------------------------------------------
  18. // PAGESEGMENT
  19. // -----------------------------------------------------------------------------
  20. typedef struct tagPAGESEGMENT *LPPAGESEGMENT;
  21. typedef struct tagPAGESEGMENT {
  22. DWORD cbOffset; // IStream Read / Seek Offset
  23. DWORD cbLength; // How long is this segment
  24. BYTE fLengthKnown; // Have I computed the length of this segment
  25. IStream *pStream; // The stream containing the data for this segment
  26. LPPAGESEGMENT pPrev; // The previous segment
  27. LPPAGESEGMENT pNext; // The next segment
  28. } PAGESEGMENT;
  29. // -----------------------------------------------------------------------------
  30. // CMessageWebPage
  31. // -----------------------------------------------------------------------------
  32. class CMessageWebPage : public IStream, public IMimeMessageCallback
  33. {
  34. public:
  35. // -------------------------------------------------------------------------
  36. // Construction
  37. // -------------------------------------------------------------------------
  38. CMessageWebPage(LPURLREQUEST pRequest);
  39. ~CMessageWebPage(void);
  40. // -------------------------------------------------------------------------
  41. // IUnknown
  42. // -------------------------------------------------------------------------
  43. STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppvObject);
  44. STDMETHODIMP_(ULONG) AddRef(void);
  45. STDMETHODIMP_(ULONG) Release(void);
  46. // -------------------------------------------------------------------------
  47. // IStream
  48. // -------------------------------------------------------------------------
  49. STDMETHODIMP Read(LPVOID pvData, ULONG cbData, ULONG *pcbRead);
  50. STDMETHODIMP Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition);
  51. STDMETHODIMP Write(const void *, ULONG, ULONG *) { return TrapError(STG_E_ACCESSDENIED); }
  52. STDMETHODIMP SetSize(ULARGE_INTEGER) { return E_NOTIMPL; }
  53. STDMETHODIMP CopyTo(LPSTREAM, ULARGE_INTEGER, ULARGE_INTEGER *, ULARGE_INTEGER *) { return E_NOTIMPL; }
  54. STDMETHODIMP Stat(STATSTG *pStat, DWORD dw) { return E_NOTIMPL; }
  55. STDMETHODIMP Commit(DWORD) { return E_NOTIMPL; }
  56. STDMETHODIMP Revert(void) { return E_NOTIMPL; }
  57. STDMETHODIMP LockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD) { return E_NOTIMPL; }
  58. STDMETHODIMP UnlockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD) { return E_NOTIMPL; }
  59. STDMETHODIMP Clone(LPSTREAM *) { return E_NOTIMPL; }
  60. // ----------------------------------------------------------------------------
  61. // IMimeWebaPageCallback (Default Implementation if client doesn't specify)
  62. // ----------------------------------------------------------------------------
  63. STDMETHODIMP OnWebPageSplitter(DWORD cInlined, IStream *pStream);
  64. // -------------------------------------------------------------------------
  65. // CMessageWebPage Methods
  66. // -------------------------------------------------------------------------
  67. HRESULT Initialize(IMimeMessageCallback *pCallback, LPMESSAGETREE pTree, LPWEBPAGEOPTIONS pOptions);
  68. HRESULT OnBodyBoundToTree(LPMESSAGETREE pTree, LPTREENODEINFO pNode);
  69. HRESULT OnBindComplete(LPMESSAGETREE pTree);
  70. private:
  71. // -------------------------------------------------------------------------
  72. // Private Methods
  73. // -------------------------------------------------------------------------
  74. void _VFreeSegmentList(void);
  75. void _VFreeSegment(LPPAGESEGMENT pSegment);
  76. void _VAppendSegment(LPPAGESEGMENT pSegment);
  77. void _VInitializeCharacterSet(LPMESSAGETREE pTree);
  78. HRESULT _AllocateSegment(LPPAGESEGMENT *ppSegment, BOOL fCreateStream);
  79. HRESULT _GetInlineHtmlStream(LPMESSAGETREE pTree, LPTREENODEINFO pNode, LPSTREAM *ppStream);
  80. HRESULT _InlineTextBody(LPMESSAGETREE pTree, LPTREENODEINFO pNode, BOOL fSetParents);
  81. HRESULT _InlineImageBody(LPMESSAGETREE pTree, LPTREENODEINFO pNode);
  82. HRESULT _DoAttachmentLinks(LPMESSAGETREE pTree);
  83. HRESULT _DoSegmentSplitter(void);
  84. HRESULT _SetContentId(LPTREENODEINFO pNode, LPSTR pszCID, ULONG cchCID);
  85. HRESULT _ComputeStreamSize(LPDWORD pcbSize);
  86. HRESULT _DoSlideShow(LPMESSAGETREE pTree);
  87. private:
  88. // -------------------------------------------------------------------------
  89. // Private Data
  90. // -------------------------------------------------------------------------
  91. LONG m_cRef; // Reference count
  92. HCHARSET m_hCharset; // Character set of the message
  93. WEBPAGEOPTIONS m_rOptions; // WebPage Options
  94. LPURLREQUEST m_pRequest; // Url Request for root stream
  95. LPPAGESEGMENT m_pHeadSegment; // First Segment
  96. LPPAGESEGMENT m_pTailSegment; // Last Segment
  97. LPPAGESEGMENT m_pCurrSegment; // Current Segment
  98. DWORD m_cbOffset; // Stream Offset
  99. BYTE m_fComplete; // Has BindComplete been called
  100. DWORD m_cInline; // Number of inline bodies
  101. DWORD m_cSlideShow; // Number of images to put into a slide show
  102. IMimeMessageCallback *m_pCallback; // WebPage Callback
  103. CRITICAL_SECTION m_cs; // Critical Section for m_pStream
  104. };
  105. #endif // __WEBPAGE_H