* Rework registering system and ReadElement so Barcode/QR classes are read correctly from stream

git-svn-id: trunk@38969 -
This commit is contained in:
michael 2018-05-10 14:11:40 +00:00
parent 0b296ac828
commit dcea95d536
3 changed files with 283 additions and 282 deletions

View File

@ -99,6 +99,7 @@ type
TFPReportExporter = class; TFPReportExporter = class;
TFPReportTextAlignment = class; TFPReportTextAlignment = class;
TFPReportLayouter = Class; TFPReportLayouter = Class;
TFPReportClassMapping = Class;
TBandList = class; TBandList = class;
@ -719,6 +720,9 @@ type
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
Class Function ElementType : String; virtual;
Class Function RegisterElement : TFPReportClassMapping; virtual;
Class Procedure UnRegisterElement; virtual;
Function CreatePropertyHash : String; virtual; Function CreatePropertyHash : String; virtual;
function ExpressionResultToString(const Res: TFPExpressionResult): String; virtual; function ExpressionResultToString(const Res: TFPExpressionResult): String; virtual;
function Equals(AElement: TFPReportElement): boolean; virtual; reintroduce; function Equals(AElement: TFPReportElement): boolean; virtual; reintroduce;
@ -881,6 +885,7 @@ type
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
Class Function ElementType: String; override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure ReadElement(AReader: TFPReportStreamer); override; procedure ReadElement(AReader: TFPReportStreamer); override;
function FindBandWithType(ABandType: TFPReportBandType): TFPReportCustomBand; function FindBandWithType(ABandType: TFPReportBandType): TFPReportCustomBand;
@ -950,7 +955,6 @@ type
procedure ParentFontChanged; override; procedure ParentFontChanged; override;
function CalcDesiredHeight: TFPReportUnits; virtual; function CalcDesiredHeight: TFPReportUnits; virtual;
function GetReportPage: TFPReportCustomPage; override; function GetReportPage: TFPReportCustomPage; override;
function GetReportBandName: string; virtual;
function GetData: TFPReportData; virtual; function GetData: TFPReportData; virtual;
procedure SetDataFromName(AName : String); virtual; procedure SetDataFromName(AName : String); virtual;
procedure SetParent(const AValue: TFPReportElement); override; procedure SetParent(const AValue: TFPReportElement); override;
@ -984,6 +988,7 @@ type
Procedure SendToBack(El : TFPReportElement); Procedure SendToBack(El : TFPReportElement);
Procedure BringToFront(El : TFPReportElement); Procedure BringToFront(El : TFPReportElement);
Class Function ReportBandType : TFPReportBandType; virtual; Class Function ReportBandType : TFPReportBandType; virtual;
Class Function ElementType : String; override;
procedure WriteElement(AWriter: TFPReportStreamer; AOriginal: TFPReportElement = nil); override; procedure WriteElement(AWriter: TFPReportStreamer; AOriginal: TFPReportElement = nil); override;
procedure ReadElement(AReader: TFPReportStreamer); override; procedure ReadElement(AReader: TFPReportStreamer); override;
property VisibleOnPage: TFPReportVisibleOnPage read FVisibleOnPage write SetVisibleOnPage; property VisibleOnPage: TFPReportVisibleOnPage read FVisibleOnPage write SetVisibleOnPage;
@ -1049,10 +1054,13 @@ type
{ Master data band. The report loop happens on this band. } { Master data band. The report loop happens on this band. }
{ TFPReportDataBand }
TFPReportDataBand = class(TFPReportCustomDataBand) TFPReportDataBand = class(TFPReportCustomDataBand)
protected protected
function GetReportBandName: string; override;
Public Public
Class Function ElementType : String; override;
Class Function ReportBandType : TFPReportBandType; override; Class Function ReportBandType : TFPReportBandType; override;
published published
property ChildBand; property ChildBand;
@ -1071,9 +1079,9 @@ type
TFPReportCustomChildBand = class(TFPReportCustomBand) TFPReportCustomChildBand = class(TFPReportCustomBand)
protected protected
function GetReportBandName: string; override;
Public Public
Procedure Validate(aErrors : TStrings); override; Procedure Validate(aErrors : TStrings); override;
Class Function ElementType : String; override;
Class Function ReportBandType : TFPReportBandType; override; Class Function ReportBandType : TFPReportBandType; override;
end; end;
@ -1089,10 +1097,12 @@ type
end; end;
{ TFPReportCustomPageFooterBand }
TFPReportCustomPageFooterBand = class(TFPReportCustomBand) TFPReportCustomPageFooterBand = class(TFPReportCustomBand)
protected protected
function GetReportBandName: string; override;
Public Public
Class Function ElementType : String; override;
Class Function ReportBandType : TFPReportBandType; override; Class Function ReportBandType : TFPReportBandType; override;
end; end;
@ -1108,10 +1118,12 @@ type
end; end;
{ TFPReportCustomPageHeaderBand }
TFPReportCustomPageHeaderBand = class(TFPReportCustomBand) TFPReportCustomPageHeaderBand = class(TFPReportCustomBand)
protected protected
function GetReportBandName: string; override;
public public
Class Function ElementType : String; override;
Class Function ReportBandType : TFPReportBandType; override; Class Function ReportBandType : TFPReportBandType; override;
end; end;
@ -1128,10 +1140,12 @@ type
end; end;
{ TFPReportCustomColumnHeaderBand }
TFPReportCustomColumnHeaderBand = class(TFPReportCustomBandWithData) TFPReportCustomColumnHeaderBand = class(TFPReportCustomBandWithData)
protected protected
function GetReportBandName: string; override;
Public Public
Class Function ElementType : String; override;
Class Function ReportBandType : TFPReportBandType; override; Class Function ReportBandType : TFPReportBandType; override;
end; end;
@ -1147,12 +1161,12 @@ type
end; end;
{ TFPReportCustomColumnFooterBand }
TFPReportCustomColumnFooterBand = class(TFPReportCustomBandWithData) TFPReportCustomColumnFooterBand = class(TFPReportCustomBandWithData)
private
protected
function GetReportBandName: string; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
Class Function ElementType : String; override;
Class Function ReportBandType : TFPReportBandType; override; Class Function ReportBandType : TFPReportBandType; override;
property BandPosition; property BandPosition;
end; end;
@ -1198,7 +1212,6 @@ type
procedure SetReprintedHeader(pReprintedHeader: TFPReportSections); procedure SetReprintedHeader(pReprintedHeader: TFPReportSections);
procedure SetStartOnNewSection(pStartOnNewSection: TFPReportSection); procedure SetStartOnNewSection(pStartOnNewSection: TFPReportSection);
protected protected
function GetReportBandName: string; override;
procedure DoWriteLocalProperties(AWriter: TFPReportStreamer; AOriginal: TFPReportElement = nil); override; procedure DoWriteLocalProperties(AWriter: TFPReportStreamer; AOriginal: TFPReportElement = nil); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure Notification(AComponent: TComponent; Operation: TOperation); override;
Procedure FixupReference(Const PN, PV: String; C: TFPReportElement); override; Procedure FixupReference(Const PN, PV: String; C: TFPReportElement); override;
@ -1230,6 +1243,7 @@ type
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
Class Function ElementType : String; override;
Procedure Validate(aErrors : TStrings); override; Procedure Validate(aErrors : TStrings); override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure ReadElement(AReader: TFPReportStreamer); override; procedure ReadElement(AReader: TFPReportStreamer); override;
@ -1265,10 +1279,13 @@ type
{ Report title band - prints once at the beginning of the report } { Report title band - prints once at the beginning of the report }
{ TFPReportCustomTitleBand }
TFPReportCustomTitleBand = class(TFPReportCustomBand) TFPReportCustomTitleBand = class(TFPReportCustomBand)
protected protected
function GetReportBandName: string; override;
Public Public
Class Function ElementType : String; override;
Class Function ReportBandType : TFPReportBandType; override; Class Function ReportBandType : TFPReportBandType; override;
end; end;
@ -1285,17 +1302,20 @@ type
{ Report summary band - prints once at the end of the report } { Report summary band - prints once at the end of the report }
{ TFPReportCustomSummaryBand }
TFPReportCustomSummaryBand = class(TFPReportCustomBand) TFPReportCustomSummaryBand = class(TFPReportCustomBand)
private private
FStartNewPage: boolean; FStartNewPage: boolean;
protected protected
function GetReportBandName: string; override;
procedure DoWriteLocalProperties(AWriter: TFPReportStreamer; AOriginal: TFPReportElement = nil); override; procedure DoWriteLocalProperties(AWriter: TFPReportStreamer; AOriginal: TFPReportElement = nil); override;
property StartNewPage: boolean read FStartNewPage write FStartNewPage default False; property StartNewPage: boolean read FStartNewPage write FStartNewPage default False;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure ReadElement(AReader: TFPReportStreamer); override; procedure ReadElement(AReader: TFPReportStreamer); override;
Class Function ElementType : String; override;
Class Function ReportBandType : TFPReportBandType; override; Class Function ReportBandType : TFPReportBandType; override;
end; end;
@ -1322,7 +1342,6 @@ type
protected protected
procedure FixupReference(Const PN, PV: String; C: TFPReportElement); override; procedure FixupReference(Const PN, PV: String; C: TFPReportElement); override;
procedure SetBandPosition(pBandPosition: TFPReportBandPosition); override; procedure SetBandPosition(pBandPosition: TFPReportBandPosition); override;
function GetReportBandName: string; override;
procedure DoWriteLocalProperties(AWriter: TFPReportStreamer; AOriginal: TFPReportElement = nil); override; procedure DoWriteLocalProperties(AWriter: TFPReportStreamer; AOriginal: TFPReportElement = nil); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure BeginRuntimeProcessing; override; procedure BeginRuntimeProcessing; override;
@ -1334,6 +1353,7 @@ type
public public
Destructor Destroy; override; Destructor Destroy; override;
procedure ReadElement(AReader: TFPReportStreamer); override; procedure ReadElement(AReader: TFPReportStreamer); override;
Class Function ElementType : String; override;
Class Function ReportBandType : TFPReportBandType; override; Class Function ReportBandType : TFPReportBandType; override;
property BandPosition; property BandPosition;
end; end;
@ -1352,16 +1372,17 @@ type
end; end;
{ TFPReportCustomDataHeaderBand }
TFPReportCustomDataHeaderBand = class(TFPReportCustomBandWithData) TFPReportCustomDataHeaderBand = class(TFPReportCustomBandWithData)
protected
function GetReportBandName: string; override;
Public Public
Class Function ElementType : String; override;
Class Function ReportBandType : TFPReportBandType; override; Class Function ReportBandType : TFPReportBandType; override;
end; end;
TFPReportDataHeaderBand = class(TFPReportCustomDataHeaderBand) TFPReportDataHeaderBand = class(TFPReportCustomDataHeaderBand)
published Published
property ChildBand; property ChildBand;
property StretchMode; property StretchMode;
property Font; property Font;
@ -1370,10 +1391,12 @@ type
end; end;
{ TFPReportCustomDataFooterBand }
TFPReportCustomDataFooterBand = class(TFPReportCustomBandWithData) TFPReportCustomDataFooterBand = class(TFPReportCustomBandWithData)
protected protected
function GetReportBandName: string; override;
Public Public
Class Function ElementType : String; override;
Class Function ReportBandType : TFPReportBandType; override; Class Function ReportBandType : TFPReportBandType; override;
end; end;
@ -1879,6 +1902,8 @@ type
end; end;
{ TFPReportCustomMemo }
TFPReportCustomMemo = class(TFPReportElement) TFPReportCustomMemo = class(TFPReportElement)
private private
FCullThreshold: TFPReportCullThreshold; FCullThreshold: TFPReportCullThreshold;
@ -1980,9 +2005,9 @@ type
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
Class Function ElementType : String; override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure ReadElement(AReader: TFPReportStreamer); override; procedure ReadElement(AReader: TFPReportStreamer); override;
procedure WriteElement(AWriter: TFPReportStreamer; AOriginal: TFPReportElement = nil); override;
{ Only returns the internal FTextLines if StretchMode <> smDontStretch, otherwise it returns nil. Don't free the TStrings result. } { Only returns the internal FTextLines if StretchMode <> smDontStretch, otherwise it returns nil. Don't free the TStrings result. }
property TextLines: TStrings read GetTextLines; property TextLines: TStrings read GetTextLines;
{ after layouting, this contains all the memo text and positions they should be displayed at. } { after layouting, this contains all the memo text and positions they should be displayed at. }
@ -2025,9 +2050,10 @@ type
Property Color : TFPReportColor Read FColor Write FColor default clBlack; Property Color : TFPReportColor Read FColor Write FColor default clBlack;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
Class Function ElementType : String; override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
Procedure ReadElement(AReader: TFPReportStreamer); override;
Function CreatePropertyHash: String; override; Function CreatePropertyHash: String; override;
procedure WriteElement(AWriter: TFPReportStreamer; AOriginal: TFPReportElement = nil); override;
end; end;
@ -2065,11 +2091,11 @@ type
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
Class Function ElementType : String; override;
Function GetRTImageID : Integer; Function GetRTImageID : Integer;
Function GetRTImage : TFPCustomImage; Function GetRTImage : TFPCustomImage;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure ReadElement(AReader: TFPReportStreamer); override; procedure ReadElement(AReader: TFPReportStreamer); override;
procedure WriteElement(AWriter: TFPReportStreamer; AOriginal: TFPReportElement = nil); override;
procedure LoadFromFile(const AFileName: string); procedure LoadFromFile(const AFileName: string);
Procedure LoadFromStream(const AStream: TStream; aHandler: TFPCustomImageReaderClass); Procedure LoadFromStream(const AStream: TStream; aHandler: TFPCustomImageReaderClass);
procedure LoadPNGFromStream(AStream: TStream); procedure LoadPNGFromStream(AStream: TStream);
@ -2110,13 +2136,13 @@ type
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
Class function ElementType: String; override;
function GetDefaultImage(Checked: Boolean): TFPCustomImage; function GetDefaultImage(Checked: Boolean): TFPCustomImage;
Function GetImage(Checked: Boolean) : TFPCustomImage; Function GetImage(Checked: Boolean) : TFPCustomImage;
Function GetRTResult : Boolean; Function GetRTResult : Boolean;
Function GetRTImage : TFPCustomImage; Function GetRTImage : TFPCustomImage;
Function CreatePropertyHash: String; override; Function CreatePropertyHash: String; override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure WriteElement(AWriter: TFPReportStreamer; AOriginal: TFPReportElement = nil); override;
Procedure ReadElement(AReader: TFPReportStreamer); override; Procedure ReadElement(AReader: TFPReportStreamer); override;
Property TrueImageID : Integer Read FTrueImageID Write FTrueImageID; Property TrueImageID : Integer Read FTrueImageID Write FTrueImageID;
Property FalseImageID : Integer Read FFalseImageID Write FFalseImageID; Property FalseImageID : Integer Read FFalseImageID Write FFalseImageID;
@ -2193,6 +2219,7 @@ type
TFPReportElementFactory = class(TObject) TFPReportElementFactory = class(TObject)
private private
FList: TFPObjectList; FList: TFPObjectList;
function GetBC(aType : TFPReportBandType): TFPReportCustomBandClass;
function GetM(Aindex : integer): TFPReportClassMapping; function GetM(Aindex : integer): TFPReportClassMapping;
function GetMappingCount: Integer; function GetMappingCount: Integer;
Protected Protected
@ -2201,6 +2228,7 @@ type
public public
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
function GetDefaultBandType(AType: TFPReportBandType): TFPReportCustomBandClass; virtual;
Function FindRenderer(aClass : TFPReportExporterClass; AElement : TFPReportElementClass) : TFPReportElementExporterCallBack; Function FindRenderer(aClass : TFPReportExporterClass; AElement : TFPReportElementClass) : TFPReportElementExporterCallBack;
Function FindImageRenderer(AElement : TFPReportElementClass) : TFPReportImageRenderCallBack; Function FindImageRenderer(AElement : TFPReportElementClass) : TFPReportImageRenderCallBack;
Function RegisterImageRenderer(AElement : TFPReportElementClass; ARenderer : TFPReportImageRenderCallBack) : TFPReportImageRenderCallBack; Function RegisterImageRenderer(AElement : TFPReportElementClass; ARenderer : TFPReportImageRenderCallBack) : TFPReportImageRenderCallBack;
@ -2215,25 +2243,12 @@ type
Function FindEditorClassForInstance(AInstance : TFPReportElement) : TFPReportElementEditorClass; Function FindEditorClassForInstance(AInstance : TFPReportElement) : TFPReportElementEditorClass;
Function FindEditorClassForInstance(AClass : TFPReportElementClass) : TFPReportElementEditorClass ; Function FindEditorClassForInstance(AClass : TFPReportElementClass) : TFPReportElementEditorClass ;
procedure AssignReportElementTypes(AStrings: TStrings); procedure AssignReportElementTypes(AStrings: TStrings);
Function PageClass : TFPReportCustomPageClass;
Property BandClasses[aType : TFPReportBandType] : TFPReportCustomBandClass Read GetBC;
Property Mappings[Aindex : integer] : TFPReportClassMapping read GetM; Property Mappings[Aindex : integer] : TFPReportClassMapping read GetM;
Property MappingCount : Integer Read GetMappingCount; Property MappingCount : Integer Read GetMappingCount;
end; end;
{ TFPReportBandFactory }
TFPReportBandFactory = class(TObject)
Private
FBandTypes : Array[TFPReportBandType] of TFPReportCustomBandClass;
FPageClass: TFPReportCustomPageClass;
function getBandClass(aIndex : TFPReportBandType): TFPReportCustomBandClass;
Public
Constructor Create;
Function RegisterBandClass(aBandType : TFPReportBandType; AClass : TFPReportCustomBandClass) : TFPReportCustomBandClass;
Function RegisterPageClass(aClass : TFPReportCustomPageClass) : TFPReportCustomPageClass;
Property BandClasses [aIndex : TFPReportBandType] : TFPReportCustomBandClass read getBandClass;
Property PageClass : TFPReportCustomPageClass Read FPageClass;
end;
{ keeps track of interested bands. eg: a list of page header like bands etc. } { keeps track of interested bands. eg: a list of page header like bands etc. }
{ TBandList } { TBandList }
@ -2306,7 +2321,6 @@ function PaperManager: TFPReportPaperManager;
// The ElementFactory is a singleton // The ElementFactory is a singleton
function gElementFactory: TFPReportElementFactory; function gElementFactory: TFPReportElementFactory;
function gBandFactory : TFPReportBandFactory;
Function ReportExportManager : TFPReportExportManager; Function ReportExportManager : TFPReportExportManager;
@ -2394,7 +2408,7 @@ resourcestring
var var
uPaperManager: TFPReportPaperManager; uPaperManager: TFPReportPaperManager;
uElementFactory: TFPReportElementFactory; uElementFactory: TFPReportElementFactory;
uBandFactory : TFPReportBandFactory; EM : TFPReportExportManager;
{ Auxiliary routines } { Auxiliary routines }
@ -2444,15 +2458,6 @@ begin
Result := uElementFactory; Result := uElementFactory;
end; end;
function gBandFactory: TFPReportBandFactory;
begin
if uBandFactory = nil then
uBandFactory := TFPReportBandFactory.Create;
Result := uBandFactory;
end;
Var
EM : TFPReportExportManager;
function ReportExportManager: TFPReportExportManager; function ReportExportManager: TFPReportExportManager;
begin begin
@ -2721,9 +2726,7 @@ begin
end; end;
Type Type
{ TFPReportReg } { TFPReportReg }
TFPReportExportReg = Class(TObject) TFPReportExportReg = Class(TObject)
private private
FClass: TFPReportExporterClass; FClass: TFPReportExporterClass;
@ -2734,30 +2737,6 @@ Type
Property OnConfig : TFPReportExporterConfigHandler Read FonConfig Write FOnConfig; Property OnConfig : TFPReportExporterConfigHandler Read FonConfig Write FOnConfig;
end; end;
{ TFPReportBandFactory }
Function GetDefaultBandType(AType : TFPReportBandType) : TFPReportCustomBandClass;
begin
Case AType of
btUnknown : Result:=Nil;
btPageHeader : Result:=TFPReportPageHeaderBand;
btReportTitle : Result:=TFPReportTitleBand;
btColumnHeader : Result:=TFPReportColumnHeaderBand;
btDataHeader : Result:=TFPReportDataHeaderBand;
btGroupHeader : Result:=TFPReportGroupHeaderBand;
btDataband : Result:=TFPReportDataBand;
btGroupFooter : Result:=TFPReportGroupFooterBand;
btDataFooter : Result:=TFPReportDataFooterBand;
btColumnFooter : Result:=TFPReportColumnFooterBand;
btReportSummary : Result:=TFPReportSummaryBand;
btPageFooter : Result:=TFPReportPageFooterBand;
btChild : Result:=TFPReportChildBand;
else
raise EReportError.CreateFmt(SErrUnknownBandType, [Ord(AType)]);
end;
end;
const const
{ Summary of ISO 8601 http://www.cl.cam.ac.uk/~mgk25/iso-time.html } { Summary of ISO 8601 http://www.cl.cam.ac.uk/~mgk25/iso-time.html }
ISO8601DateFormat = 'yyyymmdd"T"hhnnss'; // for storage ISO8601DateFormat = 'yyyymmdd"T"hhnnss'; // for storage
@ -3676,55 +3655,6 @@ begin
end; end;
end; end;
function TFPReportBandFactory.getBandClass(aIndex : TFPReportBandType
): TFPReportCustomBandClass;
begin
Result:=FBandTypes[aIndex];
end;
constructor TFPReportBandFactory.Create;
Var
T : TFPReportBandType;
begin
FPageClass:=TFPReportPage;
for T in TFPReportBandType do
begin
FBandTypes[T]:=GetDefaultBandType(T);
end;
end;
function TFPReportBandFactory.RegisterBandClass(aBandType: TFPReportBandType;
AClass: TFPReportCustomBandClass): TFPReportCustomBandClass;
Var
D : TFPReportCustomBandClass;
N : String;
begin
D:=GetDefaultBandType(aBandtype);
N:=GetEnumName(TypeInfo(TFPReportBandType),Ord(ABandType));
if (D=Nil) then
raise EReportError.CreateFmt(SErrCouldNotGetDefaultBandType, [N]);
If Not AClass.InheritsFrom(D) then
raise EReportError.CreateFmt(SErrBandClassMustDescendFrom, [N, D.ClassName]
);
Result:=FBandTypes[aBandType];
FBandTypes[aBandType]:=AClass;
end;
function TFPReportBandFactory.RegisterPageClass(aClass: TFPReportCustomPageClass
): TFPReportCustomPageClass;
begin
Result := nil; // TODO: Why is this a function if no Result is ever returned?
If Not AClass.InheritsFrom(TFPReportCustomPage) then
raise EReportError.CreateFmt(SErrPageClassMustDescendFrom, [
TFPReportCustomPageClass.ClassName]);
FPageClass:=AClass;
end;
{ TFPReportExportReg } { TFPReportExportReg }
constructor TFPReportExportReg.Create(AClass: TFPReportExporterClass); constructor TFPReportExportReg.Create(AClass: TFPReportExporterClass);
@ -4974,6 +4904,10 @@ begin
end; end;
procedure TFPReportCustomMemo.DoWriteLocalProperties(AWriter: TFPReportStreamer; AOriginal: TFPReportElement); procedure TFPReportCustomMemo.DoWriteLocalProperties(AWriter: TFPReportStreamer; AOriginal: TFPReportElement);
var
T: TFPReportTextAlignment;
begin begin
inherited DoWriteLocalProperties(AWriter, AOriginal); inherited DoWriteLocalProperties(AWriter, AOriginal);
AWriter.WriteString('Text', Text); AWriter.WriteString('Text', Text);
@ -4990,6 +4924,16 @@ begin
AWriter.WriteFloat('LineSpacing', LineSpacing); AWriter.WriteFloat('LineSpacing', LineSpacing);
AWriter.WriteQWord('LinkColor', LinkColor); AWriter.WriteQWord('LinkColor', LinkColor);
AWriter.WriteString('Options', MemoOptionsToString(Options)); AWriter.WriteString('Options', MemoOptionsToString(Options));
if (AOriginal <> nil) then
T := TFPReportCustomMemo(AOriginal).TextAlignment
else
T := nil;
AWriter.PushElement('TextAlignment');
try
FTextAlignment.WriteElement(AWriter, T);
finally
AWriter.PopElement;
end;
end; end;
procedure TFPReportCustomMemo.ExpandExpressions; procedure TFPReportCustomMemo.ExpandExpressions;
@ -5149,6 +5093,11 @@ begin
inherited Destroy; inherited Destroy;
end; end;
class function TFPReportCustomMemo.ElementType: String;
begin
Result:='Memo';
end;
procedure TFPReportCustomMemo.Assign(Source: TPersistent); procedure TFPReportCustomMemo.Assign(Source: TPersistent);
var var
E: TFPReportCustomMemo; E: TFPReportCustomMemo;
@ -5202,28 +5151,6 @@ begin
Changed; Changed;
end; end;
procedure TFPReportCustomMemo.WriteElement(AWriter: TFPReportStreamer; AOriginal: TFPReportElement);
var
T: TFPReportTextAlignment;
begin
AWriter.PushElement('Memo');
try
inherited WriteElement(AWriter, AOriginal);
if (AOriginal <> nil) then
T := TFPReportCustomMemo(AOriginal).TextAlignment
else
T := nil;
AWriter.PushElement('TextAlignment');
try
FTextAlignment.WriteElement(AWriter, T);
finally
AWriter.PopElement;
end;
finally
AWriter.PopElement;
end;
end;
{ TFPReportCustomShape } { TFPReportCustomShape }
procedure TFPReportCustomShape.SetShapeType(AValue: TFPReportShapeType); procedure TFPReportCustomShape.SetShapeType(AValue: TFPReportShapeType);
@ -5273,6 +5200,11 @@ begin
FColor:=clBlack; FColor:=clBlack;
end; end;
class function TFPReportCustomShape.ElementType: String;
begin
Result:='Shape';
end;
procedure TFPReportCustomShape.Assign(Source: TPersistent); procedure TFPReportCustomShape.Assign(Source: TPersistent);
Var Var
@ -5290,6 +5222,15 @@ begin
end; end;
end; end;
procedure TFPReportCustomShape.ReadElement(AReader: TFPReportStreamer);
begin
inherited ReadElement(AReader);
ShapeType:=StringToShapeType(AReader.ReadString('ShapeType', ShapeTypeToString(ShapeType)));
Orientation:=StringToOrientation(AReader.ReadString('Orientation', OrientationToString(Orientation)));
CornerRadius:=AReader.ReadFloat('CornerRadius', CornerRadius);
Color:=QWordToReportColor(AReader.ReadQWord('Color', Color));
end;
function TFPReportCustomShape.CreatePropertyHash: String; function TFPReportCustomShape.CreatePropertyHash: String;
begin begin
Result:=inherited CreatePropertyHash; Result:=inherited CreatePropertyHash;
@ -5299,16 +5240,6 @@ begin
+'-'+FormatFloat('000.###',CornerRadius); +'-'+FormatFloat('000.###',CornerRadius);
end; end;
procedure TFPReportCustomShape.WriteElement(AWriter: TFPReportStreamer; AOriginal: TFPReportElement);
begin
AWriter.PushElement('Shape');
try
inherited WriteElement(AWriter, AOriginal);
finally
AWriter.PopElement;
end;
end;
{ TFPReportCustomImage } { TFPReportCustomImage }
procedure TFPReportCustomImage.SetImage(AValue: TFPCustomImage); procedure TFPReportCustomImage.SetImage(AValue: TFPCustomImage);
@ -5435,6 +5366,11 @@ begin
inherited Destroy; inherited Destroy;
end; end;
class function TFPReportCustomImage.ElementType: String;
begin
Result:='Image';
end;
function TFPReportCustomImage.GetRTImageID: Integer; function TFPReportCustomImage.GetRTImageID: Integer;
begin begin
Result:=ImageID; Result:=ImageID;
@ -5474,16 +5410,6 @@ begin
FieldName := AReader.ReadString('FieldName', FieldName); FieldName := AReader.ReadString('FieldName', FieldName);
end; end;
procedure TFPReportCustomImage.WriteElement(AWriter: TFPReportStreamer; AOriginal: TFPReportElement);
begin
AWriter.PushElement('Image');
try
inherited WriteElement(AWriter, AOriginal);
finally
AWriter.PopElement;
end;
end;
procedure TFPReportCustomImage.LoadFromFile(const AFileName: string); procedure TFPReportCustomImage.LoadFromFile(const AFileName: string);
var var
@ -5625,6 +5551,11 @@ begin
inherited Destroy; inherited Destroy;
end; end;
class function TFPReportCustomCheckbox.ElementType: String;
begin
Result:='Checkbox';
end;
function TFPReportCustomCheckbox.GetImage(Checked: Boolean): TFPCustomImage; function TFPReportCustomCheckbox.GetImage(Checked: Boolean): TFPCustomImage;
begin begin
@ -5685,16 +5616,6 @@ begin
end; end;
end; end;
procedure TFPReportCustomCheckbox.WriteElement(AWriter: TFPReportStreamer; AOriginal: TFPReportElement);
begin
AWriter.PushElement('Checkbox');
try
inherited WriteElement(AWriter, AOriginal);
finally
AWriter.PopElement;
end;
end;
procedure TFPReportCustomCheckbox.ReadElement(AReader: TFPReportStreamer); procedure TFPReportCustomCheckbox.ReadElement(AReader: TFPReportStreamer);
begin begin
inherited ReadElement(AReader); inherited ReadElement(AReader);
@ -5843,7 +5764,7 @@ end;
{ TFPReportDataBand } { TFPReportDataBand }
function TFPReportDataBand.GetReportBandName: string; class function TFPReportDataBand.ElementType: String;
begin begin
Result := 'DataBand'; Result := 'DataBand';
end; end;
@ -5855,7 +5776,7 @@ end;
{ TFPReportCustomChildBand } { TFPReportCustomChildBand }
function TFPReportCustomChildBand.GetReportBandName: string; Class function TFPReportCustomChildBand.ElementType: string;
begin begin
Result := 'ChildBand'; Result := 'ChildBand';
end; end;
@ -5890,7 +5811,7 @@ end;
{ TFPReportCustomPageFooterBand } { TFPReportCustomPageFooterBand }
function TFPReportCustomPageFooterBand.GetReportBandName: string; class function TFPReportCustomPageFooterBand.ElementType: String;
begin begin
Result := 'PageFooterBand'; Result := 'PageFooterBand';
end; end;
@ -5902,7 +5823,7 @@ end;
{ TFPReportCustomPageHeaderBand } { TFPReportCustomPageHeaderBand }
function TFPReportCustomPageHeaderBand.GetReportBandName: string; class function TFPReportCustomPageHeaderBand.ElementType: String;
begin begin
Result := 'PageHeaderBand'; Result := 'PageHeaderBand';
end; end;
@ -5914,7 +5835,7 @@ end;
{ TFPReportCustomColumnHeaderBand } { TFPReportCustomColumnHeaderBand }
function TFPReportCustomColumnHeaderBand.GetReportBandName: string; class function TFPReportCustomColumnHeaderBand.ElementType: String;
begin begin
Result := 'ColumnHeaderBand'; Result := 'ColumnHeaderBand';
end; end;
@ -5926,7 +5847,7 @@ end;
{ TFPReportCustomColumnFooterBand } { TFPReportCustomColumnFooterBand }
function TFPReportCustomColumnFooterBand.GetReportBandName: string; class function TFPReportCustomColumnFooterBand.ElementType: String;
begin begin
Result := 'ColumnFooterBand'; Result := 'ColumnFooterBand';
end; end;
@ -5961,7 +5882,7 @@ begin
end; end;
end; end;
function TFPReportCustomGroupHeaderBand.GetReportBandName: string; class function TFPReportCustomGroupHeaderBand.ElementType: String;
begin begin
Result := 'GroupHeaderBand'; Result := 'GroupHeaderBand';
end; end;
@ -6236,7 +6157,7 @@ end;
{ TFPReportCustomTitleBand } { TFPReportCustomTitleBand }
function TFPReportCustomTitleBand.GetReportBandName: string; class function TFPReportCustomTitleBand.ElementType: String;
begin begin
Result := 'ReportTitleBand'; Result := 'ReportTitleBand';
end; end;
@ -6248,7 +6169,7 @@ end;
{ TFPReportCustomSummaryBand } { TFPReportCustomSummaryBand }
function TFPReportCustomSummaryBand.GetReportBandName: string; class function TFPReportCustomSummaryBand.ElementType: String;
begin begin
Result := 'ReportSummaryBand'; Result := 'ReportSummaryBand';
end; end;
@ -7072,6 +6993,21 @@ begin
inherited Destroy; inherited Destroy;
end; end;
class function TFPReportElement.ElementType: String;
begin
Result:=ClassName;
end;
class function TFPReportElement.RegisterElement: TFPReportClassMapping;
begin
Result:=gElementFactory.RegisterClass(ElementType,Self);
end;
class procedure TFPReportElement.UnRegisterElement;
begin
gElementFactory.RemoveClass(ElementType);
end;
function TFPReportElement.CreatePropertyHash: String; function TFPReportElement.CreatePropertyHash: String;
Var Var
@ -7426,15 +7362,20 @@ var
i: integer; i: integer;
begin begin
inherited WriteElement(AWriter, AOriginal); inherited WriteElement(AWriter, AOriginal);
if Assigned(FChildren) then if Not Assigned(FChildren) then
begin exit;
AWriter.PushElement('Children'); AWriter.PushElement('Children');
try try
for i := 0 to FChildren.Count-1 do for i := 0 to FChildren.Count-1 do
begin begin
AWriter.PushElement(IntToStr(i)); // use child index as identifier AWriter.PushElement(IntToStr(i)); // use child index as identifier
try try
TFPReportElement(FChildren[i]).WriteElement(AWriter, AOriginal); AWriter.PushElement(Child[I].ElementType);
try
Child[i].WriteElement(AWriter, AOriginal);
finally
AWriter.PopElement;
end;
finally finally
AWriter.PopElement; AWriter.PopElement;
end; end;
@ -7443,7 +7384,6 @@ begin
AWriter.PopElement; AWriter.PopElement;
end; end;
end; end;
end;
procedure TFPReportElementWithChildren.ReadElement(AReader: TFPReportStreamer); procedure TFPReportElementWithChildren.ReadElement(AReader: TFPReportStreamer);
var var
@ -7459,8 +7399,8 @@ begin
O:=Report; O:=Report;
if (O=Nil) then if (O=Nil) then
O:=Self.Owner; O:=Self.Owner;
if Assigned(E) then if Not Assigned(E) then
begin exit;
AReader.PushElement(E); AReader.PushElement(E);
for i := 0 to AReader.ChildCount-1 do for i := 0 to AReader.ChildCount-1 do
begin begin
@ -7470,13 +7410,17 @@ begin
lName := AReader.CurrentElementName; lName := AReader.CurrentElementName;
c := gElementFactory.CreateInstance(lName,O); c := gElementFactory.CreateInstance(lName,O);
c.Parent:=Self; c.Parent:=Self;
AReader.PushElement(Areader.GetChild(0));
try
c.ReadElement(AReader); c.ReadElement(AReader);
Finally
AReader.PopElement;
end;
finally finally
AReader.PopElement; AReader.PopElement;
end; end;
end; { for i } end; { for i }
AReader.PopElement; AReader.PopElement;
end; { children }
end; end;
function TFPReportElementWithChildren.Equals(AElement: TFPReportElement): boolean; function TFPReportElementWithChildren.Equals(AElement: TFPReportElement): boolean;
@ -7709,6 +7653,11 @@ begin
inherited Destroy; inherited Destroy;
end; end;
class function TFPReportCustomPage.ElementType: String;
begin
Result:='Page';
end;
procedure TFPReportCustomPage.Assign(Source: TPersistent); procedure TFPReportCustomPage.Assign(Source: TPersistent);
var var
E: TFPReportCustomPage; E: TFPReportCustomPage;
@ -9200,7 +9149,7 @@ begin
end; end;
end; end;
function TFPReportCustomBand.GetReportBandName: string; class function TFPReportCustomBand.ElementType: String;
begin begin
Result := 'FPCustomReportBand'; Result := 'FPCustomReportBand';
end; end;
@ -9434,8 +9383,6 @@ end;
procedure TFPReportCustomBand.WriteElement(AWriter: TFPReportStreamer; AOriginal: TFPReportElement); procedure TFPReportCustomBand.WriteElement(AWriter: TFPReportStreamer; AOriginal: TFPReportElement);
begin begin
AWriter.PushElement(GetReportBandName);
try
inherited WriteElement(AWriter, AOriginal); inherited WriteElement(AWriter, AOriginal);
if Assigned(ChildBand) then if Assigned(ChildBand) then
AWriter.WriteString('ChildBand', ChildBand.Name); AWriter.WriteString('ChildBand', ChildBand.Name);
@ -9443,9 +9390,6 @@ begin
AWriter.WriteString('Data', GetData.Name); AWriter.WriteString('Data', GetData.Name);
AWriter.WriteString('VisibleOnPage', VisibleOnPageToString(FVisibleOnPage)); AWriter.WriteString('VisibleOnPage', VisibleOnPageToString(FVisibleOnPage));
AWriter.WriteBoolean('KeepTogetherWithChildren', FKeepTogetherWithChildren); AWriter.WriteBoolean('KeepTogetherWithChildren', FKeepTogetherWithChildren);
finally
AWriter.PopElement;
end;
end; end;
procedure TFPReportCustomBand.ReadElement(AReader: TFPReportStreamer); procedure TFPReportCustomBand.ReadElement(AReader: TFPReportStreamer);
@ -9455,11 +9399,6 @@ var
s: string; s: string;
begin begin
E := AReader.FindChild(GetReportBandName);
if Assigned(E) then
begin
AReader.PushElement(E);
try
s := AReader.ReadString('ChildBand', ''); s := AReader.ReadString('ChildBand', '');
if (s<>'') then if (s<>'') then
Page.Report.AddReference(Self, 'ChildBand', s); Page.Report.AddReference(Self, 'ChildBand', s);
@ -9475,16 +9414,11 @@ begin
end end
else else
ReAssignParentFont; ReAssignParentFont;
// TODO: Read Data information
S:=AReader.ReadString('Data',''); S:=AReader.ReadString('Data','');
if (S<>'') then if (S<>'') then
SetDataFromName(S); SetDataFromName(S);
// This must come last: e.g. the UseParentFont assumes the font is properly set up // This must come last: e.g. the UseParentFont assumes the font is properly set up
inherited ReadElement(AReader); inherited ReadElement(AReader);
finally
AReader.PopElement;
end;
end;
end; end;
function TFPReportCustomBand.EvaluateVisibility: boolean; function TFPReportCustomBand.EvaluateVisibility: boolean;
@ -9651,7 +9585,7 @@ begin
FGroupHeader.FStartOnNewSection := rsPage; FGroupHeader.FStartOnNewSection := rsPage;
end; end;
function TFPReportCustomGroupFooterBand.GetReportBandName: string; class function TFPReportCustomGroupFooterBand.ElementType: String;
begin begin
Result := 'GroupFooterBand'; Result := 'GroupFooterBand';
end; end;
@ -10879,6 +10813,54 @@ begin
Result:=TFPReportClassMapping(FList[AIndex]); Result:=TFPReportClassMapping(FList[AIndex]);
end; end;
Function TFPReportElementFactory.GetDefaultBandType(AType : TFPReportBandType) : TFPReportCustomBandClass;
begin
Case AType of
btUnknown : Result:=Nil;
btPageHeader : Result:=TFPReportPageHeaderBand;
btReportTitle : Result:=TFPReportTitleBand;
btColumnHeader : Result:=TFPReportColumnHeaderBand;
btDataHeader : Result:=TFPReportDataHeaderBand;
btGroupHeader : Result:=TFPReportGroupHeaderBand;
btDataband : Result:=TFPReportDataBand;
btGroupFooter : Result:=TFPReportGroupFooterBand;
btDataFooter : Result:=TFPReportDataFooterBand;
btColumnFooter : Result:=TFPReportColumnFooterBand;
btReportSummary : Result:=TFPReportSummaryBand;
btPageFooter : Result:=TFPReportPageFooterBand;
btChild : Result:=TFPReportChildBand;
else
raise EReportError.CreateFmt(SErrUnknownBandType, [Ord(AType)]);
end;
end;
function TFPReportElementFactory.GetBC(aType : TFPReportBandType): TFPReportCustomBandClass;
Var
C : TFPReportCustomBandClass;
N : String;
I : Integer;
begin
C:=GetDefaultBandType(aType);
if C=Nil then
begin
N:=GetEnumName(TypeInfo(TFPReportBandType),Ord(AType));
Raise EReportError.CreateFmt(SErrCouldNotGetDefaultBandType, [N]);
end;
I:=IndexOfElementName(C.ElementType);
If (I=-1) then
Result:=C
else
begin
Result:=TFPReportCustomBandClass(Mappings[I].ReportElementClass);
If Not Result.InheritsFrom(C) then
raise EReportError.CreateFmt(SErrBandClassMustDescendFrom, [N, C.ClassName]);
end;
end;
function TFPReportElementFactory.GetMappingCount: Integer; function TFPReportElementFactory.GetMappingCount: Integer;
begin begin
Result:=FList.Count; Result:=FList.Count;
@ -11084,9 +11066,22 @@ begin
AStrings.Add(Mappings[I].MappingName); AStrings.Add(Mappings[I].MappingName);
end; end;
function TFPReportElementFactory.PageClass: TFPReportCustomPageClass;
Var
I : Integer;
begin
I:=IndexOfElementName(TFPReportCustomPage.ElementType);
if I=-1 then
Result:=nil
else
Result:=TFPReportCustomPageClass(Mappings[i].ReportElementClass);
end;
{ TFPReportCustomDataHeaderBand } { TFPReportCustomDataHeaderBand }
function TFPReportCustomDataHeaderBand.GetReportBandName: string; class function TFPReportCustomDataHeaderBand.ElementType: String;
begin begin
Result := 'DataHeaderBand'; Result := 'DataHeaderBand';
end; end;
@ -11098,7 +11093,7 @@ end;
{ TFPReportCustomDataFooterBand } { TFPReportCustomDataFooterBand }
function TFPReportCustomDataFooterBand.GetReportBandName: string; class function TFPReportCustomDataFooterBand.ElementType: String;
begin begin
Result := 'DataFooterBand'; Result := 'DataFooterBand';
end; end;
@ -12450,29 +12445,24 @@ end;
Procedure RegisterStandardReportClasses; Procedure RegisterStandardReportClasses;
Procedure DoReg(N : String; C : TFPReportElementClass);
begin begin
gElementFactory.RegisterClass(N,C).FStandard:=true; TFPReportTitleBand.RegisterElement;
end; TFPReportSummaryBand.RegisterElement;
TFPReportGroupHeaderBand.RegisterElement;
begin TFPReportGroupFooterBand.RegisterElement;
DoReg('ReportTitleBand', TFPReportTitleBand); TFPReportDataBand.RegisterElement;
DoReg('ReportSummaryBand', TFPReportSummaryBand); TFPReportChildBand.RegisterElement;
DoReg('GroupHeaderBand', TFPReportGroupHeaderBand); TFPReportPageHeaderBand.RegisterElement;
DoReg('GroupFooterBand', TFPReportGroupFooterBand); TFPReportPageFooterBand.RegisterElement;
DoReg('DataBand', TFPReportDataBand); TFPReportDataHeaderBand.RegisterElement;
DoReg('ChildBand', TFPReportChildBand); TFPReportDataFooterBand.RegisterElement;
DoReg('PageHeaderBand', TFPReportPageHeaderBand); TFPReportColumnHeaderBand.RegisterElement;
DoReg('PageFooterBand', TFPReportPageFooterBand); TFPReportColumnFooterBand.RegisterElement;
DoReg('DataHeaderBand', TFPReportDataHeaderBand); TFPReportMemo.RegisterElement;
DoReg('DataFooterBand', TFPReportDataFooterBand); TFPReportImage.RegisterElement;
DoReg('ColumnHeaderBand', TFPReportColumnHeaderBand); TFPReportCheckbox.RegisterElement;
DoReg('ColumnFooterBand', TFPReportColumnFooterBand); TFPReportShape.RegisterElement;
DoReg('Memo', TFPReportMemo); TFPReportPage.RegisterElement;
DoReg('Image', TFPReportImage);
DoReg('Checkbox', TFPReportCheckbox);
DoReg('Shape', TFPReportShape);
end; end;
initialization initialization
@ -12482,7 +12472,6 @@ initialization
finalization finalization
DoneReporting; DoneReporting;
uBandFactory.Free;
uElementFactory.Free; uElementFactory.Free;
EM.Free; EM.Free;
end. end.

View File

@ -42,6 +42,7 @@ Type
Public Public
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
Constructor Create(AOwner: TComponent); override; Constructor Create(AOwner: TComponent); override;
Class Function ElementType : String; override;
// Will calculate the value to display. Either Value or evaluated expression. // Will calculate the value to display. Either Value or evaluated expression.
Function BarcodeValue : String; Function BarcodeValue : String;
Procedure ReadElement(AReader: TFPReportStreamer); override; Procedure ReadElement(AReader: TFPReportStreamer); override;
@ -111,6 +112,11 @@ begin
FWeight:=2.0; FWeight:=2.0;
end; end;
class function TFPReportBarcode.ElementType: String;
begin
Result:='BarCode';
end;
procedure TFPReportBarcode.BeforePrint; procedure TFPReportBarcode.BeforePrint;
begin begin
@ -221,7 +227,7 @@ Const
begin begin
gElementFactory.RegisterClass('Barcode',TFPReportBarcode).SetIconFromBytes(Icon); TFPReportBarcode.RegisterElement.SetIconFromBytes(Icon);
// Fallback renderer // Fallback renderer
gElementFactory.RegisterImageRenderer(TFPReportBarcode,@RenderBarcode); gElementFactory.RegisterImageRenderer(TFPReportBarcode,@RenderBarcode);
end; end;
@ -229,7 +235,7 @@ end;
Procedure UnRegisterReportBarcode; Procedure UnRegisterReportBarcode;
begin begin
gElementFactory.RemoveClass('Barcode'); TFPReportBarcode.UnRegisterElement;
end; end;
initialization initialization

View File

@ -40,6 +40,7 @@ Type
procedure RecalcLayout; override; procedure RecalcLayout; override;
Procedure DoWriteLocalProperties(AWriter: TFPReportStreamer; AOriginal: TFPReportElement=nil); override; Procedure DoWriteLocalProperties(AWriter: TFPReportStreamer; AOriginal: TFPReportElement=nil); override;
Public Public
Class Function ElementType : String; override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
// Will calculate the value to display. Either Value or evaluated expression. // Will calculate the value to display. Either Value or evaluated expression.
Function QRCodeValue : String; Function QRCodeValue : String;
@ -85,6 +86,11 @@ begin
AWriter.WriteBoolean('Center',Center); AWriter.WriteBoolean('Center',Center);
end; end;
class function TFPReportQRCode.ElementType: String;
begin
Result:='QRCode';
end;
procedure TFPReportQRCode.Assign(Source: TPersistent); procedure TFPReportQRCode.Assign(Source: TPersistent);
Var Var
@ -209,7 +215,7 @@ Const
68,174, 66, 96,130); 68,174, 66, 96,130);
begin begin
gElementFactory.RegisterClass('QRCode',TFPReportQRCode).SetIconFromBytes(Icon); TFPReportQRCode.RegisterElement.SetIconFromBytes(Icon);
// Fallback renderer // Fallback renderer
gElementFactory.RegisterImageRenderer(TFPReportQRCode,@RenderQRCode); gElementFactory.RegisterImageRenderer(TFPReportQRCode,@RenderQRCode);
end; end;
@ -217,7 +223,7 @@ end;
Procedure UnRegisterReportQRCode; Procedure UnRegisterReportQRCode;
begin begin
gElementFactory.RemoveClass('QRCode'); TFPReportElement.UnRegisterElement;
end; end;
initialization initialization