1c2c66affSColin Finck /*
2c2c66affSColin Finck  *    Virtual MyDocuments Folder
3c2c66affSColin Finck  *
4c2c66affSColin Finck  *    Copyright 2007    Johannes Anderwald
5c2c66affSColin Finck  *    Copyright 2009    Andrew Hill
6c2c66affSColin Finck  *
7c2c66affSColin Finck  * This library is free software; you can redistribute it and/or
8c2c66affSColin Finck  * modify it under the terms of the GNU Lesser General Public
9c2c66affSColin Finck  * License as published by the Free Software Foundation; either
10c2c66affSColin Finck  * version 2.1 of the License, or (at your option) any later version.
11c2c66affSColin Finck  *
12c2c66affSColin Finck  * This library is distributed in the hope that it will be useful,
13c2c66affSColin Finck  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15c2c66affSColin Finck  * Lesser General Public License for more details.
16c2c66affSColin Finck  *
17c2c66affSColin Finck  * You should have received a copy of the GNU Lesser General Public
18c2c66affSColin Finck  * License along with this library; if not, write to the Free Software
19c2c66affSColin Finck  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20c2c66affSColin Finck  */
21c2c66affSColin Finck 
22c2c66affSColin Finck #ifndef _SHFLDR_MYDOCUMENTS_H_
23c2c66affSColin Finck #define _SHFLDR_MYDOCUMENTS_H_
24c2c66affSColin Finck 
25c2c66affSColin Finck class CMyDocsFolder :
26c2c66affSColin Finck     public CComCoClass<CMyDocsFolder, &CLSID_MyDocuments>,
27c2c66affSColin Finck     public CComObjectRootEx<CComMultiThreadModelNoCS>,
28c2c66affSColin Finck     public IShellFolder2,
29*bc1519ddSKatayama Hirofumi MZ     public IPersistFolder2,
30*bc1519ddSKatayama Hirofumi MZ     public IItemNameLimits
31c2c66affSColin Finck {
32c2c66affSColin Finck     private:
33c2c66affSColin Finck         CComPtr<IShellFolder2> m_pisfInner;
34c2c66affSColin Finck         LPITEMIDLIST m_pidlInner;
35c2c66affSColin Finck     public:
36c2c66affSColin Finck         CMyDocsFolder();
37c2c66affSColin Finck         ~CMyDocsFolder();
38c2c66affSColin Finck 
39c2c66affSColin Finck         // IShellFolder
40c2c66affSColin Finck         virtual HRESULT WINAPI ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes);
41c2c66affSColin Finck         virtual HRESULT WINAPI EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList);
42c2c66affSColin Finck         virtual HRESULT WINAPI BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
43c2c66affSColin Finck         virtual HRESULT WINAPI BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
44c2c66affSColin Finck         virtual HRESULT WINAPI CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2);
45c2c66affSColin Finck         virtual HRESULT WINAPI CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut);
46c2c66affSColin Finck         virtual HRESULT WINAPI GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut);
47c2c66affSColin Finck         virtual HRESULT WINAPI GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut);
48c2c66affSColin Finck         virtual HRESULT WINAPI GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet);
49c2c66affSColin Finck         virtual HRESULT WINAPI SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut);
50c2c66affSColin Finck 
51c2c66affSColin Finck         /* ShellFolder2 */
52c2c66affSColin Finck         virtual HRESULT WINAPI GetDefaultSearchGUID(GUID *pguid);
53c2c66affSColin Finck         virtual HRESULT WINAPI EnumSearches(IEnumExtraSearch **ppenum);
54c2c66affSColin Finck         virtual HRESULT WINAPI GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay);
55c2c66affSColin Finck         virtual HRESULT WINAPI GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags);
56c2c66affSColin Finck         virtual HRESULT WINAPI GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv);
57c2c66affSColin Finck         virtual HRESULT WINAPI GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd);
58c2c66affSColin Finck         virtual HRESULT WINAPI MapColumnToSCID(UINT column, SHCOLUMNID *pscid);
59c2c66affSColin Finck 
60c2c66affSColin Finck         // IPersist
61c2c66affSColin Finck         virtual HRESULT WINAPI GetClassID(CLSID *lpClassId);
62c2c66affSColin Finck 
63c2c66affSColin Finck         // IPersistFolder
64c2b476bdSThomas Faber         virtual HRESULT WINAPI Initialize(PCIDLIST_ABSOLUTE pidl);
65c2c66affSColin Finck 
66c2c66affSColin Finck         // IPersistFolder2
67b90c24d6SThomas Faber         virtual HRESULT WINAPI GetCurFolder(PIDLIST_ABSOLUTE * pidl);
68c2c66affSColin Finck 
69*bc1519ddSKatayama Hirofumi MZ         /*** IItemNameLimits methods ***/
70*bc1519ddSKatayama Hirofumi MZ 
71*bc1519ddSKatayama Hirofumi MZ         STDMETHODIMP
72*bc1519ddSKatayama Hirofumi MZ         GetMaxLength(LPCWSTR pszName, int *piMaxNameLen)
73*bc1519ddSKatayama Hirofumi MZ         {
74*bc1519ddSKatayama Hirofumi MZ             return E_NOTIMPL;
75*bc1519ddSKatayama Hirofumi MZ         }
76*bc1519ddSKatayama Hirofumi MZ 
77*bc1519ddSKatayama Hirofumi MZ         STDMETHODIMP
78*bc1519ddSKatayama Hirofumi MZ         GetValidCharacters(LPWSTR *ppwszValidChars, LPWSTR *ppwszInvalidChars)
79*bc1519ddSKatayama Hirofumi MZ         {
80*bc1519ddSKatayama Hirofumi MZ             if (ppwszValidChars)
81*bc1519ddSKatayama Hirofumi MZ             {
82*bc1519ddSKatayama Hirofumi MZ                 *ppwszValidChars = NULL;
83*bc1519ddSKatayama Hirofumi MZ             }
84*bc1519ddSKatayama Hirofumi MZ             if (ppwszInvalidChars)
85*bc1519ddSKatayama Hirofumi MZ             {
86*bc1519ddSKatayama Hirofumi MZ                 SHStrDupW(INVALID_FILETITLE_CHARACTERSW, ppwszInvalidChars);
87*bc1519ddSKatayama Hirofumi MZ             }
88*bc1519ddSKatayama Hirofumi MZ             return S_OK;
89*bc1519ddSKatayama Hirofumi MZ         }
90*bc1519ddSKatayama Hirofumi MZ 
91c2c66affSColin Finck         DECLARE_REGISTRY_RESOURCEID(IDR_MYDOCUMENTS)
92c2c66affSColin Finck         DECLARE_NOT_AGGREGATABLE(CMyDocsFolder)
93c2c66affSColin Finck 
94c2c66affSColin Finck         DECLARE_PROTECT_FINAL_CONSTRUCT()
95c2c66affSColin Finck 
96c2c66affSColin Finck         BEGIN_COM_MAP(CMyDocsFolder)
97c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
98c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
99c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
100c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
101c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
102*bc1519ddSKatayama Hirofumi MZ         COM_INTERFACE_ENTRY_IID(IID_IItemNameLimits, IItemNameLimits)
103c2c66affSColin Finck         END_COM_MAP()
104c2c66affSColin Finck };
105c2c66affSColin Finck 
106c2c66affSColin Finck #endif /* _SHFLDR_MYDOCUMENTS_H_ */
107