From 59bfe097c68438212dde0d435171ff185dba6613 Mon Sep 17 00:00:00 2001 From: jesus Date: Wed, 5 Oct 2011 19:51:48 +0000 Subject: [PATCH] LazReport, fix loading plugins like barcode from dfm streams, patch from Tony Whyman, issue #19513 git-svn-id: trunk@32706 - --- components/lazreport/source/lr_class.pas | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/components/lazreport/source/lr_class.pas b/components/lazreport/source/lr_class.pas index 4030f910cd..433a638419 100644 --- a/components/lazreport/source/lr_class.pas +++ b/components/lazreport/source/lr_class.pas @@ -909,8 +909,8 @@ type FSubject : string; FKeyWords : string; FComments : TStringList; - - + FDFMStream : TStream; + function FormatValue(V: Variant; AFormat: Integer; const AFormatStr: String): String; // function GetLRTitle: String; @@ -927,6 +927,7 @@ type procedure SetPrinterTo(const PrnName: String); procedure SetVars(Value: TStrings); procedure ClearAttribs; + procedure Loaded; override; protected procedure DefineProperties(Filer: TFiler); override; procedure ReadBinaryData(Stream: TStream); @@ -7744,17 +7745,14 @@ end; procedure TfrReport.ReadBinaryData(Stream: TStream); var n: Integer; - Stream1: TMemoryStream; begin Stream.Read(n, 4); // version if FStoreInDFM then begin Stream.Read(n, 4); - Stream1 := TMemoryStream.Create; - Stream1.CopyFrom(Stream, n); - Stream1.Position := 0; - LoadFromStream(Stream1); - Stream1.Free; + FDFMStream := TMemoryStream.Create; + FDFMStream.CopyFrom(Stream, n); + FDFMStream.Position := 0; end; end; @@ -9184,6 +9182,16 @@ begin ReportLastChange := Now; end; +procedure TfrReport.Loaded; +begin + inherited Loaded; + if assigned(FDFMStream) then + begin + LoadFromStream(FDFMStream); + FreeAndNil(FDFMStream) + end; +end; + procedure TfrReport.GetVarList(CatNo: Integer; List: TStrings); var i, n: Integer;