mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 09:59:20 +02:00
LazReport, show non-data bands in RowsLayout report
git-svn-id: trunk@27668 -
This commit is contained in:
parent
6a2f27cac2
commit
3e8c529d67
@ -586,6 +586,7 @@ type
|
|||||||
|
|
||||||
constructor Create(ATyp: TfrBandType; AParent: TfrPage); overload;
|
constructor Create(ATyp: TfrBandType; AParent: TfrPage); overload;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
function IsDataBand: boolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TfrValue = class
|
TfrValue = class
|
||||||
@ -627,9 +628,12 @@ type
|
|||||||
fColCount : Integer;
|
fColCount : Integer;
|
||||||
fColGap : Integer;
|
fColGap : Integer;
|
||||||
fColWidth : Integer;
|
fColWidth : Integer;
|
||||||
|
fLastBandType : TfrBandType;
|
||||||
|
fLastRowHeight : Integer;
|
||||||
fMargins : TfrRect;
|
fMargins : TfrRect;
|
||||||
fOrientation : TPrinterOrientation;
|
fOrientation : TPrinterOrientation;
|
||||||
fPrintToPrevPage : Boolean;
|
fPrintToPrevPage : Boolean;
|
||||||
|
fRowStarted : boolean;
|
||||||
fUseMargins : Boolean;
|
fUseMargins : Boolean;
|
||||||
Skip : Boolean;
|
Skip : Boolean;
|
||||||
InitFlag : Boolean;
|
InitFlag : Boolean;
|
||||||
@ -695,6 +699,9 @@ type
|
|||||||
procedure NewColumn(Band: TfrBand);
|
procedure NewColumn(Band: TfrBand);
|
||||||
procedure NextColumn(Band: TFrBand);
|
procedure NextColumn(Band: TFrBand);
|
||||||
function RowsLayout: boolean;
|
function RowsLayout: boolean;
|
||||||
|
procedure StartColumn;
|
||||||
|
procedure StartRowsLayoutNonDataBand(Band: TfrBand);
|
||||||
|
function AdvanceRow(Band: TfrBand): boolean;
|
||||||
|
|
||||||
property ColCount : Integer read fColCount write fColCount;
|
property ColCount : Integer read fColCount write fColCount;
|
||||||
property ColWidth : Integer read fColWidth write fColWidth;
|
property ColWidth : Integer read fColWidth write fColWidth;
|
||||||
@ -704,6 +711,9 @@ type
|
|||||||
property PrintToPrevPage : Boolean read fPrintToPrevPage write fPrintToPrevPage;
|
property PrintToPrevPage : Boolean read fPrintToPrevPage write fPrintToPrevPage;
|
||||||
property Orientation : TPrinterOrientation read fOrientation write fOrientation;
|
property Orientation : TPrinterOrientation read fOrientation write fOrientation;
|
||||||
property LayoutOrder: TLayoutOrder read fLayoutOrder write fLayoutOrder;
|
property LayoutOrder: TLayoutOrder read fLayoutOrder write fLayoutOrder;
|
||||||
|
property LastRowHeight: Integer read fLastRowHeight write fLastRowHeight;
|
||||||
|
property RowStarted: boolean read fRowStarted write fRowStarted;
|
||||||
|
property LastBandType: TfrBandType read fLastBandType write fLastbandType;
|
||||||
|
|
||||||
published
|
published
|
||||||
property Script;
|
property Script;
|
||||||
@ -4533,6 +4543,11 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TfrBand.IsDataBand: boolean;
|
||||||
|
begin
|
||||||
|
result := (typ in [btMasterData, btDetailData, btSubDetailData]);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrBand.InitDataSet(const Desc: String);
|
procedure TfrBand.InitDataSet(const Desc: String);
|
||||||
begin
|
begin
|
||||||
if Typ = btGroupHeader then
|
if Typ = btGroupHeader then
|
||||||
@ -4660,7 +4675,8 @@ var
|
|||||||
ox,oy: Integer;
|
ox,oy: Integer;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DebugLR}
|
{$IFDEF DebugLR}
|
||||||
DebugLn('%sTfrBand.DrawObject INI t=%s:%s',[sspc,dbgsname(t),t.name]);
|
DebugLn('%sTfrBand.DrawObject INI t=%s:%s Xadj=%d Margin=%d',[sspc,dbgsname(t),t.name,
|
||||||
|
Parent.XAdjust, Parent.LeftMargin]);
|
||||||
IncSpc(1);
|
IncSpc(1);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
CurPage := Parent;
|
CurPage := Parent;
|
||||||
@ -4671,7 +4687,14 @@ begin
|
|||||||
begin
|
begin
|
||||||
ox := t.x; Inc(t.x, Parent.XAdjust - Parent.LeftMargin);
|
ox := t.x; Inc(t.x, Parent.XAdjust - Parent.LeftMargin);
|
||||||
oy := t.y; Inc(t.y, y);
|
oy := t.y; Inc(t.y, y);
|
||||||
|
{$IFDEF DebugLR}
|
||||||
|
DebugLn('%sPrinting view %s x=%d y=%d dx=%d dy=%d',[sspc,ViewInfo(t),t.x,t.y,t.dx,t.dy]);
|
||||||
|
IncSpc(1);
|
||||||
|
{$ENDIF}
|
||||||
t.Print(MasterReport.EMFPages[PageNo]^.Stream);
|
t.Print(MasterReport.EMFPages[PageNo]^.Stream);
|
||||||
|
{$IFDEF DebugLR}
|
||||||
|
IncSpc(-1);
|
||||||
|
{$ENDIF}
|
||||||
t.x := ox; t.y := oy;
|
t.x := ox; t.y := oy;
|
||||||
if (t is TfrMemoView) and
|
if (t is TfrMemoView) and
|
||||||
(TfrMemoView(t).DrawMode in [drAll, drAfterCalcHeight]) then
|
(TfrMemoView(t).DrawMode in [drAll, drAfterCalcHeight]) then
|
||||||
@ -5173,6 +5196,8 @@ begin
|
|||||||
IncSpc(1);
|
IncSpc(1);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
Parent.RowStarted := True;
|
||||||
|
|
||||||
if Stretched then
|
if Stretched then
|
||||||
begin
|
begin
|
||||||
sh := CalculatedHeight;
|
sh := CalculatedHeight;
|
||||||
@ -5196,22 +5221,27 @@ begin
|
|||||||
DrawCross;
|
DrawCross;
|
||||||
end;
|
end;
|
||||||
UnStretchObjects;
|
UnStretchObjects;
|
||||||
|
|
||||||
|
Parent.LastRowHeight := sh;
|
||||||
|
|
||||||
if not WasSub then
|
if not WasSub then
|
||||||
Inc(Parent.CurY, sh);
|
Inc(Parent.CurY, sh);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
|
||||||
if UseY then
|
if UseY then
|
||||||
begin
|
begin
|
||||||
if not PageBreak then
|
if not PageBreak then
|
||||||
CheckPageBreak(y, dy, False);
|
CheckPageBreak(y, dy, False);
|
||||||
y := Parent.CurY;
|
y := Parent.CurY;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if PageBreak then
|
if PageBreak then
|
||||||
begin
|
begin
|
||||||
maxdy := CalculatedHeight;
|
maxdy := CalculatedHeight;
|
||||||
// maxdy := CalcHeight;
|
|
||||||
DrawPageBreak;
|
DrawPageBreak;
|
||||||
|
Parent.LastRowHeight := maxdy;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -5219,7 +5249,10 @@ begin
|
|||||||
if HasCross then
|
if HasCross then
|
||||||
DrawCross;
|
DrawCross;
|
||||||
if UseY and not WasSub then begin
|
if UseY and not WasSub then begin
|
||||||
if (not Parent.RowsLayout) or (Parent.CurColumn=Parent.ColCount-1) then
|
|
||||||
|
Parent.LastRowHeight := dy;
|
||||||
|
|
||||||
|
if Parent.AdvanceRow(Self) then
|
||||||
Inc(Parent.CurY, dy);
|
Inc(Parent.CurY, dy);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -5276,7 +5309,7 @@ begin
|
|||||||
CurReport.FOnBeginBand(Self);
|
CurReport.FOnBeginBand(Self);
|
||||||
frInterpretator.DoScript(Script);
|
frInterpretator.DoScript(Script);
|
||||||
|
|
||||||
if Parent.RowsLayout then begin
|
if Parent.RowsLayout and IsDataBand then begin
|
||||||
|
|
||||||
if Visible then
|
if Visible then
|
||||||
begin
|
begin
|
||||||
@ -5301,6 +5334,11 @@ begin
|
|||||||
|
|
||||||
end else begin
|
end else begin
|
||||||
|
|
||||||
|
if Parent.RowsLayout and (typ<>btColumnHeader) then
|
||||||
|
|
||||||
|
Parent.StartRowsLayoutNonDataBand(Self)
|
||||||
|
|
||||||
|
else
|
||||||
// new page was requested in script
|
// new page was requested in script
|
||||||
if ForceNewPage then
|
if ForceNewPage then
|
||||||
begin
|
begin
|
||||||
@ -5361,13 +5399,20 @@ begin
|
|||||||
if (Typ <> btPageFooter) or (PageNo = MasterReport.EMFPages.Count - 1) then
|
if (Typ <> btPageFooter) or (PageNo = MasterReport.EMFPages.Count - 1) then
|
||||||
InitValues;
|
InitValues;
|
||||||
|
|
||||||
|
// if in rows layout, reset starting column after non-data band
|
||||||
|
if Parent.RowsLayout and (typ<>btColumnHeader) then
|
||||||
|
Parent.StartColumn;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if Assigned(CurReport.FOnEndBand) then
|
if Assigned(CurReport.FOnEndBand) then
|
||||||
CurReport.FOnEndBand(Self);
|
CurReport.FOnEndBand(Self);
|
||||||
|
|
||||||
|
Parent.LastBandType := typ;
|
||||||
|
|
||||||
{$IFDEF debugLr}
|
{$IFDEF debugLr}
|
||||||
IncSpc(-1);
|
IncSpc(-1);
|
||||||
DebugLn('%sTFrBand.Draw END %s y=%d PageNo=%d',[sspc, dbgsname(self),y, PageNo]);
|
DebugLn('%sTFrBand.Draw END %s y=%d PageNo=%d EOFReached=',[sspc, dbgsname(self),y, PageNo]);
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -5981,6 +6026,7 @@ begin
|
|||||||
if b <> nil then
|
if b <> nil then
|
||||||
begin
|
begin
|
||||||
{$IFDEF DebugLR}
|
{$IFDEF DebugLR}
|
||||||
|
DebugLn;
|
||||||
DebugLn('%sTfrPage.ShowBand INI Band=%s',[sspc,BandInfo(b)]);
|
DebugLn('%sTfrPage.ShowBand INI Band=%s',[sspc,BandInfo(b)]);
|
||||||
IncSpc(1);
|
IncSpc(1);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -6218,11 +6264,7 @@ begin
|
|||||||
Inc(ColPos);
|
Inc(ColPos);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
StartColumn;
|
||||||
CurColumn := 0;
|
|
||||||
ColPos:=1;
|
|
||||||
XAdjust := LeftMargin;
|
|
||||||
end;
|
|
||||||
{$IFDEF DebugLR}
|
{$IFDEF DebugLR}
|
||||||
IncSpc(-1);
|
IncSpc(-1);
|
||||||
DebugLn('%sTfrPage.NextColumn END CurColumn=%d ColCount=%d CurY=%d XAdjust=%d',
|
DebugLn('%sTfrPage.NextColumn END CurColumn=%d ColCount=%d CurY=%d XAdjust=%d',
|
||||||
@ -6235,6 +6277,38 @@ begin
|
|||||||
result := (ColCount>1) and (LayoutOrder=loRows)
|
result := (ColCount>1) and (LayoutOrder=loRows)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrPage.StartColumn;
|
||||||
|
begin
|
||||||
|
CurColumn := 0;
|
||||||
|
ColPos:=1;
|
||||||
|
XAdjust := LeftMargin;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrPage.StartRowsLayoutNonDataBand(Band: TfrBand);
|
||||||
|
begin
|
||||||
|
|
||||||
|
// reset starting column
|
||||||
|
if Band.ForceNewPage then begin
|
||||||
|
CurColumn := ColCount - 1;
|
||||||
|
NewColumn(Band);
|
||||||
|
end else
|
||||||
|
StartColumn;
|
||||||
|
|
||||||
|
// check for partial rows
|
||||||
|
if LastBandType in [btMasterData, btDetailData, btSubdetailData] then
|
||||||
|
begin
|
||||||
|
if not RowStarted then
|
||||||
|
Inc(CurY, LastRowHeight);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TfrPage.AdvanceRow(Band: TfrBand): boolean;
|
||||||
|
begin
|
||||||
|
result := not RowsLayout or (not Band.IsDataBand) or (CurColumn=ColCount-1);
|
||||||
|
RowStarted := result;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrPage.DoAggregate(a: Array of TfrBandType);
|
procedure TfrPage.DoAggregate(a: Array of TfrBandType);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user