xref: /reactos/dll/win32/browseui/aclistisf.h (revision 53221834)
1 /*
2  *  Shell AutoComplete list
3  *
4  *  Copyright 2015  Thomas Faber
5  *  Copyright 2020  Katayama Hirofumi MZ
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 
22 #pragma once
23 
24 class CACListISF :
25     public CComCoClass<CACListISF, &CLSID_ACListISF>,
26     public CComObjectRootEx<CComMultiThreadModelNoCS>,
27     public IEnumString,
28     public IACList2,
29     public ICurrentWorkingDirectory,
30     public IShellService,
31     public IPersistFolder
32 {
33 private:
34     enum LOCATION_TYPE
35     {
36         LT_DIRECTORY,
37         LT_DESKTOP,
38         LT_MYCOMPUTER,
39         LT_FAVORITES,
40         LT_MAX
41     };
42 
43     DWORD m_dwOptions;
44     LOCATION_TYPE m_iNextLocation;
45     BOOL m_fShowHidden;
46     CStringW m_szRawPath;
47     CStringW m_szExpanded;
48     CComHeapPtr<ITEMIDLIST> m_pidlLocation;
49     CComHeapPtr<ITEMIDLIST> m_pidlCurDir;
50     CComPtr<IEnumIDList> m_pEnumIDList;
51     CComPtr<IShellFolder> m_pShellFolder;
52     CComPtr<IBrowserService> m_pBrowserService;
53 
54 public:
55     CACListISF();
56     ~CACListISF();
57 
58     HRESULT NextLocation();
59     HRESULT SetLocation(LPITEMIDLIST pidl);
60     HRESULT GetDisplayName(LPCITEMIDLIST pidlChild, CComHeapPtr<WCHAR>& pszChild);
61     HRESULT GetPaths(LPCITEMIDLIST pidlChild, CComHeapPtr<WCHAR>& pszRaw,
62                      CComHeapPtr<WCHAR>& pszExpanded);
63 
64     // *** IEnumString methods ***
65     STDMETHODIMP Next(ULONG celt, LPOLESTR *rgelt, ULONG *pceltFetched) override;
66     STDMETHODIMP Skip(ULONG celt) override;
67     STDMETHODIMP Reset() override;
68     STDMETHODIMP Clone(IEnumString **ppenum) override;
69 
70     // *** IACList methods ***
71     STDMETHODIMP Expand(LPCOLESTR pszExpand) override;
72 
73     // *** IACList2 methods ***
74     STDMETHODIMP SetOptions(DWORD dwFlag) override;
75     STDMETHODIMP GetOptions(DWORD* pdwFlag) override;
76 
77     // FIXME: These virtual keywords below should be removed.
78 
79     // *** IShellService methods ***
80     virtual STDMETHODIMP SetOwner(IUnknown *punkOwner) override;
81 
82     // *** IPersist methods ***
83     virtual STDMETHODIMP GetClassID(CLSID *pClassID) override;
84 
85     // *** IPersistFolder methods ***
86     virtual STDMETHODIMP Initialize(PCIDLIST_ABSOLUTE pidl) override;
87 
88     // *** ICurrentWorkingDirectory methods ***
89     STDMETHODIMP GetDirectory(LPWSTR pwzPath, DWORD cchSize) override;
90     STDMETHODIMP SetDirectory(LPCWSTR pwzPath) override;
91 
92 public:
93     DECLARE_REGISTRY_RESOURCEID(IDR_ACLISTISF)
94     DECLARE_NOT_AGGREGATABLE(CACListISF)
95 
96     DECLARE_PROTECT_FINAL_CONSTRUCT()
97 
98     BEGIN_COM_MAP(CACListISF)
99         COM_INTERFACE_ENTRY_IID(IID_IEnumString, IEnumString)
100         COM_INTERFACE_ENTRY_IID(IID_IACList, IACList)
101         COM_INTERFACE_ENTRY_IID(IID_IACList2, IACList2)
102         COM_INTERFACE_ENTRY_IID(IID_IShellService, IShellService)
103         // Windows doesn't return this
104         //COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
105         COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
106         COM_INTERFACE_ENTRY_IID(IID_ICurrentWorkingDirectory, ICurrentWorkingDirectory)
107     END_COM_MAP()
108 };
109