//+------------------------------------------------------------------------
//
//  Microsoft Forms
//  Copyright (C) Microsoft Corporation.  All Rights Reserved.
//
//  File:       mshtmhst.idl
//
//  Contents:   MSHTML advanced host interfaces
//
//-------------------------------------------------------------------------

cpp_quote("//=--------------------------------------------------------------------------=")
cpp_quote("// mshtmhst.h")
cpp_quote("//=--------------------------------------------------------------------------=")
cpp_quote("// (C) Copyright Microsoft Corporation.  All Rights Reserved.")
cpp_quote("//")
cpp_quote("// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF")
cpp_quote("// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO")
cpp_quote("// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A")
cpp_quote("// PARTICULAR PURPOSE.")
cpp_quote("//=--------------------------------------------------------------------------=")
cpp_quote("")
cpp_quote("#pragma comment(lib,\"uuid.lib\")")
cpp_quote("")
cpp_quote("//--------------------------------------------------------------------------")
cpp_quote("// MSTHML Advanced Host Interfaces.")
cpp_quote("")
cpp_quote("#ifndef MSHTMHST_H")
cpp_quote("#define MSHTMHST_H")

cpp_quote("#define CONTEXT_MENU_DEFAULT        0")
cpp_quote("#define CONTEXT_MENU_IMAGE          1")
cpp_quote("#define CONTEXT_MENU_CONTROL        2")
cpp_quote("#define CONTEXT_MENU_TABLE          3")
cpp_quote("// in browse mode")
cpp_quote("#define CONTEXT_MENU_TEXTSELECT     4")
cpp_quote("#define CONTEXT_MENU_ANCHOR         5")
cpp_quote("#define CONTEXT_MENU_UNKNOWN        6")
cpp_quote("//;begin_internal")
cpp_quote("// These 2 are mapped to IMAGE for the public")
cpp_quote("#define CONTEXT_MENU_IMGDYNSRC      7")
cpp_quote("#define CONTEXT_MENU_IMGART         8")
cpp_quote("#define CONTEXT_MENU_DEBUG          9")
cpp_quote("//;end_internal")
cpp_quote("#define CONTEXT_MENU_VSCROLL        10")
cpp_quote("#define CONTEXT_MENU_HSCROLL        11")

cpp_quote("#define MENUEXT_SHOWDIALOG           0x1")

cpp_quote("#define DOCHOSTUIFLAG_BROWSER       (DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE) ")

cpp_quote("#define HTMLDLG_NOUI                     0x0010")
cpp_quote("#define HTMLDLG_MODAL                    0x0020")
cpp_quote("#define HTMLDLG_MODELESS                 0x0040")
cpp_quote("#define HTMLDLG_PRINT_TEMPLATE           0x0080")
cpp_quote("#define HTMLDLG_VERIFY                   0x0100")
cpp_quote("#define HTMLDLG_ALLOW_UNKNOWN_THREAD     0x0200")

cpp_quote("#define PRINT_DONTBOTHERUSER             0x01")
cpp_quote("#define PRINT_WAITFORCOMPLETION          0x02")

cpp_quote("#define CMDID_SCRIPTSITE_URL                0")
cpp_quote("#define CMDID_SCRIPTSITE_HTMLDLGTRUST       1")
cpp_quote("#define CMDID_SCRIPTSITE_SECSTATE           2")
cpp_quote("#define CMDID_SCRIPTSITE_SID                3")
cpp_quote("#define CMDID_SCRIPTSITE_TRUSTEDDOC         4")
cpp_quote("#define CMDID_SCRIPTSITE_SECURITY_WINDOW    5")
cpp_quote("#define CMDID_SCRIPTSITE_NAMESPACE          6")
cpp_quote("#define CMDID_SCRIPTSITE_IURI               7")

import "ocidl.idl";
import "objidl.idl";
import "oleidl.idl";
import "oaidl.idl";
import "docobj.idl";

cpp_quote("EXTERN_C const GUID CGID_ScriptSite;")
cpp_quote("EXTERN_C const GUID CGID_MSHTML;")
cpp_quote("#define CMDSETID_Forms3 CGID_MSHTML")
cpp_quote("#define SZ_HTML_CLIENTSITE_OBJECTPARAM L\"{d4db6850-5385-11d0-89e9-00a0c90a90ac}\"")

cpp_quote("#ifndef __IHTMLWindow2_FWD_DEFINED__")
cpp_quote("#define __IHTMLWindow2_FWD_DEFINED__")
cpp_quote("typedef interface IHTMLWindow2 IHTMLWindow2;")
cpp_quote("#endif")


#pragma midl_echo("typedef HRESULT STDAPICALLTYPE SHOWHTMLDIALOGFN (HWND hwndParent, IMoniker *pmk, VARIANT *pvarArgIn, WCHAR* pchOptions, VARIANT *pvArgOut);")

#pragma midl_echo("typedef HRESULT STDAPICALLTYPE SHOWHTMLDIALOGEXFN (HWND hwndParent, IMoniker *pmk, DWORD dwDialogFlags, VARIANT *pvarArgIn, WCHAR* pchOptions, VARIANT *pvArgOut);")

#pragma midl_echo("typedef HRESULT STDAPICALLTYPE SHOWMODELESSHTMLDIALOGFN (HWND hwndParent, IMoniker *pmk, VARIANT *pvarArgIn, VARIANT* pvarOptions, IHTMLWindow2 ** ppWindow);")

#pragma midl_echo("typedef HRESULT STDAPICALLTYPE IEREGISTERXMLNSFN (__in LPCWSTR lpszURI, __in GUID clsid, __in BOOL fMachine);")

#pragma midl_echo("typedef HRESULT STDAPICALLTYPE IEISXMLNSREGISTEREDFN (__in LPCWSTR lpszURI, __out GUID *pCLSID);")

cpp_quote("//;begin_internal")
#pragma midl_echo("STDAPI ShowHTMLDialog(                   ")
#pragma midl_echo("    HWND        hwndParent,              ")
#pragma midl_echo("    IMoniker *  pMk,                     ")
#pragma midl_echo("    VARIANT *   pvarArgIn,               ")
#pragma midl_echo("    __in LPWSTR pchOptions,              ")
#pragma midl_echo("    VARIANT *   pvarArgOut               ")
#pragma midl_echo("    );                                   ")

#pragma midl_echo("STDAPI ShowHTMLDialogEx(                 ")
#pragma midl_echo("    HWND        hwndParent,              ")
#pragma midl_echo("    IMoniker *  pMk,                     ")
#pragma midl_echo("    DWORD       dwDialogFlags,           ")
#pragma midl_echo("    VARIANT *   pvarArgIn,               ")
#pragma midl_echo("    __in LPWSTR pchOptions,              ")
#pragma midl_echo("    VARIANT *   pvarArgOut               ")
#pragma midl_echo("    );                                   ")

#pragma midl_echo("STDAPI ShowModelessHTMLDialog(           ")
#pragma midl_echo("    HWND        hwndParent,              ")
#pragma midl_echo("    IMoniker *  pMk,                     ")
#pragma midl_echo("    VARIANT *   pvarArgIn,               ")
#pragma midl_echo("    VARIANT *   pvarOptions,             ")
#pragma midl_echo("    IHTMLWindow2 ** ppWindow);           ")
cpp_quote("//;end_internal")

cpp_quote("//;begin_internal")
#pragma midl_echo("STDAPI RunHTMLApplication(               ")
#pragma midl_echo("    HINSTANCE hinst,                     ")
#pragma midl_echo("    HINSTANCE hPrevInst,                 ")
#pragma midl_echo("    __in LPSTR szCmdLine,                ")
#pragma midl_echo("    int nCmdShow                         ")
#pragma midl_echo("    );                                   ")
cpp_quote("//;end_internal")

cpp_quote("//;begin_internal")
#pragma midl_echo("STDAPI CreateHTMLPropertyPage(           ")
#pragma midl_echo("    IMoniker *          pmk,             ")        
#pragma midl_echo("    IPropertyPage **    ppPP             ")
#pragma midl_echo("    );                                   ")
cpp_quote("//;end_internal")

#pragma midl_echo("STDAPI IERegisterXMLNS(                  ")
#pragma midl_echo("     __in LPCWSTR lpszURI,               ")
#pragma midl_echo("     __in GUID clsid,                    ")
#pragma midl_echo("     __in BOOL fMachine                  ")
#pragma midl_echo("     );                                  ")

#pragma midl_echo("STDAPI IEIsXMLNSRegistered(              ")
#pragma midl_echo("     LPCWSTR lpszURI,                    ")
#pragma midl_echo("     __out GUID *pCLSID                  ")
#pragma midl_echo("     );                                  ")

//-------------------------------------------------------------------------
//  IHostDialogHelper
//
//-------------------------------------------------------------------------

[

        object,
        uuid(53DEC138-A51E-11d2-861E-00C04FA35C89),
        pointer_default(unique),
        local
]
interface IHostDialogHelper : IUnknown
{
    HRESULT ShowHTMLDialog(
                HWND hwndParent,
                IMoniker *pMk,
                VARIANT *pvarArgIn,
                WCHAR *pchOptions,
                VARIANT *pvarArgOut,
                IUnknown *punkHost
                );
};

[
    uuid(429AF92C-A51F-11d2-861E-00C04FA35C89)
]
coclass HostDialogHelper
{
    [default]           interface IHostDialogHelper;
};

cpp_quote("EXTERN_C const GUID CLSID_HostDialogHelper;")



//-------------------------------------------------------------------------
//  IDocHostUIHandler
//
//-------------------------------------------------------------------------

cpp_quote("//;begin_internal")
typedef
enum tagDOCHOSTUITYPE {
        DOCHOSTUITYPE_BROWSE    = 0,
        DOCHOSTUITYPE_AUTHOR    = 1,
} DOCHOSTUITYPE;
cpp_quote("//;end_internal")

typedef enum tagDOCHOSTUIDBLCLK {
        DOCHOSTUIDBLCLK_DEFAULT         = 0,
        DOCHOSTUIDBLCLK_SHOWPROPERTIES  = 1,
        DOCHOSTUIDBLCLK_SHOWCODE        = 2,
} DOCHOSTUIDBLCLK ;

typedef enum tagDOCHOSTUIFLAG {
        DOCHOSTUIFLAG_DIALOG                    = 0x00000001,
        DOCHOSTUIFLAG_DISABLE_HELP_MENU         = 0x00000002,
        DOCHOSTUIFLAG_NO3DBORDER                = 0x00000004,
        DOCHOSTUIFLAG_SCROLL_NO                 = 0x00000008,
        DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE   = 0x00000010,
        DOCHOSTUIFLAG_OPENNEWWIN                = 0x00000020,
        DOCHOSTUIFLAG_DISABLE_OFFSCREEN         = 0x00000040,
        DOCHOSTUIFLAG_FLAT_SCROLLBAR            = 0x00000080,
        DOCHOSTUIFLAG_DIV_BLOCKDEFAULT          = 0x00000100,
        DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY   = 0x00000200,
        DOCHOSTUIFLAG_OVERRIDEBEHAVIORFACTORY   = 0x00000400,
        DOCHOSTUIFLAG_CODEPAGELINKEDFONTS       = 0x00000800,
        DOCHOSTUIFLAG_URL_ENCODING_DISABLE_UTF8 = 0x00001000,
        DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8  = 0x00002000,
        DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE = 0x00004000,
        DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION = 0x00010000,
        DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION   = 0x00020000, 
        DOCHOSTUIFLAG_THEME                     = 0x00040000, 
        DOCHOSTUIFLAG_NOTHEME                   = 0x00080000,
        DOCHOSTUIFLAG_NOPICS                    = 0x00100000,
        DOCHOSTUIFLAG_NO3DOUTERBORDER           = 0x00200000,
        DOCHOSTUIFLAG_DISABLE_EDIT_NS_FIXUP     = 0x00400000,
        DOCHOSTUIFLAG_LOCAL_MACHINE_ACCESS_CHECK= 0x00800000,
        DOCHOSTUIFLAG_DISABLE_UNTRUSTEDPROTOCOL = 0x01000000,
        DOCHOSTUIFLAG_HOST_NAVIGATES            = 0x02000000,
        DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION = 0x04000000,
        DOCHOSTUIFLAG_USE_WINDOWLESS_SELECTCONTROL = 0x08000000, 
        DOCHOSTUIFLAG_USE_WINDOWED_SELECTCONTROL   = 0x10000000, 
        DOCHOSTUIFLAG_ENABLE_ACTIVEX_INACTIVATE_MODE = 0x20000000,
        DOCHOSTUIFLAG_DPI_AWARE                 = 0x40000000,
} DOCHOSTUIFLAG ;


cpp_quote("#define DOCHOSTUIATOM_ENABLE_HIRES   _T(\"TridentEnableHiRes\")")


[
        object,
        uuid(bd3f23c0-d43e-11cf-893b-00aa00bdce1a),
        pointer_default(unique),
        local
]
interface IDocHostUIHandler : IUnknown
{

    typedef struct _DOCHOSTUIINFO
    {
        ULONG       cbSize;
        DWORD       dwFlags;
        DWORD       dwDoubleClick;
        OLECHAR *   pchHostCss;
        OLECHAR *   pchHostNS;
    } DOCHOSTUIINFO;

    HRESULT ShowContextMenu(
            [in] DWORD dwID,
            [in] POINT* ppt,
            [in] IUnknown* pcmdtReserved,
            [in] IDispatch* pdispReserved);
    HRESULT GetHostInfo([in, out] DOCHOSTUIINFO * pInfo);
    HRESULT ShowUI(
            [in] DWORD dwID,
            [in] IOleInPlaceActiveObject * pActiveObject,
            [in] IOleCommandTarget * pCommandTarget,
            [in] IOleInPlaceFrame * pFrame,
            [in] IOleInPlaceUIWindow * pDoc);
    HRESULT HideUI();
    HRESULT UpdateUI();
    HRESULT EnableModeless([in] BOOL fEnable);
    HRESULT OnDocWindowActivate([in] BOOL fActivate);
    HRESULT OnFrameWindowActivate([in] BOOL fActivate);
    HRESULT ResizeBorder(
            [in] LPCRECT prcBorder,
            [in] IOleInPlaceUIWindow * pUIWindow,
            [in] BOOL fRameWindow);
    HRESULT TranslateAccelerator(
            [in] LPMSG lpMsg,
            [in] const GUID * pguidCmdGroup,
            [in] DWORD nCmdID);
    HRESULT GetOptionKeyPath([out] [annotation("__out")] LPOLESTR * pchKey, [in] DWORD dw);
    HRESULT GetDropTarget(
            [in] IDropTarget * pDropTarget,
            [out] IDropTarget ** ppDropTarget);
    HRESULT GetExternal([out] IDispatch **ppDispatch);
    HRESULT TranslateUrl([in]DWORD dwTranslate, [in] [annotation("__in __nullterminated")] OLECHAR *pchURLIn, [out] [annotation("__out")] OLECHAR **ppchURLOut);
    HRESULT FilterDataObject([in]IDataObject *pDO, [out]IDataObject **ppDORet);
}

[
        object,
        uuid(3050f6d0-98b5-11cf-bb82-00aa00bdce0b),
        pointer_default(unique),
        local
]
interface IDocHostUIHandler2 : IDocHostUIHandler
{
    HRESULT GetOverrideKeyPath([out] [annotation("__deref_out")] LPOLESTR * pchKey, [in] DWORD dw);
}

cpp_quote("DEFINE_GUID(CGID_DocHostCommandHandler,0xf38bc242,0xb950,0x11d1,0x89,0x18,0x00,0xc0,0x4f,0xc2,0xc8,0x36);")

//-------------------------------------------------------------------------
//  ICustomDoc
//
//-------------------------------------------------------------------------

[
        object,
        uuid(3050f3f0-98b5-11cf-bb82-00aa00bdce0b),
        pointer_default(unique),
        local
]
interface ICustomDoc : IUnknown
{
    HRESULT SetUIHandler(
            [in] IDocHostUIHandler * pUIHandler);
}

//-------------------------------------------------------------------------
//  IDocHostShowUI
//
//-------------------------------------------------------------------------

[
        object,
        uuid(c4d244b0-d43e-11cf-893b-00aa00bdce1a),
        pointer_default(unique),
        local
]
interface IDocHostShowUI : IUnknown
{
    HRESULT ShowMessage(
            [in] HWND hwnd,
            [in] [annotation("__in __nullterminated")] LPOLESTR lpstrText,
            [in] [annotation("__in __nullterminated")] LPOLESTR lpstrCaption,
            [in] DWORD dwType,
            [in] [annotation("__in __nullterminated")] LPOLESTR lpstrHelpFile,
            [in] DWORD dwHelpContext,
            [out] LRESULT * plResult);
    HRESULT ShowHelp(
            [in] HWND hwnd,
            [in] [annotation("__in __nullterminated")] LPOLESTR pszHelpFile,
            [in] UINT uCommand,
            [in] DWORD dwData,
            [in] POINT ptMouse,
            [out] IDispatch * pDispatchObjectHit);
}

cpp_quote("#define IClassFactory3      IClassFactoryEx")
cpp_quote("#define IID_IClassFactory3  IID_IClassFactoryEx")

//-------------------------------------------------------------------------
//
//  IClassFactoryEx
//
//-------------------------------------------------------------------------
[
        object,
                uuid(342D1EA0-AE25-11D1-89C5-006008C3FBFC),
        pointer_default(unique),
        local
]
interface IClassFactoryEx : IClassFactory
{
        HRESULT CreateInstanceWithContext(IUnknown *punkContext, 
                        IUnknown *punkOuter, REFIID riid, [out] void **ppv);
};

//-------------------------------------------------------------------------
//
//  IHTMLOMWindowServices
//
//-------------------------------------------------------------------------
[
    object,
    pointer_default(unique),
    uuid(3050f5fc-98b5-11cf-bb82-00aa00bdce0b)
]
interface IHTMLOMWindowServices : IUnknown
{
    HRESULT moveTo([in] LONG x,[in] LONG y);
    HRESULT moveBy([in] LONG x,[in] LONG y);
    HRESULT resizeTo([in] LONG x,[in] LONG y);
    HRESULT resizeBy([in] LONG x,[in] LONG y);
};

cpp_quote("#define SID_SHTMLOMWindowServices  IID_IHTMLOMWindowServices")


cpp_quote("#endif")

