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

📄 richviewactions.pas

📁 richviewaction 1.58 需要richview 1.9.46
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    {$ENDIF}
    {$IFDEF USERVHTML}
    function GetRVHTML: TRvHtmlImporter;
    procedure SetRVHTML(const Value: TRvHtmlImporter);
    {$ENDIF}
    {$IFDEF USEINDY}
    function GetIdHTTP: TIdHTTP;
    procedure SetIdHTTP(const Value: TIdHTTP);
    {$ENDIF}
    {$IFDEF USERVADDICT3}
    function GetRVAddictSpell3: TRVAddictSpell3;
    function GetRVAddictThesaurus3: TRVThesaurus3;
    procedure SetRVAddictSpell3(const Value: TRVAddictSpell3);
    procedure SetRVAddictThesaurus3(const Value: TRVThesaurus3);
    {$ENDIF}
    function GetDefaultExt: String;
    procedure SetDefaultExt(const Value: String);
    function GetRVFormatName: String;
    procedure SetRVFormatName(const Value: String);
    function GetDefaultFileName: String;
    procedure SetDefaultFileName(const Value: String);
    function GetAutoDeleteUnusedStyles: Boolean;
    procedure SetAutoDeleteUnusedStyles(const Value: Boolean);
    function GetDefaultColor: TColor;
    function GetDefaultMargin: Integer;
    procedure SetDefaultColor(const Value: TColor);
    procedure SetDefaultMargin(const Value: Integer);
    function GetRVPrint: TRVPrint;
    function GetShowSoftPageBreaks: Boolean;
    procedure SetRVPrint(const Value: TRVPrint);
    procedure SetShowSoftPageBreaks(const Value: Boolean);
    function GetLanguage: TRVALanguageName;
    procedure SetLanguage(const Value: TRVALanguageName);
    function GetActionsEnabled: Boolean;
    procedure SetActionsEnabled(const Value: Boolean);
    function GetRVFLocalizable: Boolean;
    function GetXMLLocalizable: Boolean;
    procedure SetRVFLocalizable(const Value: Boolean);
    procedure SetXMLLocalizable(const Value: Boolean);
    function GetFirstPageNumber: Integer;
    procedure SetFirstPageNumber(Value: Integer);
    function GetUseHelpFiles: Boolean;
    procedure SetUseHelpFiles(const Value: Boolean);
    function GetAddColorNameToHints: Boolean;
    procedure SetAddColorNameToHints(const Value: Boolean);
    function GetOnAddStyle: TRVAddStyleEvent;
    procedure SetOnAddStyle(const Value: TRVAddStyleEvent);
    function GetOnStyleNeeded: TRVStyleNeededEvent;
    procedure SetOnStyleNeeded(const Value: TRVStyleNeededEvent);
    function GetOnMarginsChanged: TRVAEditEvent;
    procedure SetOnMarginsChanged(const Value: TRVAEditEvent);
    {$IFDEF USERVKSDEVTE}
    function GetOnCreateTeForm: TRVCreateTeFormEvent;
    procedure SetOnCreateTeForm(const Value: TRVCreateTeFormEvent);
    {$ENDIF}
    function GetOnCustomFileOperation: TRVCustomFileOperationEvent;
    procedure SetOnCustomFileOperation(
      const Value: TRVCustomFileOperationEvent);
    function GetOnDownload: TRVADownloadEvent;
    procedure SetOnDownload(const Value: TRVADownloadEvent);
    function GetSearchScope: TRVASearchScope;
    procedure SetSearchScope(const Value: TRVASearchScope);
    function GetDefaultFileFormat: TrvFileSaveFilter;
    procedure SetDefaultFileFormat(const Value: TrvFileSaveFilter);
    function GetDefaultCustomFilterIndex: Integer;
    procedure SetDefaultCustomFilterIndex(const Value: Integer);
    function GetOnBackgroundChange: TRVAEditEvent;
    procedure SetOnBackgroundChange(const Value: TRVAEditEvent);
  protected
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
    procedure Loaded; override;
  public
    destructor Destroy; override;
    property FirstPageNumber: Integer read GetFirstPageNumber write SetFirstPageNumber;
  published
    property UseXPThemes: Boolean read GetUseXPThemes write SetUseXPThemes default True;
    property DialogFontName: TFontName read GetDialogFontName write SetDialogFontName;
    property DefaultControl: TCustomRichViewEdit read GetDefaultControl write SetDefaultControl;
    property ColorDialog: TColorDialog read GetColorDialog write SetColorDialog;
    property TableGridStyle: TPenStyle read GetTableGridStyle write SetTableGridStyle default psDot;
    property RVFFilter: String read GetRVFFilter write SetRVFFilter;
    property DefaultExt: String read GetDefaultExt write SetDefaultExt;
    property RVFormatTitle: String read GetRVFormatName write SetRVFormatName;
    property DefaultFileName: String read GetDefaultFileName write SetDefaultFileName;
    property DefaultFileFormat: TrvFileSaveFilter read GetDefaultFileFormat write SetDefaultFileFormat default ffeRVF;
    property DefaultCustomFilterIndex: Integer read GetDefaultCustomFilterIndex write SetDefaultCustomFilterIndex default 1;
    property AutoDeleteUnusedStyles: Boolean read GetAutoDeleteUnusedStyles write SetAutoDeleteUnusedStyles default True;
    {$IFDEF USERVXML}
    property XMLFilter: String read GetXMLFilter write SetXMLFilter;
    property RVXML: TRichViewXML read GetRVXML write SetRVXML;
    {$ENDIF}
    {$IFDEF USERVADDICT3}
    property RVAddictSpell3: TRVAddictSpell3 read GetRVAddictSpell3 write SetRVAddictSpell3;
    property RVAddictThesaurus3: TRVThesaurus3 read GetRVAddictThesaurus3 write SetRVAddictThesaurus3;
    {$ENDIF}
    {$IFDEF USERVHTML}
    property RVHTMLImporter: TRvHtmlImporter read GetRVHTML write SetRVHTML;
    {$ENDIF}
    {$IFDEF USEINDY}
    property IdHTTP: TIdHTTP read GetIdHTTP write SetIdHTTP;
    {$ENDIF}
    property ActionsEnabled: Boolean read GetActionsEnabled write SetActionsEnabled default True;
    property UseHelpFiles: Boolean read GetUseHelpFiles write SetUseHelpFiles default True;
    property AddColorNameToHints: Boolean read GetAddColorNameToHints write SetAddColorNameToHints default True;
    property DefaultMargin: Integer read GetDefaultMargin write SetDefaultMargin default 5;
    property DefaultColor: TColor read GetDefaultColor write SetDefaultColor default clWindow;
    property RVPrint: TRVPrint read GetRVPrint write SetRVPrint;
    property ShowSoftPageBreaks: Boolean read GetShowSoftPageBreaks write SetShowSoftPageBreaks default True;
    property Language: TRVALanguageName read GetLanguage write SetLanguage;
    property RVFLocalizable: Boolean read GetRVFLocalizable write SetRVFLocalizable default True;
    property XMLLocalizable: Boolean read GetXMLLocalizable write SetXMLLocalizable default True;
    property OnStyleNeeded: TRVStyleNeededEvent read GetOnStyleNeeded write SetOnStyleNeeded;
    property OnAddStyle: TRVAddStyleEvent read GetOnAddStyle write SetOnAddStyle;
    property OnMarginsChanged: TRVAEditEvent read GetOnMarginsChanged write SetOnMarginsChanged;
    property OnCustomFileOperation: TRVCustomFileOperationEvent read GetOnCustomFileOperation write SetOnCustomFileOperation;
    property OnDownload: TRVADownloadEvent read GetOnDownload write SetOnDownload;
    property OnBackgroundChange: TRVAEditEvent read GetOnBackgroundChange write SetOnBackgroundChange;
    {$IFDEF USERVKSDEVTE}
    property OnCreateTeForm: TRVCreateTeFormEvent read GetOnCreateTeForm write SetOnCreateTeForm;
    {$ENDIF}
    property SearchScope: TRVASearchScope read GetSearchScope write SetSearchScope default rvssAskUser;
  end;

  IRVAPopupMenu = interface
    function GetPopupComponent: TComponent;
    function GetActionList: TActionList;
    procedure SetActionList(const Value: TActionList);
    function GetMaxSuggestionsCount: Integer;
    procedure SetMaxSuggestionsCount(Value: Integer);
    procedure ClearItems;
    procedure AddActionItem(Action: TAction; const Caption: String='');
    procedure AddSeparatorItem;
    procedure DeleteLastSeparatorItem;
    function GetItemCaption(Sender: TObject): string;
    {$IFNDEF RVDONOTUSELIVESPELL}
    procedure AddClickItem(Click: TNotifyEvent; const Caption: String;
      Charset: TFontCharset; Default: Boolean=False);
    function WantLiveSpellGetSuggestions: Boolean;
    procedure LiveSpellGetSuggestions(Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer;
      Suggestions: TStrings);
    procedure LiveSpellWordReplace(Edit: TCustomRichViewEdit; const Word, Correction: String; StyleNo: Integer);
    function WantLiveSpellIgnoreAll: Boolean;
    procedure LiveSpellIgnoreAll(Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer);
    function WantLiveSpellAdd: Boolean;
    procedure LiveSpellAdd(Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer);
    {$ENDIF}
  end;

  TRVAPopupMenuHelper = class
  private
    FPopupMenu: IRVAPopupMenu;
    FActionList: TActionList;
    FStyleNo: Integer;
    FMaxSuggestionsCount: Integer;
    function FindAction(ActionClass: TClass): TrvAction;
    procedure AddAction(ActionClass: TClass; const Caption: String='');
    {$IFNDEF RVDONOTUSELIVESPELL}
    function GetSuggestions(const Word: String; StyleNo: Integer): TStringList;
    procedure CorrectMisspelling(Sender: TObject);
    procedure OnIgnoreAll(Sender: TObject);
    procedure OnAddToDict(Sender: TObject);
    {$ENDIF}
    procedure PreparePopup(X, Y: Integer);
  public
    constructor Create(APopupMenu: IRVAPopupMenu); virtual;
    destructor Destroy; override;
  end;

  {$IFDEF USERVTNT}
  TRVAPopupMenuBase = TTntPopupMenu;
  TRVAPopupMenuItem = TTntMenuItem;
  {$ELSE}
  TRVAPopupMenuBase = TPopupMenu;
  TRVAPopupMenuItem = TMenuItem;
  {$ENDIF}

  TRVAPopupMenu = class (TRVAPopupMenuBase, IRVAPopupMenu)
  private
    FPopupMenuHelper: TRVAPopupMenuHelper;
    FOnLiveSpellGetSuggestions: TRVALiveSpellGetSuggestionsEvent;
    FOnLiveSpellAdd: TRVALiveSpellAddEvent;
    FOnLiveSpellIgnoreAll: TRVALiveSpellIgnoreAllEvent;
    FOnLiveSpellWordReplace: TRVALiveSpellReplaceEvent;
  protected
    { IRVAPopupMenu }
    function GetPopupComponent: TComponent;
    function GetActionList: TActionList;
    procedure SetActionList(const Value: TActionList);
    function GetMaxSuggestionsCount: Integer;
    procedure SetMaxSuggestionsCount(Value: Integer);
    procedure ClearItems;
    procedure AddActionItem(Action: TAction; const Caption: String='');
    procedure AddSeparatorItem;
    procedure DeleteLastSeparatorItem;
    function GetItemCaption(Sender: TObject): string;
    {$IFNDEF RVDONOTUSELIVESPELL}
    procedure AddClickItem(Click: TNotifyEvent; const Caption: String;
      Charset: TFontCharset; Default: Boolean=False);
    function WantLiveSpellGetSuggestions: Boolean;
    procedure LiveSpellGetSuggestions(Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer;
      Suggestions: TStrings);
    procedure LiveSpellWordReplace(Edit: TCustomRichViewEdit; const Word, Correction: String; StyleNo: Integer);
    function WantLiveSpellIgnoreAll: Boolean;
    procedure LiveSpellIgnoreAll(Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer);
    function WantLiveSpellAdd: Boolean;
    procedure LiveSpellAdd(Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer);
    {$ENDIF}
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
    procedure Popup(X,Y: Integer); override;
  published
    property ActionList: TActionList read GetActionList write SetActionList;
    property OnLiveSpellGetSuggestions: TRVALiveSpellGetSuggestionsEvent
      read FOnLiveSpellGetSuggestions write FOnLiveSpellGetSuggestions;
    property OnLiveSpellIgnoreAll: TRVALiveSpellIgnoreAllEvent
      read FOnLiveSpellIgnoreAll write FOnLiveSpellIgnoreAll;
    property OnLiveSpellAdd: TRVALiveSpellAddEvent
      read FOnLiveSpellAdd write FOnLiveSpellAdd;
    property OnLiveSpellWordReplace: TRVALiveSpellReplaceEvent
      read FOnLiveSpellWordReplace write FOnLiveSpellWordReplace;
    property MaxSuggestionsCount: Integer read GetMaxSuggestionsCount write SetMaxSuggestionsCount default 0;
  end;

  {$IFDEF USETB2K}
  TRVATBPopupMenu = class (TTBPopupMenu, IRVAPopupMenu)
  private
    FPopupMenuHelper: TRVAPopupMenuHelper;
    FOnLiveSpellGetSuggestions: TRVA2LiveSpellGetSuggestionsEvent;
    FOnLiveSpellAdd: TRVA2LiveSpellAddEvent;
    FOnLiveSpellIgnoreAll: TRVA2LiveSpellIgnoreAllEvent;
    FOnLiveSpellWordReplace: TRVA2LiveSpellReplaceEvent;
  protected
    { IRVAPopupMenu }
    function GetPopupComponent: TComponent;
    function GetActionList: TActionList;
    procedure SetActionList(const Value: TActionList);
    function GetMaxSuggestionsCount: Integer;
    procedure SetMaxSuggestionsCount(Value: Integer);
    procedure ClearItems;
    procedure AddActionItem(Action: TAction; const Caption: String='');
    procedure AddSeparatorItem;
    procedure DeleteLastSeparatorItem;
    function GetItemCaption(Sender: TObject): string;
    {$IFNDEF RVDONOTUSELIVESPELL}
    procedure AddClickItem(Click: TNotifyEvent; const Caption: String;
      Charset: TFontCharset; Default: Boolean=False);
    function WantLiveSpellGetSuggestions: Boolean;
    procedure LiveSpellGetSuggestions(Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer;
      Suggestions: TStrings);
    procedure LiveSpellWordReplace(Edit: TCustomRichViewEdit; const Word, Correction: String; StyleNo: Integer);
    function WantLiveSpellIgnoreAll: Boolean;
    procedure LiveSpellIgnoreAll(Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer);
    function WantLiveSpellAdd: Boolean;
    procedure LiveSpellAdd(Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer);
    {$ENDIF}
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
    procedure Popup(X,Y: Integer); override;
  published
    property ActionList: TActionList read GetActionList write SetActionList;
    property OnLiveSpellGetSuggestions: TRVA2LiveSpellGetSuggestionsEvent
      read FOnLiveSpellGetSuggestions write FOnLiveSpellGetSuggestions;
    property OnLiveSpellIgnoreAll: TRVA2LiveSpellIgnoreAllEvent
      read FOnLiveSpellIgnoreAll write FOnLiveSpellIgnoreAll;
    property OnLiveSpellAdd: TRVA2LiveSpellAddEvent
      read FOnLiveSpellAdd write FOnLiveSpellAdd;
    property OnLiveSpellWordReplace: TRVA2LiveSpellReplaceEvent
      read FOnLiveSpellWordReplace write FOnLiveSpellWordReplace;
    property MaxSuggestionsCount: Integer read GetMaxSuggestionsCount write SetMaxSuggestionsCount default 0;
  end;
  {$ENDIF}

  {$IFDEF USETBX}
  TRVATBXPopupMenu = class (TTBXPopupMenu, IRVAPopupMenu)
  private
    FPopupMenuHelper: TRVAPopupMenuHelper;
    FOnLiveSpellGetSuggestions: TRVA2LiveSpellGetSuggestionsEvent;
    FOnLiveSpellAdd: TRVA2LiveSpellAddEvent;
    FOnLiveSpellIgnoreAll: TRVA2LiveSpellIgnoreAllEvent;
    FOnLiveSpellWordReplace: TRVA2LiveSpellReplaceEvent;
  protected
    { IRVAPopupMenu }
    function GetPopupComponent: TComponent;
    function GetActionList: TActionList;
    procedure SetActionList(const Value: TActionList);
    function GetMaxSuggestionsCount: Integer;
    procedure SetMaxSuggestionsCount(Value: Integer);
    procedure ClearItems;
    procedure AddActionItem(Action: TAction; const Caption: String='');
    procedure AddSeparatorItem;
    procedure DeleteLastSeparatorItem;
    function GetItemCaption(Sender: TObject): string;
    {$IFNDEF RVDONOTUSELIVESPELL}
    procedure AddClickItem(Click: TNotifyEvent; const Caption: String;
      Charset: TFontCharset; Default: Boolean=False);
    function WantLiveSpellGetSuggestions: Boolean;
    procedure LiveSpellGetSuggestions(Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer;
      Suggestions: TStrings);
    procedure LiveSpellWordReplace(Edit: TCustomRichViewEdit; const Word, Correction: String; StyleNo: Integer);
    function WantLiveSpellIgnoreAll: Boolean;
    procedure LiveSpellIgnoreAll(Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer);
    function WantLiveSpellAdd: Boolean;
    procedure LiveSpellAdd(Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer);
    {$ENDIF}
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
    procedure Popup(X,Y: Integer); override;

⌨️ 快捷键说明

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