63
76
TPRText_ = class(TPRText);
79
PDFEscx = 0.792553191;
80
PDFEscy = 0.785447761;
82
procedure TfrTNPDFExportFilter.AddShape(Data: TShapeData; x, y, h, w: integer);
84
function CreateShape(ShapeClass: TPRShapeClass): TPRShape;
86
result := ShapeClass.Create(PRPanel);
87
result.Parent := PRPanel;
88
result.FillColor := Data.FillColor;
93
result.LineStyle := TPenStyle(Data.FrameStyle);
94
result.LineWidth := Data.FrameWidth - 0.5;
95
result.LineColor := Data.FrameColor;
99
case Data.ShapeType of
101
CreateShape(TPRRect);
104
CreateShape(TPREllipse);
107
with TPRRect(CreateShape(TPRRect)) do begin
108
Radius := Data.Radius;
109
SquaredCorners := TPdfCorners(Data.Corners);
113
with TPRPolygon(CreateShape(TPRPolygon)) do begin
114
SetLength(Points, 3);
115
Points[0] := PRPoint(x+w, y+h);
116
Points[1] := PRPoint(x, y+h);
117
Points[2] := PRPoint(x+w/2, y);
121
with TPRPolygon(CreateShape(TPRPolygon)) do begin
122
SetLength(Points, 2);
123
Points[0] := PRPoint(x,y);
124
Points[1] := PRPoint(x+w,y+h);
128
with TPRPolygon(CreateShape(TPRPolygon)) do begin
129
SetLength(Points, 2);
130
Points[0] := PRPoint(x,y+h);
131
Points[1] := PRPoint(x+w,y);
136
procedure TfrTNPDFExportFilter.DefaultShowView(View: TfrView;
137
nx, ny, ndy, ndx: Integer);
139
if (View.FillColor <> clNone)
140
and not (View is TfrBarCodeView)
141
and not (View is TfrPictureView)
143
ShowBackGround(View, nx, ny, ndy, ndx);
145
if View is TfrBarCodeView then
146
ShowBarCode(TfrBarCodeView(View), nx, ny, ndy, ndx)
147
else if View is TfrPictureView then
148
ShowPicture(TfrPictureView(View), nx, ny, ndy, ndx);
150
if (View.Frames<>[]) and not (View is TfrBarCodeView) then
151
ShowFrame(View, nx, ny, ndy, ndx);
69
154
constructor TfrTNPDFExportFilter.Create(AStream: TStream);
218
303
PRImage: TPRImage;
221
309
if View.Picture.Graphic is TJpegImage then
222
310
PRImage := TPRJpegImage.Create(PRPanel)
224
312
PRImage := TPRImage.Create(PRPanel);
225
314
PRImage.Parent := PRPanel;
226
PRImage.Stretch := True;
319
if view.Stretched then
321
if (View.Flags and flPictRatio<>0) and
322
(View.Picture.Width>0) and (View.Picture.Height>0) then
324
r := View.Picture.Width/View.Picture.Height;
328
ph := trunc(w/r + 0.5);
329
if (View.Flags and flPictCenter<>0) then
330
y := y + (L-ph) div 2;
335
pw := trunc(h*r + 0.5);
336
if (View.Flags and flPictCenter<>0) then
337
x := x + (L-pw) div 2;
342
PRImage.ScaleX := PDFEscX;
343
PRImage.ScaleY := PDFEscY;
344
if (View.Flags and flPictCenter<>0) then begin
345
pw := trunc(View.Picture.Width * PDFEscX + 1.5);
346
ph := trunc(View.Picture.Height * PDFEscY + 1.5);
347
x := x + (w - pw) div 2 - 1;
348
y := y + (h - ph) div 2 - 1;
352
PRImage.Stretch := View.Stretched;
227
353
PRImage.SharedName := View.SharedName;
228
354
PRImage.SharedImage := (View.SharedName<>'');
230
356
PRImage.Left := x;
231
357
PRImage.Top := y;
358
PRImage.Height := ph;
235
361
PRImage.Picture.Graphic := View.Picture.Graphic;
238
procedure TfrTNPDFExportFilter.ShowShape(View: TfrShapeView; x, y, h, w: integer
241
function CreateShape(ShapeClass: TPRShapeClass): TPRShape;
364
procedure TfrTNPDFExportFilter.ShowRoundRect(View: TfrRoundRectView; x, y, h,
371
if view.ShowGradian then
373
DefaultShowView(View, x, y, h, w)
243
result := ShapeClass.Create(PRPanel);
244
result.Parent := PRPanel;
245
result.FillColor := view.FillColor;
250
result.LineStyle := TPenStyle(View.FrameStyle);
251
result.LineWidth := View.FrameWidth - 0.5;
252
result.LineColor := View.FrameColor;
378
SWidth := trunc((View.RoundRectCurve/2) * PDFEscx + 0.5);
379
if View.RoundRect then
380
Data.Radius := SWidth
383
Data.Corners:=View.SquaredCorners;
386
Data.ShapeType := frstRoundRect;
387
Data.FillColor := ColorToRGB(View.ShadowColor);
388
Data.FrameColor := Data.FillColor; //ColorToRGB(View.FrameColor);
389
Data.FrameWidth := 0;
390
Data.FrameStyle := frsSolid;
391
SWidth := trunc(View.ShadowWidth * PDFEscx + 0.5);
392
if View.ShadowWidth>0 then
393
AddShape(Data, x + SWidth, y + SWidth, h - SWidth, w - SWidth);
396
Data.ShapeType := frstRoundRect;
397
if View.FillColor=clNone then
398
Data.FillColor := clNone
400
Data.FillColor := ColorToRGB(View.FillColor);
401
if View.Frames=[] then
402
Data.FrameColor := Data.FillColor
404
Data.FrameColor := ColorToRGB(View.FrameColor);
405
Data.FrameWidth := View.FrameWidth;
406
Data.FrameStyle := View.FrameStyle;
407
AddShape(Data, x, y, h - SWidth, w - SWidth);
411
procedure TfrTNPDFExportFilter.ShowShape(View: TfrShapeView; x, y, h, w: integer);
256
case View.ShapeType of
258
CreateShape(TPRRect);
261
CreateShape(TPREllipse);
264
with TPRRect(CreateShape(TPRRect)) do begin
269
with TPRPolygon(CreateShape(TPRPolygon)) do begin
270
SetLength(Points, 3);
271
Points[0] := PRPoint(x+w, y+h);
272
Points[1] := PRPoint(x, y+h);
273
Points[2] := PRPoint(x+w/2, y);
277
with TPRPolygon(CreateShape(TPRPolygon)) do begin
278
SetLength(Points, 2);
279
Points[0] := PRPoint(x,y);
280
Points[1] := PRPoint(x+w,y+h);
284
with TPRPolygon(CreateShape(TPRPolygon)) do begin
285
SetLength(Points, 2);
286
Points[0] := PRPoint(x,y+h);
287
Points[1] := PRPoint(x+w,y);
415
Data.ShapeType := View.ShapeType;
416
Data.FillColor := View.FillColor;
417
Data.FrameColor := View.FrameColor;
418
Data.FrameStyle := View.FrameStyle;
419
Data.FrameWidth := View.FrameWidth;
422
AddShape(Data, x, y, h, w);
292
425
procedure TfrTNPDFExportFilter.OnData(x, y: Integer; View: TfrView);
294
427
nx, ny, ndx, ndy: Integer;
296
nx := Round(x * PDFEscx);
297
ny := Round(y * PDFEscy);
298
ndx := Round((View.dx) * PDFEscx + 1) ;
299
ndy := Round((View.dy) * PDFEscy + 1) ;
429
nx := trunc(x * PDFEscx + 0.5);
430
ny := trunc(y * PDFEscy + 0.5);
431
ndx := trunc((View.dx) * PDFEscx + 1.5) ;
432
ndy := trunc((View.dy) * PDFEscy + 1.5) ;
301
434
if View is TfrShapeView then begin
303
436
ShowShape(TfrShapeView(View), nx, ny, ndy, ndx);
307
if (View.FillColor <> clNone)
308
and not (View is TfrBarCodeView)
309
and not (View is TfrPictureView)
311
ShowBackGround(View, nx, ny, ndy, ndx);
313
if View is TfrBarCodeView then
314
ShowBarCode(TfrBarCodeView(View), nx, ny, ndy, ndx)
315
else if View is TfrPictureView then
316
ShowPicture(TfrPictureView(View), nx, ny, ndy, ndx);
318
if (View.Frames<>[]) and not (View is TfrBarCodeView) then
319
ShowFrame(View, nx, ny, ndy, ndx);
439
if View is TfrRoundRectView then begin
441
ShowRoundRect(TfrRoundRectView(View), nx, ny, ndy, ndx);
444
DefaultShowView(View, nx, ny, ndy, ndx);
323
447
procedure TfrTNPDFExportFilter.OnText(X, Y: Integer; const Text: string;
451
nx, ny, ndx, ndy: Integer;
330
nx := Round(x * PDFEscx) + 1;
331
ny := Round(y * PDFEscy) + 1;
332
ndx := Round(View.dx * PDFEscx);
333
ndy := Round(View.dy * PDFEscy);
454
gapx := trunc(View.FrameWidth / 2 + 0.5) + 2;
455
gapy := trunc(View.FrameWidth / 4 + 0.5) + 1;
456
nx := trunc((x+gapx) * PDFEscx + 0.5);
457
ny := trunc((y+gapy) * PDFEscy + 0.5);
458
ndx := trunc((View.dx-gapx) * PDFEscx + 1.5);
459
ndy := trunc((View.dy-gapy) * PDFEscy + 1.5);
335
PRTLabel := TPRText.Create(PRPanel);
461
PRTLabel := TPRLabel.Create(PRPanel);
336
462
PRTLabel.Parent := PRPanel;
463
PRTLabel.Clipping := true;
338
PRTLabel.Text := Text;
465
PRTLabel.Caption := Text;
339
466
PRTLabel.Left := nx;
340
467
PRTLabel.Top := ny;
341
468
PRTLabel.Width := ndx;
342
469
PRTLabel.Height := ndy;
343
470
if View is TfrMemoView then
472
PRTLabel.Alignment := TfrMemoView_(View).Alignment;
345
473
if Pos('Arial', TfrMemoView_(View).Font.Name) > 0 then
346
474
PRTLabel.FontName := fnArial
347
475
else if Pos('Courier', TfrMemoView_(View).Font.Name) > 0 then