ReactOS 0.4.15-dev-5672-gf73ac17
CEnumFonts.cpp
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: CEnumFonts implementation
5 * COPYRIGHT: Copyright 2019 Mark Jansen <mark.jansen@reactos.org>
6 */
7
8#include "precomp.h"
9
11
12
13
15 public CComObjectRootEx<CComMultiThreadModelNoCS>,
16 public IEnumIDList
17{
18private:
21
22public:
24 :m_dwFlags(0)
25 ,m_Index(0)
26 {
27 }
28
30 {
32 m_Index = 0;
33 return S_OK;
34 }
35
36 // *** IEnumIDList methods ***
37 STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched)
38 {
39 if (!pceltFetched || !rgelt)
40 return E_POINTER;
41
42 ULONG Fetched = 0;
43
44 while (celt)
45 {
46 celt--;
47
48 if (m_Index < g_FontCache->Size())
49 {
51 rgelt[Fetched] = _ILCreate(Name, m_Index);
52
53 m_Index++;
54 Fetched++;
55 }
56 }
57
58 *pceltFetched = Fetched;
59 return Fetched ? S_OK : S_FALSE;
60 }
62 {
63 m_Index += celt;
64 return S_OK;
65 }
67 {
68 m_Index = 0;
69 return S_OK;
70 }
72 {
73 return E_NOTIMPL;
74 }
75
76
77public:
80
82 COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
84};
85
86
88{
89 return ShellObjectCreatorInit<CEnumFonts>(zip, flags, riid, ppvOut);
90}
91
HRESULT _CEnumFonts_CreateInstance(CFontExt *zip, DWORD flags, REFIID riid, LPVOID *ppvOut)
Definition: CEnumFonts.cpp:87
CFontCache * g_FontCache
Definition: CFontCache.cpp:12
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define STDMETHODIMP
Definition: basetyps.h:43
ULONG m_Index
Definition: CEnumFonts.cpp:20
DWORD m_dwFlags
Definition: CEnumFonts.cpp:19
STDMETHODIMP Clone(IEnumIDList **ppenum)
Definition: CEnumFonts.cpp:71
STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched)
Definition: CEnumFonts.cpp:37
STDMETHODIMP Skip(ULONG celt)
Definition: CEnumFonts.cpp:61
STDMETHODIMP Initialize(CFontExt *folder, DWORD flags)
Definition: CEnumFonts.cpp:29
STDMETHODIMP Reset()
Definition: CEnumFonts.cpp:66
CStringW Name(size_t Index)
Definition: CFontCache.cpp:134
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned long DWORD
Definition: ntddk_ex.h:95
LPITEMIDLIST _ILCreate(LPCWSTR lpString, ULONG Index)
Definition: fontpidl.cpp:10
GLbitfield flags
Definition: glext.h:7161
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:542
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:562
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:640
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:612
#define END_COM_MAP()
Definition: atlcom.h:553
#define REFIID
Definition: guiddef.h:118
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
Definition: fci.c:116
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define S_FALSE
Definition: winerror.h:2357
#define E_POINTER
Definition: winerror.h:2365