xref: /reactos/dll/shellext/zipfldr/CSendToZip.hpp (revision 53221834)
1 /*
2  * PROJECT:   ReactOS Zip Shell Extension
3  * LICENSE:   GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE:   SendTo handler
5  * COPYRIGHT: Copyright 2019 Mark Jansen (mark.jansen@reactos.org)
6  *            Copyright 2019 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
7  */
8 
9 #ifndef CSENDTOZIP_HPP_
10 #define CSENDTOZIP_HPP_
11 
12 class CSendToZip :
13     public CComCoClass<CSendToZip, &CLSID_ZipFolderSendTo>,
14     public CComObjectRootEx<CComMultiThreadModelNoCS>,
15     public IDropTarget,
16     public IPersistFile
17 {
18     CComPtr<IDataObject> m_pDataObject;
19     BOOL m_fCanDragDrop;
20 
21 public:
22     CSendToZip() : m_fCanDragDrop(FALSE)
23     {
24         InterlockedIncrement(&g_ModuleRefCnt);
25     }
26 
27     virtual ~CSendToZip()
28     {
29         InterlockedDecrement(&g_ModuleRefCnt);
30     }
31 
32     // *** IShellFolder2 methods ***
33     STDMETHODIMP DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
34     STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
35     STDMETHODIMP DragLeave();
36     STDMETHODIMP Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
37 
38     // *** IPersistFile methods ***
39     STDMETHODIMP IsDirty()
40     {
41         return S_FALSE;
42     }
43     STDMETHODIMP Load(LPCOLESTR pszFileName, DWORD dwMode)
44     {
45         return S_OK;
46     }
47     STDMETHODIMP Save(LPCOLESTR pszFileName, BOOL fRemember)
48     {
49         return E_NOTIMPL;
50     }
51     STDMETHODIMP SaveCompleted(LPCOLESTR pszFileName)
52     {
53         return E_NOTIMPL;
54     }
55     STDMETHODIMP GetCurFile(LPOLESTR *ppszFileName)
56     {
57         return E_NOTIMPL;
58     }
59 
60     // *** IPersist methods ***
61     STDMETHODIMP GetClassID(CLSID *pclsid)
62     {
63         *pclsid = CLSID_ZipFolderSendTo;
64         return S_OK;
65     }
66 
67 public:
68     DECLARE_NO_REGISTRY()   // Handled manually
69     DECLARE_NOT_AGGREGATABLE(CSendToZip)
70 
71     DECLARE_PROTECT_FINAL_CONSTRUCT()
72 
73     BEGIN_COM_MAP(CSendToZip)
74         COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
75         COM_INTERFACE_ENTRY_IID(IID_IPersistFile, IPersistFile)
76         COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
77     END_COM_MAP()
78 };
79 
80 #endif
81