xref: /reactos/dll/win32/browseui/ACLCustomMRU.h (revision 3e1f4074)
1 /*
2  * PROJECT:     ReactOS browseui
3  * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE:     Custom MRU AutoComplete List
5  * COPYRIGHT:   Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
6  *              Copyright 2020 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
7  */
8 
9 #pragma once
10 
11 class CACLCustomMRU :
12     public CComCoClass<CACLCustomMRU, &CLSID_ACLCustomMRU>,
13     public CComObjectRootEx<CComMultiThreadModelNoCS>,
14     public IEnumString,
15     public IACList,
16     public IACLCustomMRU
17 {
18 private:
19     CRegKey m_Key;
20     CStringW m_MRUList;
21     CSimpleArray<CStringW> m_MRUData;
22     bool m_bDirty;
23     BOOL m_bTypedURLs;
24     ULONG m_ielt;
25 
26     void PersistMRU();
27     HRESULT LoadTypedURLs(DWORD dwMax);
28     HRESULT LoadMRUList(DWORD dwMax);
29 
30 public:
31     CACLCustomMRU();
32     ~CACLCustomMRU();
33 
34     // *** IEnumString methods ***
35     STDMETHODIMP Next(ULONG celt, LPWSTR *rgelt, ULONG *pceltFetched) override;
36     STDMETHODIMP Skip(ULONG celt) override;
37     STDMETHODIMP Reset() override;
38     STDMETHODIMP Clone(IEnumString ** ppenum) override;
39 
40     // *** IACList methods ***
41     STDMETHODIMP Expand(LPCOLESTR pszExpand) override;
42 
43     // *** IACLCustomMRU methods ***
44     STDMETHODIMP Initialize(LPCWSTR pwszMRURegKey, DWORD dwMax) override;
45     STDMETHODIMP AddMRUString(LPCWSTR pwszEntry) override;
46 
47 public:
48 
49     DECLARE_REGISTRY_RESOURCEID(IDR_ACLCUSTOMMRU)
50     DECLARE_NOT_AGGREGATABLE(CACLCustomMRU)
51 
52     DECLARE_PROTECT_FINAL_CONSTRUCT()
53 
54     BEGIN_COM_MAP(CACLCustomMRU)
55         COM_INTERFACE_ENTRY_IID(IID_IEnumString, IEnumString)
56         COM_INTERFACE_ENTRY_IID(IID_IACList, IACList)
57         COM_INTERFACE_ENTRY_IID(IID_IACLCustomMRU, IACLCustomMRU)
58     END_COM_MAP()
59 };
60