summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
authorJean-Marc Levecque <jmarc.levecque@dbmail.com>2010-11-29 15:07:35 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-11-29 15:07:35 +0200
commit14f7e9d749b5314412b6f8ac56a1361f5a19bc18 (patch)
tree63ce42819725a5cbdccd5c7504a2b0ec92bd378c /extras
parente5ad58b6113f8b2e790601572b3c458013b7e3b9 (diff)
downloadfpGUI-14f7e9d749b5314412b6f8ac56a1361f5a19bc18.tar.xz
it is now possible to create a document divided into sections, with different
headers and footers. See the new multi sections demo.
Diffstat (limited to 'extras')
-rw-r--r--extras/contributed/report_tool/demo/u_demo.pas177
-rw-r--r--extras/contributed/report_tool/reportengine/u_commande.pas14
-rw-r--r--extras/contributed/report_tool/reportengine/u_imprime.pas379
-rw-r--r--extras/contributed/report_tool/reportengine/u_pdf.pas54
-rw-r--r--extras/contributed/report_tool/reportengine/u_visu.pas2
5 files changed, 403 insertions, 223 deletions
diff --git a/extras/contributed/report_tool/demo/u_demo.pas b/extras/contributed/report_tool/demo/u_demo.pas
index e5cb2e55..15493bf2 100644
--- a/extras/contributed/report_tool/demo/u_demo.pas
+++ b/extras/contributed/report_tool/demo/u_demo.pas
@@ -19,6 +19,7 @@ type
Bt_PdfEmptyPage: TfpgButton;
Bt_PdfSimpleText: TfpgButton;
Bt_PdfMultiPages: TfpgButton;
+ Bt_PdfMultiSections: TfpgButton;
Bt_PdfCadres: TfpgButton;
Bt_PdfColor: TfpgButton;
Bt_PdfLines: TfpgButton;
@@ -28,6 +29,7 @@ type
Bt_VisuEmptyPage: TfpgButton;
Bt_VisuSimpleText: TfpgButton;
Bt_VisuMultiPages: TfpgButton;
+ Bt_VisuMultiSections: TfpgButton;
Bt_VisuCadres: TfpgButton;
Bt_VisuColor: TfpgButton;
Bt_VisuLines: TfpgButton;
@@ -37,6 +39,7 @@ type
Bt_PrintEmptyPage: TfpgButton;
Bt_PrintSimpleText: TfpgButton;
Bt_PrintMultiPages: TfpgButton;
+ Bt_PrintMultiSections: TfpgButton;
Bt_PrintCadres: TfpgButton;
Bt_PrintColor: TfpgButton;
Bt_PrintLines: TfpgButton;
@@ -46,6 +49,7 @@ type
procedure Bt_PdfEmptyPageClick(Sender: TObject);
procedure Bt_PdfSimpleTextClick(Sender: TObject);
procedure Bt_PdfMultiPagesClick(Sender: TObject);
+ procedure Bt_PdfMultiSectionsClick(Sender: TObject);
procedure Bt_PdfCadresClick(Sender: TObject);
procedure Bt_PdfColorClick(Sender: TObject);
procedure Bt_PdfLinesClick(Sender: TObject);
@@ -54,6 +58,7 @@ type
procedure Bt_VisuEmptyPageClick(Sender: TObject);
procedure Bt_VisuSimpleTextClick(Sender: TObject);
procedure Bt_VisuMultiPagesClick(Sender: TObject);
+ procedure Bt_VisuMultiSectionsClick(Sender: TObject);
procedure Bt_VisuCadresClick(Sender: TObject);
procedure Bt_VisuColorClick(Sender: TObject);
procedure Bt_VisuLinesClick(Sender: TObject);
@@ -62,6 +67,7 @@ type
procedure Bt_PrintEmptyPageClick(Sender: TObject);
procedure Bt_PrintSimpleTextClick(Sender: TObject);
procedure Bt_PrintMultiPagesClick(Sender: TObject);
+ procedure Bt_PrintMultiSectionsClick(Sender: TObject);
procedure Bt_PrintCadresClick(Sender: TObject);
procedure Bt_PrintColorClick(Sender: TObject);
procedure Bt_PrintLinesClick(Sender: TObject);
@@ -71,6 +77,7 @@ type
procedure ImprimeEmptyPage(Preview: Boolean);
procedure ImprimeSimpleText(Preview: Boolean);
procedure ImprimeMultiPages(Preview: Boolean);
+ procedure ImprimeMultiSections(Preview: Boolean);
procedure ImprimeCadres(Preview: Boolean);
procedure ImprimeColor(Preview: Boolean);
procedure ImprimeLines(Preview: Boolean);
@@ -250,6 +257,58 @@ with Imprime do
end;
end;
+procedure TF_Demo.Bt_PdfMultiSectionsClick(Sender: TObject);
+var
+ Fd_SauvePdf: TfpgFileDialog;
+ FichierPdf: string;
+ FluxFichier: TFileStream;
+begin
+Imprime:= T_Imprime.Create;
+with Imprime do
+ begin
+// Langue:= Version;
+ ImprimeMultiSections(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:= 'MultiSections.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;
@@ -546,6 +605,18 @@ with Imprime do
end;
end;
+procedure TF_Demo.Bt_VisuMultiSectionsClick(Sender: TObject);
+begin
+Imprime:= T_Imprime.Create;
+with Imprime do
+ begin
+ //Langue:= Version;
+ DefaultFile:= 'MultiSections.pdf';
+ ImprimeMultiSections(True);
+ Free;
+ end;
+end;
+
procedure TF_Demo.Bt_VisuCadresClick(Sender: TObject);
begin
Imprime:= T_Imprime.Create;
@@ -621,6 +692,11 @@ begin
end;
+procedure TF_Demo.Bt_PrintMultiSectionsClick(Sender: TObject);
+begin
+
+end;
+
procedure TF_Demo.Bt_PrintCadresClick(Sender: TObject);
begin
@@ -719,6 +795,69 @@ with Imprime do
end;
end;
+procedure TF_Demo.ImprimeMultiSections(Preview: Boolean);
+var
+ FtTitreS1,FtTitreS2,FtTitreS3,FtTexte,FtNum,FtNumS: 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);
+ // 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
+ NumSectionEnTete(cnRight,lnFin,'Section','of',True,False,ColDefaut,FtNum);
+ // write page number for the section and total pages of the section on each page
+ NumPageSectionEnTete(cnCenter,lnFin,'Section page','of',True,True,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 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.ImprimeCadres(Preview: Boolean);
var
FtTitre,FtTexte: Integer;
@@ -1000,7 +1139,7 @@ begin
inherited Create(AOwner);
Name := 'F_Demo';
WindowTitle:= 'PDF demo';
-SetPosition(0, 0, 650, 400);
+SetPosition(0, 0, 650, 450);
WindowPosition:= wpScreenCenter;
Sizeable:= False;
fpgSetNamedColor(clWindowBackground,clPaleGreen);
@@ -1014,20 +1153,22 @@ L_Visu:= CreateLabel(Self,50,5,'Print to PDF',150,20,taCenter);
Bt_PdfEmptyPage:= CreateButton(Self,50,30,150,'Empty page',@Bt_PdfEmptyPageClick,'stdimg.Adobe_pdf');
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_PdfCadres:= CreateButton(Self,50,150,150,'Draw frames',@Bt_PdfCadresClick,'stdimg.Adobe_pdf');
-Bt_PdfColor:= CreateButton(Self,50,190,150,'Show colors',@Bt_PdfColorClick,'stdimg.Adobe_pdf');
-Bt_PdfLines:= CreateButton(Self,50,230,150,'Draw lines',@Bt_PdfLinesClick,'stdimg.Adobe_pdf');
-Bt_PdfGrid:= CreateButton(Self,50,270,150,'Show grid',@Bt_PdfGridClick,'stdimg.Adobe_pdf');
-Bt_PdfGraph:= CreateButton(Self,50,310,150,'Show graph',@Bt_PdfGraphClick,'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');
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_VisuCadres:= CreateButton(Self,250,150,150,'Draw frames',@Bt_VisuCadresClick,'stdimg.Preview');
-Bt_VisuColor:= CreateButton(Self,250,190,150,'Show colors',@Bt_VisuColorClick,'stdimg.Preview');
-Bt_VisuLines:= CreateButton(Self,250,230,150,'Draw lines',@Bt_VisuLinesClick,'stdimg.Preview');
-Bt_VisuGrid:= CreateButton(Self,250,270,150,'Show grid',@Bt_VisuGridClick,'stdimg.Preview');
-Bt_VisuGraph:= CreateButton(Self,250,310,150,'Show graph',@Bt_VisuGraphClick,'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');
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;
@@ -1035,17 +1176,19 @@ Bt_PrintSimpleText:= CreateButton(Self,450,70,150,'Simple text',@Bt_PrintSimpleT
Bt_PrintSimpleText.Enabled:= False;
Bt_PrintMultiPages:= CreateButton(Self,450,110,150,'Multiple pages',@Bt_PrintMultiPagesClick,'stdimg.Imprimer');
Bt_PrintMultiPages.Enabled:= False;
-Bt_PrintCadres:= CreateButton(Self,450,150,150,'Draw frames',@Bt_PrintCadresClick,'stdimg.Imprimer');
+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_PrintCadres.Enabled:= False;
-Bt_PrintColor:= CreateButton(Self,450,190,150,'Show colors',@Bt_PrintColorClick,'stdimg.Imprimer');
+Bt_PrintColor:= CreateButton(Self,450,230,150,'Show colors',@Bt_PrintColorClick,'stdimg.Imprimer');
Bt_PrintColor.Enabled:= False;
-Bt_PrintLines:= CreateButton(Self,450,230,150,'Draw lines',@Bt_PrintLinesClick,'stdimg.Imprimer');
+Bt_PrintLines:= CreateButton(Self,450,270,150,'Draw lines',@Bt_PrintLinesClick,'stdimg.Imprimer');
Bt_PrintLines.Enabled:= False;
-Bt_PrintGrid:= CreateButton(Self,450,270,150,'Show grid',@Bt_PrintGridClick,'stdimg.Imprimer');
+Bt_PrintGrid:= CreateButton(Self,450,310,150,'Show grid',@Bt_PrintGridClick,'stdimg.Imprimer');
Bt_PrintGrid.Enabled:= False;
-Bt_PrintGraph:= CreateButton(Self,450,310,150,'Show graph',@Bt_PrintGraphClick,'stdimg.Imprimer');
+Bt_PrintGraph:= CreateButton(Self,450,350,150,'Show graph',@Bt_PrintGraphClick,'stdimg.Imprimer');
Bt_PrintGraph.Enabled:= False;
-Bt_Fermer:= CreateButton(Self,450,350,150,'Fermer',@Bt_FermerClick,'stdimg.Fermer');
+Bt_Fermer:= CreateButton(Self,450,400,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 a8e3e5e7..f806247f 100644
--- a/extras/contributed/report_tool/reportengine/u_commande.pas
+++ b/extras/contributed/report_tool/reportengine/u_commande.pas
@@ -1,5 +1,5 @@
{
- << Impressions >> U_Pdf.pas
+ << Impressions >> U_Commande.pas
Copyright (C) 2010 - JM.Levecque - <jmarc.levecque@jmlesite.fr>
@@ -42,6 +42,8 @@ type
Imprimable: TDimensions;
end;
+ // document classes
+
T_Section = class
private
FNumSect: Integer;
@@ -121,6 +123,8 @@ type
property GetHeight: Integer read FHeight;
end;
+ // command classes
+
T_Commande = class
end;
@@ -331,6 +335,10 @@ var
implementation
+// utility functions
+
+// extracts the font size from the fontdesc
+
function ExtractFontSize(const AValue: string): string;
begin
if Pos(':',AValue)> 0
@@ -340,6 +348,8 @@ else
Result:= Copy(AValue,Succ(Pos('-',AValue)),Length(AValue)-Pos('-',AValue));
end;
+// document classes methods
+
function T_Section.FirstPage: Integer;
begin
Result:= T_Page(Pages[0]).PagesTot;
@@ -531,6 +541,8 @@ ACommande:= T_Numero.Create(APosX,APosY,AColonne,ATexteNum,ATexteTot,AFonte,AFon
Commandes.Add(ACommande);
end;
+// command classes methods
+
procedure T_EcritTexte.SetPosY(const AValue: Integer);
begin
if FPosY<> AValue
diff --git a/extras/contributed/report_tool/reportengine/u_imprime.pas b/extras/contributed/report_tool/reportengine/u_imprime.pas
index 96141e76..5ad5c15b 100644
--- a/extras/contributed/report_tool/reportengine/u_imprime.pas
+++ b/extras/contributed/report_tool/reportengine/u_imprime.pas
@@ -1,5 +1,5 @@
{
- << Impressions >> U_Pdf.pas
+ << Impressions >> U_Imprime.pas
Copyright (C) 2010 - JM.Levecque - <jmarc.levecque@jmlesite.fr>
@@ -49,10 +49,10 @@ type
FNmSection: Integer;
FNmPage: Integer;
FNmPageSect: Integer;
- FPosRef: TPoint; // position absolue d'écriture
- FEnTeteHeight: Integer; // position verticale de fin de texte en zone entete
- FPageHeight: Integer; // position verticale de fin de texte en zone page
- FPiedHeight: Integer; // position verticale de début de texte en zone pied
+ FPosRef: TPoint; // absolute writting position
+ FEnTeteHeight: Integer; // end of text vertical position in the header
+ FPageHeight: Integer; // end of text vertical position in the page
+ FPiedHeight: Integer; // beginning of text vertical position in the footer
FGroupe: Boolean;
FDefaultFile: string;
function Dim2Pixels(Value: Single): Integer;
@@ -80,160 +80,169 @@ type
destructor Destroy; override;
procedure Debut(IniOriente: TOrient= oPortrait; IniTypePapier: TTypePapier= A4;
IniMesure: TMesure= msMM; IniVersion: Char= 'F'; IniVisu: Boolean= True);
- // début d'impression avec initialisations
- // IniOriente = orientation du papier >> oPortrait ou oLandscape
+ // starts preview and printing process with initializations
+ // IniOriente = paper orientation >> oPortrait or oLandscape
// IniTypePapier = (A4, Letter,Legal,Executive,Comm10,Monarch,DL,C5,B5)
- // IniMesure = millimètres (msMM) ou inches (msInches)
- // IniVersion = version française 'F' ou version anglaise 'E', ou autre, à venir
- // IniVisu = True (visualisation) ou False (impression directe
+ // IniMesure = millimeters (msMM) or inches (msInches)
+ // IniVersion = version française 'F' or version English 'E', or other, to come
+ // IniVisu = True (visualisation) or False (direct printing or PDF generation)
procedure Fin;
procedure ImprimeDocument;
procedure Visualisation;
procedure Section(MgGauche,MgDroite,MgHaute,MgBasse: Single; Retrait: Single= 0);
- // nouvelle section avec initialisation des marges
+ // new section with initialization of margins
procedure Page;
- // nouvelle page dans la section courante
+ // new page in the current section
function Fond(FdColor: TfpgColor): Integer;
- // retourne le numéro alloué à la couleur créée
- // FdColor = couleur de fond
+ // returns the number allocated to the color
+ // FdColor = background color
function Fonte(FtNom: string; FtColor: TfpgColor): Integer;
- // retourne le numéro alloué à la fonte créée
- // FtNom = FontDesc définissant la fonte
- // FtColor = couleur d'écriture
+ // returns the number allocated to the font
+ // FtNom = FontDesc of the font
+ // FtColor = font color
function StyleTrait(StEpais: Integer; StColor: Tfpgcolor; StStyle: TfpgLineStyle): Integer;
- // retourne le numéro alloué au style de trait
- // StEpais = épaisseur de trait en pixels
- // StColor = couleur de trait
- // StStyle = style de trait
+ // returns the number allocated to the line style
+ // StEpais = thickness of the line in pixels
+ // StColor = line color
+ // StStyle = line style
function Bordure(BdFlags: TFBordFlags; BdStyle: Integer): Integer;
- // retourne le numéro alloué à la bordure
- // BdFlags = position de la bordure (bdTop,bdBottom,bdLeft,bdRight)
- // BdStyle = caractéristiques du trait: épaisseur, couleur, style
+ // returns the number allocated to the border
+ // BdFlags = position of the border (bdTop,bdBottom,bdLeft,bdRight)
+ // BdStyle = border line style: thickness, color, style
function Colonne(ClnPos,ClnWidth: Single; ClnMargin: Single= 0; ClnColor: TfpgColor= clWhite): Integer;
- // retourne le numero alloué à la colonne créée
- // ClnPos = position gauche en valeur numérique dans l'unité de mesure
- // ClnWidth = largeur en valeur numérique dans l'unité de mesure
- // ClnMargin = marges gauche et droite
- // ClnColor = couleur de fond de la colonne
+ // returns the number allocated to the column
+ // ClnPos = left position in numeric value in the measurement unit (msMM or msInch)
+ // ClnWidth = width in numeric value in the measurement unit (msMM or msInch)
+ // ClnMargin = left and right margins in numeric value in the measurement unit (msMM or msInch)
+ // ClnColor = column background color
procedure EcritEnTete(Horiz,Verti: Single; Texte: string; ColNum: Integer= 0; FonteNum: Integer= 0;
InterNum: Integer= 0; CoulFdNum: Integer= -1; BordNum: Integer= -1);
- // Horiz = cadrage (cnLeft,cnCenter,cnRight)
- // ou valeur numérique dans l'unité de mesure
- // Verti = ligne (lnCourante,lnFin) ou valeur numérique dans l'unité de mesure
- // Texte = texte à écrire
- // ColNum = colonne, par défaut: entre les marges gauche et droite
- // FonteNum = fonte applicable au texte
- // InterNum = interlignes applicables au texte
- // CoulFdNum = couleur de fond, si > -1, remplace la couleur de colonne éventuelle
- // BordNum = bordure applicable, si> -1
+ // Horiz = horizontal position in column (cnLeft,cnCenter,cnRight)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // Verti = line position in column (lnCourante,lnFin)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // Texte = texte to be written
+ // ColNum = column reference, default between left and right margins
+ // FonteNum = font reference
+ // InterNum = space between lines reference
+ // CoulFdNum = background color reference, if > -1, replaces the column background color if any
+ // BordNum = border reference, if> -1
procedure EcritPage(Horiz,Verti: Single; Texte: string; ColNum: Integer= 0; FonteNum: Integer= 0;
InterNum: Integer= 0; CoulFdNum: Integer= -1; BordNum: Integer= -1);
- // Horiz = cadrage (cnLeft,cnCenter,cnRight)
- // ou valeur numérique dans l'unité de mesure
- // Verti = ligne (lnCourante,lnFin) ou valeur numérique dans l'unité de mesure
- // Texte = texte à écrire
- // ColNum = colonne, par défaut: entre les marges gauche et droite
- // FonteNum = fonte applicable au texte
- // InterNum = interlignes applicables au texte
- // CoulFdNum = couleur de fond, si > -1, remplace la couleur de colonne éventuelle
- // BordNum = bordure applicable, si> -1
+ // Horiz = horizontal position in column (cnLeft,cnCenter,cnRight)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // Verti = line position in column (lnCourante,lnFin)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // Texte = texte to be written
+ // ColNum = column reference, default between left and right margins
+ // FonteNum = font reference
+ // InterNum = space between lines reference
+ // CoulFdNum = background color reference, if > -1, replaces the column background color if any
+ // BordNum = border reference, if> -1
procedure EcritPied(Horiz,Verti: Single; Texte: string; ColNum: Integer= 0; FonteNum: Integer= 0;
InterNum: Integer= 0; CoulFdNum: Integer= -1; BordNum: Integer= -1);
- // Horiz = cadrage (cnLeft,cnCenter,cnRight)
- // ou valeur numérique dans l'unité de mesure
- // Verti = ligne (lnCourante,lnFin) ou valeur numérique dans l'unité de mesure
- // Texte = texte à écrire
- // ColNum = colonne, par défaut: entre les marges gauche et droite
- // FonteNum = fonte applicable au texte
- // InterNum = interlignes applicables au texte
- // CoulFdNum = couleur de fond, si > -1, remplace la couleur de colonne éventuelle
- // BordNum = bordure applicable, si> -1
+ // Horiz = horizontal position in column (cnLeft,cnCenter,cnRight)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // Verti = line position in column (lnCourante,lnFin)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // Texte = texte to be written
+ // ColNum = column reference, default between left and right margins
+ // FonteNum = font reference
+ // InterNum = space between lines reference
+ // CoulFdNum = background color reference, if > -1, replaces the column background color if any
+ // BordNum = border reference, if> -1
procedure NumSectionEnTete(Horiz,Verti: Single; TexteSect: string= ''; TexteTot: string= '';
Total: Boolean= False; Alpha: Boolean= False; ColNum: Integer= 0; FonteNum: Integer= 0;
InterNum: Integer= 0; CoulFdNum: Integer= -1; BordNum: Integer= -1);
- // Horiz = cadrage (cnLeft,cnCenter,cnRight)
- // ou valeur numérique dans l'unité de mesure
- // Verti = ligne (lgCourante,lgFin) ou valeur numérique dans l'unité de mesure
- // TexteSection = texte à écrire devant le numéro de section
- // TexteTotal = texte à écrire devant le nombre de sections
- // Total= True > affiche le nombre total de sections
- // Alpha= True > affiche le nombre total de sections en lettres en ordre alphabétique
- // ColNum = colonne, par défaut: entre les marges gauche et droite
- // FonteNum = fonte applicable au texte
- // InterNum = interlignes applicables au texte
- // CoulFdNum = couleur de fond, si > -1, remplace la couleur de colonne éventuelle
- // BordNum = bordure applicable, si> -1
+ // Horiz = horizontal position in column (cnLeft,cnCenter,cnRight)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // Verti = line position in column (lnCourante,lnFin)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // TexteSection = text to be written before the section number
+ // TexteTotal = text to be written before the number of sections
+ // Total= True => displays the number of sections
+ // Alpha= True => displays the number of sections using letters in alphabetic order
+ // ColNum = column reference, default between left and right margins
+ // FonteNum = font reference
+ // InterNum = space between lines reference
+ // CoulFdNum = background color reference, if > -1, replaces the column background color if any
+ // BordNum = border reference, if> -1
procedure NumSectionPied(Horiz,Verti: Single; TexteSect: string= ''; TexteTot: string= '';
Total: Boolean= False; Alpha: Boolean= False; ColNum: Integer= 0; FonteNum: Integer= 0;
InterNum: Integer= 0; CoulFdNum: Integer= -1; BordNum: Integer= -1);
- // Horiz = cadrage (cnLeft,cnCenter,cnRight)
- // ou valeur numérique dans l'unité de mesure
- // Verti = ligne (lgCourante,lgFin) ou valeur numérique dans l'unité de mesure
- // TexteSection = texte à écrire devant le numéro de section
- // TexteTotal = texte à écrire devant le nombre de sections
- // Total= True > affiche le nombre total de sections
- // Alpha= True > affiche le nombre total de sections en lettres en ordre alphabétique
- // ColNum = colonne, par défaut: entre les marges gauche et droite
- // FonteNum = fonte applicable au texte
- // InterNum = interlignes applicables au texte
- // CoulFdNum = couleur de fond, si > -1, remplace la couleur de colonne éventuelle
- // BordNum = bordure applicable, si> -1
+ // Horiz = horizontal position in column (cnLeft,cnCenter,cnRight)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // Verti = line position in column (lnCourante,lnFin)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // TexteSection = text to be written before the section number
+ // TexteTotal = text to be written before the number of sections
+ // Total= True => displays the number of sections
+ // Alpha= True => displays the number of sections using letters in alphabetic order
+ // ColNum = column reference, default between left and right margins
+ // FonteNum = font reference
+ // InterNum = space between lines reference
+ // CoulFdNum = background color reference, if > -1, replaces the column background color if any
+ // BordNum = border reference, if> -1
procedure NumPageEnTete(Horiz,Verti: Single; TextePage: string= ''; TexteTotal: string= '';
Total: Boolean= False; ColNum: Integer= 0; FonteNum: Integer= 0; InterNum: Integer= 0;
CoulFdNum: Integer= -1; BordNum: Integer= -1);
- // Horiz = cadrage (cnLeft,cnCenter,cnRight)
- // ou valeur numérique dans l'unité de mesure
- // Verti = ligne (lnCourante,lnFin) ou valeur numérique dans l'unité de mesure
- // TextePage = texte à écrire devant le numéro de page
- // TexteTotal = texte à écrire devant le nombre de pages
- // Total= True > affiche le nombre total de pages
- // ColNum = colonne, par défaut: entre les marges gauche et droite
- // FonteNum = fonte applicable au texte
- // InterNum = interlignes applicables au texte
- // CoulFdNum = couleur de fond, si > -1, remplace la couleur de colonne éventuelle
- // BordNum = bordure applicable, si> -1
+ // Horiz = horizontal position in column (cnLeft,cnCenter,cnRight)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // Verti = line position in column (lnCourante,lnFin)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // TextePage = text to be written before the page number in the document
+ // TexteTotal = text to be written before the number of pages of the document
+ // Total= True > displays the number of pages of the document
+ // ColNum = column reference, default between left and right margins
+ // FonteNum = font reference
+ // InterNum = space between lines reference
+ // CoulFdNum = background color reference, if > -1, replaces the column background color if any
+ // BordNum = border reference, if> -1
procedure NumPagePied(Horiz,Verti: Single; TextePage: string= ''; TexteTotal: string= '';
Total: Boolean= False; ColNum: Integer= 0; FonteNum: Integer= 0; InterNum: Integer= 0;
CoulFdNum: Integer= -1; BordNum: Integer= -1);
- // Horiz = cadrage (cnLeft,cnCenter,cnRight)
- // ou valeur numérique dans l'unité de mesure
- // Verti = ligne (lnCourante,lnFin) ou valeur numérique dans l'unité de mesure
- // TextePage = texte à écrire devant le numéro de page
- // TexteTotal = texte à écrire devant le nombre de pages
- // Total= True > affiche le nombre total de pages
- // ColNum = colonne, par défaut: entre les marges gauche et droite
- // FonteNum = fonte applicable au texte
- // InterNum = interlignes applicables au texte
- // CoulFdNum = couleur de fond, si > -1, remplace la couleur de colonne éventuelle
- // BordNum = bordure applicable, si> -1
+ // Horiz = horizontal position in column (cnLeft,cnCenter,cnRight)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // Verti = line position in column (lnCourante,lnFin)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // TextePage = text to be written before the page number in the document
+ // TexteTotal = text to be written before the number of pages of the document
+ // Total= True > displays the number of pages of the document
+ // ColNum = column reference, default between left and right margins
+ // FonteNum = font reference
+ // InterNum = space between lines reference
+ // CoulFdNum = background color reference, if > -1, replaces the column background color if any
+ // BordNum = border reference, if> -1
procedure NumPageSectionEnTete(Horiz,Verti: Single; TexteSect: string= ''; TexteTot: string= '';
Total: Boolean= False; Alpha: Boolean= False; ColNum: Integer= 0; FonteNum: Integer= 0;
InterNum: Integer= 0; CoulFdNum: Integer= -1; BordNum: Integer= -1);
- // Horiz = cadrage (cnLeft,cnCenter,cnRight)
- // ou valeur numérique dans l'unité de mesure
- // Verti = ligne (lnCourante,lnFin) ou valeur numérique dans l'unité de mesure
- // TextePage = texte à écrire devant le numéro de page dans la section
- // TexteTotal = texte à écrire devant le nombre de pages de la section
- // Total= True > affiche le nombre total de pages de la section
- // ColNum = colonne, par défaut: entre les marges gauche et droite
- // FonteNum = fonte applicable au texte
- // InterNum = interlignes applicables au texte
- // CoulFdNum = couleur de fond, si > -1, remplce la couleur de colonne éventuelle
- // BordNum = bordure applicable, si> -1
+ // Horiz = horizontal position in column (cnLeft,cnCenter,cnRight)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // Verti = line position in column (lnCourante,lnFin)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // TextePage = text to ba written before the page number in the section
+ // TexteTotal = text to be written before the number of pages of the section
+ // Total= True > displays the number of pages of the section
+ // ColNum = column reference, default between left and right margins
+ // FonteNum = font reference
+ // InterNum = space between lines reference
+ // CoulFdNum = background color reference, if > -1, replaces the column background color if any
+ // BordNum = border reference, if> -1
procedure NumPageSectionPied(Horiz,Verti: Single; TexteSect: string= ''; TexteTot: string= '';
Total: Boolean= False; Alpha: Boolean= False; ColNum: Integer= 0; FonteNum: Integer= 0;
InterNum: Integer= 0; CoulFdNum: Integer= -1; BordNum: Integer= -1);
- // Horiz = cadrage (cnLeft,cnCenter,cnRight)
- // ou valeur numérique dans l'unité de mesure
- // Verti = ligne (lnCourante,lnFin) ou valeur numérique dans l'unité de mesure
- // TextePage = texte à écrire devant le numéro de page dans la section
- // TexteTotal = texte à écrire devant le nombre de pages de la section
- // Total= True > affiche le nombre total de pages de la section
- // ColNum = colonne, par défaut: entre les marges gauche et droite
- // FonteNum = fonte applicable au texte
- // InterNum = interlignes applicables au texte
- // CoulFdNum = couleur de fond, si > -1, remplace la couleur de colonne éventuelle
- // BordNum = bordure applicable, si> -1
+ // Horiz = horizontal position in column (cnLeft,cnCenter,cnRight)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // Verti = line position in column (lnCourante,lnFin)
+ // or numeric value in the measurement unit (msMM or msInch)
+ // TextePage = text to ba written before the page number in the section
+ // TexteTotal = text to be written before the number of pages of the section
+ // Total= True > displays the number of pages of the section
+ // ColNum = column reference, default between left and right margins
+ // FonteNum = font reference
+ // 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;
@@ -241,48 +250,50 @@ type
//procedure TraitPied(Horiz,Verti: Single; ColNum: Integer= 0; StyleNum: Integer= 0; FinH: Integer= -1;
//FinV: Integer= -1);
procedure EspaceEnTete(Verti: Single; ColNum: Integer=0; CoulFdNum: Integer= -1);
- // Verti = hauteur de l'espace vide : valeur numérique dans l'unité de mesure
- // ColNum = colonne, par défaut: entre les marges gauche et droite
- // CoulFdNum = couleur de fond, si > -1, remplace la couleur de colonne éventuelle
+ // Verti = height of the empty space : numeric value in the measurement unit (msMM or msInch)
+ // ColNum = column reference, default between left and right margins
+ // CoulFdNum = background color reference, if > -1, replaces the column background color if any
procedure EspacePage(Verti: Single; ColNum: Integer=0; CoulFdNum: Integer= -1);
- // Verti = hauteur de l'espace vide : valeur numérique dans l'unité de mesure
- // ColNum = colonne, par défaut: entre les marges gauche et droite
- // CoulFdNum = couleur de fond, si > -1, remplace la couleur de colonne éventuelle
+ // Verti = height of the empty space : numeric value in the measurement unit (msMM or msInch)
+ // ColNum = column reference, default between left and right margins
+ // CoulFdNum = background color reference, if > -1, replaces the column background color if any
procedure EspacePied(Verti: Single; ColNum: Integer=0; CoulFdNum: Integer= -1);
- // Verti = hauteur de l'espace vide : valeur numérique dans l'unité de mesure
- // ColNum = colonne, par défaut: entre les marges gauche et droite
- // CoulFdNum = couleur de fond, si > -1, remplace la couleur de colonne éventuelle
+ // Verti = height of the empty space : numeric value in the measurement unit (msMM or msInch)
+ // ColNum = column reference, default between left and right margins
+ // CoulFdNum = background color reference, if > -1, replaces the column background color if any
function Interligne(ItlSup,ItlInt,ItlInf: Single): Integer;
- // IntSup = interligne supérieure dans l'unité de mesure
- // IntInf = interligne inférieure dans l'unité de mesure
+ // IntSup = space between lines, top : numeric value in the measurement unit (msMM or msInch)
+ // IntInt = space between lines, internal if wrapping : numeric value in the measurement unit (msMM or msInch)
+ // IntInf = space between lines, botom : numeric value in the measurement unit (msMM or msInch)
procedure Groupe(SautPage: Boolean= False);
- // SautPage = True >> force nouvelle page avant le groupe
- // = False >> sur la page active si le groupe peut y être entièrement inclus
+ // SautPage = True >> forces new page before the group
+ // = False >> does not create a new page if the whole group can stand on the same page as the preceding text
procedure FinGroupe(SautPage: Boolean= False);
- // SautPage = True >> force nouvelle page après le groupe
- // = False >> continue sur la page active après le groupe
+ // SautPage = True >> forces new page after the group
+ // = False >> lets continue on the same page after the group
procedure ColorColChange(ColNum: Integer; ColColor: TfpgColor);
- // Change la couleur d'une colonne
- // ColNum = numéro de la colonne
- // ColColor = nouvelle couleur de fond de la colonne
+ // Changes the background color of a column
+ // ColNum = column reference
+ // ColColor = new background color for the column
procedure CadreMarges(AStyle: Integer);
- // Trace un cadre aux marges de la page
- // AStyle = style de trait
+ // draw a frame at the page margins
+ // AStyle = line style of the frame
procedure CadreEnTete(AStyle: Integer);
- // trace un cadre aux dimensions de l'entête
- // AStyle = style de trait
+ // draw a frame at the limits of the header
+ // AStyle = line style of the frame
procedure CadrePage(AStyle: Integer);
- // trace un care aux dimensions de la page
- // AStyle = style de trait
+ // draw a frame at the page limits : left and right margins, header bottom and footer top
+ // AStyle = line style of the frame
procedure CadrePied(AStyle: Integer);
- // trace un cadre aux dimensions du pied de page
- // AStyle = style de trait
+ // draw a frame at the limits of the footer
+ // AStyle = line style of the frame
procedure TraitPage(XDebut,YDebut,XFin,YFin: Single; AStyle: Integer);
- // XDebut = abscisse du point initial dans l'unité de mesure
- // YDebut = ordonnée du point initial dans l'unité de mesure
- // XFin = abscisse du point final dans l'unité de mesure
- // YFin = ordonnée du point final dans l'unité de mesure
- // AStyle = style de trait
+ // draw a line at absolute position
+ // XDebut = horizontal position of starting point in numeric value in the measurement unit (msMM or msInch)
+ // 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
property Langue: Char read FVersion write FVersion;
property Visualiser: Boolean read FVisualisation write FVisualisation;
property NumeroSection: Integer read FNmSection write FNmSection;
@@ -294,6 +305,8 @@ type
property CouleurCourante: Integer read FColorCourante write FColorCourante;
end;
+ // classes for interface with PDF generation
+
TPdfElement = class
end;
@@ -410,41 +423,47 @@ end;
function T_Imprime.AddLineBreaks(const Txt: TfpgString; AMaxLineWidth: integer; AFnt: TfpgFont): string;
var
- i, n, ls: integer;
+ i,n,ls: integer;
sub: string;
- lw, tw: integer;
+ lw,tw: integer;
begin
- Result := '';
- ls := Length(Txt);
- lw := 0;
- i := 1;
- while i <= ls do
+Result:= '';
+ls:= Length(Txt);
+lw:= 0;
+i:= 1;
+while i<= ls do
begin
- if (Txt[i] in txtWordDelims) then // read the delimeter only
+ if (Txt[i] in txtWordDelims)
+ then // read the delimeter only
begin
- sub := Txt[i];
- Inc(i);
- end else // read the whole word
+ sub:= Txt[i];
+ Inc(i);
+ end
+ else // read the whole word
begin
- n := PosSetEx(txtWordDelims, Txt, i);
- if n > 0 then
+ n:= PosSetEx(txtWordDelims,Txt,i);
+ if n> 0
+ then
begin
- sub := Copy(Txt, i, n-i);
- i := n;
- end else
+ sub:= Copy(Txt,i,n-i);
+ i:= n;
+ end
+ else
begin
- sub := Copy(Txt, i, MaxInt);
- i := ls+1;
+ sub:= Copy(Txt,i,MaxInt);
+ i:= ls+1;
end;
end;
- tw := AFnt.TextWidth(sub); // wrap if needed
- if (lw + tw > aMaxLineWidth) and (lw > 0) then
+ tw:= AFnt.TextWidth(sub); // wrap if needed
+ if (lw+tw> aMaxLineWidth) and (lw> 0)
+ then
begin
- lw := tw;
- Result := TrimRight(Result) + sLineBreak;
- end else
- Inc(lw, tw);
- Result := Result + sub;
+ lw:= tw;
+ Result:= TrimRight(Result)+sLineBreak;
+ end
+ else
+ Inc(lw,tw);
+ Result:= Result+sub;
end;
end;
diff --git a/extras/contributed/report_tool/reportengine/u_pdf.pas b/extras/contributed/report_tool/reportengine/u_pdf.pas
index 72d12ac6..d6f4b56f 100644
--- a/extras/contributed/report_tool/reportengine/u_pdf.pas
+++ b/extras/contributed/report_tool/reportengine/u_pdf.pas
@@ -49,6 +49,7 @@ type
protected
procedure EcritInteger(const AFlux: TStream);
procedure IncrementeInteger;
+ property Value: Integer read FValue write FValue;
public
constructor CreateInteger(const AValue: Integer);
destructor Destroy; override;
@@ -264,6 +265,8 @@ var
CurrentColor: string;
CurrentWidth: string;
+// utility functions
+
procedure EcritChaine(const Valeur: string; AFlux: TStream);
begin
AFlux.Write(PChar(Valeur)^,Length(Valeur));
@@ -338,6 +341,8 @@ Green:= Couleur div 255;
Blue:= Couleur mod 255;
end;
+// object methods
+
constructor TPdfObjet.Create;
begin
// implementation dans les descendants
@@ -949,6 +954,7 @@ var
Pages: TPdfXRef;
XRefObjets: TPdfReference;
Nom: TPdfName;
+ Dictionaire: TPdfDictionary;
Table: TPdfArray;
Count: TPdfInteger;
begin
@@ -964,9 +970,16 @@ then
begin
XRefObjets:= TPdfReference.CreateReference(Parent);
Pages.FObjet.AddElement('Parent',XRefObjets);
+ // increment count in parent pages dictionary
+ Dictionaire:= TPdfDictionary(TPdfXRef(FXRefObjets[Parent]).FObjet);
+ TPdfInteger(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('Count')]).FValue).IncrementeInteger;
+ // add kid reference in parent pages dictionary
+ XRefObjets:= TPdfReference.CreateReference(Pred(FXRefObjets.Count));
+ TPdfArray(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('Kids')]).FValue).AddItem(XRefObjets);
end
-else // add pages reference to catalog dictionary
+else
begin
+ // add pages reference to catalog dictionary
XRefObjets:= TPdfReference.CreateReference(Pred(FXRefObjets.Count));
TPdfDictionary(TPdfXRef(FXRefObjets[ElementParNom('Catalog')]).FObjet).AddElement('Pages',XRefObjets)
end;
@@ -1178,7 +1191,7 @@ end;
constructor TPdfDocument.CreateDocument;
var
- Cpt,CptSect,CptPage,CptFont,NumFont,Parent,PageNum,NumPage: Integer;
+ Cpt,CptSect,CptPage,CptFont,NumFont,TreeRoot,Parent,PageNum,NumPage: Integer;
Trouve: Boolean;
Dictionaire: TPdfDictionary;
FontName: string;
@@ -1192,11 +1205,15 @@ CreatePreferences;
Parent:= 0;
if Sections.Count> 1
then
- Parent:= CreatePages(Parent);
+ TreeRoot:= CreatePages(Parent);
NumPage:= 0; // numéro de page identique à celui de l'appel à ImprimePage
for CptSect:= 0 to Pred(Sections.Count) do
begin
- Parent:= CreatePages(Parent);
+ if Sections.Count> 1
+ then
+ Parent:= CreatePages(TreeRoot)
+ else
+ Parent:= CreatePages(Parent);
for CptPage:= 0 to Pred(T_Section(Sections[CptSect]).Pages.Count) do
begin
CreatePage(Parent);
@@ -1205,31 +1222,20 @@ for CptSect:= 0 to Pred(Sections.Count) do
CreateStream(NumPage,PageNum);
end;
end;
+if Sections.Count> 1
+then
+ begin
+ // update count in root parent pages dictionary
+ Dictionaire:= TPdfDictionary(TPdfXRef(FXRefObjets[TreeRoot]).FObjet);
+ TPdfInteger(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('Count')]).FValue).Value:= T_Section(Sections[CptSect]).TotPages;
+ end;
NumFont:= 0;
for Cpt:= 0 to Pred(Fontes.Count) do
begin
Trouve:= False;
FontName:= ExtractBaseFontName(T_Fonte(Fontes[Cpt]).GetFonte.FontDesc);
- //for CptFont:= 1 to Pred(FXRefObjets.Count) do
- // begin
- // Dictionaire:= TPdfDictionary(TPdfXRef(FXRefObjets[CptFont]).FObjet);
- // if Dictionaire.FElement.Count> 0
- // then
- // if TPdfName(TPdfDicElement(Dictionaire.FElement[0]).FValue).FValue= 'Font'
- // then
- // if TPdfName(TPdfDicElement(Dictionaire.FElement[Dictionaire.ElementParCle('BaseFont')]).FValue).FValue= FontName
- // then
- // begin
- // Trouve:= True;
- // Break;
- // end;
- // end;
- //if not Trouve
- //then
- // begin
- CreateFont(FontName,NumFont);
- Inc(NumFont);
- //end;
+ CreateFont(FontName,NumFont);
+ Inc(NumFont);
end;
TPdfInteger(TPdfDicElement(Trailer.FElement[Trailer.ElementParCle('Size')]).FValue).FValue:= FXRefObjets.Count;
if PdfPage.Count> 0
diff --git a/extras/contributed/report_tool/reportengine/u_visu.pas b/extras/contributed/report_tool/reportengine/u_visu.pas
index 5475342d..2d25f8e2 100644
--- a/extras/contributed/report_tool/reportengine/u_visu.pas
+++ b/extras/contributed/report_tool/reportengine/u_visu.pas
@@ -1,5 +1,5 @@
{
- << Impressions >> U_Pdf.pas
+ << Impressions >> U_Visu.pas
Copyright (C) 2010 - JM.Levecque - <jmarc.levecque@jmlesite.fr>