
with Ada.Unchecked_Conversion;
with Interfaces.C;  use Interfaces.C;
pragma Warnings(Off);
with System.Win32;
pragma Warnings(On);

with GNATCOM.Types;  use GNATCOM.Types;
with GNATCOM.GUID;
with GWindows.Types; use GWindows.Types;
with GNATOCX_Site;   use GNATOCX_Site;
with GNATOCX;        use GNATOCX;

package DocObj is

   type IOleDocument;
   type IOleDocumentSite;
   type IOleDocumentView;
   type IEnumOleDocumentViews;
   type IContinueCallback;
   type IPrint;
   type IOleCommandTarget;
   type IProtectedModeMenuServices;

   type Pointer_To_IOleDocument is access all IOleDocument;
   type Pointer_To_IOleDocumentSite is access all IOleDocumentSite;
   type Pointer_To_IOleDocumentView is access all IOleDocumentView;
   type Pointer_To_IEnumOleDocumentViews is access all IEnumOleDocumentViews;
   type Pointer_To_IPrint is access all IPrint;
   type Pointer_To_IOleCommandTarget is access all IOleCommandTarget;
   type Pointer_To_IProtectedModeMenuServices is access all IProtectedModeMenuServices;


   IID_IOleDocument : aliased GNATCOM.Types.GUID :=
     GNATCOM.GUID.To_GUID ("{b722bcc5-4e68-101b-a2bc-00aa00404770}");

   DOCMISC_CANCREATEMULTIPLEVIEWS   : constant unsigned := 1;
   DOCMISC_SUPPORTCOMPLEXRECTANGLES : constant unsigned := 2;
   DOCMISC_CANTOPENEDIT             : constant unsigned := 4;
   DOCMISC_NOFILESUPPORT            : constant unsigned := 8;
   -- DOCMISC;

   type af_IOleDocument_QueryInterface is access
     function (This   : access IOleDocument;
	       riid   : Pointer_To_GUID;
	       ppvObj : Pointer_To_Pointer_To_Void)
	       return HRESULT;
   pragma Convention (StdCall, af_IOleDocument_QueryInterface);

   type af_IOleDocument_AddRef is access
     function (This : access IOleDocument)
	       return unsigned_long;
   pragma Convention (StdCall, af_IOleDocument_AddRef);

   type af_IOleDocument_Release is access
     function (This : access IOleDocument)
	       return unsigned_long;
   pragma Convention (StdCall, af_IOleDocument_Release);

   type af_IOleDocument_CreateView is access
     function (This       : access IOleDocument;
	       pIPSite    : access IOleInPlaceSite;
	       pstm       : access GNATOCX.IStream;
	       dwReserved : DWORD;
	       ppView     : access Pointer_To_IOleDocumentView
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocument_CreateView);

   type af_IOleDocument_GetDocMiscStatus is access
     function (This      : access IOleDocument;
	       pdwStatus : access DWORD
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocument_GetDocMiscStatus);

   type af_IOleDocument_EnumViews is access
     function (This      : access IOleDocument;
	       ppEnum    : access Pointer_To_IEnumOleDocumentViews;
	       ppView    : access Pointer_To_IOleDocumentView
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocument_EnumViews);

   type IOleDocumentVtbl;
   type Pointer_To_IOleDocumentVtbl is access all IOleDocumentVtbl;

   type IOleDocument is
      record
	 Vtbl : Pointer_To_IOleDocumentVtbl;
      end record;
   pragma Convention (C_Pass_By_Copy, IOleDocument);

   type IOleDocumentVtbl is
      record
	 QueryInterface    : af_IOleDocument_QueryInterface;
	 AddRef            : af_IOleDocument_AddRef;
	 Release           : af_IOleDocument_Release;
	 CreateView        : af_IOleDocument_CreateView;
	 GetDocMiscStatus  : af_IOleDocument_GetDocMiscStatus;
	 EnumViews         : af_IOleDocument_EnumViews;
      end record;
   pragma Convention (C_Pass_By_Copy, IOleDocumentVtbl);


   IID_IOleDocumentSite : aliased GNATCOM.Types.GUID :=
     GNATCOM.GUID.To_GUID ("{b722bcc7-4e68-101b-a2bc-00aa00404770}");

   type af_IOleDocumentSite_QueryInterface is access
     function (This   : access IOleDocumentSite;
	       riid   : Pointer_To_GUID;
	       ppvObj : Pointer_To_Pointer_To_Void
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentSite_QueryInterface);

   type af_IOleDocumentSite_AddRef is access
     function (This : access IOleDocumentSite)
	       return unsigned_long;
   pragma Convention (StdCall, af_IOleDocumentSite_AddRef);

   type af_IOleDocumentSite_Release is access
     function (This : access IOleDocumentSite)
	       return unsigned_long;
   pragma Convention (StdCall, af_IOleDocumentSite_Release);

   type af_IOleDocumentSite_ActivateMe is access
     function (This            : access IOleDocumentSite;
	       pViewToActivate : access IOleDocumentView
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentSite_ActivateMe);

   type IOleDocumentSiteVtbl;
   type Pointer_To_IOleDocumentSiteVtbl is access all IOleDocumentSiteVtbl;

   type IOleDocumentSite is
      record
	 Vtbl : Pointer_To_IOleDocumentSiteVtbl;
      end record;
   pragma Convention (C_Pass_By_Copy, IOleDocumentSite);

   type IOleDocumentSiteVtbl is
      record
	 QueryInterface    : af_IOleDocumentSite_QueryInterface;
	 AddRef            : af_IOleDocumentSite_AddRef;
	 Release           : af_IOleDocumentSite_Release;
	 ActivateMe        : af_IOleDocumentSite_ActivateMe;
      end record;
   pragma Convention (C_Pass_By_Copy, IOleDocumentSiteVtbl);


   IID_IOleDocumentView : aliased GNATCOM.Types.GUID :=
     GNATCOM.GUID.To_GUID ("{b722bcc6-4e68-101b-a2bc-00aa00404770}");

   type af_IOleDocumentView_QueryInterface is access
     function (This   : access IOleDocumentView;
	       riid   : Pointer_To_GUID;
	       ppvObj : Pointer_To_Pointer_To_Void
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentView_QueryInterface);

   type af_IOleDocumentView_AddRef is access
     function (This : access IOleDocumentView)
	       return unsigned_long;
   pragma Convention (StdCall, af_IOleDocumentView_AddRef);

   type af_IOleDocumentView_Release is access
     function (This : access IOleDocumentView)
	       return unsigned_long;
   pragma Convention (StdCall, af_IOleDocumentView_Release);

   type af_IOleDocumentView_SetInPlaceSite is access
     function (This         : access IOleDocumentView;
	       pIPSite      : access IOleInPlaceSite
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentView_SetInPlaceSite);

   type af_IOleDocumentView_GetInPlaceSite is access
     function (This         : access IOleDocumentView;
	       ppIPSite     : access Pointer_To_IOleInPlaceSite
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentView_GetInPlaceSite);

   type af_IOleDocumentView_GetDocument is access
     function (This         : access IOleDocumentView;
	       ppunk        : access Pointer_To_IUnknown
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentView_GetDocument);

   type af_IOleDocumentView_SetRect is access
     function (This         : access IOleDocumentView;
	       prcView      : access GNATOCX.RECT
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentView_SetRect);

   type af_IOleDocumentView_GetRect is access
     function (This         : access IOleDocumentView;
	       prcView      : access GNATOCX.RECT
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentView_GetRect);

   type af_IOleDocumentView_SetRectComplex is access
     function (This         : access IOleDocumentView;
	       prcView      : access GNATOCX.RECT;
	       prcHScroll   : access GNATOCX.RECT;
	       prcVScroll   : access GNATOCX.RECT;
	       prcSizeBox   : access GNATOCX.RECT
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentView_SetRectComplex);

   type af_IOleDocumentView_Show is access
     function (This         : access IOleDocumentView;
	       fShow        : System.Win32.BOOL
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentView_Show);

   type af_IOleDocumentView_UIActivate is access
     function (This         : access IOleDocumentView;
	       fUIActivate  : System.Win32.BOOL
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentView_UIActivate);

   type af_IOleDocumentView_Open is access
     function (This         : access IOleDocumentView
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentView_Open);

   type af_IOleDocumentView_CloseView is access
     function (This         : access IOleDocumentView;
	       dwReserved   : DWORD
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentView_CloseView);

   type af_IOleDocumentView_SaveViewState is access
     function (This         : access IOleDocumentView;
	       pstm         : access GNATOCX.IStream
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentView_SaveViewState);

   type af_IOleDocumentView_ApplyViewState is access
     function (This         : access IOleDocumentView;
	       pstm         : access GNATOCX.IStream
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentView_ApplyViewState);

   type af_IOleDocumentView_Clone is access
     function (This         : access IOleDocumentView;
	       pIPSiteNew   : access IOleInPlaceSite;
	       ppViewNew    : access Pointer_To_IOleDocumentView
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleDocumentView_Clone);

   type IOleDocumentViewVtbl;
   type Pointer_To_IOleDocumentViewVtbl is access all IOleDocumentViewVtbl;

   type IOleDocumentView is
      record
	 Vtbl : Pointer_To_IOleDocumentViewVtbl;
      end record;
   pragma Convention (C_Pass_By_Copy, IOleDocumentView);

   type IOleDocumentViewVtbl is
      record
	 QueryInterface    : af_IOleDocumentView_QueryInterface;
	 AddRef            : af_IOleDocumentView_AddRef;
	 Release           : af_IOleDocumentView_Release;
	 SetInPlaceSite    : af_IOleDocumentView_SetInPlaceSite;
	 GetInPlaceSite    : af_IOleDocumentView_GetInPlaceSite;
	 GetDocument       : af_IOleDocumentView_GetDocument;
	 SetRect           : af_IOleDocumentView_SetRect;
	 GetRect           : af_IOleDocumentView_GetRect;
	 SetRectComplex    : af_IOleDocumentView_SetRectComplex;
	 Show              : af_IOleDocumentView_Show;
	 UIActivate        : af_IOleDocumentView_UIActivate;
	 Open              : af_IOleDocumentView_Open;
	 CloseView         : af_IOleDocumentView_CloseView;
	 SaveViewState     : af_IOleDocumentView_SaveViewState;
	 ApplyViewState    : af_IOleDocumentView_ApplyViewState;
	 Clone             : af_IOleDocumentView_Clone;
      end record;
   pragma Convention (C_Pass_By_Copy, IOleDocumentViewVtbl);


   IID_IEnumOleDocumentViews : aliased GNATCOM.Types.GUID :=
     GNATCOM.GUID.To_GUID ("{b722bcc8-4e68-101b-a2bc-00aa00404770}");

   type af_IEnumOleDocumentViews_QueryInterface is access
     function (This   : access IEnumOleDocumentViews;
	       riid   : Pointer_To_GUID;
	       ppvObj : Pointer_To_Pointer_To_Void
	      ) return HRESULT;
   pragma Convention (StdCall, af_IEnumOleDocumentViews_QueryInterface);

   type af_IEnumOleDocumentViews_AddRef is access
     function (This : access IEnumOleDocumentViews)
	       return unsigned_long;
   pragma Convention (StdCall, af_IEnumOleDocumentViews_AddRef);

   type af_IEnumOleDocumentViews_Release is access
     function (This : access IEnumOleDocumentViews)
	       return unsigned_long;
   pragma Convention (StdCall, af_IEnumOleDocumentViews_Release);

   type af_IEnumOleDocumentViews_Next is access
     function (This            : access IEnumOleDocumentViews;
	       cViews          : unsigned_long;
	       rgpView         : access Pointer_To_IOleDocumentView;
	       pcFetched       : access unsigned_long
	      ) return HRESULT;
   pragma Convention (StdCall, af_IEnumOleDocumentViews_Next);

   type af_IEnumOleDocumentViews_Skip is access
     function (This   : access IEnumOleDocumentViews;
	       cViews : unsigned_long
	      ) return HRESULT;
   pragma Convention (StdCall, af_IEnumOleDocumentViews_Skip);

   type af_IEnumOleDocumentViews_Reset is access
     function (This   : access IEnumOleDocumentViews
	      ) return HRESULT;
   pragma Convention (StdCall, af_IEnumOleDocumentViews_Reset);

   type af_IEnumOleDocumentViews_Clone is access
     function (This   : access IEnumOleDocumentViews;
	       ppEnum : access Pointer_To_IEnumOleDocumentViews
	      ) return HRESULT;
   pragma Convention (StdCall, af_IEnumOleDocumentViews_Clone);

   type IEnumOleDocumentViewsVtbl;
   type Pointer_To_IEnumOleDocumentViewsVtbl is access all IEnumOleDocumentViewsVtbl;

   type IEnumOleDocumentViews is
      record
	 Vtbl : Pointer_To_IEnumOleDocumentViewsVtbl;
      end record;
   pragma Convention (C_Pass_By_Copy, IEnumOleDocumentViews);

   type IEnumOleDocumentViewsVtbl is
      record
	 QueryInterface    : af_IEnumOleDocumentViews_QueryInterface;
	 AddRef            : af_IEnumOleDocumentViews_AddRef;
	 Release           : af_IEnumOleDocumentViews_Release;
	 Next              : af_IEnumOleDocumentViews_Next;
	 Skip              : af_IEnumOleDocumentViews_Skip;
	 Reset             : af_IEnumOleDocumentViews_Reset;
	 Clone             : af_IEnumOleDocumentViews_Clone;
      end record;
   pragma Convention (C_Pass_By_Copy, IEnumOleDocumentViewsVtbl);


   IID_IContinueCallback : aliased GNATCOM.Types.GUID :=
     GNATCOM.GUID.To_GUID ("{b722bcca-4e68-101b-a2bc-00aa00404770}");

   type af_IContinueCallback_QueryInterface is access
     function (This   : access IContinueCallback;
	       riid   : Pointer_To_GUID;
	       ppvObj : Pointer_To_Pointer_To_Void
	      ) return HRESULT;
   pragma Convention (StdCall, af_IContinueCallback_QueryInterface);

   type af_IContinueCallback_AddRef is access
     function (This : access IContinueCallback)
	       return unsigned_long;
   pragma Convention (StdCall, af_IContinueCallback_AddRef);

   type af_IContinueCallback_Release is access
     function (This : access IContinueCallback)
	       return unsigned_long;
   pragma Convention (StdCall, af_IContinueCallback_Release);

   type af_IContinueCallback_FContinue is access
     function (This            : access IContinueCallback
	      ) return HRESULT;
   pragma Convention (StdCall, af_IContinueCallback_FContinue);

   type af_IContinueCallback_FContinuePrinting is access
     function (This            : access IContinueCallback;
	       nCntPrinted     : Integer;
	       nCurPage        : Integer
	      ) return HRESULT;
   pragma Convention (StdCall, af_IContinueCallback_FContinuePrinting);

   type IContinueCallbackVtbl;
   type Pointer_To_IContinueCallbackVtbl is access all IContinueCallbackVtbl;

   type IContinueCallback is
      record
	 Vtbl : Pointer_To_IContinueCallbackVtbl;
      end record;
   pragma Convention (C_Pass_By_Copy, IContinueCallback);

   type IContinueCallbackVtbl is
      record
	 QueryInterface    : af_IContinueCallback_QueryInterface;
	 AddRef            : af_IContinueCallback_AddRef;
	 Release           : af_IContinueCallback_Release;
	 FContinue         : af_IContinueCallback_FContinue;
	 FContinuePrinting : af_IContinueCallback_FContinuePrinting;
      end record;
   pragma Convention (C_Pass_By_Copy, IContinueCallbackVtbl);


   PRINTFLAG_MAYBOTHERUSER        : constant unsigned := 1;
   PRINTFLAG_PROMPTUSER           : constant unsigned := 2;
   PRINTFLAG_USERMAYCHANGEPRINTER : constant unsigned := 4;
   PRINTFLAG_RECOMPOSETODEVICE    : constant unsigned := 8;
   PRINTFLAG_DONTACTUALLYPRINT    : constant unsigned := 16;
   PRINTFLAG_FORCEPROPERTIES      : constant unsigned := 32;
   PRINTFLAG_PRINTTOFILE          : constant unsigned := 64;
   -- PRINTFLAG;

   type PAGERANGE is record
      nFromPage : Integer;
      nToPage   : Integer;
   end record;

   type PAGESET is record
      cbStruct   : unsigned_long;
      fOddPages  : System.Win32.BOOL;
      fEvenPages : System.Win32.BOOL;
      cPageRange : unsigned_long;
      rgPages    : aliased PAGERANGE;
   end record;
   type Pointer_To_PAGESET is access all PAGESET;

   IID_IPrint : aliased GNATCOM.Types.GUID :=
     GNATCOM.GUID.To_GUID ("{b722bcc9-4e68-101b-a2bc-00aa00404770}");

   type af_IPrint_QueryInterface is access
     function (This   : access IPrint;
	       riid   : Pointer_To_GUID;
	       ppvObj : Pointer_To_Pointer_To_Void
	      ) return HRESULT;
   pragma Convention (StdCall, af_IPrint_QueryInterface);

   type af_IPrint_AddRef is access
     function (This : access IPrint)
	       return unsigned_long;
   pragma Convention (StdCall, af_IPrint_AddRef);

   type af_IPrint_Release is access
     function (This : access IPrint)
	       return unsigned_long;
   pragma Convention (StdCall, af_IPrint_Release);

   type af_IPrint_SetInitialPageNum is access
     function (This            : access IPrint;
	       nFirstPage      : Integer
	      ) return HRESULT;
   pragma Convention (StdCall, af_IPrint_SetInitialPageNum);

   type af_IPrint_GetPageInfo is access
     function (This            : access IPrint;
	       pnFirstPage     : access Integer;
	       pcPages         : access Integer
	      ) return HRESULT;
   pragma Convention (StdCall, af_IPrint_GetPageInfo);

   type af_IPrint_Print is access
     function (This            : access IPrint;
	       grfFlags        : DWORD;
	       pptd            : access Pointer_To_DVTARGETDEVICE;
	       ppPageSet       : access Pointer_To_PAGESET;
	       pstgmOptions    : access uuserSTGMEDIUM;
	       pcallback       : access IContinueCallback;
	       nFirstPage      : Integer;
	       pcPagesPrinted  : access Integer;
	       pnLastPage      : access Integer
	      ) return HRESULT;
   pragma Convention (StdCall, af_IPrint_Print);

   type IPrintVtbl;
   type Pointer_To_IPrintVtbl is access all IPrintVtbl;

   type IPrint is
      record
	 Vtbl : Pointer_To_IPrintVtbl;
      end record;
   pragma Convention (C_Pass_By_Copy, IPrint);

   type IPrintVtbl is
      record
	 QueryInterface    : af_IPrint_QueryInterface;
	 AddRef            : af_IPrint_AddRef;
	 Release           : af_IPrint_Release;
	 SetInitialPageNum : af_IPrint_SetInitialPageNum;
	 GetPageInfo       : af_IPrint_GetPageInfo;
	 Print             : af_IPrint_Print;
      end record;
   pragma Convention (C_Pass_By_Copy, IPrintVtbl);


   -- enum OLECMDF
   OLECMDF_SUPPORTED         : constant unsigned := 16#1#;
   OLECMDF_ENABLED           : constant unsigned := 16#2#;
   OLECMDF_LATCHED           : constant unsigned := 16#4#;
   OLECMDF_NINCHED           : constant unsigned := 16#8#;
   OLECMDF_INVISIBLE         : constant unsigned := 16#10#;
   OLECMDF_DEFHIDEONCTXTMENU : constant unsigned := 16#20#;
   -- OLECMDF;

   type OLECMD is record
      cmdID : unsigned_long;
      cmdf  : DWORD;
   end record;

   type OLECMDTEXT is record
      cmdtextf : DWORD;
      cwActual : unsigned_long;
      cwBuf    : unsigned_long;
      rgwz     : aliased wchar_t;
   end record;

   -- enum OLECMDTEXTF
   OLECMDTEXTF_NONE   : constant := 0;
   OLECMDTEXTF_NAME   : constant := 1;
   OLECMDTEXTF_STATUS : constant := 2;
   -- OLECMDTEXTF;

   -- enum OLECMDEXECOPT
   OLECMDEXECOPT_DODEFAULT      : constant := 0;
   OLECMDEXECOPT_PROMPTUSER     : constant := 1;
   OLECMDEXECOPT_DONTPROMPTUSER : constant := 2;
   OLECMDEXECOPT_SHOWHELP       : constant := 3;
   -- OLECMDEXECOPT;

   -- OLECMDID_STOPDOWNLOAD and OLECMDID_ALLOWUILESSSAVEAS are supported for QueryStatus Only
   -- enum OLECMDID
   OLECMDID_OPEN                           : constant := 1;
   OLECMDID_NEW                            : constant := 2;
   OLECMDID_SAVE                           : constant := 3;
   OLECMDID_SAVEAS                         : constant := 4;
   OLECMDID_SAVECOPYAS                     : constant := 5;
   OLECMDID_PRINT                          : constant := 6;
   OLECMDID_PRINTPREVIEW                   : constant := 7;
   OLECMDID_PAGESETUP                      : constant := 8;
   OLECMDID_SPELL                          : constant := 9;
   OLECMDID_PROPERTIES                     : constant := 10;
   OLECMDID_CUT                            : constant := 11;
   OLECMDID_COPY                           : constant := 12;
   OLECMDID_PASTE                          : constant := 13;
   OLECMDID_PASTESPECIAL                   : constant := 14;
   OLECMDID_UNDO                           : constant := 15;
   OLECMDID_REDO                           : constant := 16;
   OLECMDID_SELECTALL                      : constant := 17;
   OLECMDID_CLEARSELECTION                 : constant := 18;
   OLECMDID_ZOOM                           : constant := 19;
   OLECMDID_GETZOOMRANGE                   : constant := 20;
   OLECMDID_UPDATECOMMANDS                 : constant := 21;
   OLECMDID_REFRESH                        : constant := 22;
   OLECMDID_STOP                           : constant := 23;
   OLECMDID_HIDETOOLBARS                   : constant := 24;
   OLECMDID_SETPROGRESSMAX                 : constant := 25;
   OLECMDID_SETPROGRESSPOS                 : constant := 26;
   OLECMDID_SETPROGRESSTEXT                : constant := 27;
   OLECMDID_SETTITLE                       : constant := 28;
   OLECMDID_SETDOWNLOADSTATE               : constant := 29;
   OLECMDID_STOPDOWNLOAD                   : constant := 30;
   OLECMDID_ONTOOLBARACTIVATED             : constant := 31;
   OLECMDID_FIND                           : constant := 32;
   OLECMDID_DELETE                         : constant := 33;
   OLECMDID_HTTPEQUIV                      : constant := 34;
   OLECMDID_HTTPEQUIV_DONE                 : constant := 35;
   OLECMDID_ENABLE_INTERACTION             : constant := 36;
   OLECMDID_ONUNLOAD                       : constant := 37;
   OLECMDID_PROPERTYBAG2                   : constant := 38;
   OLECMDID_PREREFRESH                     : constant := 39;
   OLECMDID_SHOWSCRIPTERROR                : constant := 40;
   OLECMDID_SHOWMESSAGE                    : constant := 41;
   OLECMDID_SHOWFIND                       : constant := 42;
   OLECMDID_SHOWPAGESETUP                  : constant := 43;
   OLECMDID_SHOWPRINT                      : constant := 44;
   OLECMDID_CLOSE                          : constant := 45;
   OLECMDID_ALLOWUILESSSAVEAS              : constant := 46;
   OLECMDID_DONTDOWNLOADCSS                : constant := 47;
   OLECMDID_UPDATEPAGESTATUS               : constant := 48;
   OLECMDID_PRINT2                         : constant := 49;
   OLECMDID_PRINTPREVIEW2                  : constant := 50;
   OLECMDID_SETPRINTTEMPLATE               : constant := 51;
   OLECMDID_GETPRINTTEMPLATE               : constant := 52;
   OLECMDID_PAGEACTIONBLOCKED              : constant := 55;
   OLECMDID_PAGEACTIONUIQUERY              : constant := 56;
   OLECMDID_FOCUSVIEWCONTROLS              : constant := 57;
   OLECMDID_FOCUSVIEWCONTROLSQUERY         : constant := 58;
   OLECMDID_SHOWPAGEACTIONMENU             : constant := 59;
   OLECMDID_ADDTRAVELENTRY                 : constant := 60;
   OLECMDID_UPDATETRAVELENTRY              : constant := 61;
   OLECMDID_UPDATEBACKFORWARDSTATE         : constant := 62;
   OLECMDID_OPTICAL_ZOOM                   : constant := 63;
   OLECMDID_OPTICAL_GETZOOMRANGE           : constant := 64;
   OLECMDID_WINDOWSTATECHANGED             : constant := 65;
   OLECMDID_ACTIVEXINSTALLSCOPE            : constant := 66;
   OLECMDID_UPDATETRAVELENTRY_DATARECOVERY : constant := 67;
   OLECMDID_SHOWTASKDLG                    : constant := 68;
   OLECMDID_POPSTATEEVENT                  : constant := 69;
   OLECMDID_VIEWPORT_MODE                  : constant := 70;
   OLECMDID_LAYOUT_VIEWPORT_WIDTH          : constant := 71;
   OLECMDID_VISUAL_VIEWPORT_EXCLUDE_BOTTOM : constant := 72;
   OLECMDID_USER_OPTICAL_ZOOM              : constant := 73;
   OLECMDID_PAGEAVAILABLE                  : constant := 74;
   OLECMDID_GETUSERSCALABLE                : constant := 75;
   OLECMDID_UPDATE_CARET                   : constant := 76;
   OLECMDID_ENABLE_VISIBILITY              : constant := 77;
   OLECMDID_MEDIA_PLAYBACK                 : constant := 78;
   OLECMDID_SETFAVICON                     : constant := 79;
   OLECMDID_SET_HOST_FULLSCREENMODE        : constant := 80;
   OLECMDID_EXITFULLSCREEN                 : constant := 81;
   OLECMDID_SCROLLCOMPLETE                 : constant := 82;
   OLECMDID_ONBEFOREUNLOAD                 : constant := 83;
   -- OLECMDID;

   -- enum MEDIAPLAYBACK_STATE
   MEDIAPLAYBACK_RESUME              : constant := 0;
   MEDIAPLAYBACK_PAUSE               : constant := 1;
   MEDIAPLAYBACK_PAUSE_AND_SUSPEND   : constant := 2;
   MEDIAPLAYBACK_RESUME_FROM_SUSPEND : constant := 3;
   -- MEDIAPLAYBACK_STATE;

   -- Generic OLE errors that may be returned by many inerfaces
   OLE_E_FIRST : constant HRESULT := 16#80040000#;
   OLE_E_LAST  : constant HRESULT := 16#800400FF#;
   OLE_S_FIRST : constant HRESULT := 16#00040000#;
   OLE_S_LAST  : constant HRESULT := 16#000400FF#;

   OLECMDERR_E_FIRST            : constant HRESULT := OLE_E_LAST+1;
   OLECMDERR_E_NOTSUPPORTED     : constant HRESULT := OLECMDERR_E_FIRST;
   OLECMDERR_E_DISABLED         : constant HRESULT := OLECMDERR_E_FIRST+1;
   OLECMDERR_E_NOHELP           : constant HRESULT := OLECMDERR_E_FIRST+2;
   OLECMDERR_E_CANCELED         : constant HRESULT := OLECMDERR_E_FIRST+3;
   OLECMDERR_E_UNKNOWNGROUP     : constant HRESULT := OLECMDERR_E_FIRST+4;
   MSOCMDERR_E_FIRST            : constant HRESULT := OLECMDERR_E_FIRST;
   MSOCMDERR_E_NOTSUPPORTED     : constant HRESULT := OLECMDERR_E_NOTSUPPORTED;
   MSOCMDERR_E_DISABLED         : constant HRESULT := OLECMDERR_E_DISABLED;
   MSOCMDERR_E_NOHELP           : constant HRESULT := OLECMDERR_E_NOHELP;
   MSOCMDERR_E_CANCELED         : constant HRESULT := OLECMDERR_E_CANCELED;
   MSOCMDERR_E_UNKNOWNGROUP     : constant HRESULT := OLECMDERR_E_UNKNOWNGROUP;

   OLECMD_TASKDLGID_ONBEFOREUNLOAD            : constant := 1;
   OLECMDARGINDEX_SHOWPAGEACTIONMENU_HWND     : constant := 0;
   OLECMDARGINDEX_SHOWPAGEACTIONMENU_X        : constant := 1;
   OLECMDARGINDEX_SHOWPAGEACTIONMENU_Y        : constant := 2;
   OLECMDARGINDEX_ACTIVEXINSTALL_PUBLISHER    : constant := 0;
   OLECMDARGINDEX_ACTIVEXINSTALL_DISPLAYNAME  : constant := 1;
   OLECMDARGINDEX_ACTIVEXINSTALL_CLSID        : constant := 2;
   OLECMDARGINDEX_ACTIVEXINSTALL_INSTALLSCOPE : constant := 3;
   OLECMDARGINDEX_ACTIVEXINSTALL_SOURCEURL    : constant := 4;
   INSTALL_SCOPE_INVALID    : constant := 0;
   INSTALL_SCOPE_MACHINE    : constant := 1;
   INSTALL_SCOPE_USER       : constant := 2;

   -- enum IGNOREMIME
   IGNOREMIME_PROMPT : constant unsigned := 16#1#;
   IGNOREMIME_TEXT   : constant unsigned := 16#2#;
   -- IGNOREMIME;

   -- enum WPCSETTING
   WPCSETTING_LOGGING_ENABLED      : constant unsigned := 16#1#;
   WPCSETTING_FILEDOWNLOAD_BLOCKED : constant unsigned := 16#2#;
   -- WPCSETTING;

   IID_IOleCommandTarget : aliased GNATCOM.Types.GUID :=
     GNATCOM.GUID.To_GUID ("{b722bccb-4e68-101b-a2bc-00aa00404770}");

   type af_IOleCommandTarget_QueryInterface is access
     function (This   : access IOleCommandTarget;
	       riid   : Pointer_To_GUID;
	       ppvObj : Pointer_To_Pointer_To_Void
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleCommandTarget_QueryInterface);

   type af_IOleCommandTarget_AddRef is access
     function (This : access IOleCommandTarget)
	       return unsigned_long;
   pragma Convention (StdCall, af_IOleCommandTarget_AddRef);

   type af_IOleCommandTarget_Release is access
     function (This : access IOleCommandTarget)
	       return unsigned_long;
   pragma Convention (StdCall, af_IOleCommandTarget_Release);

   type af_IOleCommandTarget_QueryStatus is access
     function (This            : access IOleCommandTarget;
	       pguidCmdGroup   : access GNATCOM.Types.GUID;
	       cCmds           : unsigned_long;
	       prgCmds         : access OLECMD;
	       pCmdText        : access OLECMDTEXT
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleCommandTarget_QueryStatus);

   type af_IOleCommandTarget_Exec is access
     function (This            : access IOleCommandTarget;
	       pguidCmdGroup   : access GNATCOM.Types.GUID;
	       nCmdID          : DWORD;
	       nCmdexecopt     : DWORD;
	       pvaIn           : access VARIANT;
	       pvaOut          : access VARIANT
	      ) return HRESULT;
   pragma Convention (StdCall, af_IOleCommandTarget_Exec);

   type IOleCommandTargetVtbl;
   type Pointer_To_IOleCommandTargetVtbl is access all IOleCommandTargetVtbl;

   type IOleCommandTarget is
      record
	 Vtbl : Pointer_To_IOleCommandTargetVtbl;
      end record;
   pragma Convention (C_Pass_By_Copy, IOleCommandTarget);

   type IOleCommandTargetVtbl is
      record
	 QueryInterface    : af_IOleCommandTarget_QueryInterface;
	 AddRef            : af_IOleCommandTarget_AddRef;
	 Release           : af_IOleCommandTarget_Release;
	 QueryStatus       : af_IOleCommandTarget_QueryStatus;
	 Exec              : af_IOleCommandTarget_Exec;
      end record;
   pragma Convention (C_Pass_By_Copy, IOleCommandTargetVtbl);


   -- typedef enum
   OLECMDIDF_REFRESH_NORMAL          : constant unsigned := 0;
   OLECMDIDF_REFRESH_IFEXPIRED       : constant unsigned := 1;
   OLECMDIDF_REFRESH_CONTINUE        : constant unsigned := 2;
   OLECMDIDF_REFRESH_COMPLETELY      : constant unsigned := 3;
   OLECMDIDF_REFRESH_NO_CACHE        : constant unsigned := 4;
   OLECMDIDF_REFRESH_RELOAD          : constant unsigned := 5;
   OLECMDIDF_REFRESH_LEVELMASK       : constant unsigned := 16#00FF#;
   OLECMDIDF_REFRESH_CLEARUSERINPUT  : constant unsigned := 16#1000#;
   OLECMDIDF_REFRESH_PROMPTIFOFFLINE : constant unsigned := 16#2000#;
   OLECMDIDF_REFRESH_THROUGHSCRIPT   : constant unsigned := 16#4000#;
   OLECMDIDF_REFRESH_SKIPBEFOREUNLOADEVENT     : constant unsigned := 16#8000#;
   OLECMDIDF_REFRESH_PAGEACTION_ACTIVEXINSTALL : constant unsigned := 16#00010000#;
   OLECMDIDF_REFRESH_PAGEACTION_FILEDOWNLOAD   : constant unsigned := 16#00020000#;
   OLECMDIDF_REFRESH_PAGEACTION_LOCALMACHINE   : constant unsigned := 16#00040000#;
   OLECMDIDF_REFRESH_PAGEACTION_POPUPWINDOW    : constant unsigned := 16#00080000#;
   OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNLOCALMACHINE  : constant unsigned := 16#00100000#;
   OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNTRUSTED       : constant unsigned := 16#00200000#;
   OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNINTRANET      : constant unsigned := 16#00400000#;
   OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNINTERNET      : constant unsigned := 16#00800000#;
   OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNRESTRICTED    : constant unsigned := 16#01000000#;
   OLECMDIDF_REFRESH_PAGEACTION_MIXEDCONTENT              : constant unsigned := 16#02000000#;
   OLECMDIDF_REFRESH_PAGEACTION_INVALID_CERT              : constant unsigned := 16#04000000#;
   OLECMDIDF_REFRESH_PAGEACTION_ALLOW_VERSION             : constant unsigned := 16#08000000#;
   -- OLECMDID_REFRESHFLAG;
   -- typedef enum
   OLECMDIDF_PAGEACTION_FILEDOWNLOAD                       : constant unsigned := 16#00000001#;
   OLECMDIDF_PAGEACTION_ACTIVEXINSTALL                     : constant unsigned := 16#00000002#;
   OLECMDIDF_PAGEACTION_ACTIVEXTRUSTFAIL                   : constant unsigned := 16#00000004#;
   OLECMDIDF_PAGEACTION_ACTIVEXUSERDISABLE                 : constant unsigned := 16#00000008#;
   OLECMDIDF_PAGEACTION_ACTIVEXDISALLOW                    : constant unsigned := 16#00000010#;
   OLECMDIDF_PAGEACTION_ACTIVEXUNSAFE                      : constant unsigned := 16#00000020#;
   OLECMDIDF_PAGEACTION_POPUPWINDOW                        : constant unsigned := 16#00000040#;
   OLECMDIDF_PAGEACTION_LOCALMACHINE                       : constant unsigned := 16#00000080#;
   OLECMDIDF_PAGEACTION_MIMETEXTPLAIN                      : constant unsigned := 16#00000100#;
   OLECMDIDF_PAGEACTION_SCRIPTNAVIGATE                     : constant unsigned := 16#00000200#;
   OLECMDIDF_PAGEACTION_SCRIPTNAVIGATE_ACTIVEXINSTALL      : constant unsigned := 16#00000200#;
   OLECMDIDF_PAGEACTION_PROTLOCKDOWNLOCALMACHINE           : constant unsigned := 16#00000400#;
   OLECMDIDF_PAGEACTION_PROTLOCKDOWNTRUSTED                : constant unsigned := 16#00000800#;
   OLECMDIDF_PAGEACTION_PROTLOCKDOWNINTRANET               : constant unsigned := 16#00001000#;
   OLECMDIDF_PAGEACTION_PROTLOCKDOWNINTERNET               : constant unsigned := 16#00002000#;
   OLECMDIDF_PAGEACTION_PROTLOCKDOWNRESTRICTED             : constant unsigned := 16#00004000#;
   OLECMDIDF_PAGEACTION_PROTLOCKDOWNDENY                   : constant unsigned := 16#00008000#;
   OLECMDIDF_PAGEACTION_POPUPALLOWED                       : constant unsigned := 16#00010000#;
   OLECMDIDF_PAGEACTION_SCRIPTPROMPT                       : constant unsigned := 16#00020000#;
   OLECMDIDF_PAGEACTION_ACTIVEXUSERAPPROVAL                : constant unsigned := 16#00040000#;
   OLECMDIDF_PAGEACTION_MIXEDCONTENT                       : constant unsigned := 16#00080000#;
   OLECMDIDF_PAGEACTION_INVALID_CERT                       : constant unsigned := 16#00100000#;
   OLECMDIDF_PAGEACTION_INTRANETZONEREQUEST                : constant unsigned := 16#00200000#;
   OLECMDIDF_PAGEACTION_XSSFILTERED                        : constant unsigned := 16#00400000#;
   OLECMDIDF_PAGEACTION_SPOOFABLEIDNHOST                   : constant unsigned := 16#00800000#;
   OLECMDIDF_PAGEACTION_ACTIVEX_EPM_INCOMPATIBLE           : constant unsigned := 16#01000000#;
   OLECMDIDF_PAGEACTION_SCRIPTNAVIGATE_ACTIVEXUSERAPPROVAL : constant unsigned := 16#02000000#;
   OLECMDIDF_PAGEACTION_WPCBLOCKED                         : constant unsigned := 16#04000000#;
   OLECMDIDF_PAGEACTION_WPCBLOCKED_ACTIVEX                 : constant unsigned := 16#08000000#;
   OLECMDIDF_PAGEACTION_EXTENSION_COMPAT_BLOCKED           : constant unsigned := 16#10000000#;
   OLECMDIDF_PAGEACTION_NORESETACTIVEX                     : constant unsigned := 16#20000000#;
   OLECMDIDF_PAGEACTION_GENERIC_STATE                      : constant unsigned := 16#40000000#;
   OLECMDIDF_PAGEACTION_RESET                              : constant unsigned := 16#80000000#;
   -- OLECMDID_PAGEACTIONFLAG;
   -- typedef enum
   OLECMDIDF_BROWSERSTATE_EXTENSIONSOFF                    : constant unsigned := 16#00000001#;
   OLECMDIDF_BROWSERSTATE_IESECURITY                       : constant unsigned := 16#00000002#;
   OLECMDIDF_BROWSERSTATE_PROTECTEDMODE_OFF                : constant unsigned := 16#00000004#;
   OLECMDIDF_BROWSERSTATE_RESET                            : constant unsigned := 16#00000008#;
   OLECMDIDF_BROWSERSTATE_REQUIRESACTIVEX                  : constant unsigned := 16#00000010#;
   OLECMDIDF_BROWSERSTATE_DESKTOPHTMLDIALOG                : constant unsigned := 16#00000020#;
   OLECMDIDF_BROWSERSTATE_BLOCKEDVERSION                   : constant unsigned := 16#00000040#;
   -- OLECMDID_BROWSERSTATEFLAG;
   -- typedef enum
   OLECMDIDF_OPTICAL_ZOOM_NOPERSIST                        : constant unsigned := 16#00000001#;
   OLECMDIDF_OPTICAL_ZOOM_NOLAYOUT                         : constant unsigned := 16#00000010#;
   OLECMDIDF_OPTICAL_ZOOM_NOTRANSIENT                      : constant unsigned := 16#00000020#;
   OLECMDIDF_OPTICAL_ZOOM_RELOADFORNEWTAB                  : constant unsigned := 16#00000040#;
   -- OLECMDID_OPTICAL_ZOOMFLAG;
   -- typedef enum
   PAGEACTION_UI_DEFAULT     : constant := 0;
   PAGEACTION_UI_MODAL       : constant := 1;
   PAGEACTION_UI_MODELESS    : constant := 2;
   PAGEACTION_UI_SILENT      : constant := 3;
   -- PAGEACTION_UI;
   -- typedef enum
   OLECMDIDF_WINDOWSTATE_USERVISIBLE        : constant unsigned := 16#00000001#;
   OLECMDIDF_WINDOWSTATE_ENABLED            : constant unsigned := 16#00000002#;
   OLECMDIDF_WINDOWSTATE_USERVISIBLE_VALID  : constant unsigned := 16#00010000#;
   OLECMDIDF_WINDOWSTATE_ENABLED_VALID      : constant unsigned := 16#00020000#;
   -- OLECMDID_WINDOWSTATE_FLAG;
   -- typedef enum
   OLECMDIDF_VIEWPORTMODE_FIXED_LAYOUT_WIDTH          : constant unsigned := 16#00000001#;
   OLECMDIDF_VIEWPORTMODE_EXCLUDE_VISUAL_BOTTOM       : constant unsigned := 16#00000002#;
   OLECMDIDF_VIEWPORTMODE_FIXED_LAYOUT_WIDTH_VALID    : constant unsigned := 16#00010000#;
   OLECMDIDF_VIEWPORTMODE_EXCLUDE_VISUAL_BOTTOM_VALID : constant unsigned := 16#00020000#;
   -- OLECMDID_VIEWPORT_MODE_FLAG;

   IID_IProtectedModeMenuServices : aliased GNATCOM.Types.GUID :=
     GNATCOM.GUID.To_GUID ("{73c105ee-9dff-4a07-b83c-7eff290c266e}");

   type af_IProtectedModeMenuServices_QueryInterface is access
     function (This   : access IProtectedModeMenuServices;
	       riid   : Pointer_To_GUID;
	       ppvObj : Pointer_To_Pointer_To_Void
	      ) return HRESULT;
   pragma Convention (StdCall, af_IProtectedModeMenuServices_QueryInterface);

   type af_IProtectedModeMenuServices_AddRef is access
     function (This : access IProtectedModeMenuServices)
	       return unsigned_long;
   pragma Convention (StdCall, af_IProtectedModeMenuServices_AddRef);

   type af_IProtectedModeMenuServices_Release is access
     function (This : access IProtectedModeMenuServices)
	       return unsigned_long;
   pragma Convention (StdCall, af_IProtectedModeMenuServices_Release);

   type af_IProtectedModeMenuServices_ActivateMe is access
     function (This            : access IProtectedModeMenuServices;
	       pViewToActivate : access IOleDocumentView
	      ) return HRESULT;
   pragma Convention (StdCall, af_IProtectedModeMenuServices_ActivateMe);

   type IProtectedModeMenuServicesVtbl;
   type Pointer_To_IProtectedModeMenuServicesVtbl is access all IProtectedModeMenuServicesVtbl;

   type IProtectedModeMenuServices is
      record
	 Vtbl : Pointer_To_IProtectedModeMenuServicesVtbl;
      end record;
   pragma Convention (C_Pass_By_Copy, IProtectedModeMenuServices);

   type IProtectedModeMenuServicesVtbl is
      record
	 QueryInterface    : af_IProtectedModeMenuServices_QueryInterface;
	 AddRef            : af_IProtectedModeMenuServices_AddRef;
	 Release           : af_IProtectedModeMenuServices_Release;
	 ActivateMe        : af_IProtectedModeMenuServices_ActivateMe;
      end record;
   pragma Convention (C_Pass_By_Copy, IProtectedModeMenuServicesVtbl);

end DocObj;
