unit uInformeRegistryUtils;

interface

uses
  Classes, Forms, uClassRegistryUtils;

type
  IInformeRegistry = interface (IReportRegistry)
    ['{F6AC050F-5547-4E1F-AA44-DA0D06EDA4D7}']
    function CreateInforme(const aClassOrDisplayname: String;
      aOwner: TComponent = NIL): TInterfacedObject;
  end;

    TInformeRegistry = class(TReportRegistry, IInformeRegistry)
    protected
      function CreateInforme(const aClassOrDisplayname: String;
        aOwner: TComponent = nil): TInterfacedObject;
    end;

function CreateInforme(const AName: String; const IID: TGUID; out Intf): Boolean;

var
  InformeRegistry : IInformeRegistry;

implementation

uses
  SysUtils, cxControls;

function CreateInforme(const AName: String; const IID: TGUID; out Intf): Boolean;
begin
  ShowHourglassCursor;
  try
    Result := Supports(InformeRegistry.CreateInforme(AName, Application), IID, Intf);
  finally
    HideHourglassCursor;    
  end;
end;


{ TInformeRegistry }

function TInformeRegistry.CreateInforme(const aClassOrDisplayname: String;
  aOwner: TComponent): TInterfacedObject;
begin
  if not Assigned(AOwner) then
    AOwner := Application;
  Result := CreateObject( aClassOrDisplayname) as TInterfacedObject;
end;


initialization
  InformeRegistry := TInformeRegistry.Create;

finalization
  InformeRegistry := NIL;
  
end.
