rm_class.pas

来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 1,744 行 · 第 1/5 页

PAS
1,744
字号
    property spBottom_Designer: Integer index 5 read GetspLeft_Designer;

    property spLeft: Integer index 0 read GetspLeft write SetspLeft;
    property spTop: Integer index 1 read GetspLeft write SetspLeft;
    property spWidth: Integer index 2 read GetspLeft write SetspLeft;
    property spHeight: Integer index 3 read GetspLeft write SetspLeft;
    property spRight: Integer index 4 read GetspLeft;
    property spBottom: Integer index 5 read GetspLeft;

    property Memo1: TStrings read FMemo1 write SetMemo1;
    property ObjectType: Byte read Typ;
    property LeftFrame: TRMFrameLine read FLeftFrame write FLeftFrame;
    property TopFrame: TRMFrameLine read FTopFrame write FTopFrame;
    property RightFrame: TRMFrameLine read FRightFrame write FRightFrame;
    property BottomFrame: TRMFrameLine read FBottomFrame write FBottomFrame;
    property LeftRightFrame: Word read FLeftRightFrame write FLeftRightFrame;
    property FillColor: TColor read FFillColor write SetFillColor;
    property Memo: TStrings read FMemo write SetMemo;
  published
    property Restrictions: TRMRestrictions read FRestrictions write FRestrictions;
    property Name;
  end;

  { TRMDialogComponent }
  TRMDialogComponent = class(TRMView)
  private
    FTabOrder: Integer;
    FParentControl: string;

    procedure SetParentControl(Value: string);
  protected
    FBmpRes: string;
    procedure BeginDraw(aCanvas: TCanvas);
    procedure PaintDesignControl;
    property ParentControl: string read FParentControl write SetParentControl;
    property TabOrder: Integer read FTabOrder write FTabOrder;
  public
    class procedure DefaultSize(var aKx, aKy: Integer); override;
    constructor Create; override;
    destructor Destroy; override;
    procedure Draw(aCanvas: TCanvas); override;
    procedure LoadFromStream(aStream: TStream); override;
    procedure SaveToStream(aStream: TStream); override;
  published
  end;

  { TRMDialogControl }
  TRMDialogControl = class(TRMDialogComponent)
  private
  protected
    FControl: TControl;

    function GetFont: TFont; virtual;
    procedure SetFont(Value: TFont); virtual;

    procedure FreeChildViews;
    procedure PaintDesignControl;

    property Font: TFont read GetFont write SetFont;
  public
    constructor Create; override;
    destructor Destroy; override;
    procedure Draw(aCanvas: TCanvas); override;

    property Control: TControl read FControl;
  published
  end;

  TRMFormat = packed record
    FormatIndex1, FormatIndex2: Byte;
    FormatPercent: Byte;
    FormatdelimiterChar: Char;
  end;

  { TRMReportView }
  TRMReportView = class(TRMView)
  private
    FNeedPrint: Boolean;
    FmmOldTop, FmmOldHeight: Integer;
    FBandAlign: TRMBandAlign;
    FShiftWith: string;
    FStretchWith: string;
    FOnBeforePrint: TNotifyEvent;
    FOnBeforeCalc: TNotifyEvent;
    FOnAfterCalc: TNotifyEvent;
    FOnPreviewClick: TRMPreviewClickEvent;
    FStretchWithView, FShiftWithView: TRMReportView;

    procedure OnStretchedClick(Sender: TObject);
    procedure OnStretchedMaxClick(Sender: TObject);
    procedure OnVisibleClick(Sender: TObject);
    procedure OnPrintableClick(Sender: TObject);

    function GetGapX(Index: Integer): Double;
    procedure SetGapX(Index: Integer; Value: Double);
    function GetspGapX(Index: Integer): Integer;
    procedure SetspGapX(Index: Integer; Value: Integer);
    function GetPrintFrame: Boolean;
    procedure SetPrintFrame(Value: Boolean);
    function GetPrintable: Boolean;
    procedure SetPrintable(Value: Boolean);
    function GetTextOnly: Boolean;
    procedure SetTextOnly(Value: Boolean);
    function GetReprintOnOverFlow: Boolean;
    procedure SetReprintOnOverFlow(Value: Boolean);
    procedure SetShiftWith(Value: string);
    procedure SetStretchWith(Value: string);
    function GetDataField: string;
    procedure SetDataField(Value: string);
    procedure SetDisplayFormat(Value: string);
    function GetParentWidth: Boolean;
    procedure SetParentWidth(Value: Boolean);
    function GetParentHeight: Boolean;
    procedure SetParentHeight(Value: Boolean);
  protected
    FDisplayFormat: string;
    FormatFlag: TRMFormat;

    procedure BeginDraw(aCanvas: TCanvas);
    procedure Prepare; override;
    procedure ShowFrame; virtual;
    procedure ExpandVariables(var aStr: string);
    procedure PlaceOnEndPage(aStream: TStream); virtual;
    procedure GetBlob; virtual;
    procedure SetFactorFont(aCanvas: TCanvas);
    function GetFactorSize(aValue: Integer): Integer;
    procedure ExportData; virtual;

    property PrintFrame: Boolean read GetPrintFrame write SetPrintFrame;
    property Printable: Boolean read GetPrintable write SetPrintable;
    property BandAlign: TRMBandAlign read FBandAlign write FBandAlign;
    property TextOnly: Boolean read GetTextOnly write SetTextOnly;
    property GapLeft: Double index 0 read GetGapX write SetGapX;
    property GapTop: Double index 1 read GetGapX write SetGapX;
    property DisplayFormat: string read FDisplayFormat write SetDisplayFormat;
    property ReprintOnOverFlow: Boolean read GetReprintOnOverFlow write SetReprintOnOverFlow;
    property ShiftWith: string read FShiftWith write SetShiftWith;
    property StretchWith: string read FStretchWith write SetStretchWith;
    property DataField: string read GetDataField write SetDataField;
    property ParentHeight: Boolean read GetParentHeight write SetParentHeight;
    property ParentWidth: Boolean read GetParentWidth write SetParentWidth;
    property OnBeforeCalc: TNotifyEvent read FOnBeforeCalc write FOnBeforeCalc;
    property OnAfterCalc: TNotifyEvent read FOnAfterCalc write FOnAfterCalc;
    property OnPreviewClick: TRMPreviewClickEvent read FOnPreviewClick write FOnPreviewClick;
  public
    constructor Create; override;
    destructor Destroy; override;
    procedure DefinePopupMenu(aPopup: TRMCustomMenuItem); override;
    function GetClipRgn(rt: TRMRgnType): HRGN; override;

    procedure LoadFromStream(aStream: TStream); override;
    procedure SaveToStream(aStream: TStream); override;

    property spGapLeft: Integer index 0 read GetspGapX write SetspGapX;
    property spGapTop: Integer index 1 read GetspGapX write SetspGapX;
    property mmLeft;
    property mmTop;
    property mmWidth;
    property mmHeight;
  published
    property Visible;
    property Left;
    property Top;
    property Width;
    property Height;
    property OnBeforePrint: TNotifyEvent read FOnBeforePrint write FOnBeforePrint;
  end;

  { TRMStretcheableView }
  TRMStretcheableView = class(TRMReportView)
  private
    FUseBandHeight: Boolean;
  protected
    DrawMode: TRMDrawMode;
    CalculatedHeight: Integer;
    ActualHeight: Integer;

    function CalcHeight: Integer; virtual; abstract;
    function RemainHeight: Integer; virtual; abstract;
    procedure GetMemoVariables; virtual; abstract;
  public
    constructor Create; override;
    destructor Destroy; override;
  published
    property Stretched;
    property StretchedMax;
  end;

  TRMRepeatedOptions = class(TPersistent)
  private
    FMasterMemoView: string;
    FSuppressRepeated: Boolean;
    FMergeRepeated: Boolean;
    FMergeStretchedHeight: Boolean;
  protected
  public
  published
    property MasterMemoView: string read FMasterMemoView write FMasterMemoView;
    property SuppressRepeated: Boolean read FSuppressRepeated write FSuppressRepeated;
    property MergeRepeated: Boolean read FMergeRepeated write FMergeRepeated;
    property MergeStretchedHeight: Boolean read FMergeStretchedHeight write FMergeStretchedHeight;
  end;

  { TRMCustomMemoView }
  TRMCustomMemoView = class(TRMStretcheableView)
  private
    FDisplayBeginLine, FDisplayEndLine: Integer;
    FMasterView: TRMView;
    FSMemo: TStrings;
    FFont: TFont;
    FHighlight: TRMHighlight;
    FLineSpacing, FCharacterSpacing: Integer;
    FRotationType: TRMRotationType;
    FScaleFontType: TRMScaleFontType;
    FRepeatedOptions: TRMRepeatedOptions;
    FHAlign: TRMHAlign;
    FVAlign: TRMVAlign;
    FFontScaleWidth: Integer;
    FLastValue, FLastValue1: string;
    FLastValuePage: Integer;
    FLastValueChanged: Boolean;
    //    FTextWidths: array of integer;

    FVHeight: Integer; // used for height calculation of TRMCustomMemoView
    FLastStreamPosition: Integer;
    FmmLastTop: Integer;

    procedure OnWordWrapClick(Sender: TObject);
    procedure OnAutoWidthClick(Sender: TObject);
    procedure OnHideZerosClick(Sender: TObject);
    //    procedure OnUnderlinesClick(Sender: TObject);
    procedure OnTextOnlyClick(Sender: TObject);

    procedure CalcGeneratedData(DC: THandle);
    procedure SetFont(Value: TFont);
    function GetWordwrap: Boolean;
    procedure SetWordwrap(Value: Boolean);
    function GetWordBreak: Boolean;
    procedure SetWordBreak(Value: Boolean);
    function GetAutoWidth: Boolean;
    procedure SetAutoWidth(Value: Boolean);
    function GetMangeTag: Boolean;
    procedure SetMangeTag(Value: Boolean);
    function GetPrintAtAppendBlank: Boolean;
    procedure SetPrintAtAppendBlank(Value: Boolean);
    procedure SetRepeatedOptions(Value: TRMRepeatedOptions);
    function GetExportAsNumber: Boolean;
    procedure SetExportAsNumber(Value: Boolean);
    function GetDBFieldOnly: Boolean;
    procedure SetDBFieldOnly(Value: Boolean);
    function GetUnderlines: Boolean;
    procedure SetUnderlines(value: Boolean);
    function GetIsCurrency: Boolean;
    procedure SetIsCurrency(value: Boolean);
  protected
    FMergeEmpty: Boolean;
    CurStrNo: Integer;
    MergeEmpty: Boolean;
    LineHeight: Integer;
    FFlagPlaceOnEndPage: Boolean;
    Exporting: Boolean;

    function GetPropValue(aObject: TObject; aPropName: string;
      var aValue: Variant; Args: array of Variant): Boolean; override;
    function SetPropValue(aObject: TObject; aPropName: string;
      aValue: Variant): Boolean; override;

    function CanMergeCell: Boolean;
    procedure AssignFont(aCanvas: TCanvas);
    procedure GetBlob; override;
    procedure Prepare; override;
    procedure ExpandMemoVariables; virtual;
    procedure WrapMemo;
    procedure ShowMemo;
    function CalcHeight: Integer; override;
    function RemainHeight: Integer; override;
    procedure GetMemoVariables; override;
    procedure PlaceOnEndPage(aStream: TStream); override;
    procedure ExportData; override;
    function CalcWidth(aMemo: TStringList): Integer;
    procedure Set_AutoWidth(const aCanvas: TCanvas);
    procedure ShowUnderLines;

    property WantHook;
    property RotationType: TRMRotationType read FRotationType write FRotationType;
    property ScaleFontType: TRMScaleFontType read FScaleFontType write FScaleFontType;
    property FontScaleWidth: Integer read FFontScaleWidth write FFontScaleWidth;
    property WordWrap: Boolean read GetWordwrap write SetWordwrap;
    property WordBreak: Boolean read GetWordBreak write SetWordBreak;
    property AutoWidth: Boolean read GetAutoWidth write SetAutoWidth;
    property RepeatedOptions: TRMRepeatedOptions read FRepeatedOptions write SetRepeatedOptions;
    property PrintAtAppendBlank: Boolean read GetPrintAtAppendBlank write SetPrintAtAppendBlank;
    property ExportAsNumber: Boolean read GetExportAsNumber write SetExportAsNumber;
    property LastValue: string read FLastValue write FLastValue;
    property IsCurrency: Boolean read GetIsCurrency write SetIsCurrency;
  public
    constructor Create; override;
    destructor Destroy; override;

    procedure DefinePopupMenu(aPopup: TRMCustomMenuItem); override;
    procedure ShowEditor; override;
    procedure LoadFromStream(aStream: TStream); override;
    procedure SaveToStream(aStream: TStream); override;

    procedure Draw(aCanvas: TCanvas); override;
  published
    property Highlight: TRMHighlight read FHighlight write FHighlight;
    property PrintFrame;
    property Printable;
    property BandAlign;
    property Font: TFont read FFont write SetFont;
    property GapLeft;
    property GapTop;
    property LineSpacing: Integer read FLineSpacing write FLineSpacing;
    property CharacterSpacing: Integer read FCharacterSpacing write FCharacterSpacing;
    property HideZeros;
    property LeftFrame;
    property TopFrame;
    property RightFrame;
    property BottomFrame;
    property Memo;
    property ShiftWith;
    property StretchWith;
    property HAlign: TRMHAlign read FHAlign write FHAlign;
    property VAlign: TRMVAlign read FVAlign write FVAlign;
    property MangeTag: Boolean read GetMangeTag write SetMangeTag;
    property DisplayFormat;
    property TextOnly;
    property FillColor;
    property ParentHeight;
    property ParentWidth;
    property DBFieldOnly: Boolean read GetDBFieldOnly write SetDBFieldOnly;
    property Underlines: Boolean read GetUnderlines write SetUnderlines;
    property DisplayBeginLine: Integer read FDisplayBeginLine write FDisplayBeginLine;
    property DisplayEndLine: Integer read FDisplayEndLine write FDisplayEndLine;
    property BrushStyle;
    property Cursor;
    property ExpressionDelimiters;
    property Url;

    property OnBeforePrint;
    property OnBeforeCalc;
    property OnAfterCalc;
    property OnPreviewClick;
  end;

  { TRMMemoView }
  TRMMemoView = class(TRMCustomMemoView)
  published

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?