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 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; 19 20 public: 21 22 CFontExt(); 23 ~CFontExt(); 24 25 // *** IShellFolder2 methods *** 26 virtual STDMETHODIMP GetDefaultSearchGUID(GUID *lpguid); 27 virtual STDMETHODIMP EnumSearches(IEnumExtraSearch **ppenum); 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); 39 virtual STDMETHODIMP CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2); 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); 43 virtual STDMETHODIMP GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet); 44 virtual STDMETHODIMP SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut); 45 46 47 // *** IPersistFolder2 methods *** 48 virtual STDMETHODIMP GetCurFolder(LPITEMIDLIST *ppidl); 49 50 // *** IPersistFolder methods *** 51 virtual STDMETHODIMP Initialize(LPCITEMIDLIST pidl); 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 67 WCHAR buffer[MAX_PATH]; 68 StringCchPrintfW(buffer, _countof(buffer), L"CFontExt::QueryInterface(%s)\n", g2s(riid)); 69 OutputDebugStringW(buffer); 70 71 return E_NOINTERFACE; 72 } 73 #endif 74 75 protected: 76 77 public: 78 79 DECLARE_REGISTRY_RESOURCEID(IDR_FONTEXT) 80 DECLARE_NOT_AGGREGATABLE(CFontExt) 81 82 DECLARE_PROTECT_FINAL_CONSTRUCT() 83 84 BEGIN_COM_MAP(CFontExt) 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) 91 END_COM_MAP() 92 93 HRESULT DoInstallFontFile(LPCWSTR pszFontPath, LPCWSTR pszFontsDir, HKEY hkeyFonts); 94 HRESULT DoGetFontTitle(LPCWSTR pszFontPath, LPCWSTR pszFontName); 95 }; 96