⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rm_reg.pas

📁 这是一个功能强大
💻 PAS
📖 第 1 页 / 共 2 页
字号:

{*****************************************}
{                                         }
{         Report Machine v2.0             }
{            Registration unit            }
{                                         }
{*****************************************}


unit RM_reg;

interface

{$I RM.inc}

procedure Register;

implementation

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  DB, Dialogs,
{$IFDEF COMPILER6_UP}
  DesignIntf, DesignEditors,
{$ELSE}
  DsgnIntf,
{$ENDIF}
  RM_Class, RM_Printer, RM_DataSet, RM_Designer, RM_PreView, RM_Utils, RM_Const,
  RM_Const1, RM_PageSetup, RM_Common,
  RM_AngLbl, RM_ChineseMoneyMemo, RM_RichEdit, RM_CheckBox, RM_Diagonal, RM_Ole,
  RM_DialogCtls, RM_BarCode, RM_AsBarView, RM_Cross,
  RMD_ReportExplorer, RM_DsgGridReport, RM_GridReport,
  RM_e_txt, RM_e_bmp, RM_e_emf, RM_e_wmf, RM_e_Tiff, RM_e_xls, RM_e_htm, RM_e_csv,
  RM_EditorFieldAlias
{$IFDEF llPDFlib}, RM_E_llPDF{$ENDIF}
{$IFDEF RXGIF}, RM_e_gif{$ENDIF}
{$IFDEF JPEG}, RM_e_jpeg{$ENDIF}
  , RM_FormReport, RM_PDBGrid
{$IFDEF EHLib}, RM_PEHGrid{$ENDIF}
{$IFDEF TeeChart}, RM_Chart, RM_ChartUI, RM_PChart, RM_DBChart, RM_DBChartUI{$ENDIF}
{$IFDEF JVCLCTLS}, RM_PRxCtls{$ENDIF}
{$IFDEF InfoPower}, RM_wwRichEdit, RM_PwwGrid{$ENDIF}
{$IFDEF DM_BDE}, RMD_BDE{$ENDIF}
{$IFDEF DM_ADO}, RMD_ADO{$ENDIF}
{$IFDEF DM_IBX}, RMD_IBX{$ENDIF}
{$IFDEF DM_DBX}, RMD_DBX{$ENDIF}
{$IFDEF DM_MIDAS}, RMD_MIDAS{$ENDIF}
  ;

{-----------------------------------------------------------------------}
type
  TRMReportEditor = class(TComponentEditor)
    procedure ExecuteVerb(Index: Integer); override;
    function GetVerb(Index: Integer): string; override;
    function GetVerbCount: Integer; override;
  end;

  TRMDictionaryFileNameProperty = class(TStringProperty)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
  end;

  TRMDesigner_DefaultPageClass_Editor = class(TStringProperty)
  public
    function GetAttributes: TPropertyAttributes; override;
    procedure GetValues(aProc: TGetStrProc); override;
  end;

  TRMIniFileNameProperty = class(TStringProperty)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
  end;

{ TRMFieldProperty }

  TRMFieldProperty = class(TStringProperty)
  public
    function GetAttributes: TPropertyAttributes; override;
    procedure GetValueList(List: TStrings);
    procedure GetValues(Proc: TGetStrProc); override;
  end;

  { TRMRichEditStrings }
  TRMRichEditStrings = class(TClassProperty)
  public
    function GetAttributes: TPropertyAttributes; override;
    procedure Edit; override;
  end;

  TRMPageLayoutProperty = class(TClassProperty)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
  end;

  TRMFormReportEditor = class(TComponentEditor)
    procedure ExecuteVerb(Index: Integer); override;
    function GetVerb(Index: Integer): string; override;
    function GetVerbCount: Integer; override;
    procedure DoShow;
  end;

  TRMGridReportEditor = class(TComponentEditor)
    procedure ExecuteVerb(Index: Integer); override;
    function GetVerb(Index: Integer): string; override;
    function GetVerbCount: Integer; override;
    procedure DoShow;
  end;

  { TRMDataSet_Editor }
  TRMDataSet_Editor = class(TComponentEditor)
    procedure ExecuteVerb(Index: Integer); override;
    function GetVerb(Index: Integer): string; override;
    function GetVerbCount: Integer; override;
  end;

  { TRMDataSet_FieldAlias_Editor }
  TRMDataSet_FieldAlias_Editor = class(TClassProperty)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
  end;

{-----------------------------------------------------------------------}
{-----------------------------------------------------------------------}
{ TRMReportEditor }

function TRMReportEditor.GetVerbCount: Integer;
begin
  Result := 1;
end;

function TRMReportEditor.GetVerb(Index: Integer): string;
begin
  case Index of
    0: Result := RMLoadStr(SDesignReport);
  end;
end;

procedure TRMReportEditor.ExecuteVerb(Index: Integer);

  procedure _DoDesign;
  begin
    TRMReport(Component).DesignReport;
    if TRMReport(Component).StoreInDFM then
    begin
      if TRMReport(Component).ComponentModified then
        Designer.Modified;
    end;
  end;

begin
  case Index of
    0: _DoDesign;
  end;
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TRMDictionaryFileNameProperty }

procedure TRMDictionaryFileNameProperty.Edit;
var
  liOpenDlg: TOpenDialog;
begin
  liOpenDlg := TOpenDialog.Create(nil);
  liOpenDlg.FileName := GetValue;
  liOpenDlg.Filter := 'ReportMachine Dictionary Files (*.rmd)|*.rmd';
  liOpenDlg.Options := liOpenDlg.Options + [ofPathMustExist, ofFileMustExist];
  try
    if liOpenDlg.Execute then SetValue(liOpenDlg.FileName);
  finally
    liOpenDlg.Free;
  end;
end;

function TRMDictionaryFileNameProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paRevertable];
end;


{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TRMDesigner_DefaultPageClass_Editor }

function TRMDesigner_DefaultPageClass_Editor.GetAttributes: TPropertyAttributes;
begin
  Result := [paValueList];
end;

procedure TRMDesigner_DefaultPageClass_Editor.GetValues(aProc: TGetStrProc);
var
  i: Integer;
begin
  aProc('TRMReportPage');
  for i := 0 to RMAddInReportPageCount - 1 do
    aProc(RMAddInReportPage(i).ClassRef.ClassName);
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TRMIniFileNameProperty }

procedure TRMIniFileNameProperty.Edit;
var
  liOpenDlg: TOpenDialog;
begin
  liOpenDlg := TOpenDialog.Create(nil);
  liOpenDlg.FileName := GetValue;
  liOpenDlg.Filter := 'Ini File (*.ini)|*.ini';
  liOpenDlg.Options := liOpenDlg.Options + [ofPathMustExist, ofFileMustExist];
  try
    if liOpenDlg.Execute then SetValue(liOpenDlg.FileName);
  finally
    liOpenDlg.Free;
  end;
end;

function TRMIniFileNameProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paRevertable];
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{TRMFieldProperty}

function TRMFieldProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paValueList, paSortList, paMultiSelect];
end;

procedure TRMFieldProperty.GetValueList(List: TStrings);
var
  lReport: TComponent;
begin
  if (GetComponent(0) = nil) then Exit;

  lReport := nil;
  if (GetComponent(0) is TRMGroupItem) then
    lReport := (GetComponent(0) as TRMGroupItem).Report;

  if lReport <> nil then
  begin
    if lReport is TRMCustomFormReport then
    begin
      if TRMCustomFormReport(lReport).DataSet <> nil then
        TRMCustomFormReport(lReport).DataSet.GetFieldNames(List);
    end;
  end;
end;

procedure TRMFieldProperty.GetValues(Proc: TGetStrProc);
var
  i: Integer;
  Values: TStringList;
begin
  Values := TStringList.Create;
  try
    GetValueList(Values);
    for i := 0 to Values.Count - 1 do Proc(Values[i]);
  finally
    Values.Free;
  end;

⌨️ 快捷键说明

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