mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 09:20:48 +02:00
LazReport, fix Cairo PDF exporting of reports with checkbox objects
git-svn-id: trunk@52454 -
This commit is contained in:
parent
312f3d3439
commit
bb8f9b2c70
@ -6,7 +6,8 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, types, LResources, LCLProc, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, types, LResources, LCLProc, Forms, Controls, Graphics, Dialogs,
|
||||||
Barcode, lr_class, lr_barc, lr_rrect, lr_shape, Cairo, CairoCanvas, CairoPrinter;
|
Barcode, lr_class, lr_barc, lr_rrect, lr_shape, Cairo, CairoCanvas, CairoPrinter,
|
||||||
|
lr_chbox;
|
||||||
|
|
||||||
type
|
type
|
||||||
TShapeData = record
|
TShapeData = record
|
||||||
@ -538,6 +539,11 @@ var
|
|||||||
begin
|
begin
|
||||||
|
|
||||||
picture := View.Picture;
|
picture := View.Picture;
|
||||||
|
if Picture.Graphic=nil then
|
||||||
|
begin
|
||||||
|
DebugLn('WARNING: tried to export an empty image (%s)',[View.Name]);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
picw := Picture.Graphic.Width;
|
picw := Picture.Graphic.Width;
|
||||||
pich := Picture.Graphic.Height;
|
pich := Picture.Graphic.Height;
|
||||||
|
|
||||||
@ -719,7 +725,7 @@ procedure TlrCairoExportFilter.OnText(X, Y: Integer; const Text: string;
|
|||||||
View: TfrView);
|
View: TfrView);
|
||||||
var
|
var
|
||||||
nx, ny, gapx, gapy, sgapx, sgapy: Integer;
|
nx, ny, gapx, gapy, sgapx, sgapy: Integer;
|
||||||
aStyle: TTextStyle;
|
aStyle, oldStyle: TTextStyle;
|
||||||
R: TRect;
|
R: TRect;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
@ -747,11 +753,27 @@ begin
|
|||||||
//fCairoPrinter.Canvas.ClipRect := DataRect;
|
//fCairoPrinter.Canvas.ClipRect := DataRect;
|
||||||
//fCairoPrinter.Canvas.Clipping := true;
|
//fCairoPrinter.Canvas.Clipping := true;
|
||||||
|
|
||||||
aStyle := fCairoPrinter.Canvas.TextStyle;
|
oldStyle := fCairoPrinter.Canvas.TextStyle;
|
||||||
aStyle.Alignment:=TfrMemoView_(View).Alignment;
|
aStyle := oldStyle;
|
||||||
aStyle.Clipping:=false; // NOTE: there are some interaction between this and roundrect
|
aStyle.Clipping:=false; // NOTE: there are some interaction between this and roundrect
|
||||||
aStyle.Layout:=tlTop; // background painting, set to false for the moment
|
aStyle.Layout:=tlTop; // background painting, set to false for the moment
|
||||||
aStyle.Wordbreak:= TfrMemoView_(View).WordWrap;
|
if View is TfrMemoView then
|
||||||
|
begin
|
||||||
|
aStyle.Alignment:=TfrMemoView_(View).Alignment;
|
||||||
|
aStyle.Wordbreak:= TfrMemoView_(View).WordWrap;
|
||||||
|
end else
|
||||||
|
if View is TfrCheckBoxView then
|
||||||
|
begin
|
||||||
|
aStyle.Alignment:=taCenter;
|
||||||
|
aStyle.WordBreak:=false;
|
||||||
|
aStyle.Layout:=tlCenter;
|
||||||
|
fCairoPrinter.Canvas.Font.Size := 10;
|
||||||
|
fCairoPrinter.Canvas.Font.Style := fCairoPrinter.Canvas.Font.Style + [fsBold];
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
aStyle.Alignment:=taLeftJustify;
|
||||||
|
aStyle.WordBreak:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
gapx := trunc(View.FrameWidth / 2 + 0.5);
|
gapx := trunc(View.FrameWidth / 2 + 0.5);
|
||||||
gapy := trunc(View.FrameWidth / 4 + 0.5);
|
gapy := trunc(View.FrameWidth / 4 + 0.5);
|
||||||
@ -762,24 +784,29 @@ begin
|
|||||||
R := DataRect;
|
R := DataRect;
|
||||||
InflateRect(R, -sgapx, -sgapy);
|
InflateRect(R, -sgapx, -sgapy);
|
||||||
|
|
||||||
fCairoPrinter.Canvas.Font := TfrMemoView_(View).Font;
|
if View is TfrMemoView then
|
||||||
fCairoPrinter.Canvas.Font.Orientation := (View as TfrMemoView).Angle * 10;
|
|
||||||
|
|
||||||
if fCairoPrinter.Canvas.Font.Orientation<>0 then
|
|
||||||
fCairoPrinter.Canvas.TextRect(R, nx, R.Bottom, Text, aStyle)
|
|
||||||
else
|
|
||||||
begin
|
begin
|
||||||
if TfrMemoView_(View).Justify and not TfrMemoView_(View).LastLine then
|
fCairoPrinter.Canvas.Font := TfrMemoView_(View).Font;
|
||||||
CanvasTextRectJustify(fCairoPrinter.Canvas, R, nx, R.Right, ny, Text, true)
|
fCairoPrinter.Canvas.Font.Orientation := (View as TfrMemoView).Angle * 10;
|
||||||
|
|
||||||
|
if fCairoPrinter.Canvas.Font.Orientation<>0 then
|
||||||
|
fCairoPrinter.Canvas.TextRect(R, nx, R.Bottom, Text, aStyle)
|
||||||
else
|
else
|
||||||
fCairoPrinter.Canvas.TextRect(R, {R.Left} nx, ny, Text, aStyle);
|
begin
|
||||||
end;
|
if TfrMemoView_(View).Justify and not TfrMemoView_(View).LastLine then
|
||||||
|
CanvasTextRectJustify(fCairoPrinter.Canvas, R, nx, R.Right, ny, Text, true)
|
||||||
|
else
|
||||||
|
fCairoPrinter.Canvas.TextRect(R, {R.Left} nx, ny, Text, aStyle);
|
||||||
|
end;
|
||||||
|
end else
|
||||||
|
fCairoPrinter.Canvas.TextRect(R, {R.Left} nx, ny, Text, aStyle);
|
||||||
|
|
||||||
// restore previous clipping
|
// restore previous clipping
|
||||||
//if OldClipping then
|
//if OldClipping then
|
||||||
// fCairoPrinter.Canvas.ClipRect := OldClipRect
|
// fCairoPrinter.Canvas.ClipRect := OldClipRect
|
||||||
//else
|
//else
|
||||||
// fCairoPrinter.Canvas.Clipping := false;
|
// fCairoPrinter.Canvas.Clipping := false;
|
||||||
|
fCairoPrinter.Canvas.TextStyle := oldStyle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TlrCairoExportFilter.OnData(x, y: Integer; View: TfrView);
|
procedure TlrCairoExportFilter.OnData(x, y: Integer; View: TfrView);
|
||||||
|
Loading…
Reference in New Issue
Block a user