with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLDocument6_Interface is

   procedure Initialize (This : in out IHTMLDocument6_Type) is
   begin
      Set_IID (This, IID_IHTMLDocument6);
   end Initialize;

   function Pointer (This : IHTMLDocument6_Type)
     return Pointer_To_IHTMLDocument6
   is
   begin
      return To_Pointer_To_IHTMLDocument6 (Address (This));
   end Pointer;

   procedure Attach (This    : in out IHTMLDocument6_Type;
                     Pointer : in     Pointer_To_IHTMLDocument6)
   is
   begin
      Attach (This, GNATCOM.IInterface.To_Pointer_To_IUnknown
              (Pointer.all'Address));
   end Attach;

   function Get_compatible
     (This : IHTMLDocument6_Type)
     return Pointer_To_IHTMLDocumentCompatibleInfoCollection
   is
       RetVal : aliased Pointer_To_IHTMLDocumentCompatibleInfoCollection;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_compatible
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_compatible;

   function Get_documentMode
     (This : IHTMLDocument6_Type)
     return GNATCOM.Types.VARIANT
   is
       RetVal : aliased GNATCOM.Types.VARIANT;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_documentMode
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_documentMode;

   procedure Put_onstorage
     (This : IHTMLDocument6_Type;
      p    : GNATCOM.Types.VARIANT;
      Free : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_onstorage
         (Pointer (This),
          p));

      if Free then
               GNATCOM.IInterface.Free (p);
      
      end if;

   end Put_onstorage;

   function Get_onstorage
     (This : IHTMLDocument6_Type)
     return GNATCOM.Types.VARIANT
   is
       RetVal : aliased GNATCOM.Types.VARIANT;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_onstorage
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_onstorage;

   procedure Put_onstoragecommit
     (This : IHTMLDocument6_Type;
      p    : GNATCOM.Types.VARIANT;
      Free : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_onstoragecommit
         (Pointer (This),
          p));

      if Free then
               GNATCOM.IInterface.Free (p);
      
      end if;

   end Put_onstoragecommit;

   function Get_onstoragecommit
     (This : IHTMLDocument6_Type)
     return GNATCOM.Types.VARIANT
   is
       RetVal : aliased GNATCOM.Types.VARIANT;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_onstoragecommit
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_onstoragecommit;

   function getElementById
     (This         : IHTMLDocument6_Type;
      bstrId       : GNATCOM.Types.BSTR;
      Free         : Boolean := True)
     return Pointer_To_IHTMLElement2
   is
       RetVal : aliased Pointer_To_IHTMLElement2;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.getElementById
         (Pointer (This),
          bstrId,
          RetVal'Unchecked_Access));

      if Free then
               GNATCOM.IInterface.Free (bstrId);
      
      end if;

      return RetVal;
   end getElementById;

   procedure updateSettings
     (This : IHTMLDocument6_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.updateSettings
         (Pointer (This)));

   end updateSettings;

end MSHTML.IHTMLDocument6_Interface;

