with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IPrintManagerTemplatePrinter2_Interface is

   procedure Initialize (This : in out IPrintManagerTemplatePrinter2_Type) is
   begin
      Set_IID (This, IID_IPrintManagerTemplatePrinter2);
   end Initialize;

   function Pointer (This : IPrintManagerTemplatePrinter2_Type)
     return Pointer_To_IPrintManagerTemplatePrinter2
   is
   begin
      return To_Pointer_To_IPrintManagerTemplatePrinter2 (Address (This));
   end Pointer;

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

   procedure startPrint
     (This : IPrintManagerTemplatePrinter2_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.startPrint
         (Pointer (This)));

   end startPrint;

   procedure drawPreviewPage
     (This      : IPrintManagerTemplatePrinter2_Type;
      pElemDisp : GNATCOM.Types.Pointer_To_IDispatch;
      nPage     : Interfaces.C.long)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.drawPreviewPage
         (Pointer (This),
          pElemDisp,
          nPage));

   end drawPreviewPage;

   procedure setPageCount
     (This  : IPrintManagerTemplatePrinter2_Type;
      nPage : Interfaces.C.long)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.setPageCount
         (Pointer (This),
          nPage));

   end setPageCount;

   procedure invalidatePreview
     (This : IPrintManagerTemplatePrinter2_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.invalidatePreview
         (Pointer (This)));

   end invalidatePreview;

   function getPrintTaskOptionValue
     (This    : IPrintManagerTemplatePrinter2_Type;
      bstrKey : GNATCOM.Types.BSTR;
      Free    : Boolean := True)
     return GNATCOM.Types.VARIANT
   is
       RetVal : aliased GNATCOM.Types.VARIANT;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.getPrintTaskOptionValue
         (Pointer (This),
          bstrKey,
          RetVal'Unchecked_Access));

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

      return RetVal;
   end getPrintTaskOptionValue;

   procedure endPrint
     (This : IPrintManagerTemplatePrinter2_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.endPrint
         (Pointer (This)));

   end endPrint;

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

      return RetVal;
   end Get_showHeaderFooter;

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

      return RetVal;
   end Get_shrinkToFit;

   function Get_percentScale
     (This : IPrintManagerTemplatePrinter2_Type)
     return Interfaces.C.C_float
   is
       RetVal : aliased Interfaces.C.C_float;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_percentScale
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_percentScale;

end MSHTML.IPrintManagerTemplatePrinter2_Interface;

