summaryrefslogtreecommitdiff
path: root/extras/contributed
diff options
context:
space:
mode:
authorJean-Marc Levecque <jean-marc.levecque@jmlesite.fr>2011-03-08 10:17:18 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-03-08 10:17:18 +0200
commit8dfea42eddff5e4d896919380d16acc2ff109e5e (patch)
treed3d0e957915acb88088b8d342f22a6bb00605ac6 /extras/contributed
parent34400c5c356449c0e6a13f1417a99edcc446d605 (diff)
downloadfpGUI-8dfea42eddff5e4d896919380d16acc2ff109e5e.tar.xz
More PDF report engine improvements. Real values
Using the report engine to produce some charts, I realized that I missed an important point: positions and thickness in pdf files can use real values and not only integers. I made the change and modified the demo to show it in the frames and lines examples.
Diffstat (limited to 'extras/contributed')
-rw-r--r--extras/contributed/report_tool/demo/u_demo.pas33
-rw-r--r--extras/contributed/report_tool/reportengine/u_commande.pas189
-rw-r--r--extras/contributed/report_tool/reportengine/u_imprime.pas574
-rw-r--r--extras/contributed/report_tool/reportengine/u_pdf.pas300
4 files changed, 537 insertions, 559 deletions
diff --git a/extras/contributed/report_tool/demo/u_demo.pas b/extras/contributed/report_tool/demo/u_demo.pas
index d5deec82..7ce96c01 100644
--- a/extras/contributed/report_tool/demo/u_demo.pas
+++ b/extras/contributed/report_tool/demo/u_demo.pas
@@ -149,7 +149,7 @@ with Imprime do
with Document do
begin
FluxFichier:= TFileStream.Create(FichierPdf,fmCreate);
- EcritDocument(FluxFichier);
+ WriteDocument(FluxFichier);
FluxFichier.Free;
Free;
end;
@@ -201,7 +201,7 @@ with Imprime do
with Document do
begin
FluxFichier:= TFileStream.Create(FichierPdf,fmCreate);
- EcritDocument(FluxFichier);
+ WriteDocument(FluxFichier);
FluxFichier.Free;
Free;
end;
@@ -253,7 +253,7 @@ with Imprime do
with Document do
begin
FluxFichier:= TFileStream.Create(FichierPdf,fmCreate);
- EcritDocument(FluxFichier);
+ WriteDocument(FluxFichier);
FluxFichier.Free;
Free;
end;
@@ -305,7 +305,7 @@ with Imprime do
with Document do
begin
FluxFichier:= TFileStream.Create(FichierPdf,fmCreate);
- EcritDocument(FluxFichier);
+ WriteDocument(FluxFichier);
FluxFichier.Free;
Free;
end;
@@ -357,7 +357,7 @@ with Imprime do
with Document do
begin
FluxFichier:= TFileStream.Create(FichierPdf,fmCreate);
- EcritDocument(FluxFichier);
+ WriteDocument(FluxFichier);
FluxFichier.Free;
Free;
end;
@@ -409,7 +409,7 @@ with Imprime do
with Document do
begin
FluxFichier:= TFileStream.Create(FichierPdf,fmCreate);
- EcritDocument(FluxFichier);
+ WriteDocument(FluxFichier);
FluxFichier.Free;
Free;
end;
@@ -461,7 +461,7 @@ with Imprime do
with Document do
begin
FluxFichier:= TFileStream.Create(FichierPdf,fmCreate);
- EcritDocument(FluxFichier);
+ WriteDocument(FluxFichier);
FluxFichier.Free;
Free;
end;
@@ -513,7 +513,7 @@ with Imprime do
with Document do
begin
FluxFichier:= TFileStream.Create(FichierPdf,fmCreate);
- EcritDocument(FluxFichier);
+ WriteDocument(FluxFichier);
FluxFichier.Free;
Free;
end;
@@ -565,7 +565,7 @@ with Imprime do
with Document do
begin
FluxFichier:= TFileStream.Create(FichierPdf,fmCreate);
- EcritDocument(FluxFichier);
+ WriteDocument(FluxFichier);
FluxFichier.Free;
Free;
end;
@@ -617,7 +617,7 @@ with Imprime do
with Document do
begin
FluxFichier:= TFileStream.Create(FichierPdf,fmCreate);
- EcritDocument(FluxFichier);
+ WriteDocument(FluxFichier);
FluxFichier.Free;
Free;
end;
@@ -669,7 +669,7 @@ with Imprime do
with Document do
begin
FluxFichier:= TFileStream.Create(FichierPdf,fmCreate);
- EcritDocument(FluxFichier);
+ WriteDocument(FluxFichier);
FluxFichier.Free;
Free;
end;
@@ -1082,7 +1082,7 @@ end;
procedure TF_Demo.ImprimeCadres(Preview: Boolean);
var
FtTitre,FtTexte: Integer;
- TsFin,TsEpais: Integer;
+ TsFin,TsNorm,TsEpais: Integer;
IlTitre,IlTexte: Integer;
begin
with Imprime do
@@ -1095,7 +1095,8 @@ with Imprime do
FtTitre:= Fonte('helvetica-15:bold',clBlack);
FtTexte:= Fonte('helvetica-8',clBlack);
// create the style of lines to be used
- TsFin:= StyleTrait(1,clBlack,lsSolid);
+ TsFin:= StyleTrait(0.2,clBlack,lsSolid);
+ TsNorm:= StyleTrait(1,clBlack,lsSolid);
TsEpais:= StyleTrait(2,clBlack,lsSolid);
// create line spacings to be used
IlTitre:= Interligne(3,0,3);
@@ -1109,7 +1110,7 @@ with Imprime do
// draw thick frame rectangle at header
CadreEnTete(TsEpais);
// draw thick frame rectangle at footer
- CadrePied(TsEpais);
+ CadrePied(TsNorm);
// preparation is finished, so create PDF objects
Fin;
end;
@@ -1194,8 +1195,8 @@ with Imprime do
FtTitre:= Fonte('helvetica-15:bold',clBlack);
FtTexte:= Fonte('helvetica-8',clBlack);
// create the style of lines to be used
- TsFinNoir:= StyleTrait(1,clBlack,lsSolid);
- TsFinBleu:= StyleTrait(1,clBlue,lsDash);
+ TsFinNoir:= StyleTrait(0.2,clBlack,lsSolid);
+ TsFinBleu:= StyleTrait(0.1,clBlue,lsDash);
TsEpais:= StyleTrait(2,clBlack,lsSolid);
TsFinRouge:= StyleTrait(1,clRed,lsDashDot);
// create line spacings to be used
diff --git a/extras/contributed/report_tool/reportengine/u_commande.pas b/extras/contributed/report_tool/reportengine/u_commande.pas
index 447fc5f7..84280bf6 100644
--- a/extras/contributed/report_tool/reportengine/u_commande.pas
+++ b/extras/contributed/report_tool/reportengine/u_commande.pas
@@ -30,10 +30,10 @@ type
TFBordFlags= set of (bcGauche,bcDroite,bcHaut,bcBas);
TDimensions= record
- T: Integer;
- L: Integer;
- R: Integer;
- B: Integer;
+ T: Single;
+ L: Single;
+ R: Single;
+ B: Single;
end;
TPapier= record
@@ -50,8 +50,8 @@ type
FNbPages: Integer;
FPaper: TPapier;
FMarges: TDimensions;
- FBasEnTete: Integer;
- FHautPied: Integer;
+ FBasEnTete: Single;
+ FHautPied: Single;
FPages: TList;
FEnTete: TList;
FPied: TList;
@@ -69,17 +69,17 @@ type
procedure LoadCmdPied;
procedure LoadCmdGroupe;
procedure LoadCmdGroupeToPage;
- procedure LoadEspaceEnTete(APosY,AColonne,AHeight,AFond: Integer);
- procedure LoadEspacePage(APosY,AColonne,AHeight,AFond: Integer);
- procedure LoadEspacePied(APosY,AColonne,AHeight,AFond: Integer);
- procedure LoadEspaceGroupe(AHeight: Integer);
+ procedure LoadEspaceEnTete(APosY: Single; AColonne: Integer; AHeight: Single; AFond: Integer);
+ procedure LoadEspacePage(APosY: Single; AColonne: Integer; AHeight: Single; AFond: Integer);
+ procedure LoadEspacePied(APosY: Single; AColonne: Integer; AHeight: Single; AFond: Integer);
+ procedure LoadEspaceGroupe(AHeight: Single);
procedure LoadCadre(AStyle: Integer; AZone: TZone);
- procedure LoadTrait(APosXDeb,APosYDeb,AColonne,APosXFin,APosYFin,AStyle: Integer);
- procedure LoadTraitHorizEnTete(APosXDeb,APosYDeb,AColonne,APosXFin,APosYFin,AStyle: Integer);
- procedure LoadTraitHorizPage(APosXDeb,APosYDeb,AColonne,APosXFin,APosYFin,AStyle: Integer);
- procedure LoadTraitHorizPied(APosXDeb,APosYDeb,AColonne,APosXFin,APosYFin,AStyle: Integer);
- procedure LoadTraitHorizGroupe(AHeight: Integer);
- procedure LoadSurf(APos: array of TPoint; AColor: TfpgColor);
+ procedure LoadTrait(APosXDeb,APosYDeb: Single; AColonne: Integer; APosXFin,APosYFin: Single; AStyle: Integer);
+ procedure LoadTraitHorizEnTete(APosXDeb,APosYDeb: Single; AColonne: Integer; APosXFin,APosYFin: Single; AStyle: Integer);
+ procedure LoadTraitHorizPage(APosXDeb,APosYDeb: Single; AColonne: Integer; APosXFin,APosYFin: Single; AStyle: Integer);
+ procedure LoadTraitHorizPied(APosXDeb,APosYDeb: Single; AColonne: Integer; APosXFin,APosYFin: Single; AStyle: Integer);
+ procedure LoadTraitHorizGroupe(AHeight: Single);
+ procedure LoadSurf(APos: T_Points; AColor: TfpgColor);
function GetCmdPage(NumPage: Integer): TList;
property CmdEnTete: TList read FEntete;
property CmdPied: TList read FPied;
@@ -109,15 +109,15 @@ type
T_Groupe = class
private
- FLineHeight: Integer;
- FGroupeHeight: Integer;
+ FLineHeight: Single;
+ FGroupeHeight: Single;
FCommandes: TList;
public
constructor Create; virtual;
destructor Destroy; override;
property Commandes: TList read FCommandes write FCommandes;
- property LineHeight: Integer read FLineHeight;
- property GroupeHeight: Integer read FGroupeHeight;
+ property LineHeight: Single read FLineHeight;
+ property GroupeHeight: Single read FGroupeHeight;
end;
T_Ligne = class
@@ -127,9 +127,9 @@ type
public
constructor Create; virtual;
destructor Destroy; override;
- procedure LoadTexte(APosX,APosY,AColonne,ATexte,AFonte,AHeight,AFond,ABord,AInterL: Integer;
+ procedure LoadTexte(APosX,APosY: Single; AColonne,ATexte,AFonte,AHeight,AFond,ABord,AInterL: Integer;
ACurFont: Boolean; AFlags: TFTextFlags);
- procedure LoadNumero(APosX,APosY,AColonne,ATexteNum,ATexteTot,AFonte,AHeight,AFond,ABord,AInterL: Integer;
+ procedure LoadNumero(APosX,APosY: Single; AColonne,ATexteNum,ATexteTot,AFonte,AHeight,AFond,ABord,AInterL: Integer;
ACurFont: Boolean; AFlags: TFTextFlags; ATotal,AAlpha: Boolean; ATypeNum: TSectPageNum);
property Commandes: TList read FCommandes;
property LineHeight: Integer read FHeight;
@@ -148,8 +148,8 @@ type
T_EcritTexte = class(T_Commande)
private
- FPosX: Integer;
- FPosY: Integer;
+ FPosX: Single;
+ FPosY: Single;
FColonne: Integer;
FTexte: Integer;
FFonte: Integer;
@@ -159,10 +159,10 @@ type
FCurFont: Boolean;
FFlags: TFTextFlags;
public
- constructor Create(APosX,APosY,AColonne,ATexte,AFonte,AFond,ABord,AInterL: Integer; ACurFont: Boolean; AFlags: TFTextFlags); virtual;
- procedure SetPosY(const AValue: Integer);
- property GetPosX: Integer read FPosX;
- property GetPosY: Integer read FPosY;
+ constructor Create(APosX,APosY: Single; AColonne,ATexte,AFonte,AFond,ABord,AInterL: Integer; ACurFont: Boolean; AFlags: TFTextFlags); virtual;
+ procedure SetPosY(const AValue: Single);
+ property GetPosX: Single read FPosX;
+ property GetPosY: Single read FPosY;
property GetColonne: Integer read FColonne;
property GetTexte: Integer read FTexte;
property GetFonte: Integer read FFonte;
@@ -175,8 +175,8 @@ type
T_Numero = class(T_Commande)
private
- FPosX: Integer;
- FPosY: Integer;
+ FPosX: Single;
+ FPosY: Single;
FColonne: Integer;
FTexteNum: Integer;
FTexteTot: Integer;
@@ -190,11 +190,11 @@ type
FAlpha: Boolean;
FTypeNum: TSectPageNum;
public
- constructor Create(APosX,APosY,AColonne,ATexteNum,ATexteTot,AFonte,AFond,ABord,AInterL: Integer;
+ constructor Create(APosX,APosY: Single; AColonne,ATexteNum,ATexteTot,AFonte,AFond,ABord,AInterL: Integer;
ACurFont: Boolean; AFlags: TFTextFlags; ATotal,AAlpha: Boolean; ATypeNum: TSectPageNum); virtual;
- procedure SetPosY(const AValue: Integer);
- property GetPosX: Integer read FPosX;
- property GetPosY: Integer read FPosY;
+ procedure SetPosY(const AValue: Single);
+ property GetPosX: Single read FPosX;
+ property GetPosY: Single read FPosY;
property GetColonne: Integer read FColonne;
property GetTexteNum: Integer read FTexteNum;
property GetTexteTot: Integer read FTexteTot;
@@ -211,36 +211,36 @@ type
T_Trait = class(T_Commande)
private
- FPosX: Integer;
- FPosY: Integer;
+ FPosX: Single;
+ FPosY: Single;
FColonne: Integer;
FStyle: Integer;
- FEndX: Integer;
- FEndY: Integer;
+ FEndX: Single;
+ FEndY: Single;
public
- constructor Create(APosX,APosY,AColonne,AStyle,AEndX,AEndY: Integer); virtual;
- property GetPosX: Integer read FPosX;
- property GetPosY: Integer read FPosY;
+ constructor Create(APosX,APosY: Single; AColonne,AStyle: Integer; AEndX,AEndY: Single); virtual;
+ property GetPosX: Single read FPosX;
+ property GetPosY: Single read FPosY;
property GetColonne: Integer read FColonne;
property GetStyle: Integer read FStyle;
- property GetEndX: Integer read FEndX;
- property GetEndY: Integer read FEndY;
+ property GetEndX: Single read FEndX;
+ property GetEndY: Single read FEndY;
end;
T_Colonne = class(T_Commande)
private
- FPos: Integer;
- FWidth: Integer;
- FMargin: Integer;
+ FPos: Single;
+ FWidth: Single;
+ FMargin: Single;
FColor: TfpgColor;
public
- constructor Create(APos,AWidth,AMargin: Integer; AColor: TfpgColor); virtual;
- function GetTextPos: Integer;
- function GetTextWidth: Integer;
+ constructor Create(APos,AWidth,AMargin: Single; AColor: TfpgColor); virtual;
+ function GetTextPos: Single;
+ function GetTextWidth: Single;
procedure SetColColor(AColor: TfpgColor);
- property ColPos: Integer read FPos write FPos;
- property ColWidth: Integer read FWidth write FWidth;
- property ColMargin: Integer read FMargin write FMargin;
+ property ColPos: Single read FPos write FPos;
+ property ColWidth: Single read FWidth write FWidth;
+ property ColMargin: Single read FMargin write FMargin;
property GetColor: TfpgColor read FColor;
end;
@@ -259,28 +259,28 @@ type
T_Interligne = class(T_Commande)
private
- FSup: Integer;
- FInt: Integer;
- FInf: Integer;
+ FSup: Single;
+ FInt: Single;
+ FInf: Single;
public
- constructor Create(ASup,AInt,AInf: Integer); virtual;
- property GetSup: Integer read FSup;
- property GetInt: Integer read FInt;
- property GetInf: Integer read FInf;
+ constructor Create(ASup,AInt,AInf: Single); virtual;
+ property GetSup: Single read FSup;
+ property GetInt: Single read FInt;
+ property GetInf: Single read FInf;
end;
T_Espace = class(T_Commande)
private
- FPosY: Integer;
+ FPosY: Single;
FColonne: Integer;
- FHeight: Integer;
+ FHeight: Single;
FFond: Integer;
public
- constructor Create(APosY,AColonne,AHeight,AFond: Integer); virtual;
- procedure SetPosY(const AValue: Integer);
- property GetPosY: Integer read FPosY;
+ constructor Create(APosY: Single; AColonne: Integer; AHeight: Single; AFond: Integer); virtual;
+ procedure SetPosY(const AValue: Single);
+ property GetPosY: Single read FPosY;
property GetColonne: Integer read FColonne;
- property GetHeight: Integer read FHeight;
+ property GetHeight: Single read FHeight;
property GetFond: Integer read FFond;
end;
@@ -294,12 +294,12 @@ type
T_TraitStyle = class(T_Commande)
private
- FEpais: Integer;
+ FEpais: Single;
FColor: TfpgColor;
FStyle: TfpgLineStyle;
public
- constructor Create(AEpais: Integer; AColor: Tfpgcolor; AStyle: TfpgLineStyle); virtual;
- property GetEpais: Integer read FEpais;
+ constructor Create(AEpais: Single; AColor: Tfpgcolor; AStyle: TfpgLineStyle); virtual;
+ property GetEpais: Single read FEpais;
property GetColor: TfpgColor read FColor;
property GetStyle: TfpgLineStyle read FStyle;
end;
@@ -329,7 +329,7 @@ type
FPoints: T_Points;
FColor: TfpgColor;
public
- constructor Create(APoints: array of TPoint; AColor: TfpgColor);
+ constructor Create(APoints: array of TRefPos; AColor: TfpgColor);
property GetPoints: T_Points read FPoints;
property GetColor: TfpgColor read FColor;
end;
@@ -473,25 +473,25 @@ AGroupe.FGroupeHeight:= 0;
AGroupe.Commandes.Clear;
end;
-procedure T_Section.LoadEspaceEnTete(APosY,AColonne,AHeight,AFond: Integer);
+procedure T_Section.LoadEspaceEnTete(APosY: Single; AColonne: Integer; AHeight: Single; AFond: Integer);
begin
ACommande:= T_Espace.Create(APosY,AColonne,AHeight,AFond);
FEnTete.Add(ACommande);
end;
-procedure T_Section.LoadEspacePage(APosY,AColonne,AHeight,AFond: Integer);
+procedure T_Section.LoadEspacePage(APosY: Single; AColonne: Integer; AHeight: Single; AFond: Integer);
begin
ACommande:= T_Espace.Create(APosY,AColonne,AHeight,AFond);
T_Page(Pages[Pred(Pages.Count)]).Commandes.Add(ACommande);
end;
-procedure T_Section.LoadEspacePied(APosY,AColonne,AHeight,AFond: Integer);
+procedure T_Section.LoadEspacePied(APosY: Single; AColonne: Integer; AHeight: Single; AFond: Integer);
begin
ACommande:= T_Espace.Create(APosY,AColonne,AHeight,AFond);
FPied.Add(ACommande);
end;
-procedure T_Section.LoadEspaceGroupe(AHeight: Integer);
+procedure T_Section.LoadEspaceGroupe(AHeight: Single);
begin
AGroupe.FGroupeHeight:= AGroupe.FGroupeHeight+AHeight;
end;
@@ -502,36 +502,37 @@ ACommande:= T_Cadre.Create(AStyle,AZone);
FCadres.Add(ACommande);
end;
-procedure T_Section.LoadTrait(APosXDeb,APosYDeb,AColonne,APosXFin,APosYFin,AStyle: Integer);
+procedure T_Section.LoadTrait(APosXDeb,APosYDeb: Single; AColonne: Integer; APosXFin,APosYFin: Single; AStyle: Integer);
begin
ACommande:= T_Trait.Create(APosXDeb,APosYDeb,AColonne,AStyle,APosXFin,APosYFin);
T_Page(Pages[Pred(Pages.Count)]).Commandes.Add(ACommande);
end;
-procedure T_Section.LoadTraitHorizEnTete(APosXDeb,APosYDeb,AColonne,APosXFin,APosYFin,AStyle: Integer);
+procedure T_Section.LoadTraitHorizEnTete(APosXDeb,APosYDeb: Single; AColonne: Integer; APosXFin,APosYFin: Single;
+ AStyle: Integer);
begin
ACommande:= T_Trait.Create(APosXDeb,APosYDeb,AColonne,AStyle,APosXFin,APosYFin);
FEnTete.Add(ACommande);
end;
-procedure T_Section.LoadTraitHorizPage(APosXDeb,APosYDeb,AColonne,APosXFin,APosYFin,AStyle: Integer);
+procedure T_Section.LoadTraitHorizPage(APosXDeb,APosYDeb: Single; AColonne: Integer; APosXFin,APosYFin: Single; AStyle: Integer);
begin
ACommande:= T_Trait.Create(APosXDeb,APosYDeb,AColonne,AStyle,APosXFin,APosYFin);
T_Page(Pages[Pred(Pages.Count)]).Commandes.Add(ACommande);
end;
-procedure T_Section.LoadTraitHorizPied(APosXDeb,APosYDeb,AColonne,APosXFin,APosYFin,AStyle: Integer);
+procedure T_Section.LoadTraitHorizPied(APosXDeb,APosYDeb: Single; AColonne: Integer; APosXFin,APosYFin: Single; AStyle: Integer);
begin
ACommande:= T_Trait.Create(APosXDeb,APosYDeb,AColonne,AStyle,APosXFin,APosYFin);
FPied.Add(ACommande);
end;
-procedure T_Section.LoadTraitHorizGroupe(AHeight: Integer);
+procedure T_Section.LoadTraitHorizGroupe(AHeight: Single);
begin
AGroupe.FGroupeHeight:= AGroupe.FGroupeHeight+AHeight;
end;
-procedure T_Section.LoadSurf(APos: array of TPoint; AColor: TfpgColor);
+procedure T_Section.LoadSurf(APos: T_Points; AColor: TfpgColor);
begin
Acommande:= T_Surface.Create(APos,AColor);
T_Page(Pages[Pred(Pages.Count)]).Commandes.Add(ACommande);
@@ -580,7 +581,7 @@ FCommandes.Free;
inherited Destroy;
end;
-procedure T_Ligne.LoadTexte(APosX,APosY,AColonne,ATexte,AFonte,AHeight,AFond,ABord,AInterL: Integer;
+procedure T_Ligne.LoadTexte(APosX,APosY: Single; AColonne,ATexte,AFonte,AHeight,AFond,ABord,AInterL: Integer;
ACurFont: Boolean; AFlags: TFTextFlags);
begin
if FHeight< AHeight
@@ -590,7 +591,7 @@ ACommande:= T_EcritTexte.Create(APosX,APosY,AColonne,ATexte,AFonte,AFond,ABord,A
Commandes.Add(ACommande);
end;
-procedure T_Ligne.LoadNumero(APosX,APosY,AColonne,ATexteNum,ATexteTot,AFonte,AHeight,AFond,ABord,AInterL: Integer;
+procedure T_Ligne.LoadNumero(APosX,APosY: Single; AColonne,ATexteNum,ATexteTot,AFonte,AHeight,AFond,ABord,AInterL: Integer;
ACurFont: Boolean; AFlags: TFTextFlags; ATotal,AAlpha: Boolean; ATypeNum: TSectPageNum);
begin
if FHeight< AHeight
@@ -602,14 +603,14 @@ end;
// command class methods
-procedure T_EcritTexte.SetPosY(const AValue: Integer);
+procedure T_EcritTexte.SetPosY(const AValue: Single);
begin
if FPosY<> AValue
then
FPosY:= AValue;
end;
-constructor T_EcritTexte.Create(APosX,APosY,AColonne,ATexte,AFonte,AFond,ABord,AInterL: Integer; ACurFont: Boolean; AFlags: TFTextFlags);
+constructor T_EcritTexte.Create(APosX,APosY: Single; AColonne,ATexte,AFonte,AFond,ABord,AInterL: Integer; ACurFont: Boolean; AFlags: TFTextFlags);
begin
inherited Create;
FPosX:= APosX;
@@ -624,14 +625,14 @@ FCurFont:= ACurFont;
FFlags:= AFlags;
end;
-procedure T_Numero.SetPosY(const AValue: Integer);
+procedure T_Numero.SetPosY(const AValue: Single);
begin
if FPosY<> AValue
then
FPosY:= AValue;
end;
-constructor T_Numero.Create(APosX,APosY,AColonne,ATexteNum,ATexteTot,AFonte,AFond,ABord,AInterL: Integer;
+constructor T_Numero.Create(APosX,APosY: Single; AColonne,ATexteNum,ATexteTot,AFonte,AFond,ABord,AInterL: Integer;
ACurFont: Boolean; AFlags: TFTextFlags; ATotal,AAlpha: Boolean; ATypeNum: TSectPageNum);
begin
inherited Create;
@@ -651,7 +652,7 @@ FAlpha:= AAlpha;
FTypeNum:= ATypeNum;
end;
-constructor T_Trait.Create(APosX,APosY,AColonne,AStyle,AEndX,AEndY: Integer);
+constructor T_Trait.Create(APosX,APosY: Single; AColonne,AStyle: Integer; AEndX,AEndY: Single);
begin
FPosX:= APosX;
FPosY:= APosY;
@@ -661,7 +662,7 @@ FEndX:= AEndX;
FEndY:= AEndY;
end;
-constructor T_Colonne.Create(APos,AWidth,AMargin: Integer; AColor: TfpgColor);
+constructor T_Colonne.Create(APos,AWidth,AMargin: Single; AColor: TfpgColor);
begin
inherited Create;
FPos:= APos;
@@ -670,12 +671,12 @@ FMargin:= AMargin;
FColor:= AColor;
end;
-function T_Colonne.GetTextPos: Integer;
+function T_Colonne.GetTextPos: Single;
begin
Result:= FPos+FMargin;
end;
-function T_Colonne.GetTextWidth: Integer;
+function T_Colonne.GetTextWidth: Single;
begin
Result:= FWidth-(FMargin*2);
end;
@@ -700,7 +701,7 @@ begin
Result:= TfpgFont(FFonte).Height;
end;
-constructor T_Interligne.Create(ASup,AInt,AInf: Integer);
+constructor T_Interligne.Create(ASup,AInt,AInf: Single);
begin
inherited Create;
FSup:= ASup;
@@ -708,7 +709,7 @@ FInt:= AInt;
FInf:= AInf;
end;
-constructor T_Espace.Create(APosY,AColonne,AHeight,AFond: Integer);
+constructor T_Espace.Create(APosY: Single; AColonne: Integer; AHeight: Single; AFond: Integer);
begin
inherited Create;
FPosY:= APosY;
@@ -717,7 +718,7 @@ FHeight:= AHeight;
FFond:= AFond;
end;
-constructor T_Surface.Create(APoints: array of TPoint; AColor: TfpgColor);
+constructor T_Surface.Create(APoints: array of TRefPos; AColor: TfpgColor);
var
Cpt: Integer;
begin
@@ -728,7 +729,7 @@ for Cpt:= 0 to Pred(Length(FPoints)) do
FColor:= AColor;
end;
-procedure T_Espace.SetPosY(const AValue: Integer);
+procedure T_Espace.SetPosY(const AValue: Single);
begin
if FPosY<> AValue
then
@@ -740,7 +741,7 @@ begin
FColor:= AColor;
end;
-constructor T_TraitStyle.Create(AEpais: Integer; AColor: Tfpgcolor; AStyle: TfpgLineStyle);
+constructor T_TraitStyle.Create(AEpais: Single; AColor: Tfpgcolor; AStyle: TfpgLineStyle);
begin
inherited Create;
FEpais:= AEpais;
diff --git a/extras/contributed/report_tool/reportengine/u_imprime.pas b/extras/contributed/report_tool/reportengine/u_imprime.pas
index 02c1f1a5..415f8590 100644
--- a/extras/contributed/report_tool/reportengine/u_imprime.pas
+++ b/extras/contributed/report_tool/reportengine/u_imprime.pas
@@ -34,6 +34,7 @@ type
T_Imprime = class(TObject)
private
+ OldSeparator: Char;
FVersion: Char;
FPapier: TPapier;
FTypePapier: TTypePapier;
@@ -49,13 +50,13 @@ type
FNmSection: Integer;
FNmPage: Integer;
FNmPageSect: Integer;
- FPosRef: TPoint; // absolute writting position
- FEnTeteHeight: Integer; // end of text vertical position in the header
- FPageHeight: Integer; // end of text vertical position in the page
- FPiedHeight: Integer; // beginning of text vertical position in the footer
+ FPosRef: TRefPos; // absolute writting position
+ FEnTeteHeight: Single; // end of text vertical position in the header
+ FPageHeight: Single; // end of text vertical position in the page
+ FPiedHeight: Single; // beginning of text vertical position in the footer
FGroupe: Boolean;
FDefaultFile: string;
- function Dim2Pixels(Value: Single): Integer;
+ function Dim2Pixels(Value: Single): Single;
function AddLineBreaks(const Txt: TfpgString; AMaxLineWidth: integer; AFnt: TfpgFont): string;
function TxtHeight(AWid: Integer; const ATxt: TfpgString; AFnt: TfpgFont; ALSpace: Integer= 2): Integer;
function ConvertitEnAlpha(Valeur: Integer): string;
@@ -65,18 +66,18 @@ type
procedure PrepareFormat;
procedure CreateVisu;
procedure ImprimePage(PageNumero: Integer);
- procedure DecaleLignesPied(Decalage: Integer);
- procedure DecaleLigne(Decalage: Integer);
- procedure DecaleGroupe(Decalage: Integer);
- procedure EcritLigne(PosX,PosY,Colonne,Texte,FonteNum,FondNum,BordNum,InterL: Integer;
+ procedure DecaleLignesPied(Decalage: Single);
+ procedure DecaleLigne(Decalage: Single);
+ procedure DecaleGroupe(Decalage: Single);
+ procedure EcritLigne(PosX,PosY: Single; Colonne,Texte,FonteNum,FondNum,BordNum,InterL: Integer;
TxtFlags: TFTextFlags; Zone: TZone);
- procedure EcritNum(PosX,PosY,Colonne,TexteNum,TexteTot,FonteNum,FondNum,BordNum,InterL: Integer;
+ procedure EcritNum(PosX,PosY: Single; Colonne,TexteNum,TexteTot,FonteNum,FondNum,BordNum,InterL: Integer;
TxtFlags: TFTextFlags; Total,Alpha: Boolean; Zone: TZone; SPNum: TSectPageNum);
- procedure InsereEspace(PosY,Colonne,EspHeight,FondNum: Integer; Zone: TZone);
+ procedure InsereEspace(PosY: Single; Colonne: Integer; EspHeight: Single; FondNum: Integer; Zone: TZone);
procedure FinLigne(Zone: TZone);
procedure TraceCadre(StTrait: Integer; Zone: TZone);
- procedure TraceTrait(XDebut,YDebut,XFin,YFin,StTrait: Integer);
- procedure TraceTraitHoriz(XDebut,YDebut,Colonne,XFin,StTrait: Integer; Zone: TZone);
+ procedure TraceTrait(XDebut,YDebut,XFin,YFin: Single; StTrait: Integer);
+ procedure TraceTraitHoriz(XDebut,YDebut: Single; Colonne: Integer; XFin: Single; StTrait: Integer; Zone: TZone);
procedure PaintSurface(Points: T_Points; Couleur: TfpgColor);
function GetTitreSection: string;
procedure SetTitreSection(ATitre: string);
@@ -108,7 +109,7 @@ type
// returns the number allocated to the font
// FtNom = FontDesc of the font
// FtColor = font color
- function StyleTrait(StEpais: Integer; StColor: Tfpgcolor; StStyle: TfpgLineStyle): Integer;
+ function StyleTrait(StEpais: Single; StColor: Tfpgcolor; StStyle: TfpgLineStyle): Integer;
// returns the number allocated to the line style
// StEpais = thickness of the line in pixels
// StColor = line color
@@ -334,18 +335,18 @@ type
FPage: Integer;
FFont: Integer;
FSize: string;
- FPosX: Integer;
- FPosY: Integer;
- FLarg: Integer;
+ FPosX: Single;
+ FPosY: Single;
+ FLarg: Single;
FText: string;
FColor: TfpgColor;
public
property PageId: Integer read FPage write FPage;
property FontName: Integer read FFont write FFont;
property FontSize: string read FSize write FSize;
- property TextPosX: Integer read FPosX write FPosX;
- property TextPosY: Integer read FPosY write FPosY;
- property TextLarg: Integer read FLarg write FLarg;
+ property TextPosX: Single read FPosX write FPosX;
+ property TextPosY: Single read FPosY write FPosY;
+ property TextLarg: Single read FLarg write FLarg;
property Ecriture: string read FText write FText;
property Couleur: TfpgColor read FColor write FColor;
end;
@@ -353,11 +354,11 @@ type
TPdfRect = class(TPdfElement)
private
FPage: Integer;
- FEpais: Integer;
- FGauche: Integer;
- FBas: Integer;
- FHaut: Integer;
- FLarg: Integer;
+ FEpais: Single;
+ FGauche: Single;
+ FBas: Single;
+ FHaut: Single;
+ FLarg: Single;
FColor: Integer;
FFill: Boolean;
FStroke: Boolean;
@@ -365,11 +366,11 @@ type
protected
public
property PageId: Integer read FPage write FPage;
- property RectEpais: Integer read FEpais write FEpais;
- property RectGauche: Integer read FGauche write FGauche;
- property RectBas: Integer read FBas write FBas;
- property RectHaut: Integer read FHaut write FBas;
- property RectLarg: Integer read FLarg write FLarg;
+ property RectEpais: Single read FEpais write FEpais;
+ property RectGauche: Single read FGauche write FGauche;
+ property RectBas: Single read FBas write FBas;
+ property RectHaut: Single read FHaut write FHaut;
+ property RectLarg: Single read FLarg write FLarg;
property RectCouleur: Integer read FColor write FColor;
property RectEmplit: Boolean read FFill write FFill;
property RectTrace: Boolean read FStroke write FStroke;
@@ -379,21 +380,21 @@ type
TPdfLine = class(TPdfElement)
private
FPage: Integer;
- FEpais: Integer;
- FStartX: Integer;
- FStartY: Integer;
- FEndX: Integer;
- FEndY: Integer;
+ FEpais: Single;
+ FStartX: Single;
+ FStartY: Single;
+ FEndX: Single;
+ FEndY: Single;
FColor: Integer;
FStyle: TfpgLineStyle;
protected
public
property PageId: Integer read FPage write FPage;
- property LineEpais: Integer read FEpais write FEpais;
- property LineStartX: Integer read FSTartX write FStartX;
- property LineStartY: Integer read FStartY write FStartY;
- property LineEndX: Integer read FEndX write FEndX;
- property LineEndY: Integer read FEndY write FEndY;
+ property LineEpais: Single read FEpais write FEpais;
+ property LineStartX: Single read FSTartX write FStartX;
+ property LineStartY: Single read FStartY write FStartY;
+ property LineEndX: Single read FEndX write FEndX;
+ property LineEndY: Single read FEndY write FEndY;
property LineColor: Integer read FColor write FColor;
property LineStyle: TfpgLineStyle read FStyle write FStyle;
end;
@@ -444,13 +445,13 @@ const
PPI= 72;
Cent= 100;
-function T_Imprime.Dim2Pixels(Value: Single): Integer;
+function T_Imprime.Dim2Pixels(Value: Single): Single;
begin
if FMesure= msMM
then
- Result:= Round(Value*PPI/InchToMM)
+ Result:= Value*PPI/InchToMM
else
- Result:= Trunc(Value*PPI);
+ Result:= Value*PPI;
end;
function T_Imprime.AddLineBreaks(const Txt: TfpgString; AMaxLineWidth: integer; AFnt: TfpgFont): string;
@@ -552,7 +553,8 @@ end;
procedure T_Imprime.PrepareFormat;
var
- TempH,TempW,TempT,TempL,TempR,TempB: Integer;
+ TempH,TempW: Integer;
+ TempT,TempL,TempR,TempB: Single;
begin
with FPapier do
begin
@@ -844,7 +846,7 @@ with T_Section(Sections[Pred(NumeroSection)]) do
end;
end;
-procedure T_Imprime.DecaleLignesPied(Decalage: Integer);
+procedure T_Imprime.DecaleLignesPied(Decalage: Single);
var
Cpt: Integer;
Cmd: T_Commande;
@@ -870,7 +872,7 @@ with T_Section(Sections[Pred(NumeroSection)]) do
end;
end;
-procedure T_Imprime.DecaleLigne(Decalage: Integer);
+procedure T_Imprime.DecaleLigne(Decalage: Single);
var
Cpt: Integer;
Cmd: T_Commande;
@@ -886,7 +888,7 @@ with ALigne do
end;
end;
-procedure T_Imprime.DecaleGroupe(Decalage: Integer);
+procedure T_Imprime.DecaleGroupe(Decalage: Single);
var
Cpt: Integer;
Cmd: T_Commande;
@@ -902,10 +904,11 @@ with AGroupe do
end;
end;
-procedure T_Imprime.EcritLigne(PosX,PosY,Colonne,Texte,FonteNum,FondNum,BordNum,InterL: Integer;
+procedure T_Imprime.EcritLigne(PosX,PosY: Single; Colonne,Texte,FonteNum,FondNum,BordNum,InterL: Integer;
TxtFlags: TFTextFlags; Zone: TZone);
var
- PosH,PosV,HTxt,HautTxt,IntlInt,IntLSup,IntLInf,Half,CoulTrait,EpaisTrait,Cpt: Integer;
+ PosH,PosV,IntlInt,IntLSup,IntLInf,EpaisTrait: Single;
+ HTxt,HautTxt,Half,CoulTrait,Cpt: Integer;
FinDeLigne,UseCurFont: Boolean;
Fnt: TfpgFont;
StylTrait: TfpgLineStyle;
@@ -936,12 +939,12 @@ with T_Section(Sections[Pred(NumeroSection)]) do
IntLInf:= T_Interligne(Interlignes[FInterLCourante]).GetInf;
if Colonne> -1
then
- HautTxt:= TxtHeight(T_Colonne(Colonnes[Colonne]).GetTextWidth,Textes[Texte],Fnt,IntlInt)+IntLSup+IntLInf
+ HautTxt:= TxtHeight(Round(T_Colonne(Colonnes[Colonne]).GetTextWidth),Textes[Texte],Fnt,Round(IntlInt))+Round(IntLSup+IntLInf)
else
- HautTxt:= TxtHeight(Paper.W,Textes[Texte],Fnt,IntlInt)+IntLSup+IntLInf;
+ HautTxt:= TxtHeight(Paper.W,Textes[Texte],Fnt,Round(IntlInt))+Round(IntLSup+IntLInf);
if (Colonne> -1) and (BordNum> -1)
then
- Half:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetEpais div 2
+ Half:= Round(T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetEpais) div 2
else
Half:= 0;
case FPreparation of
@@ -1082,7 +1085,7 @@ with T_Section(Sections[Pred(NumeroSection)]) do
PosH:= PosH+T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[Texte])-T_Colonne(Colonnes[ColDefaut]).ColMargin;
if (txtHCenter in TxtFlags)
then
- PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[Texte])) div 2;
+ PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[Texte]))/2;
end
else
if PosX> 0
@@ -1103,7 +1106,7 @@ with T_Section(Sections[Pred(NumeroSection)]) do
PosH:= PosH+T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[Texte])-T_Colonne(Colonnes[ColDefaut]).ColMargin;
if (txtHCenter in TxtFlags)
then
- PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[Texte])) div 2;
+ PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[Texte]))/2;
end;
FPosRef.X:= PosH+Fnt.TextWidth(Textes[Texte]+' ');
ALigne.LoadTexte(PosH,PosV,Colonne,Texte,FonteNum,HTxt,FondNum,BordNum,InterL,UseCurFont,TxtFlags);
@@ -1128,30 +1131,30 @@ with T_Section(Sections[Pred(NumeroSection)]) do
SetColor(T_Fond(Fonds[FondNum]).GetColor)
else
SetColor(GetColor);
- FillRectangle(ColPos,PosY-IntLSup,ColWidth,HautTxt);
+ FillRectangle(Round(ColPos),Round(PosY-IntLSup),Round(ColWidth),HautTxt);
if BordNum> -1
then
with T_Bord(Bords[BordNum]) do
begin
- SetLineStyle(T_TraitStyle(TraitStyles[GetStyle]).GetEpais,T_TraitStyle(TraitStyles[GetStyle]).GetStyle);
+ SetLineStyle(Round(T_TraitStyle(TraitStyles[GetStyle]).GetEpais),T_TraitStyle(TraitStyles[GetStyle]).GetStyle);
SetColor(T_TraitStyle(TraitStyles[GetStyle]).GetColor);
if bcGauche in GetFlags
then
- DrawLine(ColPos+Half,PosY-IntLSup,ColPos+Half,PosY-IntLSup+HautTxt);
+ DrawLine(Round(ColPos)+Half,Round(PosY-IntLSup),Round(ColPos)+Half,Round(PosY-IntLSup)+HautTxt);
if bcDroite in GetFlags
then
- DrawLine(ColPos+ColWidth-Succ(Half),PosY-IntLSup,ColPos+ColWidth-Succ(Half),PosY-IntLSup+HautTxt);
+ DrawLine(Round(ColPos+ColWidth)-Succ(Half),Round(PosY-IntLSup),Round(ColPos+ColWidth)-Succ(Half),Round(PosY-IntLSup)+HautTxt);
if bcHaut in GetFlags
then
- DrawLine(ColPos,PosY-IntLSup+Half,ColPos+ColWidth,PosY-IntLSup+Half);
+ DrawLine(Round(ColPos),Round(PosY-IntLSup)+Half,Round(ColPos+ColWidth),Round(PosY-IntLSup)+Half);
if bcBas in GetFlags
then
- DrawLine(ColPos,PosY-IntLSup+HautTxt-Half,ColPos+ColWidth,PosY-IntLSup+HautTxt-Half);
+ DrawLine(Round(ColPos),Round(PosY-IntLSup)+HautTxt-Half,Round(ColPos+ColWidth),Round(PosY-IntLSup)+HautTxt-Half);
end;
- DrawText(GetTextPos,PosY,GetTextWidth,0,Textes[Texte],TxtFlags,IntlInt);
+ DrawText(Round(GetTextPos),Round(PosY),Round(GetTextWidth),0,Textes[Texte],TxtFlags,Round(IntlInt));
end
else
- DrawText(PosX,PosY-Fnt.Ascent,Textes[Texte],TxtFlags);
+ DrawText(Round(PosX),Round(PosY)-Fnt.Ascent,Textes[Texte],TxtFlags);
end;
ppFichierPDF:
if Colonne> -1
@@ -1271,7 +1274,7 @@ with T_Section(Sections[Pred(NumeroSection)]) do
TextPosX:= ColPos+ColWidth-ColMargin-Fnt.TextWidth(Textes[Texte]);
if (txtHCenter in TxtFlags)
then
- TextPosX:= GetTextPos+(ColWidth-Fnt.TextWidth(Textes[Texte])) div 2;
+ TextPosX:= GetTextPos+(ColWidth-Fnt.TextWidth(Textes[Texte]))/2;
TextPosY:= Paper.H-PosY-Fnt.Ascent;
TextLarg:= ColWidth;
Ecriture:= Textes[Texte];
@@ -1283,7 +1286,7 @@ with T_Section(Sections[Pred(NumeroSection)]) do
Wraplst:= TStringList.Create;
Wraplst.Text:= Textes[Texte];
for Cpt:= 0 to Pred(Wraplst.Count) do
- Wraplst[Cpt]:= AddLineBreaks(Wraplst[Cpt],GetTextWidth,Fnt);
+ Wraplst[Cpt]:= AddLineBreaks(Wraplst[Cpt],Round(GetTextWidth),Fnt);
Wraplst.Text:= Wraplst.Text;
for Cpt:= 0 to Pred(Wraplst.Count) do
begin
@@ -1300,7 +1303,7 @@ with T_Section(Sections[Pred(NumeroSection)]) do
TextPosX:= ColPos+ColWidth-ColMargin-Fnt.TextWidth(Wraplst[Cpt]);
if (txtHCenter in TxtFlags)
then
- TextPosX:= GetTextPos+(ColWidth-Fnt.TextWidth(Wraplst[Cpt])) div 2;
+ TextPosX:= GetTextPos+(ColWidth-Fnt.TextWidth(Wraplst[Cpt]))/2;
TextPosY:= Paper.H-PosY-Fnt.Ascent-(Fnt.Height+IntlInt)*Cpt;
TextLarg:= ColWidth;
Ecriture:= Wraplst[Cpt];
@@ -1330,7 +1333,7 @@ with T_Section(Sections[Pred(NumeroSection)]) do
end;
end;
-procedure T_Imprime.EcritNum(PosX,PosY,Colonne,TexteNum,TexteTot,FonteNum,FondNum,BordNum,InterL: Integer;
+procedure T_Imprime.EcritNum(PosX,PosY: Single; Colonne,TexteNum,TexteTot,FonteNum,FondNum,BordNum,InterL: Integer;
TxtFlags: TFTextFlags; Total,Alpha: Boolean; Zone: TZone; SPNum: TSectPageNum);
function BuildChaine: string;
@@ -1376,7 +1379,8 @@ procedure T_Imprime.EcritNum(PosX,PosY,Colonne,TexteNum,TexteTot,FonteNum,FondNu
end;
var
- PosH,PosV,HTxt,HautTxt,IntlInt,IntLSup,IntLInf,Half,CoulTrait,EpaisTrait: Integer;
+ PosH,PosV,IntlInt,IntLSup,IntLInf,EpaisTrait: Single;
+ HTxt,HautTxt,Half,CoulTrait: Integer;
FinDeLigne,UseCurFont: Boolean;
Fnt: TfpgFont;
StylTrait: TfpgLineStyle;
@@ -1407,12 +1411,12 @@ with T_Section(Sections[Pred(NumeroSection)]) do
IntLInf:= T_Interligne(Interlignes[FInterLCourante]).GetInf;
if Colonne> -1
then
- HautTxt:= TxtHeight(T_Colonne(Colonnes[Colonne]).GetTextWidth,Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0',Fnt,IntlInt)+IntLSup+IntLInf
+ HautTxt:= TxtHeight(Round(T_Colonne(Colonnes[Colonne]).GetTextWidth),Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0',Fnt,Round(IntlInt))+Round(IntLSup+IntLInf)
else
- HautTxt:= TxtHeight(Paper.W,Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0',Fnt,IntlInt)+IntLSup+IntLInf;
+ HautTxt:= TxtHeight(Paper.W,Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0',Fnt,Round(IntlInt))+Round(IntLSup+IntLInf);
if (Colonne> -1) and (BordNum> -1)
then
- Half:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetEpais div 2;
+ Half:= Round(T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetEpais) div 2;
case FPreparation of
ppPrepare:
begin
@@ -1491,9 +1495,9 @@ with T_Section(Sections[Pred(NumeroSection)]) do
then
if Total
then
- PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0 ')) div 2
+ PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0 '))/2
else
- PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 ')) div 2;
+ PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 '))/2;
end
else
if PosX> 0
@@ -1518,9 +1522,9 @@ with T_Section(Sections[Pred(NumeroSection)]) do
then
if Total
then
- PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0 ')) div 2
+ PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0 '))/2
else
- PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 ')) div 2;
+ PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 '))/2;
end;
FPosRef.X:= PosH+Fnt.TextWidth(Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0 ');
ALigne.LoadNumero(PosH,PosV,Colonne,TexteNum,TexteTot,FonteNum,HTxt,FondNum,BordNum,InterL,UseCurFont,TxtFlags,Total,Alpha,SPNum);
@@ -1546,30 +1550,30 @@ with T_Section(Sections[Pred(NumeroSection)]) do
SetColor(T_Fond(Fonds[FondNum]).GetColor)
else
SetColor(GetColor);
- FillRectangle(ColPos,PosY-IntLSup,ColWidth,HautTxt);
+ FillRectangle(Round(ColPos),Round(PosY-IntLSup),Round(ColWidth),HautTxt);
if BordNum> -1
then
with T_Bord(Bords[BordNum]) do
begin
- SetLineStyle(T_TraitStyle(TraitStyles[GetStyle]).GetEpais,T_TraitStyle(TraitStyles[GetStyle]).GetStyle);
+ SetLineStyle(Round(T_TraitStyle(TraitStyles[GetStyle]).GetEpais),T_TraitStyle(TraitStyles[GetStyle]).GetStyle);
SetColor(T_TraitStyle(TraitStyles[GetStyle]).GetColor);
if bcGauche in GetFlags
then
- DrawLine(ColPos+Half,PosY-IntLSup,ColPos+Half,PosY-IntLSup+HautTxt);
+ DrawLine(Round(ColPos)+Half,Round(PosY-IntLSup),Round(ColPos)+Half,Round(PosY-IntLSup)+HautTxt);
if bcDroite in GetFlags
then
- DrawLine(ColPos+ColWidth-Half,PosY-IntLSup,ColPos+ColWidth-Half,PosY-IntLSup+HautTxt);
+ DrawLine(Round(ColPos+ColWidth)-Half,Round(PosY-IntLSup),Round(ColPos+ColWidth)-Half,Round(PosY-IntLSup)+HautTxt);
if bcHaut in GetFlags
then
- DrawLine(ColPos,PosY-IntLSup+Half,ColPos+ColWidth,PosY-IntLSup+Half);
+ DrawLine(Round(ColPos),Round(PosY-IntLSup)+Half,Round(ColPos+ColWidth),Round(PosY-IntLSup)+Half);
if bcBas in GetFlags
then
- DrawLine(ColPos,PosY-IntLSup+HautTxt-Succ(Half),ColPos+ColWidth,PosY-IntLSup+HautTxt-Succ(Half));
+ DrawLine(Round(ColPos),Round(PosY-IntLSup)+HautTxt-Succ(Half),Round(ColPos+ColWidth),Round(PosY-IntLSup)+HautTxt-Succ(Half));
end;
- DrawText(GetTextPos,PosY,GetTextWidth,0,Chaine,TxtFlags,IntlInt);
+ DrawText(Round(GetTextPos),Round(PosY),Round(GetTextWidth),0,Chaine,TxtFlags,Round(IntlInt));
end
else
- DrawText(PosX,PosY,Chaine,TxtFlags);
+ DrawText(Round(PosX),Round(PosY),Chaine,TxtFlags);
end;
ppFichierPDF:
begin
@@ -1688,7 +1692,7 @@ with T_Section(Sections[Pred(NumeroSection)]) do
TextPosX:= ColPos+ColWidth-ColMargin-Fnt.TextWidth(Chaine);
if (txtHCenter in TxtFlags)
then
- TextPosX:= GetTextPos+(ColWidth-Fnt.TextWidth(Chaine)) div 2;
+ TextPosX:= GetTextPos+(ColWidth-Fnt.TextWidth(Chaine))/2;
TextPosY:= Paper.H-PosY-Fnt.Ascent;
TextLarg:= ColWidth;
Ecriture:= Chaine;
@@ -1716,9 +1720,9 @@ with T_Section(Sections[Pred(NumeroSection)]) do
end;
end;
-procedure T_Imprime.InsereEspace(PosY,Colonne,EspHeight,FondNum: Integer; Zone: TZone);
+procedure T_Imprime.InsereEspace(PosY: Single; Colonne: Integer; EspHeight: Single; FondNum: Integer; Zone: TZone);
var
- PosV: Integer;
+ PosV: Single;
begin
with T_Section(Sections[Pred(NumeroSection)]) do
begin
@@ -1774,7 +1778,7 @@ with T_Section(Sections[Pred(NumeroSection)]) do
SetColor(T_Fond(Fonds[FondNum]).GetColor)
else
SetColor(GetColor);
- FillRectangle(ColPos,PosV,ColWidth,EspHeight);
+ FillRectangle(Round(ColPos),Round(PosV),Round(ColWidth),Round(EspHeight));
end;
ppFichierPDF:
begin
@@ -1828,7 +1832,7 @@ end;
procedure T_Imprime.TraceCadre(StTrait: Integer; Zone: TZone);
var
- Half: Integer;
+ Half,MargeL,MargeR,MargeT,MargeB,EnTeteH,PiedH: Integer;
begin
with T_Section(Sections[Pred(NumeroSection)]) do
case FPreparation of
@@ -1839,41 +1843,49 @@ with T_Section(Sections[Pred(NumeroSection)]) do
begin
with T_TraitStyle(TraitStyles[StTrait]) do
begin
- SetLineStyle(GetEpais,GetStyle);
- Half:= GetEpais div 2;
+ SetLineStyle(Round(GetEpais),GetStyle);
+ Half:= Round(GetEpais) div 2;
SetColor(GetColor);
end;
with FMargeCourante do
+ begin
+ MargeL:= Round(L);
+ MargeR:= Round(R);
+ MargeT:= Round(T);
+ MargeB:= Round(B);
+ EnTeteH:= Round(FEnTeteHeight);
+ PiedH:= Round(FPiedHeight);
case Zone of
zEnTete:
begin
- DrawLine(L+Half,T,L+Half,T+FEnTeteHeight); // gauche
- DrawLine(R-Half,T,R-Half,T+FEnTeteHeight); // droite
- DrawLine(L,T+Half,R,T+Half); // haute
- DrawLine(L,T+FEnTeteHeight-Half,R,T+FEnTeteHeight-Half); // basse
+ DrawLine(MargeL+Half,MargeT,MargeL+Half,MargeT+EnTeteH); // gauche
+ DrawLine(MargeR-Half,MargeT,MargeR-Half,MargeT+EnTeteH); // droite
+ DrawLine(MargeL,MargeT+Half,MargeR,MargeT+Half); // haute
+ DrawLine(MargeL,MargeT+EnTeteH-Half,MargeR,MargeT+EnTeteH-Half); // basse
end;
zPage:
begin
- DrawLine(L+Half,T+FEnTeteHeight,L+Half,B-FPiedHeight); // gauche
- DrawLine(R-Half,T+FEnTeteHeight,R-Half,B-FPiedHeight); // droite
- DrawLine(L,T+FEnTeteHeight+Half,R,T+FEnTeteHeight+Half); // haute
- DrawLine(L,B-FPiedHeight-Half,R,B-FPiedHeight-Half); // basse
+ DrawLine(MargeL+Half,MargeT+EnTeteH,MargeL+Half,MargeB-PiedH); // gauche
+ DrawLine(MargeR-Half,MargeT+EnTeteH,MargeR-Half,MargeB-PiedH); // droite
+ DrawLine(MargeL,MargeT+EnTeteH+Half,MargeR,MargeT+EnTeteH+Half); // haute
+ DrawLine(MargeL,MargeB-PiedH-Half,MargeR,MargeB-PiedH-Half); // basse
end;
zPied:
begin
- DrawLine(L+Half,B-FPiedHeight,L+Half,B); // gauche
- DrawLine(R-Half,B-FPiedHeight,R-Half,B); // droite
- DrawLine(L,B-FPiedHeight+Half,R,B-FPiedHeight+Half); // haute
- DrawLine(L,B-Half,R,B-Half); // basse
+ DrawLine(MargeL+Half,MargeB-PiedH,MargeL+Half,MargeB); // gauche
+ DrawLine(MargeR-Half,MargeB-PiedH,MargeR-Half,MargeB); // droite
+ DrawLine(MargeL,MargeB-PiedH+Half,MargeR,MargeB-PiedH+Half); // haute
+ DrawLine(MargeL,MargeB-Half,MargeR,MargeB-Half); // basse
end;
zMarges:
begin
- DrawLine(L+Half,T,L+Half,B-Succ(Half)); // gauche
- DrawLine(R-Half,T,R-Half,B-Succ(Half)); // droite
- DrawLine(L,T+Half,R,T+Half); // haute
- DrawLine(L,B-Half,R,B-Half); // basse
+ DrawLine(MargeL+Half,MargeT,MargeL+Half,MargeB-Succ(Half)); // gauche
+ DrawLine(MargeR-Half,MargeT,MargeR-Half,MargeB-Succ(Half)); // droite
+ DrawLine(MargeL,MargeT+Half,MargeR,MargeT+Half); // haute
+ DrawLine(MargeL,MargeB-Half,MargeR,MargeB-Half); // basse
end;
end;
+ end;
end;
ppFichierPDF:
begin
@@ -1926,7 +1938,7 @@ with T_Section(Sections[Pred(NumeroSection)]) do
end;
end;
-procedure T_Imprime.TraceTrait(XDebut,YDebut,XFin,YFin,StTrait: Integer);
+procedure T_Imprime.TraceTrait(XDebut,YDebut,XFin,YFin: Single; StTrait: Integer);
begin
with T_Section(Sections[Pred(NumeroSection)]) do
case FPreparation of
@@ -1937,10 +1949,10 @@ with T_Section(Sections[Pred(NumeroSection)]) do
begin
with T_TraitStyle(TraitStyles[StTrait]) do
begin
- SetLineStyle(GetEpais,GetStyle);
+ SetLineStyle(Round(GetEpais),GetStyle);
SetColor(GetColor);
end;
- DrawLine(XDebut,YDebut,XFin,YFin);
+ DrawLine(Round(XDebut),Round(YDebut),Round(XFin),Round(YFin));
end;
ppFichierPdf:
begin
@@ -1961,9 +1973,9 @@ with T_Section(Sections[Pred(NumeroSection)]) do
end;
end;
-procedure T_Imprime.TraceTraitHoriz(XDebut,YDebut,Colonne,XFin,StTrait: Integer; Zone: TZone);
+procedure T_Imprime.TraceTraitHoriz(XDebut,YDebut: Single; Colonne: Integer; XFin: Single; StTrait: Integer; Zone: TZone);
var
- PosV: Integer;
+ PosV: Single;
begin
with T_Section(Sections[Pred(NumeroSection)]) do
case FPreparation of
@@ -2008,10 +2020,10 @@ with T_Section(Sections[Pred(NumeroSection)]) do
begin
with T_TraitStyle(TraitStyles[StTrait]) do
begin
- SetLineStyle(GetEpais,GetStyle);
+ SetLineStyle(Round(GetEpais),GetStyle);
SetColor(GetColor);
end;
- DrawLine(XDebut,YDebut,XFin,YDebut);
+ DrawLine(Round(XDebut),Round(YDebut),Round(XFin),Round(YDebut));
end;
ppFichierPdf:
begin
@@ -2036,6 +2048,7 @@ procedure T_Imprime.PaintSurface(Points: T_Points; Couleur: TfpgColor);
var
OldColor: TfpgColor;
Cpt: Integer;
+ Pts: array of TPoint;
begin
with T_Section(Sections[Pred(NumeroSection)]) do
case FPreparation of
@@ -2045,7 +2058,13 @@ with T_Section(Sections[Pred(NumeroSection)]) do
begin
OldColor:= FCanevas.Color;
FCanevas.SetColor(Couleur);
- FCanevas.DrawPolygon(Points);
+ SetLength(Pts,Length(Points));
+ for Cpt:= 0 to Pred(Length(Pts)) do
+ begin
+ Pts[Cpt].X:= Round(Points[Cpt].X);
+ Pts[Cpt].Y:= Round(Points[Cpt].Y);
+ end;
+ FCanevas.DrawPolygon(Pts);
FCanevas.SetColor(OldColor);
end;
ppFichierPdf:
@@ -2088,6 +2107,8 @@ end;
constructor T_Imprime.Create;
begin
inherited Create;
+OldSeparator:= DecimalSeparator;
+DecimalSeparator:= '.';
Sections:= TList.Create;
Fontes:= TList.Create;
Interlignes:= TList.Create;
@@ -2141,6 +2162,7 @@ then
Bords.Free;
Textes.Free;
ALigne.Free;
+DecimalSeparator:= OldSeparator;
inherited;
end;
@@ -2214,7 +2236,7 @@ end;
procedure T_Imprime.Section(MgGauche,MgDroite,MgHaute,MgBasse: Single; Retrait: Single;
IniOriente: TOrient= oPortrait);
var
- CMargin: Integer;
+ CMargin: Single;
begin
case FPreparation of
ppPrepare:
@@ -2282,7 +2304,7 @@ AFonte:= T_Fonte.Create(FtNom,FtColor);
Result:= Fontes.Add(AFonte);
end;
-function T_Imprime.StyleTrait(StEpais: Integer; StColor: Tfpgcolor; StStyle: TfpgLineStyle): Integer;
+function T_Imprime.StyleTrait(StEpais: Single; StColor: Tfpgcolor; StStyle: TfpgLineStyle): Integer;
begin
ATraitStyle:= T_TraitStyle.Create(StEpais,StColor,StStyle);
Result:= TraitStyles.Add(ATraitStyle);
@@ -2296,7 +2318,7 @@ end;
function T_Imprime.Colonne(ClnPos,ClnWidth: Single; ClnMargin: Single= 0; ClnColor: TfpgColor= clWhite): Integer;
var
- CPos,CWidth,CMargin: Integer;
+ CPos,CWidth,CMargin: Single;
begin
CPos:= Dim2Pixels(ClnPos);
with T_Section(Sections[Pred(NumeroSection)]) do
@@ -2317,134 +2339,125 @@ end;
procedure T_Imprime.EcritEnTete(Horiz,Verti: Single; Texte: string; ColNum: Integer= 0; FonteNum: Integer= 0;
InterNum: Integer= 0; CoulFdNum: Integer= -1; BordNum: Integer= -1);
var
- X,Y,RefTexte: Integer;
+ RefTexte: Integer;
Flags: TFTextFlags;
begin
Flags:= [];
if Horiz< 0
then
begin
- X:= Round(Horiz);
- case X of
- cnLeft:
- Include(Flags,txtLeft);
- cnCenter:
- Include(Flags,txtHCenter);
- cnRight:
- Include(Flags,txtRight);
- end;
+ if Horiz= cnLeft
+ then
+ Include(Flags,txtLeft);
+ if Horiz= cnCenter
+ then
+ Include(Flags,txtHCenter);
+ if Horiz= cnRight
+ then
+ Include(Flags,txtRight);
end
else
- X:= Dim2Pixels(Horiz);
-if Verti< 0
+ Horiz:= Dim2Pixels(Horiz);
+if Verti> 0
then
- Y:= Round(Verti)
-else
- Y:= Dim2Pixels(Verti);
+ Verti:= Dim2Pixels(Verti);
RefTexte:= Textes.IndexOf(Texte);
if RefTexte= -1
then
RefTexte:= Textes.Add(Texte);
-EcritLigne(X,Y,ColNum,RefTexte,FonteNum,CoulFdNum,BordNum,InterNum,Flags,ZEnTete);
+EcritLigne(Horiz,Verti,ColNum,RefTexte,FonteNum,CoulFdNum,BordNum,InterNum,Flags,ZEnTete);
end;
procedure T_Imprime.EcritPage(Horiz,Verti: Single; Texte: string; ColNum: Integer= 0; FonteNum: Integer= 0;
InterNum: Integer= 0; CoulFdNum: Integer= -1; BordNum: Integer= -1);
var
- X,Y,RefTexte: Integer;
+ RefTexte: Integer;
Flags: TFTextFlags;
begin
Flags:= [];
if Horiz< 0
then
begin
- X:= Round(Horiz);
- Include(Flags,txtWrap);
- case X of
- cnLeft:
- Include(Flags,txtLeft);
- cnCenter:
- Include(Flags,txtHCenter);
- cnRight:
- Include(Flags,txtRight);
- end;
+ if Horiz= cnLeft
+ then
+ Include(Flags,txtLeft);
+ if Horiz= cnCenter
+ then
+ Include(Flags,txtHCenter);
+ if Horiz= cnRight
+ then
+ Include(Flags,txtRight);
end
else
- X:= Dim2Pixels(Horiz);
-if Verti< 0
+ Horiz:= Dim2Pixels(Horiz);
+if Verti> 0
then
- Y:= Round(Verti)
-else
- Y:= Dim2Pixels(Verti);
+ Verti:= Dim2Pixels(Verti);
RefTexte:= Textes.IndexOf(Texte);
if RefTexte= -1
then
RefTexte:= Textes.Add(Texte);
-EcritLigne(X,Y,ColNum,RefTexte,FonteNum,CoulFdNum,BordNum,InterNum,Flags,ZPage);
+EcritLigne(Horiz,Verti,ColNum,RefTexte,FonteNum,CoulFdNum,BordNum,InterNum,Flags,ZPage);
end;
procedure T_Imprime.EcritPied(Horiz,Verti: Single; Texte: string; ColNum: Integer= 0; FonteNum: Integer= 0;
InterNum: Integer= 0; CoulFdNum: Integer= -1; BordNum: Integer= -1);
var
- X,Y,RefTexte: Integer;
+ RefTexte: Integer;
Flags: TFTextFlags;
begin
Flags:= [];
if Horiz< 0
then
begin
- X:= Round(Horiz);
- case X of
- cnLeft:
- Include(Flags,txtLeft);
- cnCenter:
- Include(Flags,txtHCenter);
- cnRight:
- Include(Flags,txtRight);
- end;
+ if Horiz= cnLeft
+ then
+ Include(Flags,txtLeft);
+ if Horiz= cnCenter
+ then
+ Include(Flags,txtHCenter);
+ if Horiz= cnRight
+ then
+ Include(Flags,txtRight);
end
else
- X:= Dim2Pixels(Horiz);
-if Verti< 0
+ Horiz:= Dim2Pixels(Horiz);
+if Verti> 0
then
- Y:= Round(Verti)
-else
- Y:= Dim2Pixels(Verti);
+ Verti:= Dim2Pixels(Verti);
RefTexte:= Textes.IndexOf(Texte);
if RefTexte= -1
then
RefTexte:= Textes.Add(Texte);
-EcritLigne(X,Y,ColNum,RefTexte,FonteNum,CoulFdNum,BordNum,InterNum,Flags,ZPied);
+EcritLigne(Horiz,Verti,ColNum,RefTexte,FonteNum,CoulFdNum,BordNum,InterNum,Flags,ZPied);
end;
procedure T_Imprime.NumSectionEnTete(Horiz,Verti: Single; TexteSect: string= ''; TexteTot: string= '';
Total: Boolean= False; Alpha: Boolean= False; ColNum: Integer= 0; FonteNum: Integer= 0;
InterNum: Integer= 0; CoulFdNum: Integer= -1; BordNum: Integer= -1);
var
- X,Y,RefTextePage,RefTexteTot: Integer;
+ RefTextePage,RefTexteTot: Integer;
Flags: TFTextFlags;
begin
Flags:= [];
if Horiz< 0
then
begin
- X:= Round(Horiz);
- case X of
- cnLeft:
- Include(Flags,txtLeft);
- cnCenter:
- Include(Flags,txtHCenter);
- cnRight:
- Include(Flags,txtRight);
- end;
+ if Horiz= cnLeft
+ then
+ Include(Flags,txtLeft);
+ if Horiz= cnCenter
+ then
+ Include(Flags,txtHCenter);
+ if Horiz= cnRight
+ then
+ Include(Flags,txtRight);
end
else
- X:= Dim2Pixels(Horiz);
-if Verti< 0
+ Horiz:= Dim2Pixels(Horiz);
+if Verti> 0
then
- Y:= Round(Verti)
-else
- Y:= Dim2Pixels(Verti);
+ Verti:= Dim2Pixels(Verti);
RefTextePage:= Textes.IndexOf(TexteSect);
if RefTextePage= -1
then
@@ -2453,37 +2466,35 @@ RefTexteTot:= Textes.IndexOf(TexteTot);
if RefTexteTot= -1
then
RefTexteTot:= Textes.Add(TexteTot);
-EcritNum(X,Y,ColNum,RefTextePage,RefTexteTot,FonteNum,CoulFdNum,BordNum,InterNum,Flags,Total,Alpha,ZEnTete,SectNum);
+EcritNum(Horiz,Verti,ColNum,RefTextePage,RefTexteTot,FonteNum,CoulFdNum,BordNum,InterNum,Flags,Total,Alpha,ZEnTete,SectNum);
end;
procedure T_Imprime.NumSectionPied(Horiz,Verti: Single; TexteSect: string= ''; TexteTot: string= '';
Total: Boolean= False; Alpha: Boolean= False; ColNum: Integer= 0; FonteNum: Integer= 0;
InterNum: Integer= 0;CoulFdNum: Integer= -1; BordNum: Integer= -1);
var
- X,Y,RefTextePage,RefTexteTot: Integer;
+ RefTextePage,RefTexteTot: Integer;
Flags: TFTextFlags;
begin
Flags:= [];
if Horiz< 0
then
begin
- X:= Round(Horiz);
- case X of
- cnLeft:
- Include(Flags,txtLeft);
- cnCenter:
- Include(Flags,txtHCenter);
- cnRight:
- Include(Flags,txtRight);
- end;
+ if Horiz= cnLeft
+ then
+ Include(Flags,txtLeft);
+ if Horiz= cnCenter
+ then
+ Include(Flags,txtHCenter);
+ if Horiz= cnRight
+ then
+ Include(Flags,txtRight);
end
else
- X:= Dim2Pixels(Horiz);
-if Verti< 0
+ Horiz:= Dim2Pixels(Horiz);
+if Verti> 0
then
- Y:= Round(Verti)
-else
- Y:= Dim2Pixels(Verti);
+ Verti:= Dim2Pixels(Verti);
RefTextePage:= Textes.IndexOf(TexteSect);
if RefTextePage= -1
then
@@ -2492,37 +2503,35 @@ RefTexteTot:= Textes.IndexOf(TexteTot);
if RefTexteTot= -1
then
RefTexteTot:= Textes.Add(TexteTot);
-EcritNum(X,Y,ColNum,RefTextePage,RefTexteTot,FonteNum,CoulFdNum,BordNum,InterNum,Flags,Total,Alpha,ZPied,SectNum);
+EcritNum(Horiz,Verti,ColNum,RefTextePage,RefTexteTot,FonteNum,CoulFdNum,BordNum,InterNum,Flags,Total,Alpha,ZPied,SectNum);
end;
procedure T_Imprime.NumPageEnTete(Horiz,Verti: Single; TextePage: string= ''; TexteTotal: string= '';
Total: Boolean= False; ColNum: Integer= 0; FonteNum: Integer= 0; InterNum: Integer= 0;
CoulFdNum: Integer= -1; BordNum: Integer= -1);
var
- X,Y,RefTextePage,RefTexteTot: Integer;
+ RefTextePage,RefTexteTot: Integer;
Flags: TFTextFlags;
begin
Flags:= [];
if Horiz< 0
then
begin
- X:= Round(Horiz);
- case X of
- cnLeft:
- Include(Flags,txtLeft);
- cnCenter:
- Include(Flags,txtHCenter);
- cnRight:
- Include(Flags,txtRight);
- end;
+ if Horiz= cnLeft
+ then
+ Include(Flags,txtLeft);
+ if Horiz= cnCenter
+ then
+ Include(Flags,txtHCenter);
+ if Horiz= cnRight
+ then
+ Include(Flags,txtRight);
end
else
- X:= Dim2Pixels(Horiz);
-if Verti< 0
+ Horiz:= Dim2Pixels(Horiz);
+if Verti> 0
then
- Y:= Round(Verti)
-else
- Y:= Dim2Pixels(Verti);
+ Verti:= Dim2Pixels(Verti);
RefTextePage:= Textes.IndexOf(TextePage);
if RefTextePage= -1
then
@@ -2531,37 +2540,35 @@ RefTexteTot:= Textes.IndexOf(TexteTotal);
if RefTexteTot= -1
then
RefTexteTot:= Textes.Add(TexteTotal);
-EcritNum(X,Y,ColNum,RefTextePage,RefTexteTot,FonteNum,CoulFdNum,BordNum,InterNum,Flags,Total,False,ZEnTete,PageNum);
+EcritNum(Horiz,Verti,ColNum,RefTextePage,RefTexteTot,FonteNum,CoulFdNum,BordNum,InterNum,Flags,Total,False,ZEnTete,PageNum);
end;
procedure T_Imprime.NumPagePied(Horiz,Verti: Single; TextePage: string= ''; TexteTotal: string= '';
Total: Boolean= False; ColNum: Integer= 0; FonteNum: Integer= 0; InterNum: Integer= 0;
CoulFdNum: Integer= -1; BordNum: Integer= -1);
var
- X,Y,RefTextePage,RefTexteTot: Integer;
+ RefTextePage,RefTexteTot: Integer;
Flags: TFTextFlags;
begin
Flags:= [];
if Horiz< 0
then
begin
- X:= Round(Horiz);
- case X of
- cnLeft:
- Include(Flags,txtLeft);
- cnCenter:
- Include(Flags,txtHCenter);
- cnRight:
- Include(Flags,txtRight);
- end;
+ if Horiz= cnLeft
+ then
+ Include(Flags,txtLeft);
+ if Horiz= cnCenter
+ then
+ Include(Flags,txtHCenter);
+ if Horiz= cnRight
+ then
+ Include(Flags,txtRight);
end
else
- X:= Dim2Pixels(Horiz);
-if Verti< 0
+ Horiz:= Dim2Pixels(Horiz);
+if Verti> 0
then
- Y:= Round(Verti)
-else
- Y:= Dim2Pixels(Verti);
+ Verti:= Dim2Pixels(Verti);
RefTextePage:= Textes.IndexOf(TextePage);
if RefTextePage= -1
then
@@ -2570,37 +2577,35 @@ RefTexteTot:= Textes.IndexOf(TexteTotal);
if RefTexteTot= -1
then
RefTexteTot:= Textes.Add(TexteTotal);
-EcritNum(X,Y,ColNum,RefTextePage,RefTexteTot,FonteNum,CoulFdNum,BordNum,InterNum,Flags,Total,False,ZPied,PageNum);
+EcritNum(Horiz,Verti,ColNum,RefTextePage,RefTexteTot,FonteNum,CoulFdNum,BordNum,InterNum,Flags,Total,False,ZPied,PageNum);
end;
procedure T_Imprime.NumPageSectionEnTete(Horiz,Verti: Single; TexteSect: string= ''; TexteTot: string= '';
Total: Boolean= False; Alpha: Boolean= False; ColNum: Integer= 0; FonteNum: Integer= 0;
InterNum: Integer= 0; CoulFdNum: Integer= -1; BordNum: Integer= -1);
var
- X,Y,RefTextePage,RefTexteTot: Integer;
+ RefTextePage,RefTexteTot: Integer;
Flags: TFTextFlags;
begin
Flags:= [];
if Horiz< 0
then
begin
- X:= Round(Horiz);
- case X of
- cnLeft:
- Include(Flags,txtLeft);
- cnCenter:
- Include(Flags,txtHCenter);
- cnRight:
- Include(Flags,txtRight);
- end;
+ if Horiz= cnLeft
+ then
+ Include(Flags,txtLeft);
+ if Horiz= cnCenter
+ then
+ Include(Flags,txtHCenter);
+ if Horiz= cnRight
+ then
+ Include(Flags,txtRight);
end
else
- X:= Dim2Pixels(Horiz);
-if Verti< 0
+ Horiz:= Dim2Pixels(Horiz);
+if Verti> 0
then
- Y:= Round(Verti)
-else
- Y:= Dim2Pixels(Verti);
+ Verti:= Dim2Pixels(Verti);
RefTextePage:= Textes.IndexOf(TexteSect);
if RefTextePage= -1
then
@@ -2609,37 +2614,35 @@ RefTexteTot:= Textes.IndexOf(TexteTot);
if RefTexteTot= -1
then
RefTexteTot:= Textes.Add(TexteTot);
-EcritNum(X,Y,ColNum,RefTextePage,RefTexteTot,FonteNum,CoulFdNum,BordNum,InterNum,Flags,Total,Alpha,ZEnTete,PSectNum);
+EcritNum(Horiz,Verti,ColNum,RefTextePage,RefTexteTot,FonteNum,CoulFdNum,BordNum,InterNum,Flags,Total,Alpha,ZEnTete,PSectNum);
end;
procedure T_Imprime.NumPageSectionPied(Horiz,Verti: Single; TexteSect: string= ''; TexteTot: string= '';
Total: Boolean= False; Alpha: Boolean= False; ColNum: Integer= 0; FonteNum: Integer= 0;
InterNum: Integer= 0; CoulFdNum: Integer= -1; BordNum: Integer= -1);
var
- X,Y,RefTextePage,RefTexteTot: Integer;
+ RefTextePage,RefTexteTot: Integer;
Flags: TFTextFlags;
begin
Flags:= [];
if Horiz< 0
then
begin
- X:= Round(Horiz);
- case X of
- cnLeft:
- Include(Flags,txtLeft);
- cnCenter:
- Include(Flags,txtHCenter);
- cnRight:
- Include(Flags,txtRight);
- end;
+ if Horiz= cnLeft
+ then
+ Include(Flags,txtLeft);
+ if Horiz= cnCenter
+ then
+ Include(Flags,txtHCenter);
+ if Horiz= cnRight
+ then
+ Include(Flags,txtRight);
end
else
- X:= Dim2Pixels(Horiz);
-if Verti< 0
+ Horiz:= Dim2Pixels(Horiz);
+if Verti> 0
then
- Y:= Round(Verti)
-else
- Y:= Dim2Pixels(Verti);
+ Verti:= Dim2Pixels(Verti);
RefTextePage:= Textes.IndexOf(TexteSect);
if RefTextePage= -1
then
@@ -2648,58 +2651,37 @@ RefTexteTot:= Textes.IndexOf(TexteTot);
if RefTexteTot= -1
then
RefTexteTot:= Textes.Add(TexteTot);
-EcritNum(X,Y,ColNum,RefTextePage,RefTexteTot,FonteNum,CoulFdNum,BordNum,InterNum,Flags,Total,Alpha,ZPied,PSectNum);
+EcritNum(Horiz,Verti,ColNum,RefTextePage,RefTexteTot,FonteNum,CoulFdNum,BordNum,InterNum,Flags,Total,Alpha,ZPied,PSectNum);
end;
procedure T_Imprime.TraitHorizEnTete(EspAvant,EspApres: Single; ColNum: Integer= 0; StyleNum: Integer= 0);
-var
- XDeb,YDeb: Integer;
begin
-XDeb:= Dim2Pixels(EspAvant);
-YDeb:= Dim2Pixels(EspApres);
-TraceTraitHoriz(XDeb,YDeb,ColNum,-1,StyleNum,zEntete);
+TraceTraitHoriz(Dim2Pixels(EspAvant),Dim2Pixels(EspApres),ColNum,-1,StyleNum,zEntete);
end;
procedure T_Imprime.TraitHorizPage(EspAvant,EspApres: Single; ColNum: Integer= 0; StyleNum: Integer= 0);
-var
- XDeb,YDeb: Integer;
begin
-XDeb:= Dim2Pixels(EspAvant);
-YDeb:= Dim2Pixels(EspApres);
-TraceTraitHoriz(XDeb,YDeb,ColNum,-1,StyleNum,zPage);
+TraceTraitHoriz(Dim2Pixels(EspAvant),Dim2Pixels(EspApres),ColNum,-1,StyleNum,zPage);
end;
procedure T_Imprime.TraitHorizPied(EspAvant,EspApres: Single; ColNum: Integer= 0; StyleNum: Integer= 0);
-var
- XDeb,YDeb: Integer;
begin
-XDeb:= Dim2Pixels(EspAvant);
-YDeb:= Dim2Pixels(EspApres);
-TraceTraitHoriz(XDeb,YDeb,ColNum,-1,StyleNum,zPied);
+TraceTraitHoriz(Dim2Pixels(EspAvant),Dim2Pixels(EspApres),ColNum,-1,StyleNum,zPied);
end;
procedure T_Imprime.EspaceEnTete(Verti: Single; ColNum: Integer=0; CoulFdNum: Integer= -1);
-var
- H: Integer;
begin
-H:= Dim2Pixels(Verti);
-InsereEspace(-1,ColNum,H,CoulFdNum,zEntete);
+InsereEspace(-1,ColNum,Dim2Pixels(Verti),CoulFdNum,zEntete);
end;
procedure T_Imprime.EspacePage(Verti: Single; ColNum: Integer=0; CoulFdNum: Integer= -1);
-var
- H: Integer;
begin
-H:= Dim2Pixels(Verti);
-InsereEspace(-1,ColNum,H,CoulFdNum,zPage);
+InsereEspace(-1,ColNum,Dim2Pixels(Verti),CoulFdNum,zPage);
end;
procedure T_Imprime.EspacePied(Verti: Single; ColNum: Integer=0; CoulFdNum: Integer= -1);
-var
- H: Integer;
begin
-H:= Dim2Pixels(Verti);
-InsereEspace(-1,ColNum,H,CoulFdNum,zPied);
+InsereEspace(-1,ColNum,Dim2Pixels(Verti),CoulFdNum,zPied);
end;
function T_Imprime.Interligne(ItlSup,ItlInt,ItlInf: Single): Integer;
@@ -2708,17 +2690,17 @@ var
begin
if ItlSup> 0
then
- Sup:= Dim2Pixels(ItlSup)
+ Sup:= Round(Dim2Pixels(ItlSup))
else
Sup:= 0;
if ItlInt> 0
then
- Int:= Dim2Pixels(ItlInt)
+ Int:= Round(Dim2Pixels(ItlInt))
else
Int:= 0;
if ItlInf> 0
then
- Inf:= Dim2Pixels(ItlInf)
+ Inf:= Round(Dim2Pixels(ItlInf))
else
Inf:= 0;
AInterligne:= T_Interligne.Create(Sup,Int,Inf);
@@ -2772,20 +2754,14 @@ TraceCadre(AStyle,zPied);
end;
procedure T_Imprime.TraitPage(XDebut,YDebut,XFin,YFin: Single; AStyle: Integer);
-var
- XDeb,YDeb,XEnd,YEnd: Integer;
begin
-XDeb:= Dim2Pixels(XDebut);
-YDeb:= Dim2Pixels(YDebut);
-XEnd:= Dim2Pixels(XFin);
-YEnd:= Dim2Pixels(YFin);
-TraceTrait(XDeb,YDeb,XEnd,YEnd,AStyle);
+TraceTrait(Dim2Pixels(XDebut),Dim2Pixels(YDebut),Dim2Pixels(XFin),Dim2Pixels(YFin),AStyle);
end;
procedure T_Imprime.SurfPage(XLimits,YLimits: array of Single; AColor: TfpgColor);
var
Taille,Cpt: Integer;
- Ends: array of TPoint;
+ Ends: array of TRefPos;
begin
if Length(XLimits)< Length(YLimits)
then
diff --git a/extras/contributed/report_tool/reportengine/u_pdf.pas b/extras/contributed/report_tool/reportengine/u_pdf.pas
index 00a1a1a8..c207291b 100644
--- a/extras/contributed/report_tool/reportengine/u_pdf.pas
+++ b/extras/contributed/report_tool/reportengine/u_pdf.pas
@@ -37,7 +37,7 @@ type
private
FValue: Boolean;
protected
- procedure EcritBoolean(const AFlux: TStream);
+ procedure WriteBoolean(const AFlux: TStream);
public
constructor CreateBoolean(const AValue: Boolean);
destructor Destroy; override;
@@ -47,7 +47,7 @@ type
private
FValue: Integer;
protected
- procedure EcritInteger(const AFlux: TStream);
+ procedure WriteInteger(const AFlux: TStream);
procedure IncrementeInteger;
property Value: Integer read FValue write FValue;
public
@@ -59,7 +59,7 @@ type
private
FValue: Integer;
protected
- procedure EcritReference(const AFlux: TStream);
+ procedure WriteReference(const AFlux: TStream);
public
constructor CreateReference(const AValue: Integer);
destructor Destroy; override;
@@ -69,7 +69,7 @@ type
private
FValue: string;
protected
- procedure EcritName(const AFlux: TStream);
+ procedure WriteName(const AFlux: TStream);
public
constructor CreateName(const AValue: string);
destructor Destroy; override;
@@ -79,7 +79,7 @@ type
private
FValue: string;
protected
- procedure EcritString(const AFlux: TStream);
+ procedure WriteString(const AFlux: TStream);
public
constructor CreateString(const AValue: string);
destructor Destroy; override;
@@ -89,7 +89,7 @@ type
private
FArray: TList;
protected
- procedure EcritArray(const AFlux: TStream);
+ procedure WriteArray(const AFlux: TStream);
procedure AddItem(const AValue: TPdfObjet);
public
constructor CreateArray;
@@ -100,7 +100,7 @@ type
private
FStream: TList;
protected
- procedure EcritStream(const AFlux: TStream);
+ procedure WriteStream(const AFlux: TStream);
procedure AddItem(const AValue: TPdfObjet);
public
constructor CreateStream;
@@ -112,7 +112,7 @@ type
FTxtFont: Integer;
FTxtSize: string;
protected
- procedure EcritFonte(const AFlux: TStream);
+ procedure WriteFonte(const AFlux: TStream);
public
constructor CreateFonte(const AFont: Integer; const ASize: string);
destructor Destroy; override;
@@ -120,53 +120,58 @@ type
TPdfText = class(TPdfObjet)
private
- FTxtPosX: Integer;
- FTxtPosY: Integer;
+ FTxtPosX: Single;
+ FTxtPosY: Single;
FTxtText: TPdfString;
protected
- procedure EcritText(const AFlux: TStream);
+ procedure WriteText(const AFlux: TStream);
public
- constructor CreateText(const APosX,APosY: Integer; const AText: string);
+ constructor CreateText(const APosX,APosY: Single; const AText: string);
destructor Destroy; override;
end;
TPdfLigne = class(TPdfObjet)
private
- FEpais: Integer;
- FStaX: Integer;
- FStaY: Integer;
- FEndX: Integer;
- FEndY: Integer;
+ FEpais: Single;
+ FStaX: Single;
+ FStaY: Single;
+ FEndX: Single;
+ FEndY: Single;
protected
- procedure EcritLigne(const AFlux: TStream);
+ procedure WriteLigne(const AFlux: TStream);
public
- constructor CreateLigne(const AEpais,AStaX,AStaY,AEndX,AEndY: Integer);
+ constructor CreateLigne(const AEpais,AStaX,AStaY,AEndX,AEndY: Single);
destructor Destroy; override;
end;
TPdfRectangle = class(TPdfObjet)
private
- FEpais: Integer;
- FRecX: Integer;
- FRecY: Integer;
- FRecW: Integer;
- FRecH: Integer;
+ FEpais: Single;
+ FRecX: Single;
+ FRecY: Single;
+ FRecW: Single;
+ FRecH: Single;
FFill: Boolean;
FStroke: Boolean;
protected
- procedure EcritRectangle(const AFlux: TStream);
+ procedure WriteRectangle(const AFlux: TStream);
public
- constructor CreateRectangle(const AEpais,APosX,APosY,AWidth,AHeight: Integer; const AFill,AStroke: Boolean);
+ constructor CreateRectangle(const AEpais,APosX,APosY,AWidth,AHeight: Single; const AFill,AStroke: Boolean);
destructor Destroy; override;
end;
- T_Points = array of TPoint;
+ TRefPos= record
+ X: Single;
+ Y: Single;
+ end;
+
+ T_Points = array of TRefPos;
TPdfSurface = class(TPdfObjet)
private
- FPoints: array of TPoint;
+ FPoints: T_Points;
protected
- procedure EcritSurface(const AFlux: TStream);
+ procedure WriteSurface(const AFlux: TStream);
public
constructor CreateSurface(const APoints: T_Points);
destructor Destroy; override;
@@ -177,7 +182,7 @@ type
FDash: TfpgLineStyle;
FPhase: Integer;
protected
- procedure EcritLineStyle(const AFlux: TStream);
+ procedure WriteLineStyle(const AFlux: TStream);
public
constructor CreateLineStyle(ADash: TfpgLineStyle; APhase: Integer);
destructor Destroy; override;
@@ -190,7 +195,7 @@ type
FBlue: string;
FStroke: Boolean;
protected
- procedure EcritColor(const AFlux: TStream);
+ procedure WriteColor(const AFlux: TStream);
public
constructor CreateColor(const AStroke: Boolean; Couleur: LongInt);
destructor Destroy; override;
@@ -201,7 +206,7 @@ type
FKey: TPdfName;
FValue: TPdfObjet;
protected
- procedure EcritDicElement(const AFlux: TStream);
+ procedure WriteDicElement(const AFlux: TStream);
public
constructor CreateDicElement(const AKey: string; const AValue: TPdfObjet);
destructor Destroy; override;
@@ -213,7 +218,7 @@ type
protected
procedure AddElement(const AKey: string; const AValue: TPdfObjet);
function ElementParCle(const AValue: string): Integer;
- procedure EcritDictionary(AFlux: TStream);
+ procedure WriteDictionary(AFlux: TStream);
public
constructor CreateDictionary;
destructor Destroy; override;
@@ -225,7 +230,7 @@ type
FObjet: TPdfDictionary;
FStream: TPdfStream;
protected
- procedure EcritXRef(const AFlux: TStream);
+ procedure WriteXRef(const AFlux: TStream);
public
constructor CreateXRef;
destructor Destroy; override;
@@ -237,8 +242,8 @@ type
FXRefObjets: TList; // list of TPdfXRef
protected
function ElementParNom(const AValue: string): Integer;
- procedure EcritXRefTable(const AFlux: TStream);
- procedure EcritObjet(const AObjet: Integer; const AFlux: TStream);
+ procedure WriteXRefTable(const AFlux: TStream);
+ procedure WriteObjet(const AObjet: Integer; const AFlux: TStream);
procedure CreateRefTable;
procedure CreateTrailer;
function CreateCatalog: Integer;
@@ -254,7 +259,7 @@ type
public
constructor CreateDocument;
destructor Destroy; override;
- procedure EcritDocument(const AFlux: TStream);
+ procedure WriteDocument(const AFlux: TStream);
end;
const
@@ -283,7 +288,7 @@ var
// utility functions
-procedure EcritChaine(const Valeur: string; AFlux: TStream);
+procedure WriteChaine(const Valeur: string; AFlux: TStream);
begin
AFlux.Write(PChar(Valeur)^,Length(Valeur));
end;
@@ -361,7 +366,7 @@ end;
constructor TPdfObjet.Create;
begin
- // implementation dans les descendants
+ // to be implemented by descendents
end;
destructor TPdfObjet.Destroy;
@@ -369,13 +374,13 @@ begin
inherited;
end;
-procedure TPdfBoolean.EcritBoolean(const AFlux: TStream);
+procedure TPdfBoolean.WriteBoolean(const AFlux: TStream);
begin
if FValue
then
- EcritChaine('true',AFlux)
+ WriteChaine('true',AFlux)
else
- EcritChaine('false',AFlux);
+ WriteChaine('false',AFlux);
end;
constructor TPdfBoolean.CreateBoolean(const AValue: Boolean);
@@ -389,9 +394,9 @@ begin
inherited;
end;
-procedure TPdfInteger.EcritInteger(const AFlux: TStream);
+procedure TPdfInteger.WriteInteger(const AFlux: TStream);
begin
-EcritChaine(IntToStr(FValue), AFlux);
+WriteChaine(IntToStr(FValue), AFlux);
end;
procedure TPdfInteger.IncrementeInteger;
@@ -410,9 +415,9 @@ begin
inherited;
end;
-procedure TPdfReference.EcritReference(const AFlux: TStream);
+procedure TPdfReference.WriteReference(const AFlux: TStream);
begin
-EcritChaine(IntToStr(FValue)+' 0 R',AFlux);
+WriteChaine(IntToStr(FValue)+' 0 R',AFlux);
end;
constructor TPdfReference.CreateReference(const AValue: Integer);
@@ -426,11 +431,11 @@ begin
inherited;
end;
-procedure TPdfName.EcritName(const AFlux: TStream);
+procedure TPdfName.WriteName(const AFlux: TStream);
begin
if FValue<> ''
then
- EcritChaine('/'+FValue,AFlux);
+ WriteChaine('/'+FValue,AFlux);
end;
constructor TPdfName.CreateName(const AValue: string);
@@ -444,9 +449,9 @@ begin
inherited;
end;
-procedure TPdfString.EcritString(const AFlux: TStream);
+procedure TPdfString.WriteString(const AFlux: TStream);
begin
-EcritChaine('('+Utf8ToAnsi(FValue)+')',AFlux);
+WriteChaine('('+Utf8ToAnsi(FValue)+')',AFlux);
end;
constructor TPdfString.CreateString(const AValue: string);
@@ -460,27 +465,27 @@ begin
inherited;
end;
-procedure TPdfArray.EcritArray(const AFlux: TStream);
+procedure TPdfArray.WriteArray(const AFlux: TStream);
var
Cpt: Integer;
begin
-EcritChaine('[',AFlux);
+WriteChaine('[',AFlux);
for Cpt:= 0 to Pred(FArray.Count) do
begin
if Cpt> 0
then
- EcritChaine(' ',AFlux);
+ WriteChaine(' ',AFlux);
if TPdfObjet(FArray[Cpt]) is TPdfInteger
then
- TPdfInteger(FArray[Cpt]).EcritInteger(AFlux);
+ TPdfInteger(FArray[Cpt]).WriteInteger(AFlux);
if TPdfObjet(FArray[Cpt]) is TPdfReference
then
- TPdfReference(FArray[Cpt]).EcritReference(AFlux);
+ TPdfReference(FArray[Cpt]).WriteReference(AFlux);
if TPdfObjet(FArray[Cpt]) is TPdfName
then
- TPdfName(FArray[Cpt]).EcritName(AFlux);
+ TPdfName(FArray[Cpt]).WriteName(AFlux);
end;
-EcritChaine(']',AFlux);
+WriteChaine(']',AFlux);
end;
procedure TPdfArray.AddItem(const AValue: TPdfObjet);
@@ -500,7 +505,7 @@ FArray.Free;
inherited;
end;
-procedure TPdfStream.EcritStream(const AFlux: TStream);
+procedure TPdfStream.WriteStream(const AFlux: TStream);
var
Cpt: Integer;
begin
@@ -508,25 +513,25 @@ for Cpt:= 0 to Pred(FStream.Count) do
begin
if TPdfObjet(FStream[Cpt]) is TPdfFonte
then
- TPdfFonte(FStream[Cpt]).EcritFonte(AFlux);
+ TPdfFonte(FStream[Cpt]).WriteFonte(AFlux);
if TPdfColor(FStream[Cpt]) is TPdfColor
then
- TPdfColor(FStream[Cpt]).EcritColor(AFlux);
+ TPdfColor(FStream[Cpt]).WriteColor(AFlux);
if TPdfObjet(FStream[Cpt]) is TPdfText
then
- TPdfText(FStream[Cpt]).EcritText(AFlux);
+ TPdfText(FStream[Cpt]).WriteText(AFlux);
if TPdfObjet(FStream[Cpt]) is TPdfRectangle
then
- TPdfRectangle(FStream[Cpt]).EcritRectangle(AFlux);
+ TPdfRectangle(FStream[Cpt]).WriteRectangle(AFlux);
if TPdfObjet(FStream[Cpt]) is TPdfLigne
then
- TPdfLigne(FStream[Cpt]).EcritLigne(AFlux);
+ TPdfLigne(FStream[Cpt]).WriteLigne(AFlux);
if TPdfObjet(FStream[Cpt]) is TPdfLineStyle
then
- TPdfLineStyle(FStream[Cpt]).EcritLineStyle(AFlux);
+ TPdfLineStyle(FStream[Cpt]).WriteLineStyle(AFlux);
if TPdfObjet(FStream[Cpt]) is TPdfSurface
then
- TPdfSurface(FStream[Cpt]).EcritSurface(AFlux);
+ TPdfSurface(FStream[Cpt]).WriteSurface(AFlux);
end;
end;
@@ -547,9 +552,9 @@ FStream.Free;
inherited;
end;
-procedure TPdfFonte.EcritFonte(const AFlux: TStream);
+procedure TPdfFonte.WriteFonte(const AFlux: TStream);
begin
-EcritChaine('/F'+IntToStr(FTxtFont)+' '+FTxtSize+' Tf'+CRLF,AFlux);
+WriteChaine('/F'+IntToStr(FTxtFont)+' '+FTxtSize+' Tf'+CRLF,AFlux);
end;
constructor TPdfFonte.CreateFonte(const AFont: Integer; const ASize: string);
@@ -564,16 +569,16 @@ begin
inherited;
end;
-procedure TPdfText.EcritText(const AFlux: TStream);
+procedure TPdfText.WriteText(const AFlux: TStream);
begin
-EcritChaine('BT'+CRLF,AFlux);
-EcritChaine(IntToStr(FTxtPosX)+' '+IntToStr(FTxtPosY)+' Td'+CRLF,AFlux);
-TPdfString(FTxtText).EcritString(AFlux);
-EcritChaine(' Tj'+CRLF,AFlux);
-EcritChaine('ET'+CRLF,AFlux);
+WriteChaine('BT'+CRLF,AFlux);
+WriteChaine(FormatFloat('0.##',FTxtPosX)+' '+FormatFloat('0.##',FTxtPosY)+' Td'+CRLF,AFlux);
+TPdfString(FTxtText).WriteString(AFlux);
+WriteChaine(' Tj'+CRLF,AFlux);
+WriteChaine('ET'+CRLF,AFlux);
end;
-constructor TPdfText.CreateText(const APosX,APosY: Integer; const AText: string);
+constructor TPdfText.CreateText(const APosX,APosY: Single; const AText: string);
begin
inherited Create;
FTxtPosX:= APosX;
@@ -587,21 +592,21 @@ FTxtText.Free;
inherited;
end;
-procedure TPdfLigne.EcritLigne(const AFlux: TStream);
+procedure TPdfLigne.WriteLigne(const AFlux: TStream);
begin
-if (IntToStr(FEpais)+' w')<> CurrentWidth
+if (FormatFloat('0.##',FEpais)+' w')<> CurrentWidth
then
begin
- EcritChaine('1 J'+CRLF,AFlux);
- EcritChaine(IntToStr(FEpais)+' w'+CRLF,AFlux);
- CurrentWidth:= IntToStr(FEpais)+' w';
+ WriteChaine('1 J'+CRLF,AFlux);
+ WriteChaine(FormatFloat('0.##',FEpais)+' w'+CRLF,AFlux);
+ CurrentWidth:= FormatFloat('0.##',FEpais)+' w';
end;
-EcritChaine(IntToStr(FStaX)+' '+IntToStr(FStaY)+' m'+CRLF,AFlux);
-EcritChaine(IntToStr(FEndX)+' '+IntToStr(FEndY)+' l'+CRLF,AFlux);
-EcritChaine('S'+CRLF,AFlux);
+WriteChaine(FormatFloat('0.##',FStaX)+' '+FormatFloat('0.##',FStaY)+' m'+CRLF,AFlux);
+WriteChaine(FormatFloat('0.##',FEndX)+' '+FormatFloat('0.##',FEndY)+' l'+CRLF,AFlux);
+WriteChaine('S'+CRLF,AFlux);
end;
-constructor TPdfLigne.CreateLigne(const AEpais,AStaX,AStaY,AEndX,AEndY: Integer);
+constructor TPdfLigne.CreateLigne(const AEpais,AStaX,AStaY,AEndX,AEndY: Single);
begin
inherited Create;
FEpais:= AEpais;
@@ -616,27 +621,27 @@ begin
inherited;
end;
-procedure TPdfRectangle.EcritRectangle(const AFlux: TStream);
+procedure TPdfRectangle.WriteRectangle(const AFlux: TStream);
begin
if FStroke
then
- if (IntToStr(FEpais)+' w')<> CurrentWidth
+ if (FormatFloat('0.##',FEpais)+' w')<> CurrentWidth
then
begin
- EcritChaine('1 J'+CRLF,AFlux);
- EcritChaine(IntToStr(FEpais)+' w'+CRLF,AFlux);
- CurrentWidth:= IntToStr(FEpais)+' w';
+ WriteChaine('1 J'+CRLF,AFlux);
+ WriteChaine(FormatFloat('0.##',FEpais)+' w'+CRLF,AFlux);
+ CurrentWidth:= FormatFloat('0.##',FEpais)+' w';
end;
-EcritChaine(IntToStr(FRecX)+' '+IntToStr(FRecY)+' '+IntToStr(FRecW)+' '+IntToStr(FRecH)+' re'+CRLF,AFlux);
+WriteChaine(FormatFloat('0.##',FRecX)+' '+FormatFloat('0.##',FRecY)+' '+FormatFloat('0.##',FRecW)+' '+FormatFloat('0.##',FRecH)+' re'+CRLF,AFlux);
if FStroke
then
- EcritChaine('S'+CRLF,AFlux);
+ WriteChaine('S'+CRLF,AFlux);
if FFill
then
- EcritChaine('f'+CRLF,AFlux);
+ WriteChaine('f'+CRLF,AFlux);
end;
-constructor TPdfRectangle.CreateRectangle(const AEpais,APosX,APosY,AWidth,AHeight: Integer; const AFill,AStroke: Boolean);
+constructor TPdfRectangle.CreateRectangle(const AEpais,APosX,APosY,AWidth,AHeight: Single; const AFill,AStroke: Boolean);
begin
inherited Create;
FEpais:= AEpais;
@@ -653,15 +658,15 @@ begin
inherited;
end;
-procedure TPdfSurface.EcritSurface(const AFlux: TStream);
+procedure TPdfSurface.WriteSurface(const AFlux: TStream);
var
Cpt: Integer;
begin
-EcritChaine(IntToStr(FPoints[0].X)+' '+IntToStr(FPoints[0].Y)+' m'+CRLF,AFlux);
+WriteChaine(FormatFloat('0.##',FPoints[0].X)+' '+FormatFloat('0.##',FPoints[0].Y)+' m'+CRLF,AFlux);
for Cpt:= 1 to Pred(Length(FPoints)) do
- EcritChaine(IntToStr(FPoints[Cpt].X)+' '+IntToStr(FPoints[Cpt].Y)+' l'+CRLF,AFlux);
-EcritChaine('h'+CRLF,AFlux);
-EcritChaine('f'+CRLF,AFlux);
+ WriteChaine(FormatFloat('0.##',FPoints[Cpt].X)+' '+FormatFloat('0.##',FPoints[Cpt].Y)+' l'+CRLF,AFlux);
+WriteChaine('h'+CRLF,AFlux);
+WriteChaine('f'+CRLF,AFlux);
end;
constructor TPdfSurface.CreateSurface(const APoints: T_Points);
@@ -675,20 +680,20 @@ begin
inherited;
end;
-procedure TPdfLineStyle.EcritLineStyle(const AFlux: TStream);
+procedure TPdfLineStyle.WriteLineStyle(const AFlux: TStream);
begin
-EcritChaine('[',AFlux);
+WriteChaine('[',AFlux);
case FDash of
lsDash:
- EcritChaine('5 5',AFlux);
+ WriteChaine('5 5',AFlux);
lsDot:
- EcritChaine('2 2',AFlux);
+ WriteChaine('2 2',AFlux);
lsDashDot:
- EcritChaine('5 2 2 2',AFlux);
+ WriteChaine('5 2 2 2',AFlux);
lsDashDotDot:
- EcritChaine('5 2 2 2 2 2',AFlux);
+ WriteChaine('5 2 2 2 2 2',AFlux);
end;
-EcritChaine('] '+IntToStr(FPhase)+' d'+CRLF,AFlux);
+WriteChaine('] '+IntToStr(FPhase)+' d'+CRLF,AFlux);
end;
constructor TPdfLineStyle.CreateLineStyle(ADash: TfpgLineStyle; APhase: Integer);
@@ -703,7 +708,7 @@ begin
inherited;
end;
-procedure TPdfColor.EcritColor(const AFlux: TStream);
+procedure TPdfColor.WriteColor(const AFlux: TStream);
begin
if FStroke
then
@@ -711,7 +716,7 @@ then
if (FRed+' '+FGreen+' '+FBlue+' rg')<> CurrentColor
then
begin
- EcritChaine(FRed+' '+FGreen+' '+FBlue+' rg'+CRLF,AFlux);
+ WriteChaine(FRed+' '+FGreen+' '+FBlue+' rg'+CRLF,AFlux);
CurrentColor:= FRed+' '+FGreen+' '+FBlue+' rg';
end;
end
@@ -719,24 +724,19 @@ else
if (FRed+' '+FGreen+' '+FBlue+' RG')<> CurrentColor
then
begin
- EcritChaine(FRed+' '+FGreen+' '+FBlue+' RG'+CRLF,AFlux);
+ WriteChaine(FRed+' '+FGreen+' '+FBlue+' RG'+CRLF,AFlux);
CurrentColor:= FRed+' '+FGreen+' '+FBlue+' RG';
end;
end;
constructor TPdfColor.CreateColor(const AStroke: Boolean; Couleur: Longint);
-var
- OldSeparator: Char;
begin
inherited Create;
-OldSeparator:= DecimalSeparator;
-DecimalSeparator:= '.';
FBlue:= FormatFloat('0.##',Couleur mod 256/256);
Couleur:= Couleur div 256;
FGreen:= FormatFloat('0.##',Couleur mod 256/256);
FRed:= FormatFloat('0.##',Couleur div 256/256);
FStroke:= AStroke;
-DecimalSeparator:= OldSeparator;
end;
destructor TPdfColor.Destroy;
@@ -744,32 +744,32 @@ begin
inherited
end;
-procedure TPdfDicElement.EcritDicElement(const AFlux: TStream);
+procedure TPdfDicElement.WriteDicElement(const AFlux: TStream);
begin
-FKey.EcritName(AFlux);
-EcritChaine(' ',AFlux);
+FKey.WriteName(AFlux);
+WriteChaine(' ',AFlux);
if FValue is TPdfBoolean
then
- TPdfBoolean(FValue).EcritBoolean(AFlux);
+ TPdfBoolean(FValue).WriteBoolean(AFlux);
if FValue is TPdfInteger
then
- TPdfInteger(FValue).EcritInteger(AFlux);
+ TPdfInteger(FValue).WriteInteger(AFlux);
if FValue is TPdfReference
then
- TPdfReference(FValue).EcritReference(AFlux);
+ TPdfReference(FValue).WriteReference(AFlux);
if FValue is TPdfName
then
- TPdfName(FValue).EcritName(AFlux);
+ TPdfName(FValue).WriteName(AFlux);
if FValue is TPdfString
then
- TPdfString(FValue).EcritString(AFlux);
+ TPdfString(FValue).WriteString(AFlux);
if FValue is TPdfArray
then
- TPdfArray(FValue).EcritArray(AFlux);
+ TPdfArray(FValue).WriteArray(AFlux);
if FValue is TPdfDictionary
then
- TPdfDictionary(FValue).EcritDictionary(AFlux);
-EcritChaine(CRLF,AFlux);
+ TPdfDictionary(FValue).WriteDictionary(AFlux);
+WriteChaine(CRLF,AFlux);
end;
constructor TPdfDicElement.CreateDicElement(const AKey: string; const AValue: TPdfObjet);
@@ -806,14 +806,14 @@ for Cpt:= 0 to Pred(FElement.Count) do
end;
end;
-procedure TPdfDictionary.EcritDictionary(AFlux: TStream);
+procedure TPdfDictionary.WriteDictionary(AFlux: TStream);
var
Cpt: Integer;
begin
-EcritChaine('<<'+CRLF,AFlux);
+WriteChaine('<<'+CRLF,AFlux);
for Cpt:= 0 to Pred(FElement.Count) do
- TPdfDicElement(FElement[Cpt]).EcritDicElement(AFlux);
-EcritChaine('>>',AFlux);
+ TPdfDicElement(FElement[Cpt]).WriteDicElement(AFlux);
+WriteChaine('>>',AFlux);
end;
constructor TPdfDictionary.CreateDictionary;
@@ -834,9 +834,9 @@ FElement.Free;
inherited;
end;
-procedure TPdfXRef.EcritXRef(const AFlux: TStream);
+procedure TPdfXRef.WriteXRef(const AFlux: TStream);
begin
-EcritChaine(IntToChaine(FOffset,10)+' '+IntToChaine(0,5)+' n'+CRLF,AFlux);
+WriteChaine(IntToChaine(FOffset,10)+' '+IntToChaine(0,5)+' n'+CRLF,AFlux);
end;
constructor TPdfXRef.CreateXRef;
@@ -864,47 +864,47 @@ for Cpt:= 1 to Pred(FXRefObjets.Count) do
Result:= Cpt;
end;
-procedure TPdfDocument.EcritXRefTable(const AFlux: TStream);
+procedure TPdfDocument.WriteXRefTable(const AFlux: TStream);
var
Cpt: Integer;
begin
if FXRefObjets.Count> 1
then
for Cpt:= 1 to Pred(FXRefObjets.Count) do
- TPdfXRef(FXRefObjets[Cpt]).EcritXRef(AFlux);
+ TPdfXRef(FXRefObjets[Cpt]).WriteXRef(AFlux);
end;
-procedure TPdfDocument.EcritObjet(const AObjet: Integer; const AFlux: TStream);
+procedure TPdfDocument.WriteObjet(const AObjet: Integer; const AFlux: TStream);
var
Dictionaire: TPdfDictionary;
Long: TPdfInteger;
Fin: Integer;
Flux: TMemoryStream;
begin
-EcritChaine(IntToStr(AObjet)+' 0 obj'+CRLF,AFlux);
+WriteChaine(IntToStr(AObjet)+' 0 obj'+CRLF,AFlux);
if TPdfXRef(FXRefObjets[AObjet]).FStream= nil
then
- TPdfDictionary(TPdfXRef(FXRefObjets[AObjet]).FObjet).EcritDictionary(AFlux)
+ TPdfDictionary(TPdfXRef(FXRefObjets[AObjet]).FObjet).WriteDictionary(AFlux)
else
begin
Flux:= TMemoryStream.Create;
Flux.Position:= 0;
CurrentColor:= '';
CurrentWidth:= '';
- TPdfXRef(FXRefObjets[AObjet]).FStream.EcritStream(Flux);
+ TPdfXRef(FXRefObjets[AObjet]).FStream.WriteStream(Flux);
// write stream length element in contents dictionary
Long:= TPdfInteger.CreateInteger(Flux.Size);
TPdfDictionary(TPdfXRef(FXRefObjets[AObjet]).FObjet).AddElement('Length',Long);
Flux.Free;
- TPdfXRef(FXRefObjets[AObjet]).FObjet.EcritDictionary(AFlux);
+ TPdfXRef(FXRefObjets[AObjet]).FObjet.WriteDictionary(AFlux);
// write stream in contents dictionary
CurrentColor:= '';
CurrentWidth:= '';
- EcritChaine(CRLF+'stream'+CRLF,AFlux);
- TPdfXRef(FXRefObjets[AObjet]).FStream.EcritStream(AFlux);
- EcritChaine('endstream',AFlux);
+ WriteChaine(CRLF+'stream'+CRLF,AFlux);
+ TPdfXRef(FXRefObjets[AObjet]).FStream.WriteStream(AFlux);
+ WriteChaine('endstream',AFlux);
end;
-EcritChaine(CRLF+'endobj'+CRLF,AFlux);
+WriteChaine(CRLF+'endobj'+CRLF,AFlux);
end;
procedure TPdfDocument.CreateRefTable;
@@ -1465,31 +1465,31 @@ FXRefObjets.Free;
inherited;
end;
-procedure TPdfDocument.EcritDocument(const AFlux: TStream);
+procedure TPdfDocument.WriteDocument(const AFlux: TStream);
var
Cpt,XRefPos: Integer;
begin
AFlux.Position:= 0;
-EcritChaine(PDF_VERSION+CRLF,AFlux);
+WriteChaine(PDF_VERSION+CRLF,AFlux);
// write numbered indirect objects
for Cpt:= 1 to Pred(FXRefObjets.Count) do
begin
XRefPos:= AFlux.Position;
- EcritObjet(Cpt,AFlux);
+ WriteObjet(Cpt,AFlux);
TPdfXRef(FXRefObjets[Cpt]).Offset:= XRefPos;
end;
XRefPos:= AFlux.Position;
// write xref table
-EcritChaine('xref'+CRLF+'0 '+IntToStr(FXRefObjets.Count)+CRLF,AFlux);
+WriteChaine('xref'+CRLF+'0 '+IntToStr(FXRefObjets.Count)+CRLF,AFlux);
with TPdfXRef(FXRefObjets[0]) do
- EcritChaine(IntToChaine(Offset,10)+' '+IntToChaine(PDF_MAX_GEN_NUM,5)+' f'+CRLF,AFlux);
-EcritXRefTable(AFlux);
+ WriteChaine(IntToChaine(Offset,10)+' '+IntToChaine(PDF_MAX_GEN_NUM,5)+' f'+CRLF,AFlux);
+WriteXRefTable(AFlux);
// write trailer
-EcritChaine('trailer'+CRLF,AFlux);
-Trailer.EcritDictionary(AFlux);
+WriteChaine('trailer'+CRLF,AFlux);
+Trailer.WriteDictionary(AFlux);
// write offset of last xref table
-EcritChaine(CRLF+'startxref'+CRLF+IntToStr(XRefPos)+CRLF,AFlux);
-EcritChaine(PDF_FILE_END,AFlux);
+WriteChaine(CRLF+'startxref'+CRLF+IntToStr(XRefPos)+CRLF,AFlux);
+WriteChaine(PDF_FILE_END,AFlux);
end;
end.