diff --git a/components/lazreport/source/addons/cairoexport/lr_e_cairo.pas b/components/lazreport/source/addons/cairoexport/lr_e_cairo.pas index 2cb86dd5f8..24256f3dd2 100644 --- a/components/lazreport/source/addons/cairoexport/lr_e_cairo.pas +++ b/components/lazreport/source/addons/cairoexport/lr_e_cairo.pas @@ -74,6 +74,7 @@ type procedure ShowShape(View: TfrShapeView; x, y, h, w: integer); procedure OnText(X, Y: Integer; const Text: string; View: TfrView); override; procedure OnData(x, y: Integer; View: TfrView); override; + procedure OnExported(x, y: Integer; View: TfrView); override; public property Backend: TlrCairoBackend read fBackend write fBackend; end; @@ -786,6 +787,14 @@ begin DataRect := Rect(nx, ny, nx+ndx, ny+ndy); + // enable global clipping only for this view classes + // others classes might need clipping only in some cases or + // may need another clipping shape. + if + (View is TfrMemoView) + then + SaveClipping(@DataRect); + if View is TfrShapeView then begin ShowShape(TfrShapeView(View), nx, ny, ndy, ndx); @@ -799,6 +808,11 @@ begin DefaultShowView(View, nx, ny, ndy, ndx); end; +procedure TlrCairoExportFilter.OnExported(x, y: Integer; View: TfrView); +begin + RestoreClipping; +end; + initialization frRegisterExportFilter(TlrCairoExportFilter, 'Cairo Adobe Acrobat PDF (*.pdf)', '*.pdf'); frRegisterExportFilter(TlrCairoExportFilter, 'Cairo Postscript (*.ps)', '*.ps');