ReactOS  0.4.15-dev-2354-g9e947e2
CFontExt.hpp
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Font Shell Extension
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: CFontExt definition
5  * COPYRIGHT: Copyright 2019,2020 Mark Jansen (mark.jansen@reactos.org)
6  * Copyright 2019 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
7  */
8 
9 #pragma once
10 
11 class CFontExt :
12  public CComCoClass<CFontExt, &CLSID_CFontExt>,
13  public CComObjectRootEx<CComMultiThreadModelNoCS>,
14  public IShellFolder2,
15  public IPersistFolder2,
16  public IDropTarget
17 {
18  CComHeapPtr<ITEMIDLIST> m_Folder;
21 
22 public:
23 
24  CFontExt();
25  ~CFontExt();
26 
27  // *** IShellFolder2 methods ***
28  virtual STDMETHODIMP GetDefaultSearchGUID(GUID *lpguid);
29  virtual STDMETHODIMP EnumSearches(IEnumExtraSearch **ppenum);
30  virtual STDMETHODIMP GetDefaultColumn(DWORD dwReserved, ULONG *pSort, ULONG *pDisplay);
31  virtual STDMETHODIMP GetDefaultColumnState(UINT iColumn, SHCOLSTATEF *pcsFlags);
32  virtual STDMETHODIMP GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv);
33  virtual STDMETHODIMP GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd);
34  virtual STDMETHODIMP MapColumnToSCID(UINT iColumn, SHCOLUMNID *pscid);
35 
36  // *** IShellFolder methods ***
37  virtual STDMETHODIMP ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes);
38  virtual STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList);
39  virtual STDMETHODIMP BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
40  virtual STDMETHODIMP BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
42  virtual STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut);
43  virtual STDMETHODIMP GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut);
44  virtual STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut);
46  virtual STDMETHODIMP SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut);
47 
48 
49  // *** IPersistFolder2 methods ***
50  virtual STDMETHODIMP GetCurFolder(LPITEMIDLIST *ppidl);
51 
52  // *** IPersistFolder methods ***
54 
55  // *** IPersist methods ***
56  virtual STDMETHODIMP GetClassID(CLSID *lpClassId);
57 
58  // *** IDropTarget methods ***
59  virtual STDMETHODIMP DragEnter(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
60  virtual STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
61  virtual STDMETHODIMP DragLeave();
62  virtual STDMETHODIMP Drop(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
63 
64 #if 0
65  static HRESULT WINAPI log_stuff(void* pv, REFIID riid, LPVOID* ppv, DWORD_PTR dw)
66  {
67  WCHAR* g2s(REFCLSID iid);
68 
70  StringCchPrintfW(buffer, _countof(buffer), L"CFontExt::QueryInterface(%s)\n", g2s(riid));
72 
73  return E_NOINTERFACE;
74  }
75 #endif
76 
77 protected:
78 
79 public:
80 
83 
85 
87  COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
88  COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
89  COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
90  COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
91  COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
92  //COM_INTERFACE_ENTRY_FUNC_BLIND(0, log_stuff)
93  END_COM_MAP()
94 
95  HRESULT DoInstallFontFile(LPCWSTR pszFontPath, LPCWSTR pszFontsDir, HKEY hkeyFonts);
96  HRESULT DoGetFontTitle(IN LPCWSTR pszFontPath, OUT CStringW& strFontName);
97 };
#define IN
Definition: typedefs.h:39
virtual STDMETHODIMP DragLeave()
Definition: CFontExt.cpp:467
virtual STDMETHODIMP GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd)
Definition: CFontExt.cpp:120
#define REFIID
Definition: guiddef.h:118
#define E_NOINTERFACE
Definition: winerror.h:2364
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
interface IBindCtx * LPBC
Definition: objfwd.h:18
#define pt(x, y)
Definition: drawing.c:79
REFIID riid
Definition: precomp.h:44
virtual STDMETHODIMP GetClassID(CLSID *lpClassId)
Definition: CFontExt.cpp:442
#define REFCLSID
Definition: guiddef.h:117
virtual STDMETHODIMP Initialize(LPCITEMIDLIST pidl)
Definition: CFontExt.cpp:411
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
_In_ LPCSTR lpName
Definition: winbase.h:2768
REFIID LPVOID * ppv
Definition: atlbase.h:39
CStringW m_LastDetailsFontName
Definition: CFontExt.hpp:19
virtual STDMETHODIMP DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CFontExt.cpp:449
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
~CFontExt()
Definition: CFontExt.cpp:81
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:611
GLuint buffer
Definition: glext.h:5915
static LPOLESTR
Definition: stg_prop.c:27
virtual STDMETHODIMP CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
Definition: CFontExt.cpp:257
HRESULT DoInstallFontFile(LPCWSTR pszFontPath, LPCWSTR pszFontsDir, HKEY hkeyFonts)
Definition: CFontExt.cpp:562
virtual STDMETHODIMP EnumSearches(IEnumExtraSearch **ppenum)
Definition: CFontExt.cpp:93
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
virtual STDMETHODIMP BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
Definition: CFontExt.cpp:245
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
virtual STDMETHODIMP GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: CFontExt.cpp:371
#define STDMETHODIMP
Definition: basetyps.h:43
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
WIN32_FIND_DATAW m_LastDetailsFileData
Definition: CFontExt.hpp:20
virtual STDMETHODIMP GetDefaultColumnState(UINT iColumn, SHCOLSTATEF *pcsFlags)
Definition: CFontExt.cpp:105
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT DoGetFontTitle(IN LPCWSTR pszFontPath, OUT CStringW &strFontName)
Definition: CFontExt.cpp:603
virtual STDMETHODIMP ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
Definition: CFontExt.cpp:234
WCHAR * g2s(REFCLSID iid)
Definition: CFontExt.cpp:50
virtual STDMETHODIMP BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
Definition: CFontExt.cpp:251
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
CFontExt()
Definition: CFontExt.cpp:76
virtual STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut)
Definition: CFontExt.cpp:328
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
virtual STDMETHODIMP Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CFontExt.cpp:472
virtual STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CFontExt.cpp:462
DWORD SHCOLSTATEF
Definition: shtypes.idl:142
virtual STDMETHODIMP GetDefaultSearchGUID(GUID *lpguid)
Definition: CFontExt.cpp:87
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
virtual STDMETHODIMP GetCurFolder(LPITEMIDLIST *ppidl)
Definition: CFontExt.cpp:398
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:605
uint32_t DWORD_PTR
Definition: typedefs.h:65
CComHeapPtr< ITEMIDLIST > m_Folder
Definition: CFontExt.hpp:18
virtual STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
Definition: CFontExt.cpp:240
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:561
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
unsigned int UINT
Definition: ndis.h:50
virtual STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
Definition: CFontExt.cpp:270
virtual STDMETHODIMP GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv)
Definition: CFontExt.cpp:114
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:639
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
virtual STDMETHODIMP GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut)
Definition: CFontExt.cpp:299
#define OUT
Definition: typedefs.h:40
unsigned int ULONG
Definition: retypes.h:1
CAtlStringW CStringW
Definition: atlstr.h:130
virtual STDMETHODIMP MapColumnToSCID(UINT iColumn, SHCOLUMNID *pscid)
Definition: CFontExt.cpp:227
virtual STDMETHODIMP SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
Definition: CFontExt.cpp:391
#define END_COM_MAP()
Definition: atlcom.h:552
virtual STDMETHODIMP GetDefaultColumn(DWORD dwReserved, ULONG *pSort, ULONG *pDisplay)
Definition: CFontExt.cpp:99
#define IDR_FONTEXT
Definition: resource.h:15
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPARAM lParam
Definition: combotst.c:139