summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rw-r--r--extras/contributed/report_tool/demo/u_demo.pas186
-rw-r--r--extras/contributed/report_tool/reportengine/u_commande.pas74
-rw-r--r--extras/contributed/report_tool/reportengine/u_imprime.pas1830
-rw-r--r--extras/contributed/report_tool/reportengine/u_pdf.pas183
-rw-r--r--extras/contributed/report_tool/reportengine/u_visu.pas98
5 files changed, 1459 insertions, 912 deletions
diff --git a/extras/contributed/report_tool/demo/u_demo.pas b/extras/contributed/report_tool/demo/u_demo.pas
index 15493bf2..88bd4e09 100644
--- a/extras/contributed/report_tool/demo/u_demo.pas
+++ b/extras/contributed/report_tool/demo/u_demo.pas
@@ -20,6 +20,7 @@ type
Bt_PdfSimpleText: TfpgButton;
Bt_PdfMultiPages: TfpgButton;
Bt_PdfMultiSections: TfpgButton;
+ Bt_PdfOutlines: TfpgButton;
Bt_PdfCadres: TfpgButton;
Bt_PdfColor: TfpgButton;
Bt_PdfLines: TfpgButton;
@@ -30,6 +31,7 @@ type
Bt_VisuSimpleText: TfpgButton;
Bt_VisuMultiPages: TfpgButton;
Bt_VisuMultiSections: TfpgButton;
+ Bt_VisuOutlines: TfpgButton;
Bt_VisuCadres: TfpgButton;
Bt_VisuColor: TfpgButton;
Bt_VisuLines: TfpgButton;
@@ -40,6 +42,7 @@ type
Bt_PrintSimpleText: TfpgButton;
Bt_PrintMultiPages: TfpgButton;
Bt_PrintMultiSections: TfpgButton;
+ Bt_PrintOutlines: TfpgButton;
Bt_PrintCadres: TfpgButton;
Bt_PrintColor: TfpgButton;
Bt_PrintLines: TfpgButton;
@@ -50,6 +53,7 @@ type
procedure Bt_PdfSimpleTextClick(Sender: TObject);
procedure Bt_PdfMultiPagesClick(Sender: TObject);
procedure Bt_PdfMultiSectionsClick(Sender: TObject);
+ procedure Bt_PdfOutlinesClick(Sender: TObject);
procedure Bt_PdfCadresClick(Sender: TObject);
procedure Bt_PdfColorClick(Sender: TObject);
procedure Bt_PdfLinesClick(Sender: TObject);
@@ -59,6 +63,7 @@ type
procedure Bt_VisuSimpleTextClick(Sender: TObject);
procedure Bt_VisuMultiPagesClick(Sender: TObject);
procedure Bt_VisuMultiSectionsClick(Sender: TObject);
+ procedure Bt_VisuOutlinesClick(Sender: TObject);
procedure Bt_VisuCadresClick(Sender: TObject);
procedure Bt_VisuColorClick(Sender: TObject);
procedure Bt_VisuLinesClick(Sender: TObject);
@@ -68,6 +73,7 @@ type
procedure Bt_PrintSimpleTextClick(Sender: TObject);
procedure Bt_PrintMultiPagesClick(Sender: TObject);
procedure Bt_PrintMultiSectionsClick(Sender: TObject);
+ procedure Bt_PrintOutlinesClick(Sender: TObject);
procedure Bt_PrintCadresClick(Sender: TObject);
procedure Bt_PrintColorClick(Sender: TObject);
procedure Bt_PrintLinesClick(Sender: TObject);
@@ -78,6 +84,7 @@ type
procedure ImprimeSimpleText(Preview: Boolean);
procedure ImprimeMultiPages(Preview: Boolean);
procedure ImprimeMultiSections(Preview: Boolean);
+ procedure ImprimeOutlines(Preview: Boolean);
procedure ImprimeCadres(Preview: Boolean);
procedure ImprimeColor(Preview: Boolean);
procedure ImprimeLines(Preview: Boolean);
@@ -309,6 +316,58 @@ with Imprime do
end;
end;
+procedure TF_Demo.Bt_PdfOutlinesClick(Sender: TObject);
+var
+ Fd_SauvePdf: TfpgFileDialog;
+ FichierPdf: string;
+ FluxFichier: TFileStream;
+begin
+Imprime:= T_Imprime.Create;
+with Imprime do
+ begin
+// Langue:= Version;
+ ImprimeOutlines(False);
+ if T_Section(Sections[Pred(Sections.Count)]).TotPages= 0
+ then
+ begin
+ ShowMessage('There is no file to print');
+ Exit;
+ end;
+ Fd_SauvePdf:= TfpgFileDialog.Create(nil);
+ Fd_SauvePdf.InitialDir:= ExtractFilePath(Paramstr(0));
+ Fd_SauvePdf.FontDesc:= 'bitstream vera sans-9';
+ Fd_SauvePdf.Filter:= 'Fichiers pdf |*.pdf';
+ Fd_SauvePdf.FileName:= 'Outlines.pdf';
+ try
+ if Fd_SauvePdf.RunSaveFile
+ then
+ begin
+ FichierPdf:= Fd_SauvePdf.FileName;
+ if Lowercase(Copy(FichierPdf,Length(FichierPdf)-3,4))<> '.pdf'
+ then
+ FichierPdf:= FichierPdf+'.pdf';
+ Document:= TPdfDocument.CreateDocument;
+ with Document do
+ begin
+ FluxFichier:= TFileStream.Create(FichierPdf,fmCreate);
+ EcritDocument(FluxFichier);
+ FluxFichier.Free;
+ Free;
+ end;
+ {$ifdef linux}
+ fpgOpenURL(FichierPdf);
+ {$endif}
+ {$ifdef win32}
+ ShellExecute(0,PChar('OPEN'),PChar(FichierPdf),PChar(''),PChar(''),1);
+ {$endif}
+ end;
+ finally
+ Fd_SauvePdf.Free;
+ end;
+ Free;
+ end;
+end;
+
procedure TF_Demo.Bt_PdfCadresClick(Sender: TObject);
var
Fd_SauvePdf: TfpgFileDialog;
@@ -617,6 +676,18 @@ with Imprime do
end;
end;
+procedure TF_Demo.Bt_VisuOutlinesClick(Sender: TObject);
+begin
+Imprime:= T_Imprime.Create;
+with Imprime do
+ begin
+ //Langue:= Version;
+ DefaultFile:= 'Outlines.pdf';
+ ImprimeOutlines(True);
+ Free;
+ end;
+end;
+
procedure TF_Demo.Bt_VisuCadresClick(Sender: TObject);
begin
Imprime:= T_Imprime.Create;
@@ -697,6 +768,11 @@ begin
end;
+procedure TF_Demo.Bt_PrintOutlinesClick(Sender: TObject);
+begin
+
+end;
+
procedure TF_Demo.Bt_PrintCadresClick(Sender: TObject);
begin
@@ -798,6 +874,7 @@ end;
procedure TF_Demo.ImprimeMultiSections(Preview: Boolean);
var
FtTitreS1,FtTitreS2,FtTitreS3,FtTexte,FtNum,FtNumS: Integer;
+ ColDefSect2: Integer;
Cpt: Integer;
begin
with Imprime do
@@ -826,7 +903,74 @@ with Imprime do
Page;
// create a new section and define the margins
- Section(10,10,10,10);
+ Section(10,10,10,10,0,oLandscape);
+ // create a default column for section2 which is landscape oriented
+ ColDefSect2:= Colonne(20,257);
+ // write title on each page of the section
+ EcritEnTete(cnCenter,lnFin,'MULTI SECTION DOCUMENT',ColDefSect2,FtTitreS2);
+ // write section number and total of sections on each page
+ NumSectionEnTete(cnRight,lnFin,'Section','of',True,False,ColDefSect2,FtNum);
+ // write page number for the section and total pages of the section on each page
+ NumPageSectionEnTete(cnCenter,lnFin,'Section page','of',True,True,ColDefSect2,FtNumS);
+ // write page number and total of pages on each page
+ NumPagePied(cnCenter,lnFin,'Page','of',True,ColDefSect2,FtNum);
+ // create some new empty pages in the section
+ for Cpt:= 1 to 2 do
+ Page;
+
+ // create a new section and define the margins
+ Section(20,20,20,20);
+ // write title on each page of the section
+ EcritEnTete(cnCenter,lnFin,'MULTI SECTION DOCUMENT',ColDefaut,FtTitreS3);
+ // write section number and total of sections on each page
+ NumSectionEnTete(cnRight,lnFin,'Section','of',True,True,ColDefaut,FtNum);
+ // write page number for the section and total pages of the section on each page
+ NumPageSectionEnTete(cnCenter,lnFin,'Section page','of',True,False,ColDefaut,FtNumS);
+ // write page number and total of pages on each page
+ NumPagePied(cnCenter,lnFin,'Page','of',True,ColDefaut,FtNum);
+ // create some new empty pages in the section
+ for Cpt:= 1 to 4 do
+ Page;
+
+ // preparation is finished, so create PDF objects
+ Fin;
+ end;
+end;
+
+procedure TF_Demo.ImprimeOutlines(Preview: Boolean);
+var
+ FtTitreS1,FtTitreS2,FtTitreS3,FtTexte,FtNum,FtNumS: Integer;
+ ColDefSect2: Integer;
+ Cpt: Integer;
+begin
+with Imprime do
+ begin
+ // define orientation, page format, measurement unit, language, preview (true) or print (false)
+ Debut(oPortrait,A4,msMM,Langue,Preview);
+ // create the fonts to be used (use one of the 14 Adobe PDF standard fonts)
+ FtTitreS1:= Fonte('helvetica-15:bold',clBlack);
+ FtTitreS2:= Fonte('helvetica-14:italic',clBlack);
+ FtTitreS3:= Fonte('helvetica-12:bold:italic',clBlack);
+ FtTexte:= Fonte('helvetica-8',clBlack);
+ FtNum:= Fonte('helvetica-7:italic',clBlack);
+ FtNumS:= Fonte('helvetica-7:italic',clGray);
+ // create a new section and define the margins
+ Section(20,10,10,10);
+ // write title on each page of the section
+ EcritEnTete(cnCenter,lnFin,'MULTI SECTION DOCUMENT',ColDefaut,FtTitreS1);
+ // write section number and total of sections on each page
+ NumSectionEnTete(cnRight,lnFin,'Section','of',True,False,ColDefaut,FtNum);
+ // write page number for the section and total pages of the section on each page
+ NumPageSectionPied(cnCenter,lnFin,'Section page','of',True,False,ColDefaut,FtNumS);
+ // write page number and total of pages on each page
+ NumPagePied(cnCenter,lnFin,'Page','of',True,ColDefaut,FtNum);
+ // create some new empty pages in the section
+ for Cpt:= 1 to 3 do
+ Page;
+
+ // create a new section and define the margins
+ Section(10,10,10,10,0,oLandscape);
+ TitreSection:= 'Landscape oriented';
// write title on each page of the section
EcritEnTete(cnCenter,lnFin,'MULTI SECTION DOCUMENT',ColDefaut,FtTitreS2);
// write section number and total of sections on each page
@@ -854,6 +998,7 @@ with Imprime do
Page;
// preparation is finished, so create PDF objects
+ Outline:= True;
Fin;
end;
end;
@@ -998,6 +1143,7 @@ with Imprime do
EcritPage(cnLeft,lnFin,'',Col3,FtTexte);
EspacePage(5);
EcritPage(cnLeft,lnFin,'A thick border',Col3,FtTexte,IlTexte,-1,BdRect);
+ TraitHorizPage(2,2,Col2,TsEpais);
TraitPage(30,100,150,150,tsFinNoir);
TraitPage(50,70,180,100,tsFinBleu);
TraitPage(40,140,160,80,tsFinRouge);
@@ -1139,7 +1285,7 @@ begin
inherited Create(AOwner);
Name := 'F_Demo';
WindowTitle:= 'PDF demo';
-SetPosition(0, 0, 650, 450);
+SetPosition(0, 0, 650, 500);
WindowPosition:= wpScreenCenter;
Sizeable:= False;
fpgSetNamedColor(clWindowBackground,clPaleGreen);
@@ -1154,21 +1300,23 @@ Bt_PdfEmptyPage:= CreateButton(Self,50,30,150,'Empty page',@Bt_PdfEmptyPageClick
Bt_PdfSimpleText:= CreateButton(Self,50,70,150,'Simple text',@Bt_PdfSimpleTextClick,'stdimg.Adobe_pdf');
Bt_PdfMultiPages:= CreateButton(Self,50,110,150,'Multiple pages',@Bt_PdfMultiPagesClick,'stdimg.Adobe_pdf');
Bt_PdfMultiSections:= CreateButton(Self,50,150,150,'Multiple sections',@Bt_PdfMultiSectionsClick,'stdimg.Adobe_pdf');
-Bt_PdfCadres:= CreateButton(Self,50,190,150,'Draw frames',@Bt_PdfCadresClick,'stdimg.Adobe_pdf');
-Bt_PdfColor:= CreateButton(Self,50,230,150,'Show colors',@Bt_PdfColorClick,'stdimg.Adobe_pdf');
-Bt_PdfLines:= CreateButton(Self,50,270,150,'Draw lines',@Bt_PdfLinesClick,'stdimg.Adobe_pdf');
-Bt_PdfGrid:= CreateButton(Self,50,310,150,'Show grid',@Bt_PdfGridClick,'stdimg.Adobe_pdf');
-Bt_PdfGraph:= CreateButton(Self,50,350,150,'Show graph',@Bt_PdfGraphClick,'stdimg.Adobe_pdf');
+Bt_PdfOutlines:= CreateButton(Self,50,190,150,'Outlines',@Bt_PdfOutlinesClick,'stdimg.Adobe_pdf');
+Bt_PdfCadres:= CreateButton(Self,50,230,150,'Draw frames',@Bt_PdfCadresClick,'stdimg.Adobe_pdf');
+Bt_PdfColor:= CreateButton(Self,50,270,150,'Show colors',@Bt_PdfColorClick,'stdimg.Adobe_pdf');
+Bt_PdfLines:= CreateButton(Self,50,310,150,'Draw lines',@Bt_PdfLinesClick,'stdimg.Adobe_pdf');
+Bt_PdfGrid:= CreateButton(Self,50,350,150,'Show grid',@Bt_PdfGridClick,'stdimg.Adobe_pdf');
+Bt_PdfGraph:= CreateButton(Self,50,390,150,'Show graph',@Bt_PdfGraphClick,'stdimg.Adobe_pdf');
L_Pdf:= CreateLabel(Self,250,5,'Preview',150,20,taCenter);
Bt_VisuEmptyPage:= CreateButton(Self,250,30,150,'Empty page',@Bt_VisuEmptyPageClick,'stdimg.Preview');
Bt_VisuSimpleText:= CreateButton(Self,250,70,150,'Simple text',@Bt_VisuSimpleTextClick,'stdimg.Preview');
Bt_VisuMultiPages:= CreateButton(Self,250,110,150,'Multiple pages',@Bt_VisuMultiPagesClick,'stdimg.Preview');
Bt_VisuMultiSections:= CreateButton(Self,250,150,150,'Multiple sections',@Bt_VisuMultiSectionsClick,'stdimg.Preview');
-Bt_VisuCadres:= CreateButton(Self,250,190,150,'Draw frames',@Bt_VisuCadresClick,'stdimg.Preview');
-Bt_VisuColor:= CreateButton(Self,250,230,150,'Show colors',@Bt_VisuColorClick,'stdimg.Preview');
-Bt_VisuLines:= CreateButton(Self,250,270,150,'Draw lines',@Bt_VisuLinesClick,'stdimg.Preview');
-Bt_VisuGrid:= CreateButton(Self,250,310,150,'Show grid',@Bt_VisuGridClick,'stdimg.Preview');
-Bt_VisuGraph:= CreateButton(Self,250,350,150,'Show graph',@Bt_VisuGraphClick,'stdimg.Preview');
+Bt_VisuOutlines:= CreateButton(Self,250,190,150,'Outlines',@Bt_VisuOutlinesClick,'stdimg.Preview');
+Bt_VisuCadres:= CreateButton(Self,250,230,150,'Draw frames',@Bt_VisuCadresClick,'stdimg.Preview');
+Bt_VisuColor:= CreateButton(Self,250,270,150,'Show colors',@Bt_VisuColorClick,'stdimg.Preview');
+Bt_VisuLines:= CreateButton(Self,250,310,150,'Draw lines',@Bt_VisuLinesClick,'stdimg.Preview');
+Bt_VisuGrid:= CreateButton(Self,250,350,150,'Show grid',@Bt_VisuGridClick,'stdimg.Preview');
+Bt_VisuGraph:= CreateButton(Self,250,390,150,'Show graph',@Bt_VisuGraphClick,'stdimg.Preview');
L_Print:= CreateLabel(Self,450,5,'Print to printer',150,20,taCenter);
Bt_PrintEmptyPage:= CreateButton(Self,450,30,150,'Empty page',@Bt_PrintEmptyPageClick,'stdimg.Imprimer');
Bt_PrintEmptyPage.Enabled:= False;
@@ -1178,17 +1326,19 @@ Bt_PrintMultiPages:= CreateButton(Self,450,110,150,'Multiple pages',@Bt_PrintMul
Bt_PrintMultiPages.Enabled:= False;
Bt_PrintMultiSections:= CreateButton(Self,450,150,150,'Multiple sections',@Bt_PrintMultiSectionsClick,'stdimg.Imprimer');
Bt_PrintMultiSections.Enabled:= False;
-Bt_PrintCadres:= CreateButton(Self,450,190,150,'Draw frames',@Bt_PrintCadresClick,'stdimg.Imprimer');
+Bt_PrintOutlines:= CreateButton(Self,450,190,150,'Outlines',@Bt_PrintOutlinesClick,'stdimg.Imprimer');
+Bt_PrintOutlines.Enabled:= False;
+Bt_PrintCadres:= CreateButton(Self,450,230,150,'Draw frames',@Bt_PrintCadresClick,'stdimg.Imprimer');
Bt_PrintCadres.Enabled:= False;
-Bt_PrintColor:= CreateButton(Self,450,230,150,'Show colors',@Bt_PrintColorClick,'stdimg.Imprimer');
+Bt_PrintColor:= CreateButton(Self,450,270,150,'Show colors',@Bt_PrintColorClick,'stdimg.Imprimer');
Bt_PrintColor.Enabled:= False;
-Bt_PrintLines:= CreateButton(Self,450,270,150,'Draw lines',@Bt_PrintLinesClick,'stdimg.Imprimer');
+Bt_PrintLines:= CreateButton(Self,450,310,150,'Draw lines',@Bt_PrintLinesClick,'stdimg.Imprimer');
Bt_PrintLines.Enabled:= False;
-Bt_PrintGrid:= CreateButton(Self,450,310,150,'Show grid',@Bt_PrintGridClick,'stdimg.Imprimer');
+Bt_PrintGrid:= CreateButton(Self,450,350,150,'Show grid',@Bt_PrintGridClick,'stdimg.Imprimer');
Bt_PrintGrid.Enabled:= False;
-Bt_PrintGraph:= CreateButton(Self,450,350,150,'Show graph',@Bt_PrintGraphClick,'stdimg.Imprimer');
+Bt_PrintGraph:= CreateButton(Self,450,390,150,'Show graph',@Bt_PrintGraphClick,'stdimg.Imprimer');
Bt_PrintGraph.Enabled:= False;
-Bt_Fermer:= CreateButton(Self,450,400,150,'Fermer',@Bt_FermerClick,'stdimg.Fermer');
+Bt_Fermer:= CreateButton(Self,450,450,150,'Fermer',@Bt_FermerClick,'stdimg.Fermer');
Bt_Fermer.BackgroundColor:= clTomato;
Randomize;
for Cpt:= 0 to 18 do
diff --git a/extras/contributed/report_tool/reportengine/u_commande.pas b/extras/contributed/report_tool/reportengine/u_commande.pas
index f806247f..1b58bd3c 100644
--- a/extras/contributed/report_tool/reportengine/u_commande.pas
+++ b/extras/contributed/report_tool/reportengine/u_commande.pas
@@ -48,6 +48,7 @@ type
private
FNumSect: Integer;
FNbPages: Integer;
+ FPaper: TPapier;
FMarges: TDimensions;
FBasEnTete: Integer;
FHautPied: Integer;
@@ -55,10 +56,12 @@ type
FEnTete: TList;
FPied: TList;
FCadres: TList;
- function FirstPage: Integer;
- function TotalPages: Integer;
+ FColonnes: TList;
+ FTitre: string;
+ function GetFirstPage: Integer;
+ function GetTotalPages: Integer;
public
- constructor Create(AMarges: TDimensions; ANum: Integer); virtual;
+ constructor Create(APaper: TPapier; AMarges: TDimensions; ANum: Integer); virtual;
destructor Destroy; override;
procedure LoadPage(APageNum: Integer);
procedure LoadCmdEnTete;
@@ -71,15 +74,21 @@ type
procedure LoadEspacePied(APosY,AColonne,AHeight,AFond: Integer);
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);
function GetCmdPage(NumPage: Integer): TList;
- property GetCmdEnTete: TList read FEntete;
- property GetCmdPied: TList read FPied;
- property GetNbPages: Integer read FNbPages;
- property GetFirstPage: Integer read FirstPage;
+ property CmdEnTete: TList read FEntete;
+ property CmdPied: TList read FPied;
+ property NbPages: Integer read FNbPages;
+ property FirstPage: Integer read GetFirstPage;
property Pages: TList read FPages;
- property TotPages: Integer read TotalPages;
- property GetMarges: TDimensions read FMarges;
- property GetCmdCadres: TList read FCadres;
+ property TotPages: Integer read GetTotalPages;
+ property Paper: TPapier read FPaper;
+ property Marges: TDimensions read FMarges;
+ property CmdCadres: TList read FCadres;
+ property Colonnes: TList read FColonnes;
+ property Titre: string read FTitre write FTitre;
end;
T_Page = class
@@ -104,8 +113,8 @@ type
constructor Create; virtual;
destructor Destroy; override;
property Commandes: TList read FCommandes write FCommandes;
- property GetLineHeight: Integer read FLineHeight;
- property GetGroupeHeight: Integer read FGroupeHeight;
+ property LineHeight: Integer read FLineHeight;
+ property GroupeHeight: Integer read FGroupeHeight;
end;
T_Ligne = class
@@ -120,7 +129,7 @@ type
procedure LoadNumero(APosX,APosY,AColonne,ATexteNum,ATexteTot,AFonte,AHeight,AFond,ABord,AInterL: Integer;
ACurFont: Boolean; AFlags: TFTextFlags; ATotal,AAlpha: Boolean; ATypeNum: TSectPageNum);
property Commandes: TList read FCommandes;
- property GetHeight: Integer read FHeight;
+ property LineHeight: Integer read FHeight;
end;
// command classes
@@ -226,9 +235,9 @@ type
function GetTextPos: Integer;
function GetTextWidth: Integer;
procedure SetColColor(AColor: TfpgColor);
- property GetColPos: Integer read FPos;
- property GetColWidth: Integer read FWidth;
- property GetColMargin: Integer read FMargin;
+ property ColPos: Integer read FPos write FPos;
+ property ColWidth: Integer read FWidth write FWidth;
+ property ColMargin: Integer read FMargin write FMargin;
property GetColor: TfpgColor read FColor;
end;
@@ -314,7 +323,7 @@ type
var
Sections: TList;
- Colonnes: TList;
+// Colonnes: TList;
Textes: TStringList;
Fontes: TList;
Interlignes: TList;
@@ -348,14 +357,14 @@ else
Result:= Copy(AValue,Succ(Pos('-',AValue)),Length(AValue)-Pos('-',AValue));
end;
-// document classes methods
+// document class methods
-function T_Section.FirstPage: Integer;
+function T_Section.GetFirstPage: Integer;
begin
Result:= T_Page(Pages[0]).PagesTot;
end;
-function T_Section.TotalPages: Integer;
+function T_Section.GetTotalPages: Integer;
begin
if Pages.Count> 0
then
@@ -364,10 +373,11 @@ else
Result:= 0;
end;
-constructor T_Section.Create(AMarges: TDimensions; ANum: Integer);
+constructor T_Section.Create(APaper: TPapier; AMarges: TDimensions; ANum: Integer);
begin
FNumSect:= ANum;
FNbPages:= 0;
+FPaper:= APaper;
FMarges:= AMarges;
FBasEnTete:= FMarges.T;
FHautPied:= FMarges.B;
@@ -375,6 +385,7 @@ FPages:= TList.Create;
FEnTete:= TList.Create;
FPied:= TList.Create;
FCadres:= TList.Create;
+FColonnes:= TList.Create;
end;
destructor T_Section.Destroy;
@@ -383,6 +394,7 @@ FPages.Free;
FEnTete.Free;
FPied.Free;
FCadres.Free;
+FColonnes.Free;
inherited Destroy;
end;
@@ -478,6 +490,24 @@ 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);
+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);
+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);
+begin
+ACommande:= T_Trait.Create(APosXDeb,APosYDeb,AColonne,AStyle,APosXFin,APosYFin);
+FPied.Add(ACommande);
+end;
+
function T_Section.GetCmdPage(NumPage: Integer): TList;
begin
Result:= T_Page(Pages[Pred(NumPage)]).Commandes;
@@ -541,7 +571,7 @@ ACommande:= T_Numero.Create(APosX,APosY,AColonne,ATexteNum,ATexteTot,AFonte,AFon
Commandes.Add(ACommande);
end;
-// command classes methods
+// command class methods
procedure T_EcritTexte.SetPosY(const AValue: Integer);
begin
diff --git a/extras/contributed/report_tool/reportengine/u_imprime.pas b/extras/contributed/report_tool/reportengine/u_imprime.pas
index 5ad5c15b..0350c0da 100644
--- a/extras/contributed/report_tool/reportengine/u_imprime.pas
+++ b/extras/contributed/report_tool/reportengine/u_imprime.pas
@@ -62,7 +62,8 @@ type
function GetHauteurPapier: Integer;
function GetLargeurPapier: Integer;
procedure Bv_VisuPaint(Sender: TObject);
- procedure PrepareVisu;
+ procedure PrepareFormat;
+ procedure CreateVisu;
procedure ImprimePage(PageNumero: Integer);
procedure DecaleLignesPied(Decalage: Integer);
procedure DecaleLigne(Decalage: Integer);
@@ -75,6 +76,9 @@ type
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);
+ function GetTitreSection: string;
+ procedure SetTitreSection(ATitre: string);
public
constructor Create;
destructor Destroy; override;
@@ -89,8 +93,11 @@ type
procedure Fin;
procedure ImprimeDocument;
procedure Visualisation;
- procedure Section(MgGauche,MgDroite,MgHaute,MgBasse: Single; Retrait: Single= 0);
+ procedure Section(MgGauche,MgDroite,MgHaute,MgBasse: Single; Retrait: Single= 0;
+ IniOriente: TOrient= oPortrait);
// new section with initialization of margins
+ // Retrait = additional margin which can be necessary when frames are drawn
+ // IniOriente = paper orientation >> oPortrait or oLandscape
procedure Page;
// new page in the current section
function Fond(FdColor: TfpgColor): Integer;
@@ -243,12 +250,21 @@ type
// InterNum = space between lines reference
// CoulFdNum = background color reference, if > -1, replaces the column background color if any
// BordNum = border reference, if> -1
- //procedure TraitEnTete(Horiz,Verti: Single; ColNum: Integer= 0; StyleNum: Integer= 0; FinH: Integer= -1;
- //FinV: Integer= -1);
- //procedure TraitPage(Horiz,Verti: Single; ColNum: Integer= 0; StyleNum: Integer= 0; FinH: Integer= -1;
- //FinV: Integer= -1);
- //procedure TraitPied(Horiz,Verti: Single; ColNum: Integer= 0; StyleNum: Integer= 0; FinH: Integer= -1;
- //FinV: Integer= -1);
+ procedure TraitHorizEnTete(EspAvant,EspApres: Single; ColNum: Integer= 0; StyleNum: Integer= 0);
+ // EspAvant = empty space before the horizontal line : numeric value in the measurement unit (msMM or msInch)
+ // EspApres = empty space after the horizontal line : numeric value in the measurement unit (msMM or msInch)
+ // ColNum = column reference, default between left and right margins
+ // StyleNum = reference of the line style
+ procedure TraitHorizPage(EspAvant,EspApres: Single; ColNum: Integer= 0; StyleNum: Integer= 0);
+ // EspAvant = empty space before the horizontal line : numeric value in the measurement unit (msMM or msInch)
+ // EspApres = empty space after the horizontal line : numeric value in the measurement unit (msMM or msInch)
+ // ColNum = column reference, default between left and right margins
+ // StyleNum = reference of the line style
+ procedure TraitHorizPied(EspAvant,EspApres: Single; ColNum: Integer= 0; StyleNum: Integer= 0);
+ // EspAvant = empty space before the horizontal line : numeric value in the measurement unit (msMM or msInch)
+ // EspApres = empty space after the horizontal line : numeric value in the measurement unit (msMM or msInch)
+ // ColNum = column reference, default between left and right margins
+ // StyleNum = reference of the line style
procedure EspaceEnTete(Verti: Single; ColNum: Integer=0; CoulFdNum: Integer= -1);
// Verti = height of the empty space : numeric value in the measurement unit (msMM or msInch)
// ColNum = column reference, default between left and right margins
@@ -293,7 +309,7 @@ type
// YDebut = vertical position of starting point in numeric value in the measurement unit (msMM or msInch)
// XFin = horizontal position of ending point in numeric value in the measurement unit (msMM or msInch)
// YFin = vertical position of ending point in numeric value in the measurement unit (msMM or msInch)
- // AStyle = line style of the frame
+ // AStyle = reference of the line style of the frame
property Langue: Char read FVersion write FVersion;
property Visualiser: Boolean read FVisualisation write FVisualisation;
property NumeroSection: Integer read FNmSection write FNmSection;
@@ -303,6 +319,7 @@ type
property LargeurPapier: Integer read GetLargeurPapier;
property DefaultFile: string read FDefaultFile write FDefaultFile;
property CouleurCourante: Integer read FColorCourante write FColorCourante;
+ property TitreSection: string read GetTitreSection write SetTitreSection;
end;
// classes for interface with PDF generation
@@ -518,7 +535,7 @@ begin
ImprimePage(NumeroPage);
end;
-procedure T_Imprime.PrepareVisu;
+procedure T_Imprime.PrepareFormat;
var
TempH,TempW,TempT,TempL,TempR,TempB: Integer;
begin
@@ -654,6 +671,10 @@ with FPapier do
end;
end;
end;
+end;
+
+procedure T_Imprime.CreateVisu;
+begin
F_Visu:= TF_Visu.Create(nil);
with F_Visu do
begin
@@ -692,6 +713,20 @@ with T_Section(APageSect) do
end;
end;
+procedure LibereColonnes(AColSect: PSection);
+var
+ Cpt: Integer;
+begin
+with T_Section(AColSect) do
+ if Colonnes.Count> 0
+ then
+ begin
+ for Cpt:= 0 to Pred(Colonnes.Count) do
+ T_Colonne(Colonnes[Cpt]).Free;
+ Colonnes.Free;
+ end;
+end;
+
procedure T_Imprime.ImprimePage(PageNumero: Integer);
var
CptSect,CptPage,CptCmd: Integer;
@@ -713,11 +748,11 @@ NumeroSection:= CptSect;
NumeroPageSection:= LaPage.PagesSect;
with T_Section(Sections[Pred(NumeroSection)]) do
begin
- if GetCmdEnTete.Count> 0
+ if CmdEnTete.Count> 0
then
- for CptCmd:= 0 to Pred(GetCmdEnTete.Count) do
+ for CptCmd:= 0 to Pred(CmdEnTete.Count) do
begin
- Cmd:= T_Commande(GetCmdEnTete.Items[CptCmd]);
+ Cmd:= T_Commande(CmdEnTete.Items[CptCmd]);
if Cmd is T_EcritTexte
then
with Cmd as T_EcritTexte do
@@ -731,6 +766,10 @@ with T_Section(Sections[Pred(NumeroSection)]) do
then
with Cmd as T_Espace do
InsereEspace(GetPosY,GetColonne,GetHeight,GetFond,zEnTete);
+ if Cmd is T_Trait
+ then
+ with Cmd as T_Trait do
+ TraceTrait(GetPosX,GetPosY,GetEndX,GetEndY,GetStyle);
end;
if GetCmdPage(NumeroPageSection).Count> 0
then
@@ -750,11 +789,11 @@ with T_Section(Sections[Pred(NumeroSection)]) do
with Cmd as T_Trait do
TraceTrait(GetPosX,GetPosY,GetEndX,GetEndY,GetStyle);
end;
- if GetCmdPied.Count> 0
+ if CmdPied.Count> 0
then
- for CptCmd:= 0 to Pred(GetCmdPied.Count) do
+ for CptCmd:= 0 to Pred(CmdPied.Count) do
begin
- Cmd:= T_Commande(GetCmdPied.Items[CptCmd]);
+ Cmd:= T_Commande(CmdPied.Items[CptCmd]);
if Cmd is T_EcritTexte
then
with Cmd as T_EcritTexte do
@@ -768,12 +807,16 @@ with T_Section(Sections[Pred(NumeroSection)]) do
then
with Cmd as T_Espace do
InsereEspace(GetPosY,GetColonne,GetHeight,GetFond,zPied);
+ if Cmd is T_Trait
+ then
+ with Cmd as T_Trait do
+ TraceTrait(GetPosX,GetPosY,GetEndX,GetEndY,GetStyle);
end;
- if GetCmdCadres.Count> 0
+ if CmdCadres.Count> 0
then
- for CptCmd:= 0 to Pred(GetCmdCadres.Count) do
+ for CptCmd:= 0 to Pred(CmdCadres.Count) do
begin
- Cmd:= T_Commande(GetCmdCadres.Items[CptCmd]);
+ Cmd:= T_Commande(CmdCadres.Items[CptCmd]);
if Cmd is T_Cadre
then
with Cmd as T_Cadre do
@@ -788,11 +831,11 @@ var
Cmd: T_Commande;
begin
with T_Section(Sections[Pred(NumeroSection)]) do
- if GetCmdPied.Count> 0
+ if CmdPied.Count> 0
then
- for Cpt:= 0 to Pred(GetCmdPied.Count) do
+ for Cpt:= 0 to Pred(CmdPied.Count) do
begin
- Cmd:= T_Commande(GetCmdPied.Items[Cpt]);
+ Cmd:= T_Commande(CmdPied.Items[Cpt]);
if Cmd is T_EcritTexte
then
with Cmd as T_EcritTexte do
@@ -848,105 +891,120 @@ var
Fnt: TfpgFont;
StylTrait: TfpgLineStyle;
begin
-FinDeLigne:= False;
-if FPreparation= ppPrepare
-then
- if FFonteCourante<> FonteNum
+with T_Section(Sections[Pred(NumeroSection)]) do
+ begin
+ FinDeLigne:= False;
+ if FPreparation= ppPrepare
then
- begin
- FFonteCourante:= FonteNum;
- UseCurFont:= False;
- end
- else
- UseCurFont:= True;
-Fnt:= T_Fonte(Fontes[FonteNum]).GetFonte;
-if Interlignes.Count= 0
-then
- Interligne(0,0,0);
-if FInterLCourante<> InterL
-then
- FInterLCourante:= InterL;
-IntLSup:= T_Interligne(Interlignes[FInterLCourante]).GetSup;
-IntlInt:= T_Interligne(Interlignes[FInterLCourante]).GetInt;
-IntLInf:= T_Interligne(Interlignes[FInterLCourante]).GetInf;
-if Colonne> -1
-then
- HautTxt:= TxtHeight(T_Colonne(Colonnes[Colonne]).GetTextWidth,Textes[Texte],Fnt,IntlInt)+IntLSup+IntLInf
-else
- HautTxt:= TxtHeight(FPapier.W,Textes[Texte],Fnt,IntlInt)+IntLSup+IntLInf;
-if (Colonne> -1) and (BordNum> -1)
-then
- Half:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetEpais div 2
-else
- Half:= 0;
-case FPreparation of
- ppPrepare:
- begin
- if T_Section(Sections[Pred(NumeroSection)]).GetNbPages= 0
- then
- Page;
- if Colonne> -1
+ if FFonteCourante<> FonteNum
then
begin
- HTxt:= ALigne.GetHeight;
- if HTxt< HautTxt
- then
- HTxt:= HautTxt;
+ FFonteCourante:= FonteNum;
+ UseCurFont:= False;
end
else
- if HTxt< Fnt.Height
+ UseCurFont:= True;
+ Fnt:= T_Fonte(Fontes[FonteNum]).GetFonte;
+ if Interlignes.Count= 0
+ then
+ Interligne(0,0,0);
+ if FInterLCourante<> InterL
+ then
+ FInterLCourante:= InterL;
+ IntLSup:= T_Interligne(Interlignes[FInterLCourante]).GetSup;
+ IntlInt:= T_Interligne(Interlignes[FInterLCourante]).GetInt;
+ IntLInf:= T_Interligne(Interlignes[FInterLCourante]).GetInf;
+ if Colonne> -1
+ then
+ HautTxt:= TxtHeight(T_Colonne(Colonnes[Colonne]).GetTextWidth,Textes[Texte],Fnt,IntlInt)+IntLSup+IntLInf
+ else
+ HautTxt:= TxtHeight(Paper.W,Textes[Texte],Fnt,IntlInt)+IntLSup+IntLInf;
+ if (Colonne> -1) and (BordNum> -1)
+ then
+ Half:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetEpais div 2
+ else
+ Half:= 0;
+ case FPreparation of
+ ppPrepare:
+ begin
+ if NbPages= 0
+ then
+ Page;
+ if Colonne> -1
then
- HTxt:= Fnt.Height;
- case Zone of
- zEntete:
- FPosRef.Y:= FMargeCourante.T+FEnTeteHeight;
- zPage:
- FPosRef.Y:= FMargeCourante.T+FEnTeteHeight+FPageHeight;
- zPied:
begin
- FPosRef.Y:= FMargeCourante.B-HTxt;
- FPiedHeight:= FPiedHeight+HTxt;
- DecaleLignesPied(HTxt);
+ HTxt:= ALigne.LineHeight;
+ if HTxt< HautTxt
+ then
+ HTxt:= HautTxt;
+ end
+ else
+ if HTxt< Fnt.Height
+ then
+ HTxt:= Fnt.Height;
+ case Zone of
+ zEntete:
+ FPosRef.Y:= FMargeCourante.T+FEnTeteHeight;
+ zPage:
+ FPosRef.Y:= FMargeCourante.T+FEnTeteHeight+FPageHeight;
+ zPied:
+ begin
+ FPosRef.Y:= FMargeCourante.B-HTxt;
+ FPiedHeight:= FPiedHeight+HTxt;
+ DecaleLignesPied(HTxt);
+ end;
end;
- end;
- if PosY= lnCourante
- then
- PosV:= FPosRef.Y+IntLSup
- else
- begin
- FinDeLigne:= True;
- if PosY= lnFin
+ if PosY= lnCourante
then
+ PosV:= FPosRef.Y+IntLSup
+ else
begin
- PosV:= FPosRef.Y+IntLSup;
- case Zone of
- zEnTete:
- FPosRef.Y:= FPosRef.Y+HTxt;
- zPage:
- begin
- if FPosRef.Y+HTxt> FMargeCourante.B-FPiedHeight
- then
- if FGroupe
+ FinDeLigne:= True;
+ if PosY= lnFin
+ then
+ begin
+ PosV:= FPosRef.Y+IntLSup;
+ case Zone of
+ zEnTete:
+ FPosRef.Y:= FPosRef.Y+HTxt;
+ zPage:
+ begin
+ if FPosRef.Y+HTxt> FMargeCourante.B-FPiedHeight
then
- begin
- if AGroupe.GetGroupeHeight+HTxt< FMargeCourante.B-FMargeCourante.T-FEnTeteHeight-FPiedHeight
+ if FGroupe
then
begin
- Page;
- if AGroupe.Commandes.Count> 0
+ if AGroupe.GroupeHeight+HTxt< FMargeCourante.B-FMargeCourante.T-FEnTeteHeight-FPiedHeight
then
begin
- FPosRef.Y:= FMargeCourante.T+FEnTeteHeight;
- DecaleGroupe(T_EcritTexte(AGroupe.Commandes[0]).GetPosY-FPosRef.Y);
- FPosRef.Y:= FPosRef.Y+AGroupe.GetGroupeHeight+Succ(Half);
- if ALigne.Commandes.Count> 0
+ Page;
+ if AGroupe.Commandes.Count> 0
then
- DecaleLigne(T_EcritTexte(ALigne.Commandes[0]).GetPosY-FPosRef.Y);
- PosV:= FPosRef.Y+IntLSup;
- FPosRef.Y:= FPosRef.Y+HTxt+Succ(Half);
+ begin
+ FPosRef.Y:= FMargeCourante.T+FEnTeteHeight;
+ DecaleGroupe(T_EcritTexte(AGroupe.Commandes[0]).GetPosY-FPosRef.Y);
+ FPosRef.Y:= FPosRef.Y+AGroupe.GroupeHeight+Succ(Half);
+ if ALigne.Commandes.Count> 0
+ then
+ DecaleLigne(T_EcritTexte(ALigne.Commandes[0]).GetPosY-FPosRef.Y);
+ PosV:= FPosRef.Y+IntLSup;
+ FPosRef.Y:= FPosRef.Y+HTxt+Succ(Half);
+ end
+ else
+ begin
+ if ALigne.Commandes.Count> 0
+ then
+ DecaleLigne(T_EcritTexte(ALigne.Commandes[0]).GetPosY-FPosRef.Y);
+ PosV:= FPosRef.Y+IntLSup;
+ FPosRef.Y:= FPosRef.Y+HTxt+Succ(Half);
+ end;
end
else
begin
+ LoadCmdGroupeToPage;
+ AGroupe.Commandes.Clear;
+ Page;
+ FPosRef.Y:= FMargeCourante.T+FEnTeteHeight;
if ALigne.Commandes.Count> 0
then
DecaleLigne(T_EcritTexte(ALigne.Commandes[0]).GetPosY-FPosRef.Y);
@@ -956,8 +1014,6 @@ case FPreparation of
end
else
begin
- T_Section(Sections[Pred(Sections.Count)]).LoadCmdGroupeToPage;
- AGroupe.Commandes.Clear;
Page;
FPosRef.Y:= FMargeCourante.T+FEnTeteHeight;
if ALigne.Commandes.Count> 0
@@ -965,231 +1021,242 @@ case FPreparation of
DecaleLigne(T_EcritTexte(ALigne.Commandes[0]).GetPosY-FPosRef.Y);
PosV:= FPosRef.Y+IntLSup;
FPosRef.Y:= FPosRef.Y+HTxt+Succ(Half);
- end;
- end
+ end
else
- begin
- Page;
- FPosRef.Y:= FMargeCourante.T+FEnTeteHeight;
- if ALigne.Commandes.Count> 0
- then
- DecaleLigne(T_EcritTexte(ALigne.Commandes[0]).GetPosY-FPosRef.Y);
- PosV:= FPosRef.Y+IntLSup;
- FPosRef.Y:= FPosRef.Y+HTxt+Succ(Half);
- end
- else
- FPosRef.Y:= FPosRef.Y+HTxt;
+ FPosRef.Y:= FPosRef.Y+HTxt;
+ end;
end;
+ if BordNum> -1
+ then
+ with T_Bord(Bords[BordNum]) do
+ if bcBas in GetFlags
+ then
+ FPosRef.Y:= FPosRef.Y+1;
+ end
+ else
+ begin
+ PosV:= PosY;
+ FPosRef.Y:= PosV+IntLInf;
end;
- if BordNum> -1
+ case Zone of
+ zEnTete:
+ FEnTeteHeight:= FPosRef.Y-FMargeCourante.T;
+ zPage:
+ FPageHeight:= FPosRef.Y-FEnTeteHeight-FMargeCourante.T;
+ end;
+ end;
+ //if PosX= cnSuite
+ //then
+ //PosH:= FPosRef.X
+ //else
+ if Colonne= -1
then
- with T_Bord(Bords[BordNum]) do
- if bcBas in GetFlags
+ if PosX> 0
+ then
+ PosH:= PosX
+ else
+ begin
+ PosH:= T_Colonne(Colonnes[ColDefaut]).GetTextPos;
+ if (txtRight in TxtFlags)
then
- FPosRef.Y:= FPosRef.Y+1;
- end
- else
+ 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;
+ end
+ else
+ if PosX> 0
+ then
+ begin
+ if (PosX< T_Colonne(Colonnes[Colonne]).GetTextPos)
+ or (PosX> (T_Colonne(Colonnes[Colonne]).GetTextPos+T_Colonne(Colonnes[Colonne]).GetTextWidth))
+ then
+ PosH:= T_Colonne(Colonnes[Colonne]).GetTextPos
+ else
+ PosH:= PosX;
+ end
+ else
+ begin
+ PosH:= T_Colonne(Colonnes[Colonne]).GetTextPos;
+ if (txtRight in TxtFlags)
+ then
+ 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;
+ end;
+ FPosRef.X:= PosH+Fnt.TextWidth(Textes[Texte]+' ');
+ ALigne.LoadTexte(PosH,PosV,Colonne,Texte,FonteNum,HTxt,FondNum,BordNum,InterL,UseCurFont,TxtFlags);
+ if FinDeLigne
+ then
begin
- PosV:= PosY;
- FPosRef.Y:= PosV+IntLInf;
- end;
- case Zone of
- zEnTete:
- FEnTeteHeight:= FPosRef.Y-FMargeCourante.T;
- zPage:
- FPageHeight:= FPosRef.Y-FEnTeteHeight-FMargeCourante.T;
+ HTxt:= 0;
+ FinLigne(Zone);
end;
end;
- //if PosX= cnSuite
- //then
- //PosH:= FPosRef.X
- //else
- if Colonne= -1
- then
- if PosX> 0
- then
- PosH:= PosX
- else
+ ppVisualise:
+ with FCanevas do
begin
- PosH:= T_Colonne(Colonnes[0]).GetTextPos;
- if (txtRight in TxtFlags)
- then
- PosH:= PosH+T_Colonne(Colonnes[0]).GetColWidth-Fnt.TextWidth(Textes[Texte])-T_Colonne(Colonnes[0]).GetColMargin;
- if (txtHCenter in TxtFlags)
+ Font:= T_Fonte(Fontes[FonteNum]).GetFonte;
+ SetTextColor(T_Fonte(Fontes[FonteNum]).GetColor);
+ if Colonne> -1
then
- PosH:= PosH+(T_Colonne(Colonnes[0]).GetColWidth-Fnt.TextWidth(Textes[Texte])) div 2;
- end
- else
- if PosX> 0
- then
- begin
- if (PosX< T_Colonne(Colonnes[Colonne]).GetTextPos)
- or (PosX> (T_Colonne(Colonnes[Colonne]).GetTextPos+T_Colonne(Colonnes[Colonne]).GetTextWidth))
- then
- PosH:= T_Colonne(Colonnes[Colonne]).GetTextPos
+ with T_Colonne(Colonnes[Colonne]) do
+ begin
+ if FondNum> -1
+ then
+ SetColor(T_Fond(Fonds[FondNum]).GetColor)
+ else
+ SetColor(GetColor);
+ FillRectangle(ColPos,PosY-IntLSup,ColWidth,HautTxt);
+ if BordNum> -1
+ then
+ with T_Bord(Bords[BordNum]) do
+ begin
+ SetLineStyle(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);
+ if bcDroite in GetFlags
+ then
+ DrawLine(ColPos+ColWidth-Succ(Half),PosY-IntLSup,ColPos+ColWidth-Succ(Half),PosY-IntLSup+HautTxt);
+ if bcHaut in GetFlags
+ then
+ DrawLine(ColPos,PosY-IntLSup+Half,ColPos+ColWidth,PosY-IntLSup+Half);
+ if bcBas in GetFlags
+ then
+ DrawLine(ColPos,PosY-IntLSup+HautTxt-Half,ColPos+ColWidth,PosY-IntLSup+HautTxt-Half);
+ end;
+ DrawText(GetTextPos,PosY,GetTextWidth,0,Textes[Texte],TxtFlags,IntlInt);
+ end
else
- PosH:= PosX;
- end
- else
- begin
- PosH:= T_Colonne(Colonnes[Colonne]).GetTextPos;
- if (txtRight in TxtFlags)
- then
- PosH:= PosH+T_Colonne(Colonnes[0]).GetColWidth-Fnt.TextWidth(Textes[Texte])-T_Colonne(Colonnes[0]).GetColMargin;
- if (txtHCenter in TxtFlags)
- then
- PosH:= PosH+(T_Colonne(Colonnes[0]).GetColWidth-Fnt.TextWidth(Textes[Texte])) div 2;
+ DrawText(PosX,PosY-Fnt.Ascent,Textes[Texte],TxtFlags);
end;
- FPosRef.X:= PosH+Fnt.TextWidth(Textes[Texte]+' ');
- ALigne.LoadTexte(PosH,PosV,Colonne,Texte,FonteNum,HTxt,FondNum,BordNum,InterL,UseCurFont,TxtFlags);
- if FinDeLigne
- then
- begin
- HTxt:= 0;
- FinLigne(Zone);
- end;
- end;
- ppVisualise:
- with FCanevas do
- begin
- Font:= T_Fonte(Fontes[FonteNum]).GetFonte;
- SetTextColor(T_Fonte(Fontes[FonteNum]).GetColor);
+ ppFichierPDF:
if Colonne> -1
then
with T_Colonne(Colonnes[Colonne]) do
begin
- if FondNum> -1
+ if (GetColor<> clWhite) or (FondNum> -1)
then
- SetColor(T_Fond(Fonds[FondNum]).GetColor)
- else
- SetColor(GetColor);
- FillRectangle(GetColPos,PosY-IntLSup,GetColWidth,HautTxt);
+ begin
+ PdfRect:= TPdfRect.Create;
+ with PdfRect do
+ begin
+ PageId:= NumeroPage;
+ FGauche:= ColPos;
+ FBas:= Paper.H-PosY+IntLSup-HautTxt;
+ FHaut:= HautTxt;
+ FLarg:= ColWidth;
+ if FondNum> -1
+ then
+ FColor:= T_Fond(Fonds[FondNum]).GetColor
+ else
+ FColor:= GetColor;
+ FFill:= True;
+ FStroke:= False;
+ end;
+ PdfPage.Add(PdfRect);
+ end;
if BordNum> -1
then
with T_Bord(Bords[BordNum]) do
begin
- SetLineStyle(T_TraitStyle(TraitStyles[GetStyle]).GetEpais,T_TraitStyle(TraitStyles[GetStyle]).GetStyle);
- SetColor(T_TraitStyle(TraitStyles[GetStyle]).GetColor);
+ StylTrait:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetStyle;
+ CoulTrait:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetColor;
+ EpaisTrait:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetEpais;
if bcGauche in GetFlags
then
- DrawLine(GetColPos+Half,PosY-IntLSup,GetColPos+Half,PosY-IntLSup+HautTxt);
+ begin
+ PdfLine:= TPdfLine.Create;
+ with PdfLine do
+ begin
+ PageId:= NumeroPage;
+ FStartX:= ColPos;
+ FStartY:= Paper.H-PosY+IntLSup;
+ FEndX:= ColPos;
+ FEndY:= Paper.H-PosY+IntLSup-HautTxt;
+ FStyle:= StylTrait;
+ FColor:= CoulTrait;
+ FEpais:= EpaisTrait;
+ end;
+ PdfPage.Add(PdfLine);
+ end;
if bcDroite in GetFlags
then
- DrawLine(GetColPos+GetColWidth-Succ(Half),PosY-IntLSup,GetColPos+GetColWidth-Succ(Half),PosY-IntLSup+HautTxt);
+ begin
+ PdfLine:= TPdfLine.Create;
+ with PdfLine do
+ begin
+ PageId:= NumeroPage;
+ FStartX:= ColPos+ColWidth;
+ FStartY:= Paper.H-PosY+IntLSup;
+ FEndX:= ColPos+ColWidth;
+ FEndY:= Paper.H-PosY+IntLSup-HautTxt;
+ FStyle:= StylTrait;
+ FColor:= CoulTrait;
+ FEpais:= EpaisTrait;
+ end;
+ PdfPage.Add(PdfLine);
+ end;
if bcHaut in GetFlags
then
- DrawLine(GetColPos,PosY-IntLSup+Half,GetColPos+GetColWidth,PosY-IntLSup+Half);
- if bcBas in GetFlags
- then
- DrawLine(GetColPos,PosY-IntLSup+HautTxt-Half,GetColPos+GetColWidth,PosY-IntLSup+HautTxt-Half);
- end;
- DrawText(GetTextPos,PosY,GetTextWidth,0,Textes[Texte],TxtFlags,IntlInt);
- end
- else
- DrawText(PosX,PosY-Fnt.Ascent,Textes[Texte],TxtFlags);
- end;
- ppFichierPDF:
- if Colonne> -1
- then
- with T_Colonne(Colonnes[Colonne]) do
- begin
- if (GetColor<> clWhite) or (FondNum> -1)
- then
- begin
- PdfRect:= TPdfRect.Create;
- with PdfRect do
- begin
- PageId:= NumeroPage;
- FGauche:= GetColPos;
- FBas:= FPapier.H-PosY+IntLSup-HautTxt;
- FHaut:= HautTxt;
- FLarg:= GetColWidth;
- if FondNum> -1
- then
- FColor:= T_Fond(Fonds[FondNum]).GetColor
- else
- FColor:= GetColor;
- FFill:= True;
- FStroke:= False;
- end;
- PdfPage.Add(PdfRect);
- end;
- if BordNum> -1
- then
- with T_Bord(Bords[BordNum]) do
- begin
- StylTrait:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetStyle;
- CoulTrait:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetColor;
- EpaisTrait:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetEpais;
- if bcGauche in GetFlags
- then
- begin
- PdfLine:= TPdfLine.Create;
- with PdfLine do
begin
- PageId:= NumeroPage;
- FStartX:= GetColPos;
- FStartY:= FPapier.H-PosY+IntLSup;
- FEndX:= GetColPos;
- FEndY:= FPapier.H-PosY+IntLSup-HautTxt;
- FStyle:= StylTrait;
- FColor:= CoulTrait;
- FEpais:= EpaisTrait;
+ PdfLine:= TPdfLine.Create;
+ with PdfLine do
+ begin
+ PageId:= NumeroPage;
+ FStartX:= ColPos;
+ FStartY:= Paper.H-PosY+IntLSup;
+ FEndX:= ColPos+ColWidth;
+ FEndY:= Paper.H-PosY+IntLSup;
+ FStyle:= StylTrait;
+ FColor:= CoulTrait;
+ FEpais:= EpaisTrait;
+ end;
+ PdfPage.Add(PdfLine);
end;
- PdfPage.Add(PdfLine);
- end;
- if bcDroite in GetFlags
- then
- begin
- PdfLine:= TPdfLine.Create;
- with PdfLine do
+ if bcBas in GetFlags
+ then
begin
- PageId:= NumeroPage;
- FStartX:= GetColPos+GetColWidth;
- FStartY:= FPapier.H-PosY+IntLSup;
- FEndX:= GetColPos+GetColWidth;
- FEndY:= FPapier.H-PosY+IntLSup-HautTxt;
- FStyle:= StylTrait;
- FColor:= CoulTrait;
- FEpais:= EpaisTrait;
+ PdfLine:= TPdfLine.Create;
+ with PdfLine do
+ begin
+ PageId:= NumeroPage;
+ FStartX:= ColPos;
+ FStartY:= Paper.H-PosY+IntLSup-HautTxt;
+ FEndX:= ColPos+ColWidth;
+ FEndY:= Paper.H-PosY+IntLSup-HautTxt;
+ FStyle:= StylTrait;
+ FColor:= CoulTrait;
+ FEpais:= EpaisTrait;
+ end;
+ PdfPage.Add(PdfLine);
end;
- PdfPage.Add(PdfLine);
end;
- if bcHaut in GetFlags
+ PdfTexte:= TPdfTexte.Create;
+ with PdfTexte do
+ begin
+ PageId:= NumeroPage;
+ FFont:= FonteNum;
+ FSize:= T_Fonte(Fontes[FonteNum]).GetSize;
+ FColor:= T_Fonte(Fontes[FonteNum]).GetColor;
+ TextPosX:= GetTextPos;
+ if (txtRight in TxtFlags)
then
- begin
- PdfLine:= TPdfLine.Create;
- with PdfLine do
- begin
- PageId:= NumeroPage;
- FStartX:= GetColPos;
- FStartY:= FPapier.H-PosY+IntLSup;
- FEndX:= GetColPos+GetColWidth;
- FEndY:= FPapier.H-PosY+IntLSup;
- FStyle:= StylTrait;
- FColor:= CoulTrait;
- FEpais:= EpaisTrait;
- end;
- PdfPage.Add(PdfLine);
- end;
- if bcBas in GetFlags
+ TextPosX:= ColPos+ColWidth-ColMargin-Fnt.TextWidth(Textes[Texte]);
+ if (txtHCenter in TxtFlags)
then
- begin
- PdfLine:= TPdfLine.Create;
- with PdfLine do
- begin
- PageId:= NumeroPage;
- FStartX:= GetColPos;
- FStartY:= FPapier.H-PosY+IntLSup-HautTxt;
- FEndX:= GetColPos+GetColWidth;
- FEndY:= FPapier.H-PosY+IntLSup-HautTxt;
- FStyle:= StylTrait;
- FColor:= CoulTrait;
- FEpais:= EpaisTrait;
- end;
- PdfPage.Add(PdfLine);
- end;
+ TextPosX:= GetTextPos+(ColWidth-Fnt.TextWidth(Textes[Texte])) div 2;
+ TextPosY:= Paper.H-PosY-Fnt.Ascent;
+ TextLarg:= ColWidth;
+ Ecriture:= Textes[Texte];
end;
+ PdfPage.Add(PdfTexte);
+ end
+ else
+ begin
PdfTexte:= TPdfTexte.Create;
with PdfTexte do
begin
@@ -1197,35 +1264,14 @@ case FPreparation of
FFont:= FonteNum;
FSize:= T_Fonte(Fontes[FonteNum]).GetSize;
FColor:= T_Fonte(Fontes[FonteNum]).GetColor;
- TextPosX:= GetTextPos;
- if (txtRight in TxtFlags)
- then
- TextPosX:= GetColPos+GetColWidth-GetColMargin-Fnt.TextWidth(Textes[Texte]);
- if (txtHCenter in TxtFlags)
- then
- TextPosX:= GetTextPos+(GetColWidth-Fnt.TextWidth(Textes[Texte])) div 2;
- TextPosY:= FPapier.H-PosY-Fnt.Ascent;
- TextLarg:= GetColWidth;
- Ecriture:= Textes[Texte];
+ FPosX:= PosX;
+ FPosY:= Paper.H-PosY;
+ FLarg:= Paper.W;
+ FText:= Textes[Texte];
end;
PdfPage.Add(PdfTexte);
- end
- else
- begin
- PdfTexte:= TPdfTexte.Create;
- with PdfTexte do
- begin
- PageId:= NumeroPage;
- FFont:= FonteNum;
- FSize:= T_Fonte(Fontes[FonteNum]).GetSize;
- FColor:= T_Fonte(Fontes[FonteNum]).GetColor;
- FPosX:= PosX;
- FPosY:= FPapier.H-PosY;
- FLarg:= FPapier.W;
- FText:= Textes[Texte];
end;
- PdfPage.Add(PdfTexte);
- end;
+ end;
end;
end;
@@ -1267,7 +1313,7 @@ procedure T_Imprime.EcritNum(PosX,PosY,Colonne,TexteNum,TexteTot,FonteNum,FondNu
if Total
then
Result:= Textes[TexteNum]+' '+NumAlpha+' '+Textes[TexteTot]+' '
- +IntToStr(T_Section(Sections[Pred(NumeroSection)]).GetNbPages)
+ +IntToStr(T_Section(Sections[Pred(NumeroSection)]).NbPages)
else
Result:= Textes[TexteNum]+' '+NumAlpha;
end;
@@ -1281,331 +1327,336 @@ var
StylTrait: TfpgLineStyle;
Chaine: string;
begin
-FinDeLigne:= False;
-if FPreparation= ppPrepare
-then
- if FFonteCourante<> FonteNum
+with T_Section(Sections[Pred(NumeroSection)]) do
+ begin
+ FinDeLigne:= False;
+ if FPreparation= ppPrepare
then
- begin
- FFonteCourante:= FonteNum;
- UseCurFont:= False;
- end
- else
- UseCurFont:= True;
-Fnt:= T_Fonte(Fontes[FonteNum]).GetFonte;
-if Interlignes.Count= 0
-then
- Interligne(0,0,0);
-if FInterLCourante<> InterL
-then
- FInterLCourante:= InterL;
-IntLSup:= T_Interligne(Interlignes[FInterLCourante]).GetSup;
-IntlInt:= T_Interligne(Interlignes[FInterLCourante]).GetInt;
-IntLInf:= T_Interligne(Interlignes[FInterLCourante]).GetInf;
-HautTxt:= TxtHeight(T_Colonne(Colonnes[Colonne]).GetTextWidth,Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0',Fnt,IntlInt)+IntLSup+IntLInf;
-if (Colonne> -1) and (BordNum> -1)
-then
- Half:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetEpais div 2;
-case FPreparation of
- ppPrepare:
- begin
- if T_Section(Sections[Pred(NumeroSection)]).GetNbPages= 0
- then
- Page;
- if Colonne> -1
+ if FFonteCourante<> FonteNum
then
begin
- HTxt:= ALigne.GetHeight;
- if HTxt< HautTxt
- then
- HTxt:= HautTxt;
+ FFonteCourante:= FonteNum;
+ UseCurFont:= False;
end
else
- if HTxt< Fnt.Height
- then
- HTxt:= Fnt.Height;
- case Zone of
- zEntete:
- FPosRef.Y:= FMargeCourante.T+FEnTeteHeight;
- zPied:
- begin
- FPosRef.Y:= FMargeCourante.B-HTxt;
- FPiedHeight:= FPiedHeight+HTxt;
- DecaleLignesPied(HTxt);
- end;
- end;
- if PosY= lnCourante
- then
- PosV:= FPosRef.Y+IntLSup
- else
+ UseCurFont:= True;
+ Fnt:= T_Fonte(Fontes[FonteNum]).GetFonte;
+ if Interlignes.Count= 0
+ then
+ Interligne(0,0,0);
+ if FInterLCourante<> InterL
+ then
+ FInterLCourante:= InterL;
+ IntLSup:= T_Interligne(Interlignes[FInterLCourante]).GetSup;
+ IntlInt:= T_Interligne(Interlignes[FInterLCourante]).GetInt;
+ 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
+ else
+ HautTxt:= TxtHeight(Paper.W,Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0',Fnt,IntlInt)+IntLSup+IntLInf;
+ if (Colonne> -1) and (BordNum> -1)
+ then
+ Half:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetEpais div 2;
+ case FPreparation of
+ ppPrepare:
begin
- FinDeLigne:= True;
- if PosY= lnFin
+ if NbPages= 0
+ then
+ Page;
+ if Colonne> -1
then
begin
- PosV:= FPosRef.Y+IntLSup;
- case Zone of
- zEnTete:
- FPosRef.Y:= FPosRef.Y+HTxt;
- end;
- if BordNum> -1
+ HTxt:= ALigne.LineHeight;
+ if HTxt< HautTxt
then
- with T_Bord(Bords[BordNum]) do
- if bcBas in GetFlags
- then
- FPosRef.Y:= FPosRef.Y+1;
+ HTxt:= HautTxt;
end
else
- begin
- PosV:= PosY;
- FPosRef.Y:= PosV+IntLInf;
- end;
+ if HTxt< Fnt.Height
+ then
+ HTxt:= Fnt.Height;
case Zone of
- zEnTete:
- FEnTeteHeight:= FPosRef.Y-FMargeCourante.T;
- //zPied: ////////////
- // PosV:= FPosRef.Y; ////////////
+ zEntete:
+ FPosRef.Y:= FMargeCourante.T+FEnTeteHeight;
+ zPied:
+ begin
+ FPosRef.Y:= FMargeCourante.B-HTxt;
+ FPiedHeight:= FPiedHeight+HTxt;
+ DecaleLignesPied(HTxt);
+ end;
end;
- end;
- if Colonne= -1
- then
- if PosX> 0
+ if PosY= lnCourante
then
- PosH:= PosX
+ PosV:= FPosRef.Y+IntLSup
else
begin
- PosH:= T_Colonne(Colonnes[0]).GetTextPos-T_Colonne(Colonnes[0]).GetColMargin;
- if (txtRight in TxtFlags)
+ FinDeLigne:= True;
+ if PosY= lnFin
then
- if Total
- then
- PosH:= PosH+T_Colonne(Colonnes[0]).GetColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0 ')-T_Colonne(Colonnes[0]).GetColMargin
- else
- PosH:= PosH+T_Colonne(Colonnes[0]).GetColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 ')-T_Colonne(Colonnes[0]).GetColMargin;
- if (txtHCenter in TxtFlags)
- then
- if Total
+ begin
+ PosV:= FPosRef.Y+IntLSup;
+ case Zone of
+ zEnTete:
+ FPosRef.Y:= FPosRef.Y+HTxt;
+ end;
+ if BordNum> -1
then
- PosH:= PosH+(T_Colonne(Colonnes[0]).GetColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0 ')) div 2
- else
- PosH:= PosH+(T_Colonne(Colonnes[0]).GetColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 ')) div 2;
- end
- else
- if PosX> 0
- then
- if (PosX< T_Colonne(Colonnes[Colonne]).GetTextPos)
- or (PosX> (T_Colonne(Colonnes[Colonne]).GetTextPos+T_Colonne(Colonnes[Colonne]).GetTextWidth))
- then
- PosH:= T_Colonne(Colonnes[Colonne]).GetTextPos
+ with T_Bord(Bords[BordNum]) do
+ if bcBas in GetFlags
+ then
+ FPosRef.Y:= FPosRef.Y+1;
+ end
else
- PosH:= PosX
- else
- begin
- PosH:= T_Colonne(Colonnes[Colonne]).GetTextPos-T_Colonne(Colonnes[0]).GetColMargin;
- if (txtRight in TxtFlags)
- then
- if Total
- then
- PosH:= PosH+T_Colonne(Colonnes[0]).GetColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0 ')-T_Colonne(Colonnes[0]).GetColMargin
- else
- PosH:= PosH+T_Colonne(Colonnes[0]).GetColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 ')-T_Colonne(Colonnes[0]).GetColMargin;
- if (txtHCenter in TxtFlags)
- then
- if Total
- then
- PosH:= PosH+(T_Colonne(Colonnes[0]).GetColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0 ')) div 2
- else
- PosH:= PosH+(T_Colonne(Colonnes[0]).GetColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 ')) div 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);
- if FinDeLigne
- then
- begin
- HTxt:= 0;
- FinLigne(Zone);
- end;
- end;
- ppVisualise:
- with FCanevas do
- begin
- Chaine:= BuildChaine;
- Font:= T_Fonte(Fontes[FonteNum]).GetFonte;
- SetTextColor(T_Fonte(Fontes[FonteNum]).GetColor);
- if Colonne> -1
- then
- with T_Colonne(Colonnes[Colonne]) do
begin
- if FondNum> -1
+ PosV:= PosY;
+ FPosRef.Y:= PosV+IntLInf;
+ end;
+ case Zone of
+ zEnTete:
+ FEnTeteHeight:= FPosRef.Y-FMargeCourante.T;
+ end;
+ end;
+ if Colonne= -1
+ then
+ if PosX> 0
then
- SetColor(T_Fond(Fonds[FondNum]).GetColor)
+ PosH:= PosX
else
- SetColor(GetColor);
- FillRectangle(GetColPos,PosY-IntLSup,GetColWidth,HautTxt);
- if BordNum> -1
- then
- with T_Bord(Bords[BordNum]) do
- begin
- SetLineStyle(T_TraitStyle(TraitStyles[GetStyle]).GetEpais,T_TraitStyle(TraitStyles[GetStyle]).GetStyle);
- SetColor(T_TraitStyle(TraitStyles[GetStyle]).GetColor);
- if bcGauche in GetFlags
+ begin
+ PosH:= T_Colonne(Colonnes[ColDefaut]).GetTextPos-T_Colonne(Colonnes[0]).ColMargin;
+ if (txtRight in TxtFlags)
+ then
+ if Total
then
- DrawLine(GetColPos+Half,PosY-IntLSup,GetColPos+Half,PosY-IntLSup+HautTxt);
- if bcDroite in GetFlags
+ PosH:= PosH+T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0 ')-T_Colonne(Colonnes[ColDefaut]).ColMargin
+ else
+ PosH:= PosH+T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 ')-T_Colonne(Colonnes[ColDefaut]).ColMargin;
+ if (txtHCenter in TxtFlags)
+ then
+ if Total
then
- DrawLine(GetColPos+GetColWidth-Half,PosY-IntLSup,GetColPos+GetColWidth-Half,PosY-IntLSup+HautTxt);
- if bcHaut in GetFlags
+ PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0 ')) div 2
+ else
+ PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 ')) div 2;
+ end
+ else
+ if PosX> 0
+ then
+ if (PosX< T_Colonne(Colonnes[Colonne]).GetTextPos)
+ or (PosX> (T_Colonne(Colonnes[Colonne]).GetTextPos+T_Colonne(Colonnes[Colonne]).GetTextWidth))
+ then
+ PosH:= T_Colonne(Colonnes[Colonne]).GetTextPos
+ else
+ PosH:= PosX
+ else
+ begin
+ PosH:= T_Colonne(Colonnes[Colonne]).GetTextPos-T_Colonne(Colonnes[ColDefaut]).ColMargin;
+ if (txtRight in TxtFlags)
+ then
+ if Total
then
- DrawLine(GetColPos,PosY-IntLSup+Half,GetColPos+GetColWidth,PosY-IntLSup+Half);
- if bcBas in GetFlags
+ PosH:= PosH+T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0 ')-T_Colonne(Colonnes[ColDefaut]).ColMargin
+ else
+ PosH:= PosH+T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 ')-T_Colonne(Colonnes[ColDefaut]).ColMargin;
+ if (txtHCenter in TxtFlags)
+ then
+ if Total
then
- DrawLine(GetColPos,PosY-IntLSup+HautTxt-Succ(Half),GetColPos+GetColWidth,PosY-IntLSup+HautTxt-Succ(Half));
- end;
- DrawText(GetTextPos,PosY,GetTextWidth,0,Chaine,TxtFlags,IntlInt);
- end
- else
- DrawText(PosX,PosY,Chaine,TxtFlags);
+ PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 '+Textes[TexteTot]+' 0 ')) div 2
+ else
+ PosH:= PosH+(T_Colonne(Colonnes[ColDefaut]).ColWidth-Fnt.TextWidth(Textes[TexteNum]+' 0 ')) div 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);
+ if FinDeLigne
+ then
+ begin
+ HTxt:= 0;
+ FinLigne(Zone);
+ end;
end;
- ppFichierPDF:
- begin
- Chaine:= BuildChaine;
- if Colonne> -1
- then
- with T_Colonne(Colonnes[Colonne]) do
+ ppVisualise:
+ with FCanevas do
begin
- if (GetColor<> clWhite) or (FondNum> -1)
+ Chaine:= BuildChaine;
+ Font:= T_Fonte(Fontes[FonteNum]).GetFonte;
+ SetTextColor(T_Fonte(Fontes[FonteNum]).GetColor);
+ if Colonne> -1
then
- begin
- PdfRect:= TPdfRect.Create;
- with PdfRect do
+ with T_Colonne(Colonnes[Colonne]) do
begin
- PageId:= NumeroPage;
- FGauche:= GetColPos;
- FBas:= FPapier.H-PosY+IntLSup-HautTxt;
- FHaut:= HautTxt;
- FLarg:= GetColWidth;
if FondNum> -1
then
- FColor:= T_Fond(Fonds[FondNum]).GetColor
+ SetColor(T_Fond(Fonds[FondNum]).GetColor)
else
- FColor:= GetColor;
- FFill:= True;
- FStroke:= False;
- end;
- PdfPage.Add(PdfRect);
- end;
- if BordNum> -1
- then
- with T_Bord(Bords[BordNum]) do
- begin
- StylTrait:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetStyle;
- CoulTrait:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetColor;
- EpaisTrait:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetEpais;
- if bcGauche in GetFlags
+ SetColor(GetColor);
+ FillRectangle(ColPos,PosY-IntLSup,ColWidth,HautTxt);
+ if BordNum> -1
then
- begin
- PdfLine:= TPdfLine.Create;
- with PdfLine do
+ with T_Bord(Bords[BordNum]) do
begin
- PageId:= NumeroPage;
- FStartX:= GetColPos;
- FStartY:= FPapier.H-PosY+IntLSup;
- FEndX:= GetColPos;
- FEndY:= FPapier.H-PosY+IntLSup-HautTxt;
- FStyle:= StylTrait;
- FColor:= CoulTrait;
- FEpais:= EpaisTrait;
+ SetLineStyle(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);
+ if bcDroite in GetFlags
+ then
+ DrawLine(ColPos+ColWidth-Half,PosY-IntLSup,ColPos+ColWidth-Half,PosY-IntLSup+HautTxt);
+ if bcHaut in GetFlags
+ then
+ DrawLine(ColPos,PosY-IntLSup+Half,ColPos+ColWidth,PosY-IntLSup+Half);
+ if bcBas in GetFlags
+ then
+ DrawLine(ColPos,PosY-IntLSup+HautTxt-Succ(Half),ColPos+ColWidth,PosY-IntLSup+HautTxt-Succ(Half));
end;
- PdfPage.Add(PdfLine);
- end;
- if bcDroite in GetFlags
+ DrawText(GetTextPos,PosY,GetTextWidth,0,Chaine,TxtFlags,IntlInt);
+ end
+ else
+ DrawText(PosX,PosY,Chaine,TxtFlags);
+ end;
+ ppFichierPDF:
+ begin
+ Chaine:= BuildChaine;
+ if Colonne> -1
+ then
+ with T_Colonne(Colonnes[Colonne]) do
+ begin
+ if (GetColor<> clWhite) or (FondNum> -1)
then
begin
- PdfLine:= TPdfLine.Create;
- with PdfLine do
+ PdfRect:= TPdfRect.Create;
+ with PdfRect do
begin
PageId:= NumeroPage;
- FStartX:= GetColPos+GetColWidth;
- FStartY:= FPapier.H-PosY+IntLSup;
- FEndX:= GetColPos+GetColWidth;
- FEndY:= FPapier.H-PosY+IntLSup-HautTxt;
- FStyle:= StylTrait;
- FColor:= CoulTrait;
- FEpais:= EpaisTrait;
+ FGauche:= ColPos;
+ FBas:= Paper.H-PosY+IntLSup-HautTxt;
+ FHaut:= HautTxt;
+ FLarg:= ColWidth;
+ if FondNum> -1
+ then
+ FColor:= T_Fond(Fonds[FondNum]).GetColor
+ else
+ FColor:= GetColor;
+ FFill:= True;
+ FStroke:= False;
end;
- PdfPage.Add(PdfLine);
+ PdfPage.Add(PdfRect);
end;
- if bcHaut in GetFlags
+ if BordNum> -1
then
- begin
- PdfLine:= TPdfLine.Create;
- with PdfLine do
+ with T_Bord(Bords[BordNum]) do
begin
- PageId:= NumeroPage;
- FStartX:= GetColPos;
- FStartY:= FPapier.H-PosY+IntLSup;
- FEndX:= GetColPos+GetColWidth;
- FEndY:= FPapier.H-PosY+IntLSup;
- FStyle:= StylTrait;
- FColor:= CoulTrait;
- FEpais:= EpaisTrait;
+ StylTrait:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetStyle;
+ CoulTrait:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetColor;
+ EpaisTrait:= T_TraitStyle(TraitStyles[T_Bord(Bords[BordNum]).GetStyle]).GetEpais;
+ if bcGauche in GetFlags
+ then
+ begin
+ PdfLine:= TPdfLine.Create;
+ with PdfLine do
+ begin
+ PageId:= NumeroPage;
+ FStartX:= ColPos;
+ FStartY:= Paper.H-PosY+IntLSup;
+ FEndX:= ColPos;
+ FEndY:= Paper.H-PosY+IntLSup-HautTxt;
+ FStyle:= StylTrait;
+ FColor:= CoulTrait;
+ FEpais:= EpaisTrait;
+ end;
+ PdfPage.Add(PdfLine);
+ end;
+ if bcDroite in GetFlags
+ then
+ begin
+ PdfLine:= TPdfLine.Create;
+ with PdfLine do
+ begin
+ PageId:= NumeroPage;
+ FStartX:= ColPos+ColWidth;
+ FStartY:= Paper.H-PosY+IntLSup;
+ FEndX:= ColPos+ColWidth;
+ FEndY:= Paper.H-PosY+IntLSup-HautTxt;
+ FStyle:= StylTrait;
+ FColor:= CoulTrait;
+ FEpais:= EpaisTrait;
+ end;
+ PdfPage.Add(PdfLine);
+ end;
+ if bcHaut in GetFlags
+ then
+ begin
+ PdfLine:= TPdfLine.Create;
+ with PdfLine do
+ begin
+ PageId:= NumeroPage;
+ FStartX:= ColPos;
+ FStartY:= Paper.H-PosY+IntLSup;
+ FEndX:= ColPos+ColWidth;
+ FEndY:= Paper.H-PosY+IntLSup;
+ FStyle:= StylTrait;
+ FColor:= CoulTrait;
+ FEpais:= EpaisTrait;
+ end;
+ PdfPage.Add(PdfLine);
+ end;
+ if bcBas in GetFlags
+ then
+ begin
+ PdfLine:= TPdfLine.Create;
+ with PdfLine do
+ begin
+ PageId:= NumeroPage;
+ FStartX:= ColPos;
+ FStartY:= Paper.H-PosY+IntLSup-HautTxt;
+ FEndX:= ColPos+ColWidth;
+ FEndY:= Paper.H-PosY+IntLSup-HautTxt;
+ FStyle:= StylTrait;
+ FColor:= CoulTrait;
+ FEpais:= EpaisTrait;
+ end;
+ PdfPage.Add(PdfLine);
+ end;
end;
- PdfPage.Add(PdfLine);
- end;
- if bcBas in GetFlags
- then
+ PdfTexte:= TPdfTexte.Create;
+ with PdfTexte do
begin
- PdfLine:= TPdfLine.Create;
- with PdfLine do
- begin
- PageId:= NumeroPage;
- FStartX:= GetColPos;
- FStartY:= FPapier.H-PosY+IntLSup-HautTxt;
- FEndX:= GetColPos+GetColWidth;
- FEndY:= FPapier.H-PosY+IntLSup-HautTxt;
- FStyle:= StylTrait;
- FColor:= CoulTrait;
- FEpais:= EpaisTrait;
- end;
- PdfPage.Add(PdfLine);
+ PageId:= NumeroPage;
+ FFont:= FonteNum;
+ FSize:= T_Fonte(Fontes[FonteNum]).GetSize;
+ FColor:= T_Fonte(Fontes[FonteNum]).GetColor;
+ TextPosX:= GetTextPos;
+ if (txtRight in TxtFlags)
+ then
+ TextPosX:= ColPos+ColWidth-ColMargin-Fnt.TextWidth(Chaine);
+ if (txtHCenter in TxtFlags)
+ then
+ TextPosX:= GetTextPos+(ColWidth-Fnt.TextWidth(Chaine)) div 2;
+ TextPosY:= Paper.H-PosY-Fnt.Ascent;
+ TextLarg:= ColWidth;
+ Ecriture:= Chaine;
end;
- end;
- PdfTexte:= TPdfTexte.Create;
- with PdfTexte do
+ PdfPage.Add(PdfTexte);
+ end
+ else
begin
- PageId:= NumeroPage;
- FFont:= FonteNum;
- FSize:= T_Fonte(Fontes[FonteNum]).GetSize;
- FColor:= T_Fonte(Fontes[FonteNum]).GetColor;
- TextPosX:= GetTextPos;
- if (txtRight in TxtFlags)
- then
- TextPosX:= GetColPos+GetColWidth-GetColMargin-Fnt.TextWidth(Chaine);
- if (txtHCenter in TxtFlags)
- then
- TextPosX:= GetTextPos+(GetColWidth-Fnt.TextWidth(Chaine)) div 2;
- TextPosY:= FPapier.H-PosY-Fnt.Ascent;
- TextLarg:= GetColWidth;
- Ecriture:= Chaine;
+ PdfTexte:= TPdfTexte.Create;
+ with PdfTexte do
+ begin
+ PageId:= NumeroPage;
+ FFont:= FonteNum;
+ FSize:= T_Fonte(Fontes[FonteNum]).GetSize;
+ FColor:= T_Fonte(Fontes[FonteNum]).GetColor;
+ FPosX:= PosX;
+ FPosY:= PosY-Fnt.Ascent;
+ FLarg:= Paper.W;
+ FText:= Chaine;
+ end;
+ PdfPage.Add(PdfTexte);
end;
- PdfPage.Add(PdfTexte);
- end
- else
- begin
- PdfTexte:= TPdfTexte.Create;
- with PdfTexte do
- begin
- PageId:= NumeroPage;
- FFont:= FonteNum;
- FSize:= T_Fonte(Fontes[FonteNum]).GetSize;
- FColor:= T_Fonte(Fontes[FonteNum]).GetColor;
- FPosX:= PosX;
- FPosY:= PosY-Fnt.Ascent;
- FLarg:= FPapier.W;
- FText:= Chaine;
end;
- PdfPage.Add(PdfTexte);
- end;
end;
end;
end;
@@ -1614,238 +1665,318 @@ procedure T_Imprime.InsereEspace(PosY,Colonne,EspHeight,FondNum: Integer; Zone:
var
PosV: Integer;
begin
-if PosY> -1
-then
- PosV:= PosY
-else
- PosV:= FPosRef.Y;
-case FPreparation of
- ppPrepare:
- begin
- case Zone of
- zEnTete:
- begin
- FPosRef.Y:= FMargeCourante.T+FEnTeteHeight;
- FPosRef.Y:= FPosRef.Y+EspHeight;
- FEnTeteHeight:= FPosRef.Y-FMargeCourante.T;
- T_Section(Sections[Pred(NumeroSection)]).LoadEspaceEnTete(PosV,Colonne,EspHeight,FondNum);
- end;
- zPage:
- begin
- FPosRef.Y:= FMargeCourante.T+FEnTeteHeight+FPageHeight;
- if FPosRef.Y+EspHeight> FMargeCourante.B-FPiedHeight
- then
+with T_Section(Sections[Pred(NumeroSection)]) do
+ begin
+ if PosY> -1
+ then
+ PosV:= PosY
+ else
+ PosV:= FPosRef.Y;
+ case FPreparation of
+ ppPrepare:
+ begin
+ case Zone of
+ zEnTete:
begin
FPosRef.Y:= FMargeCourante.T+FEnTeteHeight;
- Page;
- end
- else
FPosRef.Y:= FPosRef.Y+EspHeight;
- FPageHeight:= FPosRef.Y-FEnTeteHeight-FMargeCourante.T;
- T_Section(Sections[Pred(NumeroSection)]).LoadEspacePage(PosV,Colonne,EspHeight,FondNum);
+ FEnTeteHeight:= FPosRef.Y-FMargeCourante.T;
+ LoadEspaceEnTete(PosV,Colonne,EspHeight,FondNum);
+ end;
+ zPage:
+ begin
+ FPosRef.Y:= FMargeCourante.T+FEnTeteHeight+FPageHeight;
+ if FPosRef.Y+EspHeight> FMargeCourante.B-FPiedHeight
+ then
+ begin
+ FPosRef.Y:= FMargeCourante.T+FEnTeteHeight;
+ Page;
+ end
+ else
+ FPosRef.Y:= FPosRef.Y+EspHeight;
+ FPageHeight:= FPosRef.Y-FEnTeteHeight-FMargeCourante.T;
+ LoadEspacePage(PosV,Colonne,EspHeight,FondNum);
+ end;
+ zPied:
+ begin
+ FPosRef.Y:= FMargeCourante.B-EspHeight;
+ FPiedHeight:= FPiedHeight+EspHeight;
+ PosV:= FPosRef.Y;
+ DecaleLignesPied(EspHeight);
+ LoadEspacePied(PosV,Colonne,EspHeight,FondNum);
+ end;
end;
- zPied:
+ FinLigne(Zone);
+ end;
+ ppVisualise:
+ with FCanevas,T_Colonne(Colonnes[Colonne]) do
begin
- FPosRef.Y:= FMargeCourante.B-EspHeight;
- FPiedHeight:= FPiedHeight+EspHeight;
- PosV:= FPosRef.Y;
- DecaleLignesPied(EspHeight);
- T_Section(Sections[Pred(NumeroSection)]).LoadEspacePied(PosV,Colonne,EspHeight,FondNum);
+ if FondNum> -1
+ then
+ SetColor(T_Fond(Fonds[FondNum]).GetColor)
+ else
+ SetColor(GetColor);
+ FillRectangle(ColPos,PosV,ColWidth,EspHeight);
end;
- end;
- FinLigne(Zone);
- end;
- ppVisualise:
- with FCanevas,T_Colonne(Colonnes[Colonne]) do
+ ppFichierPDF:
begin
- if FondNum> -1
+ if Colonne> -1
then
- SetColor(T_Fond(Fonds[FondNum]).GetColor)
- else
- SetColor(GetColor);
- FillRectangle(GetColPos,PosV,GetColWidth,EspHeight);
- end;
- ppFichierPDF:
- begin
- if Colonne> -1
- then
- with T_Colonne(Colonnes[Colonne]) do
- begin
- if (GetColor<> clWhite) or (FondNum> -1)
- then
+ with T_Colonne(Colonnes[Colonne]) do
begin
- PdfRect:= TPdfRect.Create;
- with PdfRect do
+ if (GetColor<> clWhite) or (FondNum> -1)
+ then
begin
- PageId:= NumeroPage;
- FGauche:= GetColPos;
- FBas:= FPapier.H-PosY-EspHeight;
- FHaut:= EspHeight;
- FLarg:= GetColWidth;
- if FondNum> -1
- then
- FColor:= T_Fond(Fonds[FondNum]).GetColor
- else
- FColor:= GetColor;
- FFill:= True;
- FStroke:= False;
+ PdfRect:= TPdfRect.Create;
+ with PdfRect do
+ begin
+ PageId:= NumeroPage;
+ FGauche:= ColPos;
+ FBas:= Paper.H-PosY-EspHeight;
+ FHaut:= EspHeight;
+ FLarg:= ColWidth;
+ if FondNum> -1
+ then
+ FColor:= T_Fond(Fonds[FondNum]).GetColor
+ else
+ FColor:= GetColor;
+ FFill:= True;
+ FStroke:= False;
+ end;
+ PdfPage.Add(PdfRect);
end;
- PdfPage.Add(PdfRect);
end;
- end;
+ end;
end;
end;
end;
procedure T_Imprime.FinLigne(Zone: TZone);
begin
-case Zone of
- zEnTete:
- T_Section(Sections[Pred(NumeroSection)]).LoadCmdEnTete;
- zPage:
- if FGroupe
- then
- T_Section(Sections[Pred(NumeroSection)]).LoadCmdGroupe
- else
- T_Section(Sections[Pred(NumeroSection)]).LoadCmdPage;
- zPied:
- T_Section(Sections[Pred(NumeroSection)]).LoadCmdPied;
- end;
+with T_Section(Sections[Pred(NumeroSection)]) do
+ case Zone of
+ zEnTete:
+ LoadCmdEnTete;
+ zPage:
+ if FGroupe
+ then
+ LoadCmdGroupe
+ else
+ LoadCmdPage;
+ zPied:
+ LoadCmdPied;
+ end;
end;
procedure T_Imprime.TraceCadre(StTrait: Integer; Zone: TZone);
var
Half: Integer;
begin
-case FPreparation of
- ppPrepare:
- T_Section(Sections[Pred(NumeroSection)]).LoadCadre(StTrait,Zone);
- ppVisualise:
- with FCanevas do
- begin
- with T_TraitStyle(TraitStyles[StTrait]) do
+with T_Section(Sections[Pred(NumeroSection)]) do
+ case FPreparation of
+ ppPrepare:
+ LoadCadre(StTrait,Zone);
+ ppVisualise:
+ with FCanevas do
begin
- SetLineStyle(GetEpais,GetStyle);
- Half:= GetEpais div 2;
- SetColor(GetColor);
- end;
- with FMargeCourante do
- 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
- 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
- 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
- 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
- end;
+ with T_TraitStyle(TraitStyles[StTrait]) do
+ begin
+ SetLineStyle(GetEpais,GetStyle);
+ Half:= GetEpais div 2;
+ SetColor(GetColor);
end;
- end;
- ppFichierPDF:
- begin
- PdfRect:= TPdfRect.Create;
- with PdfRect do
+ with FMargeCourante do
+ 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
+ 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
+ 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
+ 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
+ end;
+ end;
+ end;
+ ppFichierPDF:
begin
- PageId:= NumeroPage;
- with T_TraitStyle(TraitStyles[StTrait]) do
+ PdfRect:= TPdfRect.Create;
+ with PdfRect do
begin
- FEpais:= GetEpais;
- FColor:= GetColor;
- FLineStyle:= GetStyle;
- end;
- with FMargeCourante do
- case Zone of
- zEnTete:
- begin
- FGauche:= L;
- FBas:= FPapier.H-T-FEnTeteHeight;
- FHaut:= FEnTeteHeight;
- FLarg:= R-L;
- end;
- zPage:
- begin
- FGauche:= L;
- FBas:= FPapier.H-B-FPiedHeight;
- FHaut:= FPapier.H-T-FEnTeteHeight-B-FPiedHeight;
- FLarg:= R-L;
- end;
- zPied:
- begin
- FGauche:= L;
- FBas:= FPapier.H-B;
- FHaut:= FPiedHeight;
- FLarg:= R-L;
- end;
- zMarges:
- begin
- FGauche:= L;
- FBas:= FPapier.H-B;
- FHaut:= B-T;
- FLarg:= R-L;
- end;
+ PageId:= NumeroPage;
+ with T_TraitStyle(TraitStyles[StTrait]) do
+ begin
+ FEpais:= GetEpais;
+ FColor:= GetColor;
+ FLineStyle:= GetStyle;
end;
- FFill:= False;
- FStroke:= True;
- PdfPage.Add(PdfRect);
+ with FMargeCourante do
+ case Zone of
+ zEnTete:
+ begin
+ FGauche:= L;
+ FBas:= Paper.H-T-FEnTeteHeight;
+ FHaut:= FEnTeteHeight;
+ FLarg:= R-L;
+ end;
+ zPage:
+ begin
+ FGauche:= L;
+ FBas:= Paper.H-B-FPiedHeight;
+ FHaut:= Paper.H-T-FEnTeteHeight-B-FPiedHeight;
+ FLarg:= R-L;
+ end;
+ zPied:
+ begin
+ FGauche:= L;
+ FBas:= Paper.H-B;
+ FHaut:= FPiedHeight;
+ FLarg:= R-L;
+ end;
+ zMarges:
+ begin
+ FGauche:= L;
+ FBas:= Paper.H-B;
+ FHaut:= B-T;
+ FLarg:= R-L;
+ end;
+ end;
+ FFill:= False;
+ FStroke:= True;
+ PdfPage.Add(PdfRect);
+ end;
end;
end;
- end;
end;
procedure T_Imprime.TraceTrait(XDebut,YDebut,XFin,YFin,StTrait: Integer);
begin
-case FPreparation of
- ppPrepare:
- T_Section(Sections[Pred(NumeroSection)]).LoadTrait(XDebut,YDebut,ColDefaut,XFin,YFin,StTrait);
- ppVisualise:
- begin
- with FCanevas do
+with T_Section(Sections[Pred(NumeroSection)]) do
+ case FPreparation of
+ ppPrepare:
+ LoadTrait(XDebut,YDebut,ColDefaut,XFin,YFin,StTrait);
+ ppVisualise:
+ with FCanevas do
+ begin
+ with T_TraitStyle(TraitStyles[StTrait]) do
+ begin
+ SetLineStyle(GetEpais,GetStyle);
+ SetColor(GetColor);
+ end;
+ DrawLine(XDebut,YDebut,XFin,YFin);
+ end;
+ ppFichierPdf:
begin
- with T_TraitStyle(TraitStyles[StTrait]) do
+ PdfLine:= TPdfLine.Create;
+ with PdfLine do
begin
- SetLineStyle(GetEpais,GetStyle);
- SetColor(GetColor);
+ PageId:= NumeroPage;
+ FStartX:= XDebut;
+ FStartY:= Paper.H-YDebut;
+ FEndX:= XFin;
+ FEndY:= Paper.H-YFin;
+ FStyle:= T_TraitStyle(TraitStyles[StTrait]).GetStyle;;
+ FColor:= T_TraitStyle(TraitStyles[StTrait]).GetColor;
+ FEpais:= T_TraitStyle(TraitStyles[StTrait]).GetEpais;
end;
- DrawLine(XDebut,YDebut,XFin,YFin);
+ PdfPage.Add(PdfLine);
end;
end;
- ppFichierPdf:
- begin
- PdfLine:= TPdfLine.Create;
- with PdfLine do
+end;
+
+procedure T_Imprime.TraceTraitHoriz(XDebut,YDebut,Colonne,XFin,StTrait: Integer; Zone: TZone);
+var
+ PosV: Integer;
+begin
+with T_Section(Sections[Pred(NumeroSection)]) do
+ case FPreparation of
+ ppPrepare:
+ case Zone of
+ zEnTete:
+ begin
+ FPosRef.Y:= FMargeCourante.T+FEnTeteHeight;
+ PosV:= FPosRef.Y+XDebut;
+ FPosRef.Y:= FPosRef.Y+XDebut+YDebut+T_TraitStyle(TraitStyles[StTrait]).GetEpais;
+ FEnTeteHeight:= FPosRef.Y-FMargeCourante.T;
+ with T_Colonne(Colonnes[colonne]) do
+ LoadTraitHorizEnTete(ColPos,PosV,Colonne,ColPos+ColWidth,PosV,StTrait);
+ end;
+ zPage:
+ begin
+ FPosRef.Y:= FMargeCourante.T+FEnTeteHeight+FPageHeight;
+ PosV:= FPosRef.Y+XDebut;
+ FPosRef.Y:= FPosRef.Y+XDebut+YDebut+T_TraitStyle(TraitStyles[StTrait]).GetEpais;
+ FPageHeight:= FPosRef.Y-FEnTeteHeight-FMargeCourante.T;
+ with T_Colonne(Colonnes[colonne]) do
+ LoadTraitHorizPage(ColPos,PosV,Colonne,ColPos+ColWidth,PosV,StTrait);
+ end;
+ zPied:
+ begin
+ FPosRef.Y:= FMargeCourante.B-XDebut;
+ PosV:= FPosRef.Y;
+ FPosRef.Y:= FPosRef.Y-YDebut-T_TraitStyle(TraitStyles[StTrait]).GetEpais;
+ FPiedHeight:= FPiedHeight+XDebut+YDebut+T_TraitStyle(TraitStyles[StTrait]).GetEpais;
+ DecaleLignesPied(XDebut+YDebut+T_TraitStyle(TraitStyles[StTrait]).GetEpais);
+ with T_Colonne(Colonnes[colonne]) do
+ LoadTraitHorizPied(ColPos,PosV,Colonne,ColPos+ColWidth,PosV,StTrait);
+ end;
+ end;
+ ppVisualise:
+ with FCanevas do
+ begin
+ with T_TraitStyle(TraitStyles[StTrait]) do
+ begin
+ SetLineStyle(GetEpais,GetStyle);
+ SetColor(GetColor);
+ end;
+ DrawLine(XDebut,YDebut,XFin,YDebut);
+ end;
+ ppFichierPdf:
begin
- PageId:= NumeroPage;
- FStartX:= XDebut;
- FStartY:= FPapier.H-YDebut;
- FEndX:= XFin;
- FEndY:= FPapier.H-YFin;
- FStyle:= T_TraitStyle(TraitStyles[StTrait]).GetStyle;;
- FColor:= T_TraitStyle(TraitStyles[StTrait]).GetColor;
- FEpais:= T_TraitStyle(TraitStyles[StTrait]).GetEpais;
+ PdfLine:= TPdfLine.Create;
+ with PdfLine do
+ begin
+ PageId:= NumeroPage;
+ FStartX:= XDebut;
+ FStartY:= Paper.H-YDebut;
+ FEndX:= XFin;
+ FEndY:= Paper.H-YDebut;
+ FStyle:= T_TraitStyle(TraitStyles[StTrait]).GetStyle;;
+ FColor:= T_TraitStyle(TraitStyles[StTrait]).GetColor;
+ FEpais:= T_TraitStyle(TraitStyles[StTrait]).GetEpais;
+ end;
+ PdfPage.Add(PdfLine);
end;
- PdfPage.Add(PdfLine);
end;
- end;
+end;
+
+function T_Imprime.GetTitreSection: string;
+begin
+Result:= T_Section(Sections[Pred(Sections.Count)]).Titre;
+end;
+
+procedure T_Imprime.SetTitreSection(ATitre: string);
+begin
+T_Section(Sections[Pred(Sections.Count)]).Titre:= ATitre;
end;
{ Commandes publiques }
@@ -1854,7 +1985,6 @@ constructor T_Imprime.Create;
begin
inherited Create;
Sections:= TList.Create;
-Colonnes:= TList.Create;
Fontes:= TList.Create;
Interlignes:= TList.Create;
Fonds:= TList.Create;
@@ -1865,6 +1995,7 @@ ALigne:= T_Ligne.Create;
PdfPage:= TList.Create;
OldDecSeparator:= DecimalSeparator;
DecimalSeparator:= '.';
+Outline:= False;
end;
destructor T_Imprime.Destroy;
@@ -1874,14 +2005,14 @@ begin
DecimalSeparator:= OldDecSeparator;
if Sections.Count> 0
then
+ begin
for Cpt:= 0 to Pred(Sections.Count) do
+ begin
LiberePages(Sections[Cpt]);
+ LibereColonnes(Sections[Cpt]);
+ end;
+ end;
Sections.Free;
-if Colonnes.Count> 0
-then
- for Cpt:= 0 to Pred(Colonnes.Count) do
- T_Colonne(Colonnes[Cpt]).Free;
-Colonnes.Free;
if Fontes.Count> 0
then
for Cpt:= 0 to Pred(Fontes.Count) do
@@ -1921,7 +2052,8 @@ FTypepapier:= IniTypePapier;
FMesure:= IniMesure;
FPreparation:= ppPrepare;
FVisualisation:= IniVisu;
-PrepareVisu;
+PrepareFormat;
+CreateVisu;
FFonteCourante:= -1;
FInterLCourante:= -1;
FGroupe:= False;
@@ -1961,7 +2093,6 @@ then
F_Visu.Free;
end;
end;
-//Libere;
end;
procedure T_Imprime.ImprimeDocument;
@@ -1979,49 +2110,49 @@ then
FCanevas:= Bv_Visu.Canvas;
end;
-procedure T_Imprime.Section(MgGauche,MgDroite,MgHaute,MgBasse: Single; Retrait: Single);
+procedure T_Imprime.Section(MgGauche,MgDroite,MgHaute,MgBasse: Single; Retrait: Single;
+ IniOriente: TOrient= oPortrait);
var
CMargin: Integer;
begin
-if FPreparation= ppPrepare
-then
- begin
- with FMargeCourante,FPapier do
- begin
- if Dim2Pixels(MgGauche)> Imprimable.L
- then
- L:= Dim2Pixels(MgGauche)
- else
- L:= Imprimable.L;
- if (W-Dim2Pixels(MgDroite))< Imprimable.R
- then
- R:= W-Dim2Pixels(MgDroite)
- else
- R:= Imprimable.R;
- if Dim2Pixels(MgHaute)> Imprimable.T
- then
- T:= Dim2Pixels(MgHaute)
- else
- T:= Imprimable.T;
- if (H-Dim2Pixels(MgBasse))< Imprimable.B
- then
- B:= H-Dim2Pixels(MgBasse)
- else
- B:= Imprimable.B;
- end;
- FPosRef.X:= FMargeCourante.L;
- FEnTeteHeight:= 0;
- FPageHeight:= 0;
- FPiedHeight:= 0;
- NumeroSection:= NumeroSection+1;
- ASection:= T_Section.Create(FMargeCourante,NumeroSection);
- Sections.Add(ASection);
- if Sections.Count= 1
- then
+case FPreparation of
+ ppPrepare:
begin
+ FOrientation:= IniOriente;
+ PrepareFormat;
+ with FMargeCourante,FPapier do
+ begin
+ if Dim2Pixels(MgGauche)> Imprimable.L
+ then
+ L:= Dim2Pixels(MgGauche)
+ else
+ L:= Imprimable.L;
+ if (W-Dim2Pixels(MgDroite))< Imprimable.R
+ then
+ R:= W-Dim2Pixels(MgDroite)
+ else
+ R:= Imprimable.R;
+ if Dim2Pixels(MgHaute)> Imprimable.T
+ then
+ T:= Dim2Pixels(MgHaute)
+ else
+ T:= Imprimable.T;
+ if (H-Dim2Pixels(MgBasse))< Imprimable.B
+ then
+ B:= H-Dim2Pixels(MgBasse)
+ else
+ B:= Imprimable.B;
+ end;
+ FPosRef.X:= FMargeCourante.L;
+ FEnTeteHeight:= 0;
+ FPageHeight:= 0;
+ FPiedHeight:= 0;
+ NumeroSection:= NumeroSection+1;
+ ASection:= T_Section.Create(FPapier,FMargeCourante,NumeroSection);
+ Sections.Add(ASection);
CMargin:= Dim2Pixels(Retrait);
AColonne:= T_Colonne.Create(FMargeCourante.L,FMargeCourante.R-FMargeCourante.L,CMargin,clWhite);
- Colonnes.Add(AColonne);
+ T_Section(Sections[Pred(Sections.Count)]).Colonnes.Add(AColonne);
end;
end;
end;
@@ -2069,17 +2200,17 @@ begin
CPos:= Dim2Pixels(ClnPos);
with T_Section(Sections[Pred(NumeroSection)]) do
begin
- if CPos< GetMarges.L
+ if CPos< Marges.L
then
- CPos:= GetMarges.L;
+ CPos:= Marges.L;
CWidth:= Dim2Pixels(ClnWidth);
- if CWidth> (GetMarges.R-GetMarges.L)
+ if CWidth> (Marges.R-Marges.L)
then
- CWidth:= GetMarges.R-GetMarges.L;
+ CWidth:= Marges.R-Marges.L;
end;
CMargin:= Dim2Pixels(ClnMargin);
AColonne:= T_Colonne.Create(CPos,CWidth,CMargin,ClnColor);
-Result:= Colonnes.Add(AColonne);
+Result:= T_Section(Sections[Pred(Sections.Count)]).Colonnes.Add(AColonne);
end;
procedure T_Imprime.EcritEnTete(Horiz,Verti: Single; Texte: string; ColNum: Integer= 0; FonteNum: Integer= 0;
@@ -2419,6 +2550,33 @@ then
EcritNum(X,Y,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);
+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);
+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);
+end;
+
procedure T_Imprime.EspaceEnTete(Verti: Single; ColNum: Integer=0; CoulFdNum: Integer= -1);
var
H: Integer;
@@ -2489,7 +2647,7 @@ end;
procedure T_Imprime.ColorColChange(ColNum: Integer; ColColor: TfpgColor);
begin
-T_Colonne(Colonnes[ColNum]).SetColColor(ColColor);
+T_Colonne(T_Section(Sections[Pred(Sections.Count)]).Colonnes[ColNum]).SetColColor(ColColor);
end;
procedure T_Imprime.CadreMarges(AStyle: Integer);
diff --git a/extras/contributed/report_tool/reportengine/u_pdf.pas b/extras/contributed/report_tool/reportengine/u_pdf.pas
index d6f4b56f..07921e2d 100644
--- a/extras/contributed/report_tool/reportengine/u_pdf.pas
+++ b/extras/contributed/report_tool/reportengine/u_pdf.pas
@@ -229,11 +229,13 @@ type
procedure EcritObjet(const AObjet: Integer; const AFlux: TStream);
procedure CreateRefTable;
procedure CreateTrailer;
- procedure CreateCatalog;
+ function CreateCatalog: Integer;
procedure CreateInfo;
procedure CreatePreferences;
function CreatePages(Parent: Integer): Integer;
- procedure CreatePage(Parent: Integer);
+ function CreatePage(Parent,Haut,Larg: Integer): Integer;
+ function CreateOutlines(Parent: Integer): Integer;
+ function CreateOutline(Parent,SectNo,PageNo: Integer; SectTitre: string): Integer;
procedure CreateFont(NomFonte: string; NumFonte: Integer);
function CreateContents: Integer;
procedure CreateStream(NumeroPage,PageNum: Integer);
@@ -254,6 +256,7 @@ const
var
Document: TPdfDocument;
OldDecSeparator: Char;
+ Outline: Boolean;
implementation
@@ -264,6 +267,7 @@ var
Trailer: TPdfDictionary;
CurrentColor: string;
CurrentWidth: string;
+ Catalogue: Integer;
// utility functions
@@ -881,7 +885,7 @@ XRefObjets:= TPdfInteger.CreateInteger(FXRefObjets.Count);
Trailer.AddElement('Size',XRefObjets);
end;
-procedure TPdfDocument.CreateCatalog;
+function TPdfDocument.CreateCatalog: Integer;
var
Catalog: TPdfXRef;
XRefObjets: TPdfReference;
@@ -896,6 +900,7 @@ Trailer.AddElement('Root',XRefObjets);
// add type element to catalog dictionary
Nom:= TPdfName.CreateName('Catalog');
Catalog.FObjet.AddElement('Type',Nom);
+Result:= Pred(FXRefObjets.Count);
end;
procedure TPdfDocument.CreateInfo;
@@ -992,7 +997,7 @@ Pages.FObjet.AddElement('Count',Count);
Result:= Pred(FXRefObjets.Count);
end;
-procedure TPdfDocument.CreatePage(Parent: Integer);
+function TPdfDocument.CreatePage(Parent,Haut,Larg: Integer): Integer;
var
Page: TPdfXRef;
XRefObjets: TPdfReference;
@@ -1025,9 +1030,9 @@ Coord:= TPdfInteger.CreateInteger(0);
TPdfArray(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('MediaBox')]).FValue).AddItem(Coord);
Coord:= TPdfInteger.CreateInteger(0);
TPdfArray(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('MediaBox')]).FValue).AddItem(Coord);
-Coord:= TPdfInteger.CreateInteger(Imprime.LargeurPapier);
+Coord:= TPdfInteger.CreateInteger(Larg);
TPdfArray(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('MediaBox')]).FValue).AddItem(Coord);
-Coord:= TPdfInteger.CreateInteger(Imprime.HauteurPapier);
+Coord:= TPdfInteger.CreateInteger(Haut);
TPdfArray(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('MediaBox')]).FValue).AddItem(Coord);
// add resources element to page dictionary
Dictionaire:= TPdfDictionary.CreateDictionary;
@@ -1045,6 +1050,64 @@ TPdfArray(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('ProcSet
// add text element in procset array to page dictionary
Nom:= TPdfName.CreateName('Text');
TPdfArray(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('ProcSet')]).FValue).AddItem(Nom);
+Result:= Pred(FXRefObjets.Count);
+end;
+
+function TPdfDocument.CreateOutlines(Parent: Integer): Integer;
+var
+ Outlines: TPdfXRef;
+ XRefObjets: TPdfReference;
+ Nom: TPdfName;
+ Count: TPdfInteger;
+begin
+// add xref entry
+Outlines:= TPdfXRef.CreateXRef;
+FXRefObjets.Add(Outlines);
+// add type element to outlines dictionary
+Nom:= TPdfName.CreateName('Outlines');
+Outlines.FObjet.AddElement('Type',Nom);
+// add count element to outlines dictionary
+Count:= TPdfInteger.CreateInteger(0);
+Outlines.FObjet.AddElement('Count',Count);
+Result:= Pred(FXRefObjets.Count);
+end;
+
+function TPdfDocument.CreateOutline(Parent,SectNo,PageNo: Integer; SectTitre: string): Integer;
+var
+ Outline: TPdfXRef;
+ XRefObjets: TPdfReference;
+ Titre: TPdfString;
+ Count: TPdfInteger;
+ Table: TPdfArray;
+begin
+// add xref entry
+Outline:= TPdfXRef.CreateXRef;
+FXRefObjets.Add(Outline);
+// add title element to outline dictionary
+if PageNo> -1
+then
+ if SectTitre<> ''
+ then
+ Titre:= TPdfString.CreateString(SectTitre+' Page '+IntToStr(PageNo))
+ else
+ Titre:= TPdfString.CreateString('Section '+IntToStr(SectNo)+' Page '+IntToStr(PageNo))
+else
+ if SectTitre<> ''
+ then
+ Titre:= TPdfString.CreateString(SectTitre)
+ else
+ Titre:= TPdfString.CreateString('Section '+IntToStr(SectNo));
+Outline.FObjet.AddElement('Title',Titre);
+// add parent reference to outline dictionary
+XRefObjets:= TPdfReference.CreateReference(Parent);
+Outline.FObjet.AddElement('Parent',XRefObjets);
+// add count element to outline dictionary
+Count:= TPdfInteger.CreateInteger(0);
+Outline.FObjet.AddElement('Count',Count);
+// add dest element to outline dictionary
+Table:= TPdfArray.CreateArray;
+Outline.FObjet.AddElement('Dest',Table);
+Result:= Pred(FXRefObjets.Count);
end;
procedure TPdfDocument.CreateFont(NomFonte: string; NumFonte: Integer);
@@ -1191,35 +1254,127 @@ end;
constructor TPdfDocument.CreateDocument;
var
- Cpt,CptSect,CptPage,CptFont,NumFont,TreeRoot,Parent,PageNum,NumPage: Integer;
- Trouve: Boolean;
+ Cpt,CptSect,CptPage,CptFont,NumFont,TreeRoot,ParentPage,PageNum,NumPage: Integer;
+ OutlineRoot,ParentOutline,PageOutline,NextOutline,NextSect,NewPage: Integer;
Dictionaire: TPdfDictionary;
+ XRefObjets,PrevOutline,PrevSect: TPdfReference;
+ Nom: TPdfName;
+ Trouve: Boolean;
FontName: string;
begin
inherited Create;
CreateRefTable;
CreateTrailer;
-CreateCatalog;
+Catalogue:= CreateCatalog;
CreateInfo;
CreatePreferences;
-Parent:= 0;
+ParentPage:= 0;
+ParentOutline:= 0;
if Sections.Count> 1
then
- TreeRoot:= CreatePages(Parent);
+ begin
+ if Outline
+ then
+ begin
+ OutlineRoot:= CreateOutlines(ParentOutline);
+ // add outline reference to catalog dictionary
+ XRefObjets:= TPdfReference.CreateReference(Pred(FXRefObjets.Count));
+ TPdfDictionary(TPdfXRef(FXRefObjets[Catalogue]).FObjet).AddElement('Outlines',XRefObjets);
+ // add useoutline element to catalog dictionary
+ Nom:= TPdfName.CreateName('UseOutlines');
+ TPdfDictionary(TPdfXRef(FXRefObjets[Catalogue]).FObjet).AddElement('PageMode',Nom);
+ end;
+ TreeRoot:= CreatePages(ParentPage);
+ end;
NumPage:= 0; // numéro de page identique à celui de l'appel à ImprimePage
for CptSect:= 0 to Pred(Sections.Count) do
begin
if Sections.Count> 1
then
- Parent:= CreatePages(TreeRoot)
+ begin
+ if Outline
+ then
+ begin
+ ParentOutline:= CreateOutline(OutlineRoot,Succ(CptSect),-1,T_Section(Sections[CptSect]).Titre);
+ Dictionaire:= TPdfDictionary(TPdfXRef(FXRefObjets[OutlineRoot]).FObjet);
+ TPdfInteger(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('Count')]).FValue).IncrementeInteger;
+ if CptSect= 0
+ then
+ begin
+ XRefObjets:= TPdfReference.CreateReference(Pred(FXRefObjets.Count));
+ TPdfDictionary(TPdfXRef(FXRefObjets[OutlineRoot]).FObjet).AddElement('First',XRefObjets);
+ NextSect:= ParentOutline;
+ PrevSect:= XRefObjets;
+ end
+ else
+ begin
+ XRefObjets:= TPdfReference.CreateReference(Pred(FXRefObjets.Count));
+ TPdfDictionary(TPdfXRef(FXRefObjets[NextSect]).FObjet).AddElement('Next',XRefObjets);
+ TPdfDictionary(TPdfXRef(FXRefObjets[ParentOutline]).FObjet).AddElement('Prev',PrevSect);
+ NextSect:= ParentOutline;
+ PrevSect:= XRefObjets;
+ end;
+ if CptSect= Pred(Sections.Count)
+ then
+ begin
+ XRefObjets:= TPdfReference.CreateReference(Pred(FXRefObjets.Count));
+ TPdfDictionary(TPdfXRef(FXRefObjets[OutlineRoot]).FObjet).AddElement('Last',XRefObjets);
+ end;
+ end;
+ ParentPage:= CreatePages(TreeRoot);
+ end
else
- Parent:= CreatePages(Parent);
+ ParentPage:= CreatePages(ParentPage);
for CptPage:= 0 to Pred(T_Section(Sections[CptSect]).Pages.Count) do
begin
- CreatePage(Parent);
+ with T_Section(Sections[CptSect]) do
+ NewPage:= CreatePage(ParentPage,Paper.H,Paper.W);
Inc(NumPage);
PageNum:= CreateContents; // pagenum = numéro d'objet dans le fichier PDF
CreateStream(NumPage,PageNum);
+ if (Sections.Count> 1) and Outline
+ then
+ begin
+ PageOutline:= CreateOutline(ParentOutline,Succ(CptSect),Succ(Cptpage),T_Section(Sections[CptSect]).Titre);
+ Dictionaire:= TPdfDictionary(TPdfXRef(FXRefObjets[ParentOutline]).FObjet);
+ TPdfInteger(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('Count')]).FValue).IncrementeInteger;
+ // add page reference to outline destination
+ Dictionaire:= TPdfDictionary(TPdfXRef(FXRefObjets[PageOutline]).FObjet);
+ XRefObjets:= TPdfReference.CreateReference(NewPage);
+ TPdfArray(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('Dest')]).FValue).AddItem(XRefObjets);
+ // add display control name to outline destination
+ Nom:= TPdfName.CreateName('Fit');
+ TPdfArray(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('Dest')]).FValue).AddItem(Nom);
+ if CptPage= 0
+ then
+ begin
+ XRefObjets:= TPdfReference.CreateReference(Pred(FXRefObjets.Count));
+ TPdfDictionary(TPdfXRef(FXRefObjets[ParentOutline]).FObjet).AddElement('First',XRefObjets);
+ NextOutline:= PageOutline;
+ PrevOutline:= XRefObjets;
+ // add page reference to parent outline destination
+ Dictionaire:= TPdfDictionary(TPdfXRef(FXRefObjets[ParentOutline]).FObjet);
+ XRefObjets:= TPdfReference.CreateReference(NewPage);
+ TPdfArray(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('Dest')]).FValue).AddItem(XRefObjets);
+ // add display control name to outline destination
+ Nom:= TPdfName.CreateName('Fit');
+ TPdfArray(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('Dest')]).FValue).AddItem(Nom);
+ end
+ else
+ begin
+ XRefObjets:= TPdfReference.CreateReference(Pred(FXRefObjets.Count));
+ TPdfDictionary(TPdfXRef(FXRefObjets[NextOutline]).FObjet).AddElement('Next',XRefObjets);
+ TPdfDictionary(TPdfXRef(FXRefObjets[PageOutline]).FObjet).AddElement('Prev',PrevOutline);
+ NextOutline:= PageOutline;
+ PrevOutline:= XRefObjets;
+ end;
+ if CptPage= Pred(T_Section(Sections[CptSect]).Pages.Count)
+ then
+ begin
+ XRefObjets:= TPdfReference.CreateReference(Pred(FXRefObjets.Count));
+ TPdfDictionary(TPdfXRef(FXRefObjets[ParentOutline]).FObjet).AddElement('Last',XRefObjets);
+ end;
+ end;
end;
end;
if Sections.Count> 1
diff --git a/extras/contributed/report_tool/reportengine/u_visu.pas b/extras/contributed/report_tool/reportengine/u_visu.pas
index 2d25f8e2..d95d836a 100644
--- a/extras/contributed/report_tool/reportengine/u_visu.pas
+++ b/extras/contributed/report_tool/reportengine/u_visu.pas
@@ -110,7 +110,7 @@ with Imprime do
E_NumSect.Text:= IntToStr(NumeroSection);
L_NbrSect.Text:= IntToStr(Sections.Count);
L_NumPageSect.Text:= IntToStr(NumeroPageSection);
- L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).GetNbPages);
+ L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).NbPages);
ChangeBoutons;
end;
end;
@@ -179,11 +179,19 @@ with Imprime do
NumeroSection:= 1;
NumeroPageSection:= 1;
E_NumPage.Text:= IntToStr(NumeroPage);
- Bv_Visu.Invalidate;
+ Bv_Visu.Visible:= False;
+ with T_Section(Sections[Pred(NumeroSection)]),F_Visu do
+ begin
+ Bv_Visu.Height:= Paper.H;
+ Bv_Visu.Width:= Paper.W;
+ Bv_Visu.Top:= 50+(F_Visu.Height-50-Paper.H) div 2;
+ Bv_Visu.Left:= (F_Visu.Width-Paper.W) div 2;
+ end;
+ Bv_Visu.Visible:= True;
ChangeBoutons;
E_NumSect.Text:= IntToStr(NumeroSection);
L_NumPageSect.Text:= IntToStr(NumeroPageSection);
- L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).GetNbPages);
+ L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).NbPages);
end;
end;
@@ -196,16 +204,27 @@ with Imprime do
then
begin
NumeroSection:= NumeroSection-1;
- NumeroPageSection:= T_Section(Sections[Pred(NumeroSection)]).GetNbPages;
+ NumeroPageSection:= T_Section(Sections[Pred(NumeroSection)]).NbPages;
+ Bv_Visu.Visible:= False;
+ with T_Section(Sections[Pred(NumeroSection)]),F_Visu do
+ begin
+ Bv_Visu.Height:= Paper.H;
+ Bv_Visu.Width:= Paper.W;
+ Bv_Visu.Top:= 50+(F_Visu.Height-50-Paper.H) div 2;
+ Bv_Visu.Left:= (F_Visu.Width-Paper.W) div 2;
+ end;
+ Bv_Visu.Visible:= True;
end
else
+ begin
NumeroPageSection:= NumeroPageSection-1;
+ Bv_Visu.Invalidate;
+ end;
E_NumPage.Text:= IntToStr(NumeroPage);
- Bv_Visu.Invalidate;
ChangeBoutons;
E_NumSect.Text:= IntToStr(NumeroSection);
L_NumPageSect.Text:= IntToStr(NumeroPageSection);
- L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).GetNbPages);
+ L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).NbPages);
end;
end;
@@ -214,20 +233,31 @@ begin
with Imprime do
begin
NumeroPage:= NumeroPage+1;
- if NumeroPageSection= T_Section(Sections[Pred(NumeroSection)]).GetNbPages
+ if NumeroPageSection= T_Section(Sections[Pred(NumeroSection)]).NbPages
then
begin
NumeroSection:= NumeroSection+1;
NumeroPageSection:= 1;
+ Bv_Visu.Visible:= False;
+ with T_Section(Sections[Pred(NumeroSection)]),F_Visu do
+ begin
+ Bv_Visu.Height:= Paper.H;
+ Bv_Visu.Width:= Paper.W;
+ Bv_Visu.Top:= 50+(F_Visu.Height-50-Paper.H) div 2;
+ Bv_Visu.Left:= (F_Visu.Width-Paper.W) div 2;
+ end;
+ Bv_Visu.Visible:= True;
end
else
+ begin
NumeroPageSection:= NumeroPageSection+1;
+ Bv_Visu.Invalidate;
+ end;
E_NumPage.Text:= IntToStr(NumeroPage);
- Bv_Visu.Invalidate;
ChangeBoutons;
E_NumSect.Text:= IntToStr(NumeroSection);
L_NumPageSect.Text:= IntToStr(NumeroPageSection);
- L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).GetNbPages);
+ L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).NbPages);
end;
end;
@@ -237,13 +267,21 @@ with Imprime do
begin
NumeroPage:= T_Section(Sections[Pred(Sections.Count)]).TotPages;
NumeroSection:= Sections.Count;
- NumeroPageSection:= T_Section(Sections[Pred(Sections.Count)]).GetNbPages;
+ NumeroPageSection:= T_Section(Sections[Pred(Sections.Count)]).NbPages;
E_NumPage.Text:= IntToStr(NumeroPage);
- Bv_Visu.Invalidate;
+ Bv_Visu.Visible:= False;
+ with T_Section(Sections[Pred(NumeroSection)]),F_Visu do
+ begin
+ Bv_Visu.Height:= Paper.H;
+ Bv_Visu.Width:= Paper.W;
+ Bv_Visu.Top:= 50+(F_Visu.Height-50-Paper.H) div 2;
+ Bv_Visu.Left:= (F_Visu.Width-Paper.W) div 2;
+ end;
+ Bv_Visu.Visible:= True;
ChangeBoutons;
E_NumSect.Text:= IntToStr(NumeroSection);
L_NumPageSect.Text:= IntToStr(NumeroPageSection);
- L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).GetNbPages);
+ L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).NbPages);
end;
end;
@@ -256,14 +294,22 @@ begin
with Imprime do
begin
NumeroSection:= NumeroSection-1;
- NumeroPage:= T_Section(Sections[Pred(NumeroSection)]).GetFirstPage;
+ NumeroPage:= T_Section(Sections[Pred(NumeroSection)]).FirstPage;
NumeroPageSection:= 1;
E_NumPage.Text:= IntToStr(NumeroPage);
- Bv_Visu.Invalidate;
+ Bv_Visu.Visible:= False;
+ with T_Section(Sections[Pred(NumeroSection)]),F_Visu do
+ begin
+ Bv_Visu.Height:= Paper.H;
+ Bv_Visu.Width:= Paper.W;
+ Bv_Visu.Top:= 50+(F_Visu.Height-50-Paper.H) div 2;
+ Bv_Visu.Left:= (F_Visu.Width-Paper.W) div 2;
+ end;
+ Bv_Visu.Visible:= True;
ChangeBoutons;
E_NumSect.Text:= IntToStr(NumeroSection);
L_NumPageSect.Text:= IntToStr(NumeroPageSection);
- L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).GetNbPages);
+ L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).NbPages);
end;
end;
@@ -272,14 +318,22 @@ begin
with Imprime do
begin
NumeroSection:= NumeroSection+1;
- NumeroPage:= T_Section(Sections[Pred(NumeroSection)]).GetFirstPage;
+ NumeroPage:= T_Section(Sections[Pred(NumeroSection)]).FirstPage;
NumeroPageSection:= 1;
E_NumPage.Text:= IntToStr(NumeroPage);
- Bv_Visu.Invalidate;
+ Bv_Visu.Visible:= False;
+ with T_Section(Sections[Pred(NumeroSection)]),F_Visu do
+ begin
+ Bv_Visu.Height:= Paper.H;
+ Bv_Visu.Width:= Paper.W;
+ Bv_Visu.Top:= 50+(F_Visu.Height-50-Paper.H) div 2;
+ Bv_Visu.Left:= (F_Visu.Width-Paper.W) div 2;
+ end;
+ Bv_Visu.Visible:= True;
ChangeBoutons;
E_NumSect.Text:= IntToStr(NumeroSection);
L_NumPageSect.Text:= IntToStr(NumeroPageSection);
- L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).GetNbPages);
+ L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).NbPages);
end;
end;
@@ -391,7 +445,7 @@ then
repeat
Inc(CptPage);
Inc(CptPageSect);
- until (CptPage= NumeroPage) or (CptPage= T_Section(Sections[Pred(Cptsect)]).GetNbPages);
+ until (CptPage= NumeroPage) or (CptPage= T_Section(Sections[Pred(Cptsect)]).NbPages);
until CptPage= NumeroPage;
NumeroSection:= CptSect;
NumeroPageSection:= CptPagesect;
@@ -399,7 +453,7 @@ then
ChangeBoutons;
E_NumSect.Text:= IntToStr(NumeroSection);
L_NumPageSect.Text:= IntToStr(NumeroPageSection);
- L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).GetNbPages);
+ L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).NbPages);
end;
end;
@@ -420,13 +474,13 @@ then
else
NumeroSection:= E_NumSect.Value;
E_NumSect.Value:= NumeroSection;
- NumeroPage:= T_Section(Sections[Pred(Numerosection)]).GetFirstPage;
+ NumeroPage:= T_Section(Sections[Pred(Numerosection)]).FirstPage;
NumeroPageSection:= 1;
E_NumPage.Value:= NumeroPage;
Bv_Visu.Invalidate;
ChangeBoutons;
L_NumPageSect.Text:= IntToStr(NumeroPageSection);
- L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).GetNbPages);
+ L_NbrPageSect.Text:= IntToStr(T_Section(Sections[Pred(NumeroSection)]).NbPages);
end;
end;