with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLElementAppliedStyles_Interface is

   procedure Initialize (This : in out IHTMLElementAppliedStyles_Type) is
   begin
      Set_IID (This, IID_IHTMLElementAppliedStyles);
   end Initialize;

   function Pointer (This : IHTMLElementAppliedStyles_Type)
     return Pointer_To_IHTMLElementAppliedStyles
   is
   begin
      return To_Pointer_To_IHTMLElementAppliedStyles (Address (This));
   end Pointer;

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

   function msGetRulesApplied
     (This                     : IHTMLElementAppliedStyles_Type)
     return Pointer_To_IRulesAppliedCollection
   is
       RetVal : aliased Pointer_To_IRulesAppliedCollection;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.msGetRulesApplied
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end msGetRulesApplied;

   function msGetRulesAppliedWithAncestor
     (This                     : IHTMLElementAppliedStyles_Type;
      varContext               : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      Free                     : Boolean := True)
     return Pointer_To_IRulesAppliedCollection
   is
       RetVal : aliased Pointer_To_IRulesAppliedCollection;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.msGetRulesAppliedWithAncestor
         (Pointer (This),
          varContext,
          RetVal'Unchecked_Access));

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

      return RetVal;
   end msGetRulesAppliedWithAncestor;

end MSHTML.IHTMLElementAppliedStyles_Interface;

