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, 29bc1519ddSKatayama Hirofumi MZ public IPersistFolder2, 30bc1519ddSKatayama Hirofumi MZ public IItemNameLimits 31c2c66affSColin Finck { 32c2c66affSColin Finck private: 33c2c66affSColin Finck CComPtr<IShellFolder2> m_pisfInner; 34c2c66affSColin Finck LPITEMIDLIST m_pidlInner; 35d2b91debSMark Jansen 36d2b91debSMark Jansen HRESULT EnsureFolder(); 37d2b91debSMark Jansen 38c2c66affSColin Finck public: 39c2c66affSColin Finck CMyDocsFolder(); 40c2c66affSColin Finck ~CMyDocsFolder(); 41c2c66affSColin Finck 42d2b91debSMark Jansen HRESULT WINAPI FinalConstruct(); 43d2b91debSMark Jansen 44c2c66affSColin Finck // IShellFolder 45*49b2b1daSKatayama Hirofumi MZ STDMETHOD(ParseDisplayName)(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes) override; 46*49b2b1daSKatayama Hirofumi MZ STDMETHOD(EnumObjects)(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override; 47*49b2b1daSKatayama Hirofumi MZ STDMETHOD(BindToObject)(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override; 48*49b2b1daSKatayama Hirofumi MZ STDMETHOD(BindToStorage)(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override; 49*49b2b1daSKatayama Hirofumi MZ STDMETHOD(CompareIDs)(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) override; 50*49b2b1daSKatayama Hirofumi MZ STDMETHOD(CreateViewObject)(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override; 51*49b2b1daSKatayama Hirofumi MZ STDMETHOD(GetAttributesOf)(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override; 52*49b2b1daSKatayama Hirofumi MZ STDMETHOD(GetUIObjectOf)(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut) override; 53*49b2b1daSKatayama Hirofumi MZ STDMETHOD(GetDisplayNameOf)(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override; 54*49b2b1daSKatayama Hirofumi MZ STDMETHOD(SetNameOf)(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override; 55c2c66affSColin Finck 56c2c66affSColin Finck /* ShellFolder2 */ 57*49b2b1daSKatayama Hirofumi MZ STDMETHOD(GetDefaultSearchGUID)(GUID *pguid) override; 58*49b2b1daSKatayama Hirofumi MZ STDMETHOD(EnumSearches)(IEnumExtraSearch **ppenum) override; 59*49b2b1daSKatayama Hirofumi MZ STDMETHOD(GetDefaultColumn)(DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override; 60*49b2b1daSKatayama Hirofumi MZ STDMETHOD(GetDefaultColumnState)(UINT iColumn, DWORD *pcsFlags) override; 61*49b2b1daSKatayama Hirofumi MZ STDMETHOD(GetDetailsEx)(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override; 62*49b2b1daSKatayama Hirofumi MZ STDMETHOD(GetDetailsOf)(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override; 63*49b2b1daSKatayama Hirofumi MZ STDMETHOD(MapColumnToSCID)(UINT column, SHCOLUMNID *pscid) override; 64c2c66affSColin Finck 65c2c66affSColin Finck // IPersist 66*49b2b1daSKatayama Hirofumi MZ STDMETHOD(GetClassID)(CLSID *lpClassId) override; 67c2c66affSColin Finck 68c2c66affSColin Finck // IPersistFolder 69*49b2b1daSKatayama Hirofumi MZ STDMETHOD(Initialize)(PCIDLIST_ABSOLUTE pidl) override; 70c2c66affSColin Finck 71c2c66affSColin Finck // IPersistFolder2 72*49b2b1daSKatayama Hirofumi MZ STDMETHOD(GetCurFolder)(PIDLIST_ABSOLUTE * pidl) override; 73c2c66affSColin Finck 74bc1519ddSKatayama Hirofumi MZ /*** IItemNameLimits methods ***/ 75bc1519ddSKatayama Hirofumi MZ 76bc1519ddSKatayama Hirofumi MZ STDMETHODIMP GetMaxLength(LPCWSTR pszName,int * piMaxNameLen)77*49b2b1daSKatayama Hirofumi MZ GetMaxLength(LPCWSTR pszName, int *piMaxNameLen) override 78bc1519ddSKatayama Hirofumi MZ { 79bc1519ddSKatayama Hirofumi MZ return E_NOTIMPL; 80bc1519ddSKatayama Hirofumi MZ } 81bc1519ddSKatayama Hirofumi MZ 82bc1519ddSKatayama Hirofumi MZ STDMETHODIMP GetValidCharacters(LPWSTR * ppwszValidChars,LPWSTR * ppwszInvalidChars)83*49b2b1daSKatayama Hirofumi MZ GetValidCharacters(LPWSTR *ppwszValidChars, LPWSTR *ppwszInvalidChars) override 84bc1519ddSKatayama Hirofumi MZ { 85bc1519ddSKatayama Hirofumi MZ if (ppwszValidChars) 86bc1519ddSKatayama Hirofumi MZ { 87bc1519ddSKatayama Hirofumi MZ *ppwszValidChars = NULL; 88bc1519ddSKatayama Hirofumi MZ } 89bc1519ddSKatayama Hirofumi MZ if (ppwszInvalidChars) 90bc1519ddSKatayama Hirofumi MZ { 91bc1519ddSKatayama Hirofumi MZ SHStrDupW(INVALID_FILETITLE_CHARACTERSW, ppwszInvalidChars); 92bc1519ddSKatayama Hirofumi MZ } 93bc1519ddSKatayama Hirofumi MZ return S_OK; 94bc1519ddSKatayama Hirofumi MZ } 95bc1519ddSKatayama Hirofumi MZ 96c2c66affSColin Finck DECLARE_REGISTRY_RESOURCEID(IDR_MYDOCUMENTS) 97c2c66affSColin Finck DECLARE_NOT_AGGREGATABLE(CMyDocsFolder) 98c2c66affSColin Finck 99c2c66affSColin Finck DECLARE_PROTECT_FINAL_CONSTRUCT() 100c2c66affSColin Finck 101c2c66affSColin Finck BEGIN_COM_MAP(CMyDocsFolder) 102c2c66affSColin Finck COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2) 103c2c66affSColin Finck COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder) 104c2c66affSColin Finck COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder) 105c2c66affSColin Finck COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2) 106c2c66affSColin Finck COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist) 107bc1519ddSKatayama Hirofumi MZ COM_INTERFACE_ENTRY_IID(IID_IItemNameLimits, IItemNameLimits) 108c2c66affSColin Finck END_COM_MAP() 109c2c66affSColin Finck }; 110c2c66affSColin Finck 111c2c66affSColin Finck #endif /* _SHFLDR_MYDOCUMENTS_H_ */ 112