with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IPrintManagerTemplatePrinter_Interface is

   procedure Initialize (This : in out IPrintManagerTemplatePrinter_Type) is
   begin
      Set_IID (This, IID_IPrintManagerTemplatePrinter);
   end Initialize;

   function Pointer (This : IPrintManagerTemplatePrinter_Type)
     return Pointer_To_IPrintManagerTemplatePrinter
   is
   begin
      return To_Pointer_To_IPrintManagerTemplatePrinter (Address (This));
   end Pointer;

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

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

   end startPrint;

   procedure drawPreviewPage
     (This      : IPrintManagerTemplatePrinter_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  : IPrintManagerTemplatePrinter_Type;
      nPage : Interfaces.C.long)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.setPageCount
         (Pointer (This),
          nPage));

   end setPageCount;

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

   end invalidatePreview;

   function getPrintTaskOptionValue
     (This    : IPrintManagerTemplatePrinter_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 : IPrintManagerTemplatePrinter_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.endPrint
         (Pointer (This)));

   end endPrint;

end MSHTML.IPrintManagerTemplatePrinter_Interface;

