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.

175 lines
6.4 KiB

  1. #ifndef _HTML_H
  2. #define _HTML_H
  3. #include "webvw.h"
  4. interface IHTMLDocument2;
  5. #define DECLAREWAITCURSOR2 HCURSOR hcursor_wait_cursor_save
  6. //
  7. // a class host for trident so that we can control what it downloads
  8. // and what it doesn't...
  9. //
  10. class CTridentHost : public IOleClientSite,
  11. public IDispatch,
  12. public IDocHostUIHandler
  13. {
  14. public:
  15. CTridentHost();
  16. ~CTridentHost();
  17. HRESULT SetTrident( IOleObject * pTrident );
  18. // IUnknown
  19. STDMETHOD ( QueryInterface )( REFIID riid, void ** ppvObj );
  20. STDMETHOD_( ULONG, AddRef ) ( void );
  21. STDMETHOD_( ULONG, Release ) ( void );
  22. // IDispatch (ambient properties)
  23. STDMETHOD( GetTypeInfoCount ) (UINT *pctinfo);
  24. STDMETHOD( GetTypeInfo )(UINT itinfo, LCID lcid, ITypeInfo **pptinfo);
  25. STDMETHOD( GetIDsOfNames )(REFIID riid, OLECHAR **rgszNames, UINT cNames,
  26. LCID lcid, DISPID *rgdispid);
  27. STDMETHOD( Invoke )(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags,
  28. DISPPARAMS *pdispparams, VARIANT *pvarResult,
  29. EXCEPINFO *pexcepinfo, UINT *puArgErr);
  30. // IOleClientSite
  31. STDMETHOD( SaveObject )(void);
  32. STDMETHOD( GetMoniker )(DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk);
  33. STDMETHOD( GetContainer )(IOleContainer **ppContainer);
  34. STDMETHOD( ShowObject )(void);
  35. STDMETHOD( OnShowWindow )(BOOL fShow);
  36. STDMETHOD( RequestNewObjectLayout )(void);
  37. // IDocHostUIHandler
  38. STDMETHOD( ShowContextMenu )( DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdispReserved);
  39. STDMETHOD( GetHostInfo )( DOCHOSTUIINFO *pInfo);
  40. STDMETHOD( ShowUI )( DWORD dwID, IOleInPlaceActiveObject *pActiveObject,IOleCommandTarget *pCommandTarget,
  41. IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc);
  42. STDMETHOD( HideUI )( void);
  43. STDMETHOD( UpdateUI )( void);
  44. STDMETHOD( EnableModeless )( BOOL fEnable);
  45. STDMETHOD( OnDocWindowActivate )( BOOL fActivate);
  46. STDMETHOD( OnFrameWindowActivate )( BOOL fActivate);
  47. STDMETHOD( ResizeBorder )( LPCRECT prcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow);
  48. STDMETHOD( TranslateAccelerator )( LPMSG lpMsg, const GUID *pguidCmdGroup, DWORD nCmdID);
  49. STDMETHOD( GetOptionKeyPath )( LPOLESTR *pchKey, DWORD dw);
  50. STDMETHOD( GetDropTarget )( IDropTarget *pDropTarget, IDropTarget **ppDropTarget);
  51. STDMETHOD( GetExternal )( IDispatch **ppDispatch);
  52. STDMETHOD( TranslateUrl )( DWORD dwTranslate, OLECHAR *pchURLIn, OLECHAR **ppchURLOut);
  53. STDMETHOD( FilterDataObject )( IDataObject *pDO, IDataObject **ppDORet);
  54. public:
  55. BITBOOL m_fOffline : 1;
  56. protected:
  57. long m_cRef;
  58. };
  59. class CHtmlThumb : public IExtractImage,
  60. public IThumbnailCapture,
  61. public IRunnableTask,
  62. public IPropertyNotifySink,
  63. public IPersistFile,
  64. public IPersistMoniker,
  65. public CComObjectRoot,
  66. public CComCoClass< CHtmlThumb,&CLSID_HtmlThumbnailExtractor >
  67. {
  68. public:
  69. CHtmlThumb();
  70. ~CHtmlThumb();
  71. BEGIN_COM_MAP( CHtmlThumb )
  72. COM_INTERFACE_ENTRY( IExtractImage)
  73. COM_INTERFACE_ENTRY( IThumbnailCapture )
  74. COM_INTERFACE_ENTRY( IRunnableTask )
  75. COM_INTERFACE_ENTRY( IPropertyNotifySink )
  76. COM_INTERFACE_ENTRY( IPersistFile )
  77. COM_INTERFACE_ENTRY( IPersistMoniker )
  78. END_COM_MAP( )
  79. DECLARE_REGISTRY( CHtmlThumb,
  80. _T("Shell.ThumbnailExtract.HTML.1"),
  81. _T("Shell.ThumbnailExtract.HTML.1"),
  82. IDS_HTMLTHUMBEXTRACT_DESC,
  83. THREADFLAGS_APARTMENT);
  84. DECLARE_NOT_AGGREGATABLE( CHtmlThumb );
  85. // IExtractImage
  86. STDMETHOD (GetLocation) ( LPWSTR pszPathBuffer,
  87. DWORD cch,
  88. DWORD * pdwPriority,
  89. const SIZE * prgSize,
  90. DWORD dwRecClrDepth,
  91. DWORD *pdwFlags );
  92. STDMETHOD (Extract)( HBITMAP * phBmpThumbnail );
  93. // IThumbnailCapture
  94. STDMETHOD (CaptureThumbnail) ( const SIZE * pMaxSize, IUnknown * pHTMLDoc2, HBITMAP * phbmThumbnail );
  95. // IRunnableTask
  96. STDMETHOD (Run)( void ) ;
  97. STDMETHOD (Kill)( BOOL fWait );
  98. STDMETHOD (Suspend)( );
  99. STDMETHOD (Resume)( );
  100. STDMETHOD_( ULONG, IsRunning )( void );
  101. // IPropertyNotifySink
  102. STDMETHOD (OnChanged)( DISPID dispID);
  103. STDMETHOD (OnRequestEdit) ( DISPID dispID);
  104. // IPersistFile
  105. STDMETHOD (GetClassID )(CLSID *pClassID);
  106. STDMETHOD (IsDirty )();
  107. STDMETHOD (Load )( LPCOLESTR pszFileName, DWORD dwMode);
  108. STDMETHOD (Save )( LPCOLESTR pszFileName, BOOL fRemember);
  109. STDMETHOD (SaveCompleted )( LPCOLESTR pszFileName);
  110. STDMETHOD (GetCurFile )( LPOLESTR *ppszFileName);
  111. // IPersistMoniker
  112. STDMETHOD( Load )( BOOL fFullyAvailable, IMoniker *pimkName, LPBC pibc, DWORD grfMode);
  113. STDMETHOD( Save )( IMoniker *pimkName, LPBC pbc, BOOL fRemember);
  114. STDMETHOD( SaveCompleted )( IMoniker *pimkName, LPBC pibc);
  115. STDMETHOD( GetCurMoniker )( IMoniker **ppimkName);
  116. protected:
  117. HRESULT InternalResume( void );
  118. HRESULT Create_URL_Moniker( IMoniker **ppMoniker );
  119. HRESULT WaitForRender( void );
  120. HRESULT Finish( HBITMAP * pBmp, const SIZE * prgSize, DWORD dwClrDepth );
  121. HRESULT CheckReadyState( );
  122. void ReportError( void ** pMsgArgs );
  123. LONG m_lState;
  124. BOOL m_fAsync;
  125. HANDLE m_hDone;
  126. CTridentHost m_Host;
  127. IHTMLDocument2 * m_pHTML;
  128. IOleObject * m_pOleObject;
  129. IConnectionPoint * m_pConPt;
  130. IViewObject * m_pViewObject;
  131. DWORD m_dwTimeout;
  132. DWORD m_dwCurrentTick;
  133. DWORD m_dwPropNotifyCookie;
  134. WCHAR m_szPath[MAX_PATH];
  135. SIZE m_rgSize;
  136. HBITMAP * m_phBmp;
  137. DWORD m_dwClrDepth;
  138. DECLAREWAITCURSOR2;
  139. DWORD m_dwXRenderSize;
  140. DWORD m_dwYRenderSize;
  141. IMoniker * m_pMoniker;
  142. };
  143. // time we wait before asking the internet explorer if it is done yet ...
  144. #define TIME_PAUSE 200
  145. // default timeout (seconds)
  146. #define TIME_DEFAULT 90
  147. #endif