Home | History | Annotate | Download | only in Common
      1 // IFileExtractCallback.h
      2 
      3 #ifndef __I_FILE_EXTRACT_CALLBACK_H
      4 #define __I_FILE_EXTRACT_CALLBACK_H
      5 
      6 #include "../../../Common/MyString.h"
      7 
      8 #include "../../IDecl.h"
      9 
     10 #include "LoadCodecs.h"
     11 #include "OpenArchive.h"
     12 
     13 namespace NOverwriteAnswer
     14 {
     15   enum EEnum
     16   {
     17     kYes,
     18     kYesToAll,
     19     kNo,
     20     kNoToAll,
     21     kAutoRename,
     22     kCancel
     23   };
     24 }
     25 
     26 
     27 /* ---------- IFolderArchiveExtractCallback ----------
     28 is implemented by
     29   Console/ExtractCallbackConsole.h  CExtractCallbackConsole
     30   FileManager/ExtractCallback.h     CExtractCallbackImp
     31   FAR/ExtractEngine.cpp             CExtractCallBackImp: (QueryInterface is not supported)
     32 
     33 IID_IFolderArchiveExtractCallback is requested by:
     34   - Agent/ArchiveFolder.cpp
     35       CAgentFolder::CopyTo(..., IFolderOperationsExtractCallback *callback)
     36       is sent to IArchiveFolder::Extract()
     37 
     38   - FileManager/PanelCopy.cpp
     39       CPanel::CopyTo(), if (options->testMode)
     40       is sent to IArchiveFolder::Extract()
     41 
     42  IFolderArchiveExtractCallback is used by Common/ArchiveExtractCallback.cpp
     43 */
     44 
     45 #define INTERFACE_IFolderArchiveExtractCallback(x) \
     46   STDMETHOD(AskOverwrite)( \
     47       const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize, \
     48       const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize, \
     49       Int32 *answer) x; \
     50   STDMETHOD(PrepareOperation)(const wchar_t *name, Int32 isFolder, Int32 askExtractMode, const UInt64 *position) x; \
     51   STDMETHOD(MessageError)(const wchar_t *message) x; \
     52   STDMETHOD(SetOperationResult)(Int32 opRes, Int32 encrypted) x; \
     53 
     54 DECL_INTERFACE_SUB(IFolderArchiveExtractCallback, IProgress, 0x01, 0x07)
     55 {
     56   INTERFACE_IFolderArchiveExtractCallback(PURE)
     57 };
     58 
     59 #define INTERFACE_IFolderArchiveExtractCallback2(x) \
     60   STDMETHOD(ReportExtractResult)(Int32 opRes, Int32 encrypted, const wchar_t *name) x; \
     61 
     62 DECL_INTERFACE_SUB(IFolderArchiveExtractCallback2, IUnknown, 0x01, 0x08)
     63 {
     64   INTERFACE_IFolderArchiveExtractCallback2(PURE)
     65 };
     66 
     67 /* ---------- IExtractCallbackUI ----------
     68 is implemented by
     69   Console/ExtractCallbackConsole.h  CExtractCallbackConsole
     70   FileManager/ExtractCallback.h     CExtractCallbackImp
     71 */
     72 
     73 #ifdef _NO_CRYPTO
     74   #define INTERFACE_IExtractCallbackUI_Crypto(x)
     75 #else
     76   #define INTERFACE_IExtractCallbackUI_Crypto(x) \
     77   virtual HRESULT SetPassword(const UString &password) x;
     78 #endif
     79 
     80 #define INTERFACE_IExtractCallbackUI(x) \
     81   virtual HRESULT BeforeOpen(const wchar_t *name, bool testMode) x; \
     82   virtual HRESULT OpenResult(const CCodecs *codecs, const CArchiveLink &arcLink, const wchar_t *name, HRESULT result) x; \
     83   virtual HRESULT ThereAreNoFiles() x; \
     84   virtual HRESULT ExtractResult(HRESULT result) x; \
     85   INTERFACE_IExtractCallbackUI_Crypto(x)
     86 
     87 struct IExtractCallbackUI: IFolderArchiveExtractCallback
     88 {
     89   INTERFACE_IExtractCallbackUI(PURE)
     90 };
     91 
     92 
     93 
     94 #define INTERFACE_IGetProp(x) \
     95   STDMETHOD(GetProp)(PROPID propID, PROPVARIANT *value) x; \
     96 
     97 DECL_INTERFACE_SUB(IGetProp, IUnknown, 0x01, 0x20)
     98 {
     99   INTERFACE_IGetProp(PURE)
    100 };
    101 
    102 #define INTERFACE_IFolderExtractToStreamCallback(x) \
    103   STDMETHOD(UseExtractToStream)(Int32 *res) x; \
    104   STDMETHOD(GetStream7)(const wchar_t *name, Int32 isDir, ISequentialOutStream **outStream, Int32 askExtractMode, IGetProp *getProp) x; \
    105   STDMETHOD(PrepareOperation7)(Int32 askExtractMode) x; \
    106   STDMETHOD(SetOperationResult7)(Int32 resultEOperationResult, Int32 encrypted) x; \
    107 
    108 DECL_INTERFACE_SUB(IFolderExtractToStreamCallback, IUnknown, 0x01, 0x30)
    109 {
    110   INTERFACE_IFolderExtractToStreamCallback(PURE)
    111 };
    112 
    113 
    114 #endif
    115