File: reportdesignbaseforms.pp

package info (click to toggle)
lazarus 2.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 214,460 kB
  • sloc: pascal: 1,862,622; xml: 265,709; cpp: 56,595; sh: 3,008; java: 609; makefile: 535; perl: 297; sql: 222; ansic: 137
file content (191 lines) | stat: -rw-r--r-- 5,602 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
{
    This file is part of the FPReport report designer.
    Copyright (c) 2017 by the Free Pascal development team

    Factory class pattern for the various forms that make up the designer

    See the file COPYING.FPC, included in this distribution,
    for details about the copyright.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 **********************************************************************}

unit reportdesignbaseforms;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, fpreport, forms, db, fpreportdesignobjectlist,
  fpreportdata;

Type
  { TReportEditorForm }

  TBaseReportEditorForm = Class(TForm)
  private
    FReport: TFPCustomReport;
  Protected
    procedure SetReport(AValue: TFPCustomReport); virtual;
  Public
    Property Report : TFPCustomReport Read FReport Write SetReport;
  end;
  TBaseReportEditorFormClass = class of TBaseReportEditorForm;


  TBaseReportResizeForm = Class(TBaseReportEditorForm)
  Protected
    function GetH: TSizeAdjust; virtual; abstract;
    function GetHS: TFPReportUnits; virtual; abstract;
    function GetV: TSizeAdjust; virtual; abstract;
    function GetVS: TFPReportUnits; virtual; abstract;
    procedure SetH(AValue: TSizeAdjust); virtual; abstract;
    procedure SetHS(AValue: TFPReportUnits);virtual; abstract;
    procedure SetV(AValue: TSizeAdjust);virtual; abstract;
    procedure SetVS(AValue: TFPReportUnits);virtual; abstract;
  public
    Property Horizontal : TSizeAdjust Read GetH Write SetH;
    Property Vertical : TSizeAdjust Read GetV Write SetV;
    Property HorizontalSize : TFPReportUnits Read GetHS Write SetHS;
    Property VerticalSize : TFPReportUnits Read GetVS Write SetVS;
  end;
  TBaseReportResizeFormClass = Class of TBaseReportResizeForm;

  TBaseReportAlignForm = Class(TBaseReportEditorForm)
  Protected
    function GetH: THAlignAction; virtual; abstract;
    function GetV: TVAlignAction; virtual; abstract;
    procedure SetH(AValue: THAlignAction); virtual; abstract;
    procedure SetV(AValue: TVAlignAction); virtual; abstract;
  public
    Property Horizontal : THAlignAction Read GetH Write SetH;
    Property Vertical : TVAlignAction Read GetV Write SetV;
  end;
  TBaseReportAlignFormClass = class of TBaseReportAlignForm;

  { TReportDataForm }

  { TBaseReportDataForm }

  TBaseReportDataForm = Class(TBaseReportEditorForm)
  private
    FData: TFPReportDataDefinitions;
  Protected
    procedure SetData(AValue: TFPReportDataDefinitions); virtual;
  public
    Constructor Create(AOwner: TComponent); override;
    Destructor Destroy; override;
    Property Data : TFPReportDataDefinitions Read FData Write SetData;
  end;
  TBaseReportDataFormClass = Class of TBaseReportDataForm;

  { TBaseReportDataPreviewForm }

  TBaseReportDataPreviewForm = class (TBaseReportEditorForm)
  Private
    FDataset: TDataset;
  Protected
    procedure SetDataSet(AValue: TDataset); virtual;
  public
    Property PreviewDataset : TDataset Read FDataset Write SetDataSet;
  end;
  TBaseReportDataPreviewFormClass = class of TBaseReportDataPreviewForm;

  { TBaseReportVariablesForm }

  TBaseReportVariablesForm = class(TBaseReportEditorForm)
  private
    FVariables: TFPReportVariables;
  Protected
    procedure SetVariables(AValue: TFPReportVariables); virtual;
    function CreateVariables: TFPReportVariables; virtual;
  public
    Constructor Create(AOwner : TComponent); override;
    Destructor Destroy; override;
    Property Variables : TFPReportVariables Read FVariables Write SetVariables;
  end;
  TBaseReportVariablesFormClass = Class of TBaseReportVariablesForm;

  TBaseImportReportForm = Class(TForm)
  Public
    Procedure Log(Const Msg : String); virtual; abstract;
  end;
  TBaseImportReportFormClass = Class of TBaseImportReportForm;

Var
  ReportDataFormClass : TBaseReportDataFormClass;
  ReportResizeFormClass : TBaseReportResizeFormClass;
  ReportAlignFormClass : TBaseReportAlignFormClass;
  ReportDataPreviewClass : TBaseReportDataPreviewFormClass;
  ReportVariablesFormClass : TBaseReportVariablesFormClass;
  ReportPropertiesFormClass : TBaseReportEditorFormClass;
  ReportImportFormClass : TBaseImportReportFormClass;

implementation

{ TBaseReportVariablesForm }

procedure TBaseReportVariablesForm.SetVariables(AValue: TFPReportVariables);
begin
  if FVariables=AValue then Exit;
  FVariables.Assign(AValue);
end;

function TBaseReportVariablesForm.CreateVariables: TFPReportVariables;
begin
  Result:=TFPReportVariables.Create(Nil,TFPReportVariable);
end;

constructor TBaseReportVariablesForm.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FVariables:=CreateVariables;
end;

destructor TBaseReportVariablesForm.Destroy;
begin
  FreeAndNil(FVariables);
  inherited Destroy;
end;

{ TBaseReportDataPreviewForm }

procedure TBaseReportDataPreviewForm.SetDataSet(AValue: TDataset);
begin
  FDataset:=AValue;
end;

{ TReportDataForm }

procedure TBaseReportDataForm.SetData(AValue: TFPReportDataDefinitions);
begin
  if FData=AValue then Exit;
  FData.Assign(AValue);
end;

constructor TBaseReportDataForm.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FData:=TFPReportDataDefinitions.Create(TFPReportDataDefinitionItem);
end;

destructor TBaseReportDataForm.Destroy;
begin
  FreeAndNil(FData);
  inherited Destroy;
end;

{ TReportEditorForm }

procedure TBaseReportEditorForm.SetReport(AValue: TFPCustomReport);
begin
  if FReport=AValue then Exit;
  FReport:=AValue;
end;

end.