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.

325 lines
11 KiB

  1. /**********************************************************************
  2. * FontView.h - Definition for the CFontView, our implementation for
  3. * the IShellView in our browser.
  4. *
  5. **********************************************************************/
  6. #if !defined(__FONTVIEW_H__)
  7. #define __FONTVIEW_H__
  8. #ifndef __EXTRICON_H__
  9. #include "extricon.h"
  10. #endif
  11. // Forward declarations.
  12. class CFontClass;
  13. class CFontList;
  14. class CFontView;
  15. class CFontManager;
  16. VOID InstallDataObject( LPDATAOBJECT pdobj, DWORD dwEffect, HWND hWnd, CFontView * poView = NULL);
  17. // ********************************************************************
  18. class CFontData : public IDataObject
  19. {
  20. public:
  21. // ctor, dtor, and init.
  22. //
  23. CFontData();
  24. ~CFontData();
  25. BOOL bInit( CFontList * poList );
  26. CFontList *poDetachList(void);
  27. CFontList *poCloneList(void);
  28. // *** IUnknown methods ***
  29. STDMETHODIMP QueryInterface( REFIID riid, LPVOID * ppvObj );
  30. STDMETHODIMP_(ULONG) AddRef( void );
  31. STDMETHODIMP_(ULONG) Release( void );
  32. // **** IDataObject ****
  33. //
  34. STDMETHODIMP GetData( FORMATETC *pformatetcIn, STGMEDIUM *pmedium );
  35. STDMETHODIMP GetDataHere( FORMATETC *pformatetc, STGMEDIUM *pmedium );
  36. STDMETHODIMP QueryGetData( FORMATETC *pformatetc );
  37. STDMETHODIMP GetCanonicalFormatEtc( FORMATETC *pformatectIn,
  38. FORMATETC *pformatetcOut );
  39. STDMETHODIMP SetData( FORMATETC *pformatetc,
  40. STGMEDIUM *pmedium,
  41. BOOL fRelease );
  42. STDMETHODIMP EnumFormatEtc( DWORD dwDirection,
  43. IEnumFORMATETC **ppenumFormatEtc );
  44. STDMETHODIMP DAdvise( FORMATETC *pformatetc,
  45. DWORD advf,
  46. IAdviseSink *pAdvSink,
  47. DWORD *pdwConnection);
  48. STDMETHODIMP DUnadvise( DWORD dwConnection);
  49. STDMETHODIMP EnumDAdvise( IEnumSTATDATA **ppenumAdvise );
  50. // Additional public interfaces.
  51. //
  52. BOOL bAFR(); // AddFontResource() for each of these
  53. BOOL bRFR(); // RemoveFontResource for each object.
  54. static CLIPFORMAT s_CFPerformedDropEffect; // Performed Drop Effect CF atom.
  55. static CLIPFORMAT s_CFPreferredDropEffect;
  56. static CLIPFORMAT s_CFLogicalPerformedDropEffect;
  57. //
  58. // Get the performed data transfer effect from the Data Object.
  59. //
  60. DWORD GetPerformedDropEffect(void)
  61. { return m_dwPerformedDropEffect; }
  62. void SetPerformedDropEffect(DWORD dwEffect)
  63. { m_dwPerformedDropEffect = dwEffect; }
  64. DWORD GetLogicalPerformedDropEffect(void)
  65. { return m_dwLogicalPerformedDropEffect; }
  66. void SetLogicalPerformedDropEffect(DWORD dwEffect)
  67. { m_dwLogicalPerformedDropEffect = dwEffect; }
  68. DWORD GetPreferredDropEffect(void)
  69. { return m_dwPreferredDropEffect; }
  70. void SetPreferredDropEffect(DWORD dwEffect)
  71. { m_dwPreferredDropEffect = dwEffect; }
  72. private:
  73. int m_cRef;
  74. CFontList * m_poList;
  75. DWORD m_dwPerformedDropEffect; // DROPEFFECT_XXXX.
  76. DWORD m_dwPreferredDropEffect; // DROPEFFECT_XXXX.
  77. DWORD m_dwLogicalPerformedDropEffect;
  78. HRESULT ReleaseStgMedium(LPSTGMEDIUM pmedium);
  79. };
  80. // ********************************************************************
  81. class CFontView : public IShellView, public IDropTarget, public IPersistFolder
  82. {
  83. public:
  84. CFontView(void);
  85. ~CFontView( );
  86. int Compare( CFontClass * pFont1, CFontClass * pFont2 );
  87. void vShapeView( );
  88. // *** IUnknown methods ***
  89. STDMETHODIMP QueryInterface( REFIID riid, void **ppv );
  90. STDMETHODIMP_(ULONG) AddRef( void );
  91. STDMETHODIMP_(ULONG) Release( void );
  92. // *** IOleWindow methods ***
  93. STDMETHODIMP GetWindow( HWND * lphwnd );
  94. STDMETHODIMP ContextSensitiveHelp( BOOL fEnterMode );
  95. // *** IShellView methods ***
  96. STDMETHODIMP TranslateAccelerator( LPMSG msg );
  97. STDMETHODIMP EnableModeless( BOOL fEnable );
  98. STDMETHODIMP UIActivate( UINT uState );
  99. STDMETHODIMP Refresh( void );
  100. STDMETHODIMP CreateViewWindow( IShellView * lpPrevView,
  101. LPCFOLDERSETTINGS lpfs,
  102. IShellBrowser * psb,
  103. RECT * prcView,
  104. HWND * phwnd);
  105. STDMETHODIMP DestroyViewWindow( void );
  106. STDMETHODIMP GetCurrentInfo( LPFOLDERSETTINGS lpfs );
  107. STDMETHODIMP AddPropertySheetPages( DWORD dwReserved,
  108. LPFNADDPROPSHEETPAGE lpfn,
  109. LPARAM lparam);
  110. STDMETHODIMP SaveViewState( void );
  111. STDMETHODIMP SelectItem( LPCITEMIDLIST lpvID, UINT uFlags );
  112. STDMETHODIMP GetItemObject( UINT uItem, REFIID riid, LPVOID *ppv );
  113. // **** IDropTarget ****
  114. //
  115. STDMETHODIMP DragEnter( IDataObject __RPC_FAR *pDataObj,
  116. DWORD grfKeyState, POINTL pt,
  117. DWORD __RPC_FAR *pdwEffect );
  118. STDMETHODIMP DragOver( DWORD grfKeyState,
  119. POINTL pt,
  120. DWORD __RPC_FAR *pdwEffect );
  121. STDMETHODIMP DragLeave( void );
  122. STDMETHODIMP Drop( IDataObject __RPC_FAR *pDataObj,
  123. DWORD grfKeyState,
  124. POINTL pt,
  125. DWORD __RPC_FAR *pdwEffect );
  126. // *** IPersist methods ***
  127. STDMETHODIMP GetClassID( LPCLSID lpClassID );
  128. // *** IPersistFolder methods ***
  129. STDMETHODIMP Initialize( LPCITEMIDLIST pidl );
  130. public:
  131. void StatusPush( UINT nStatus );
  132. void StatusPush( LPTSTR lpsz );
  133. void StatusPop( );
  134. void StatusClear( );
  135. //
  136. // Exposing this is a violation of the design of this object.
  137. // However, it is needed so that we can provide a parent to the installation
  138. // progress dialog.
  139. //
  140. HWND GetViewWindow(void)
  141. { return m_hwndView; }
  142. DWORD GetDateReading(void)
  143. { return m_dwDateFormat; }
  144. IDataObject *m_pdtobjHdrop; // Used to support drag-drop from Win3.1 app.
  145. private:
  146. enum CLICKMODE
  147. {
  148. CLICKMODE_SINGLE = 1,
  149. CLICKMODE_DOUBLE = 2,
  150. };
  151. int RegisterWindowClass( );
  152. STDMETHODIMP GetSavedViewState( );
  153. void SortObjects( );
  154. void FillObjects( );
  155. int AddObject( CFontClass * poFont );
  156. LRESULT BeginDragDrop( NM_LISTVIEW FAR *lpn );
  157. int OnActivate( UINT state );
  158. int OnDeactivate( );
  159. int MergeToolbar( );
  160. static INT_PTR CALLBACK FontViewDlgProc( HWND, UINT, WPARAM, LPARAM );
  161. static LRESULT CALLBACK FontViewWndProc( HWND, UINT, WPARAM, LPARAM );
  162. static INT_PTR CALLBACK OptionsDlgProc( HWND, UINT, WPARAM, LPARAM) ;
  163. int OnMenuSelect( HWND hWnd, UINT nID, UINT nFlags, HMENU hMenu );
  164. int OnCommand( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
  165. int OnNotify( LPNMHDR lpn );
  166. VOID OnLVN_ItemActivate(LPNMITEMACTIVATE pnma);
  167. void OnDropFiles( HDROP hDrop, DWORD dwEffect = DROPEFFECT_MOVE );
  168. void OnCmdCutCopy( UINT nID );
  169. void OnCmdDelete( );
  170. void OnCmdPaste( );
  171. void OnCmdProperties( );
  172. void OnPointSize( int nPlus );
  173. void OnHelpTopics( HWND hWnd );
  174. INT ItemImageIndex(CFontClass *poFont);
  175. CLICKMODE SetListviewClickMode(VOID);
  176. void UpdateUnderlines(void);
  177. void LV_OnGetInfoTip(LPNMLVGETINFOTIP lpnm);
  178. VOID LV_OnHoverNotify(LPNMLISTVIEW pnmlv);
  179. BOOL CreateToolTipWindow(VOID);
  180. VOID UpdateFontSample(INT iItem);
  181. //
  182. // Functions to support Attributes column in details view and
  183. // alternate coloring of compressed files.
  184. //
  185. int OnShellChangeNotify(WPARAM wParam, LPARAM lParam);
  186. int OnCustomDrawNotify(LPNMHDR lpn);
  187. void UpdateFontViewObject(CFontClass *poFont);
  188. int CompareByFileAttributes(CFontClass *poFont1, CFontClass *poFont2);
  189. LPTSTR BuildAttributeString(DWORD dwAttributes, LPTSTR pszString, UINT nChars);
  190. //
  191. // Functions to support drag-drop from Win3.1 app.
  192. //
  193. void OldDAD_DropTargetLeaveAndReleaseData(void);
  194. LRESULT OldDAD_HandleMessages(UINT message, WPARAM wParam, const DROPSTRUCT *lpds);
  195. void UpdateMenuItems( HMENU hMenu );
  196. void UpdateToolbar( );
  197. LRESULT ProcessMessage( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
  198. BOOL OpenCurrent( );
  199. BOOL PrintCurrent( );
  200. BOOL ViewValue( CFontClass * poFont );
  201. BOOL PrintValue( CFontClass *poFont );
  202. void vLoadCombo( );
  203. void SetViewMode( UINT uMode );
  204. void UpdatePanColumn( );
  205. void vToggleSelection( BOOL bSelectAll );
  206. int iCurrentSelection( );
  207. HRESULT GetUIObjectFromItem( REFIID riid, LPVOID FAR *ppobj, UINT nItem );
  208. HRESULT GetFontList( CFontList **ppoList, UINT nItem );
  209. void ReleaseFontObjects(void);
  210. void UpdateSelectedCount();
  211. private:
  212. int m_cRef;
  213. BOOL m_bFamilyOnly;
  214. CFontClass * m_poPanose;
  215. HWND m_hwndView;
  216. HWND m_hwndList;
  217. HWND m_hwndText;
  218. HWND m_hwndCombo;
  219. HWND m_hwndParent;
  220. HWND m_hwndNextClip; // Next window in the viewer chain
  221. HMODULE m_hmodHHCtrlOcx; // Html Help OCX.
  222. DWORD m_dwDateFormat;
  223. HWND m_hwndToolTip; // Tooltip window handle.
  224. BOOL m_bShowPreviewToolTip;// User preference setting.
  225. LPTSTR m_pszSampleText; // Sample string used for character fonts.
  226. LPTSTR m_pszSampleSymbols; // Sample string used for symbol fonts.
  227. INT m_iTTLastHit; // Last item with active tooltip.
  228. HFONT m_hfontSample; // Font for displaying sample in tooltip window.
  229. HIMAGELIST m_hImageList;
  230. HIMAGELIST m_hImageListSmall;
  231. int m_iFirstBitmap;
  232. HMENU m_hmenuCur;
  233. IShellBrowser* m_psb;
  234. UINT m_uState; // Deactivated, active-focus, active-nofocus
  235. UINT m_idViewMode;
  236. UINT m_ViewModeReturn;
  237. UINT m_fFolderFlags;
  238. UINT m_nComboWid;
  239. int m_iSortColumn;
  240. int m_iSortLast;
  241. BOOL m_bSortAscending; // TRUE = ascending, FALSE = descending.
  242. CLICKMODE m_iViewClickMode; // CLICKMODE_SINGLE or CLICKMODE_DOUBLE.
  243. DWORD m_dwEffect; // Drag/drop effect.
  244. DWORD m_dwOldDADEffect; // Drag/drop effect for Win3.1-style drops.
  245. DWORD m_grfKeyState;
  246. BOOL m_bDragSource;
  247. int m_iHidden;
  248. HANDLE m_hAccel;
  249. BOOL m_bResizing; // Resizing the view window ?
  250. BOOL m_bUIActivated; // UI Activated through UIActivate( )
  251. // This flag is used to prevent processing
  252. // NM_SETFOCUS before UIActivate( ) has
  253. // been called.
  254. ULONG m_uSHChangeNotifyID; // Registered shell change notification ID.
  255. CFontIconHandler m_IconHandler;
  256. CFontManager *m_poFontManager;
  257. BOOL m_bShowCompColor; // T = user want's alternate color for compressed items.
  258. BOOL m_bShowHiddenFonts;
  259. };
  260. #endif // __FONTVIEW_H__