LazReport, support for images stored in old reports where they were stored as bitmaps

git-svn-id: trunk@28576 -
This commit is contained in:
jesus 2010-11-30 18:43:04 +00:00
parent ec7076415f
commit 242d0d20fa

View File

@ -4287,19 +4287,19 @@ begin
inherited LoadFromXML(XML, Path); inherited LoadFromXML(XML, Path);
Shared:=XML.GetValue(Path+'Picture/Shared/Value',false); Shared:=XML.GetValue(Path+'Picture/Shared/Value',false);
b := XML.GetValue(Path+'Picture/Type/Value', pkNone);
Ext := XML.GetValue(Path+'Picture/Type/Ext', '');
M := nil; M := nil;
b := XML.GetValue(Path+'Picture/Type/Value', pkNone); if (b=pkAny) and (Ext<>'') then
if b=pkAny then begin Graphic := ExtensionToGraphic(Ext)
Ext := XML.GetValue(Path+'Picture/Type/Ext', '');
if Ext='' then begin
GetPictureStream;
Graphic := StreamToGraphic(M);
end else
Graphic := ExtensionToGraphic(Ext)
end
else else
Graphic := PictureTypeToGraphic(b); if (b>pkBitmap) then
Graphic := PictureTypeToGraphic(b)
else begin
GetPictureStream;
Graphic := StreamToGraphic(M);
end;
Picture.Graphic := Graphic; Picture.Graphic := Graphic;
if Graphic <> nil then if Graphic <> nil then
@ -4308,8 +4308,12 @@ begin
if M=nil then if M=nil then
GetPictureStream; GetPictureStream;
try try
M.Position := 0; try
Picture.Graphic.LoadFromStream(M); M.Position := 0;
Picture.Graphic.LoadFromStream(M);
except
ShowMessage('Unknown Image Format!');
end;
finally finally
M.Free; M.Free;
end; end;
@ -4517,6 +4521,12 @@ function TfrPictureView.StreamToGraphic(M: TMemoryStream): TGraphic;
end; end;
begin begin
if M=nil then begin
result := nil;
exit;
end;
M.Position := 0; M.Position := 0;
if TestStreamIsBMP(M) then if TestStreamIsBMP(M) then