diff options
author | Jean-Marc Levecque <jmarc.levecque@dbmail.com> | 2010-12-10 09:48:01 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-12-10 09:48:01 +0200 |
commit | 5e8d895d00ee131574b434c632b04d557d056cad (patch) | |
tree | 2aed0f95a4ad8d4212a5834830a72c74b8b1dc56 /extras | |
parent | e01c52a650bfdcce0bb1c8bbceefeb4e8dd46764 (diff) | |
download | fpGUI-5e8d895d00ee131574b434c632b04d557d056cad.tar.xz |
solves a bug relating to height calculation
for groups, and text wrapping on PDF.
Diffstat (limited to 'extras')
-rw-r--r-- | extras/contributed/report_tool/reportengine/u_commande.pas | 12 | ||||
-rw-r--r-- | extras/contributed/report_tool/reportengine/u_imprime.pas | 82 |
2 files changed, 75 insertions, 19 deletions
diff --git a/extras/contributed/report_tool/reportengine/u_commande.pas b/extras/contributed/report_tool/reportengine/u_commande.pas index 1b58bd3c..0e119879 100644 --- a/extras/contributed/report_tool/reportengine/u_commande.pas +++ b/extras/contributed/report_tool/reportengine/u_commande.pas @@ -72,11 +72,13 @@ type procedure LoadEspaceEnTete(APosY,AColonne,AHeight,AFond: Integer); procedure LoadEspacePage(APosY,AColonne,AHeight,AFond: Integer); procedure LoadEspacePied(APosY,AColonne,AHeight,AFond: Integer); + procedure LoadEspaceGroupe(AHeight: Integer); procedure LoadCadre(AStyle: Integer; AZone: TZone); procedure LoadTrait(APosXDeb,APosYDeb,AColonne,APosXFin,APosYFin,AStyle: Integer); procedure LoadTraitHorizEnTete(APosXDeb,APosYDeb,AColonne,APosXFin,APosYFin,AStyle: Integer); procedure LoadTraitHorizPage(APosXDeb,APosYDeb,AColonne,APosXFin,APosYFin,AStyle: Integer); procedure LoadTraitHorizPied(APosXDeb,APosYDeb,AColonne,APosXFin,APosYFin,AStyle: Integer); + procedure LoadTraitHorizGroupe(AHeight: Integer); function GetCmdPage(NumPage: Integer): TList; property CmdEnTete: TList read FEntete; property CmdPied: TList read FPied; @@ -478,6 +480,11 @@ ACommande:= T_Espace.Create(APosY,AColonne,AHeight,AFond); FPied.Add(ACommande); end; +procedure T_Section.LoadEspaceGroupe(AHeight: Integer); +begin +AGroupe.FGroupeHeight:= AGroupe.FGroupeHeight+AHeight; +end; + procedure T_Section.LoadCadre(AStyle: Integer; AZone: TZone); begin ACommande:= T_Cadre.Create(AStyle,AZone); @@ -508,6 +515,11 @@ ACommande:= T_Trait.Create(APosXDeb,APosYDeb,AColonne,AStyle,APosXFin,APosYFin); FPied.Add(ACommande); end; +procedure T_Section.LoadTraitHorizGroupe(AHeight: Integer); +begin +AGroupe.FGroupeHeight:= AGroupe.FGroupeHeight+AHeight; +end; + function T_Section.GetCmdPage(NumPage: Integer): TList; begin Result:= T_Page(Pages[Pred(NumPage)]).Commandes; diff --git a/extras/contributed/report_tool/reportengine/u_imprime.pas b/extras/contributed/report_tool/reportengine/u_imprime.pas index 0350c0da..b5de5730 100644 --- a/extras/contributed/report_tool/reportengine/u_imprime.pas +++ b/extras/contributed/report_tool/reportengine/u_imprime.pas @@ -886,10 +886,11 @@ end; procedure T_Imprime.EcritLigne(PosX,PosY,Colonne,Texte,FonteNum,FondNum,BordNum,InterL: Integer; TxtFlags: TFTextFlags; Zone: TZone); var - PosH,PosV,HTxt,HautTxt,IntlInt,IntLSup,IntLInf,Half,CoulTrait,EpaisTrait: Integer; + PosH,PosV,HTxt,HautTxt,IntlInt,IntLSup,IntLInf,Half,CoulTrait,EpaisTrait,Cpt: Integer; FinDeLigne,UseCurFont: Boolean; Fnt: TfpgFont; StylTrait: TfpgLineStyle; + Wraplst: TStringList; begin with T_Section(Sections[Pred(NumeroSection)]) do begin @@ -1002,7 +1003,7 @@ with T_Section(Sections[Pred(NumeroSection)]) do else begin LoadCmdGroupeToPage; - AGroupe.Commandes.Clear; +// AGroupe.Commandes.Clear; Page; FPosRef.Y:= FMargeCourante.T+FEnTeteHeight; if ALigne.Commandes.Count> 0 @@ -1235,25 +1236,60 @@ with T_Section(Sections[Pred(NumeroSection)]) do PdfPage.Add(PdfLine); end; end; - PdfTexte:= TPdfTexte.Create; - with PdfTexte do + if Fnt.TextWidth(Textes[Texte])< GetTextWidth + then 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:= ColPos+ColWidth-ColMargin-Fnt.TextWidth(Textes[Texte]); - if (txtHCenter in TxtFlags) - then - TextPosX:= GetTextPos+(ColWidth-Fnt.TextWidth(Textes[Texte])) div 2; - TextPosY:= Paper.H-PosY-Fnt.Ascent; - TextLarg:= ColWidth; - Ecriture:= Textes[Texte]; + 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 + TextPosX:= ColPos+ColWidth-ColMargin-Fnt.TextWidth(Textes[Texte]); + if (txtHCenter in TxtFlags) + then + 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 + Wraplst:= TStringList.Create; + Wraplst.Text:= Textes[Texte]; + for Cpt:= 0 to Pred(Wraplst.Count) do + Wraplst[Cpt]:= AddLineBreaks(Wraplst[Cpt],GetTextWidth,Fnt); + Wraplst.Text:= Wraplst.Text; + for Cpt:= 0 to Pred(Wraplst.Count) do + begin + 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 + TextPosX:= ColPos+ColWidth-ColMargin-Fnt.TextWidth(Wraplst[Cpt]); + if (txtHCenter in TxtFlags) + then + TextPosX:= GetTextPos+(ColWidth-Fnt.TextWidth(Wraplst[Cpt])) div 2; + TextPosY:= Paper.H-PosY-Fnt.Ascent-(Fnt.Height+IntlInt)*Cpt; + TextLarg:= ColWidth; + Ecriture:= Wraplst[Cpt]; + end; + PdfPage.Add(PdfTexte); + end; + WrapLst.Free; end; - PdfPage.Add(PdfTexte); end else begin @@ -1706,6 +1742,9 @@ with T_Section(Sections[Pred(NumeroSection)]) do LoadEspacePied(PosV,Colonne,EspHeight,FondNum); end; end; + if FGroupe + then + LoadEspaceGroupe(EspHeight); FinLigne(Zone); end; ppVisualise: @@ -1910,6 +1949,7 @@ begin with T_Section(Sections[Pred(NumeroSection)]) do case FPreparation of ppPrepare: + begin case Zone of zEnTete: begin @@ -1940,6 +1980,10 @@ with T_Section(Sections[Pred(NumeroSection)]) do LoadTraitHorizPied(ColPos,PosV,Colonne,ColPos+ColWidth,PosV,StTrait); end; end; + if FGroupe + then + LoadTraitHorizGroupe(T_TraitStyle(TraitStyles[StTrait]).GetEpais); + end; ppVisualise: with FCanevas do begin |