with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLSelection_Interface is

   procedure Initialize (This : in out IHTMLSelection_Type) is
   begin
      Set_IID (This, IID_IHTMLSelection);
   end Initialize;

   function Pointer (This : IHTMLSelection_Type)
     return Pointer_To_IHTMLSelection
   is
   begin
      return To_Pointer_To_IHTMLSelection (Address (This));
   end Pointer;

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

   function Get_anchorNode
     (This : IHTMLSelection_Type)
     return Pointer_To_IHTMLDOMNode
   is
       RetVal : aliased Pointer_To_IHTMLDOMNode;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_anchorNode
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_anchorNode;

   function Get_anchorOffset
     (This : IHTMLSelection_Type)
     return Interfaces.C.long
   is
       RetVal : aliased Interfaces.C.long;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_anchorOffset
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_anchorOffset;

   function Get_focusNode
     (This : IHTMLSelection_Type)
     return Pointer_To_IHTMLDOMNode
   is
       RetVal : aliased Pointer_To_IHTMLDOMNode;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_focusNode
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_focusNode;

   function Get_focusOffset
     (This : IHTMLSelection_Type)
     return Interfaces.C.long
   is
       RetVal : aliased Interfaces.C.long;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_focusOffset
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_focusOffset;

   function Get_isCollapsed
     (This : IHTMLSelection_Type)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_isCollapsed
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_isCollapsed;

   procedure collapse
     (This       : IHTMLSelection_Type;
      parentNode : GNATCOM.Types.Pointer_To_IDispatch;
      offfset    : Interfaces.C.long)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.collapse
         (Pointer (This),
          parentNode,
          offfset));

   end collapse;

   procedure collapseToStart
     (This : IHTMLSelection_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.collapseToStart
         (Pointer (This)));

   end collapseToStart;

   procedure collapseToEnd
     (This : IHTMLSelection_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.collapseToEnd
         (Pointer (This)));

   end collapseToEnd;

   procedure selectAllChildren
     (This       : IHTMLSelection_Type;
      parentNode : GNATCOM.Types.Pointer_To_IDispatch)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.selectAllChildren
         (Pointer (This),
          parentNode));

   end selectAllChildren;

   procedure deleteFromDocument
     (This : IHTMLSelection_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.deleteFromDocument
         (Pointer (This)));

   end deleteFromDocument;

   function Get_rangeCount
     (This : IHTMLSelection_Type)
     return Interfaces.C.long
   is
       RetVal : aliased Interfaces.C.long;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_rangeCount
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_rangeCount;

   function getRangeAt
     (This    : IHTMLSelection_Type;
      index   : Interfaces.C.long)
     return Pointer_To_IHTMLDOMRange
   is
       RetVal : aliased Pointer_To_IHTMLDOMRange;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.getRangeAt
         (Pointer (This),
          index,
          RetVal'Unchecked_Access));

      return RetVal;
   end getRangeAt;

   procedure addRange
     (This   : IHTMLSelection_Type;
      urange : GNATCOM.Types.Pointer_To_IDispatch)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.addRange
         (Pointer (This),
          urange));

   end addRange;

   procedure removeRange
     (This   : IHTMLSelection_Type;
      urange : GNATCOM.Types.Pointer_To_IDispatch)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.removeRange
         (Pointer (This),
          urange));

   end removeRange;

   procedure removeAllRanges
     (This : IHTMLSelection_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.removeAllRanges
         (Pointer (This)));

   end removeAllRanges;

   function toString
     (This             : IHTMLSelection_Type)
     return GNATCOM.Types.BSTR
   is
       RetVal : aliased GNATCOM.Types.BSTR;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.toString
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end toString;

end MSHTML.IHTMLSelection_Interface;

