ReactOS 0.4.15-dev-7674-gc0b4db1
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
11class 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;
19
20public:
21
22 CFontExt();
23 ~CFontExt();
24
25 // *** IShellFolder2 methods ***
26 virtual STDMETHODIMP GetDefaultSearchGUID(GUID *lpguid);
28 virtual STDMETHODIMP GetDefaultColumn(DWORD dwReserved, ULONG *pSort, ULONG *pDisplay);
29 virtual STDMETHODIMP GetDefaultColumnState(UINT iColumn, SHCOLSTATEF *pcsFlags);
30 virtual STDMETHODIMP GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv);
31 virtual STDMETHODIMP GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd);
32 virtual STDMETHODIMP MapColumnToSCID(UINT iColumn, SHCOLUMNID *pscid);
33
34 // *** IShellFolder methods ***
35 virtual STDMETHODIMP ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes);
36 virtual STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList);
37 virtual STDMETHODIMP BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
38 virtual STDMETHODIMP BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
40 virtual STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut);
41 virtual STDMETHODIMP GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut);
42 virtual STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut);
44 virtual STDMETHODIMP SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut);
45
46
47 // *** IPersistFolder2 methods ***
49
50 // *** IPersistFolder methods ***
52
53 // *** IPersist methods ***
54 virtual STDMETHODIMP GetClassID(CLSID *lpClassId);
55
56 // *** IDropTarget methods ***
57 virtual STDMETHODIMP DragEnter(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
58 virtual STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
59 virtual STDMETHODIMP DragLeave();
60 virtual STDMETHODIMP Drop(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
61
62#if 0
63 static HRESULT WINAPI log_stuff(void* pv, REFIID riid, LPVOID* ppv, DWORD_PTR dw)
64 {
65 WCHAR* g2s(REFCLSID iid);
66
68 StringCchPrintfW(buffer, _countof(buffer), L"CFontExt::QueryInterface(%s)\n", g2s(riid));
70
71 return E_NOINTERFACE;
72 }
73#endif
74
75protected:
76
77public:
78
81
83
85 COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
86 COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
87 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
88 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
89 COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
90 //COM_INTERFACE_ENTRY_FUNC_BLIND(0, log_stuff)
92
93 HRESULT DoInstallFontFile(LPCWSTR pszFontPath, LPCWSTR pszFontsDir, HKEY hkeyFonts);
94 HRESULT DoGetFontTitle(IN LPCWSTR pszFontPath, OUT CStringW& strFontName);
95};
WCHAR * g2s(REFCLSID iid)
Definition: CFontExt.cpp:57
#define STDMETHODIMP
Definition: basetyps.h:43
virtual STDMETHODIMP GetDefaultColumnState(UINT iColumn, SHCOLSTATEF *pcsFlags)
Definition: CFontExt.cpp:112
virtual STDMETHODIMP GetClassID(CLSID *lpClassId)
Definition: CFontExt.cpp:492
virtual STDMETHODIMP SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
Definition: CFontExt.cpp:441
HRESULT DoGetFontTitle(IN LPCWSTR pszFontPath, OUT CStringW &strFontName)
Definition: CFontExt.cpp:665
virtual STDMETHODIMP GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd)
Definition: CFontExt.cpp:127
CComHeapPtr< ITEMIDLIST > m_Folder
Definition: CFontExt.hpp:18
CFontExt()
Definition: CFontExt.cpp:83
virtual STDMETHODIMP Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CFontExt.cpp:521
virtual STDMETHODIMP DragLeave()
Definition: CFontExt.cpp:516
virtual STDMETHODIMP GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut)
Definition: CFontExt.cpp:340
virtual STDMETHODIMP EnumSearches(IEnumExtraSearch **ppenum)
Definition: CFontExt.cpp:100
virtual STDMETHODIMP GetDefaultColumn(DWORD dwReserved, ULONG *pSort, ULONG *pDisplay)
Definition: CFontExt.cpp:106
virtual STDMETHODIMP GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: CFontExt.cpp:412
virtual STDMETHODIMP GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv)
Definition: CFontExt.cpp:121
virtual STDMETHODIMP GetCurFolder(LPITEMIDLIST *ppidl)
Definition: CFontExt.cpp:448
virtual STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CFontExt.cpp:511
HRESULT DoInstallFontFile(LPCWSTR pszFontPath, LPCWSTR pszFontsDir, HKEY hkeyFonts)
Definition: CFontExt.cpp:615
virtual STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
Definition: CFontExt.cpp:235
virtual STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
Definition: CFontExt.cpp:311
virtual STDMETHODIMP BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
Definition: CFontExt.cpp:240
virtual STDMETHODIMP GetDefaultSearchGUID(GUID *lpguid)
Definition: CFontExt.cpp:94
virtual STDMETHODIMP CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
Definition: CFontExt.cpp:252
virtual STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut)
Definition: CFontExt.cpp:369
virtual STDMETHODIMP DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CFontExt.cpp:499
~CFontExt()
Definition: CFontExt.cpp:88
virtual STDMETHODIMP BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
Definition: CFontExt.cpp:246
virtual STDMETHODIMP MapColumnToSCID(UINT iColumn, SHCOLUMNID *pscid)
Definition: CFontExt.cpp:222
LPARAM lParam
Definition: combotst.c:139
#define IDR_FONTEXT
Definition: resource.h:15
#define MAX_PATH
Definition: compat.h:34
#define pt(x, y)
Definition: drawing.c:79
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint buffer
Definition: glext.h:5915
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:679
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:651
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:645
#define END_COM_MAP()
Definition: atlcom.h:592
static IParseDisplayName ParseDisplayName
Definition: moniker.c:816
static LPOLESTR
Definition: stg_prop.c:27
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
interface IBindCtx * LPBC
Definition: objfwd.h:18
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
DWORD SHCOLSTATEF
Definition: shtypes.idl:142
#define _countof(array)
Definition: sndvol32.h:68
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_In_ LPCSTR lpName
Definition: winbase.h:2789
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
LONG_PTR LPARAM
Definition: windef.h:208
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
static void Initialize()
Definition: xlate.c:212
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185