📄 richviewactions.pas
字号:
{*******************************************************}
{ }
{ RichViewActions }
{ Main RichViewActions unit }
{ }
{ Copyright (c) 2002-2007, Sergey Tkachenko }
{ svt@trichview.com }
{ http://www.trichview.com }
{ }
{*******************************************************}
unit RichViewActions;
{$I RichViewActions.inc}
{
See history.txt
----------------------------------------------------------------------------
TrvCustomAction
TrvAction - base action : MH
TrvActionNew
TrvActionOpen
TrvActionSave
TrvActionCustomIO
TrvActionCustomFileIO
TrvActionSaveAs
TrvActionExport
TrvActionInsertFile
TrvActionInsertPicture
TrvActionFind
TrvActionFindNext
TrvActionReplace
TrvActionCut : MH
TrvActionCopy : MH
TrvActionPaste : MH
TrvActionPasteSpecial
TrvActionUndo : MH
TrvActionRedo : MH
TrvActionCharCase
TrvActionTextStyles
TrvActionFonts : MB
TrvActionFontEx
TrvActionTextBiDi
TrvActionTextLTR
TrvActionTextRTL
TrvActionFontStyle : MH, MB
TrvActionFontBold : MH, MB
TrvActionFontItalic : MH, MB
TrvActionFontUnderline : MH, MB
TrvActionFontStrikeout : MH, MB
TrvActionFontStyleEx
TrvActionFontAllCaps
TrvActionFontOverline
TrvActionFontShrinkGrow
TrvActionFontGrow
TrvActionFontShrink
TrvActionFontGrowOnePoint
TrvActionFontShrinkOnePoint
TRVActionInsertHyperlink
TrvActionInsertTable : MH
TrvCustomPrintAction
TrvActionPrintPreview : MB
TrvActionQuickPrint
TrvActionPrint : MB
TrvActionParaStyles : MB
TrvActionLineSpacing
TrvActionLineSpacing100
TrvActionLineSpacing150
TrvActionLineSpacing200
TrvActionParaBorder
TrvActionAlignment : MB
TrvActionAlignLeft : MB
TrvActionAlignRight : MB
TrvActionAlignCenter : MB
TrvActionAlignJustify
TrvActionParaBiDi
TrvActionParaLTR
TrvActionParaRTL
TrvActionIndent
TrvActionIndentInc : MB
TrvActionIndentDec : MB
TrvActionParagraph
TrvActionWordWrap : MB
TrvActionSelectAll : MB
TrvActionItemProperties
TRVActionInsertHLine
TrvActionInsertSymbol
TrvActionFillColor
TrvActionCustomColor
TrvActionFontCustomColor
TrvActionFontColor;
TrvActionFontBackColor;
TrvActionParaCustomColor
TrvActionParaColor;
TrvActionColor;
TrvActionBackground
TrvActionParaList
TrvActionCustomParaListSwitcher
TrvActionParaBullets
TrvActionParaNumbering
TrvActionTableCell
TrvActionTableRCBase
TrvActionTableInsertRowsAbove
TrvActionTableInsertRowsBelow
TrvActionTableInsertColLeft
TrvActionTableInsertColRight
TrvActionTableDeleteRows
TrvActionTableDeleteCols
TrvActionTableMergeCells
TrvActionTableSplitCells
TrvActionTableSelectTable
TrvActionTableSelectRows
TrvActionTableSelectCols
TrvActionTableSelectCell
TrvActionTableProperties
TrvActionTableMultiCellAttributes
TrvActionTableCellVAlign
TrvActionTableCellVAlignTop
TrvActionTableCellVAlignMiddle
TrvActionTableCellVAlignBottom
TrvActionTableCellVAlignDefault
TrvActionTableCellBorder
TrvActionTableCellLeftBorder
TrvActionTableCellRightBorder
TrvActionTableCellTopBorder
TrvActionTableCellBottomBorder
TrvActionTableCellAllBorders
TrvActionTableCellNoBorders
TrvActionInsertPageBreak
TrvActionRemovePageBreak
TrvActionTableGrid
TrvActionPageSetup
----------------------------------------------------------------------------
TRichViewEdit Actions
These components are freely distributable in source form provided all copyrights
and acknowledgements remain intact. Authors would also appreciate receiving
notification of all changes, improvements or additions made to these components.
You can use these components in any project, including commercial applications.
RichViewActions are based on work made by
Matt Harward, Phat Rock Ventures, LLC (MH) mharward@phatrock.com
Michael Beck (MB) mbeck1@compuserve.com
Actions initially created by these authors are marked with MH or MB in
the list above.
----------------------------------------------------------------------------
}
interface
{$I RV_Defs.inc}
uses
Windows, Messages, Classes, Graphics, SysUtils, Controls, StdCtrls,
Printers, Dialogs, Forms, ShellApi, Clipbrd,
{$IFDEF RICHVIEWDEF6}
DateUtils,
{$ENDIF}
RichView, rvrvData, rvEdit, ActnList, RVTable,
RVItem, RVStyle, RVTInplace, rvScroll, rvUni, PtblRV, RVERVData, RVMisc,
{$IFDEF USERVXML}
RichViewXML,
{$ENDIF}
{$IFDEF USERVHTML}
RVHTMLImport, RVNormalize,
{$ENDIF}
{$IFDEF USERVADDICT3}
ad3RichViewCmpnts, ad3SpellBase,
{$ENDIF}
{$IFDEF USERVKSDEVTE}
te_controls, te_forms,
{$ENDIF}
{$IFDEF USEINDY}
idhttp,
{$ENDIF}
{$IFDEF USEJVCL}
JvWinDialogs,
{$ENDIF}
{$IFDEF USETB2K}
TB2Item,
{$ENDIF}
{$IFDEF USETBX}
TBX,
{$ENDIF}
CRVData, RVClasses,RVOfficeCnv, ExtDlgs, RVFuncs, Menus,
{$IFDEF USERVTNT}
TntClasses, TntActnList, TntStdActns, TntDialogs, TntStdCtrls, TntMenus,
{$ENDIF}
RVALocalize;
type
TrvFileImportFilter = (ffiRVF, ffiRTF, {$IFDEF USERVXML}ffiXML,{$ENDIF} ffiTextANSI, ffiTextUnicode, ffiTextAuto, ffiCustom, {$IFDEF USERVHTML}ffiHTML,{$ENDIF} ffiOfficeConverters);
TrvFileOpenFilter = ffiRVF..ffiCustom;
TrvFileExportFilter = (ffeRVF, ffeRTF, {$IFDEF USERVXML}ffeXML,{$ENDIF} ffeTextANSI, ffeTextUnicode, ffeCustom, ffeHTMLCSS, ffeHTML,
ffeOfficeConverters);
TrvFileSaveFilter = ffeRVF..ffeCustom;
TrvFileImportFilterSet = set of TrvFileImportFilter;
TrvFileOpenFilterSet = set of TrvFileOpenFilter;
TrvFileExportFilterSet = set of TrvFileExportFilter;
TrvFileSaveFilterSet = set of TrvFileSaveFilter;
TrvPaperMarginsUnits = (rvpmuMillimeters, rvpmuInches);
TrvaColorInterface = (rvacNone, rvacColorDialog, rvacAdvanced);
TRVFileChangeEvent = procedure (Sender: TObject;
Editor: TCustomRichViewEdit; const FileName: String;
FileFormat: TrvFileSaveFilter; IsNew: Boolean) of object;
TRVOpenFileEvent = procedure (Sender: TObject;
Editor: TCustomRichViewEdit; const FileName: String;
FileFormat: TrvFileOpenFilter; CustomFilterIndex: Integer) of object;
TRVAEditorControlCommand = (rvaeccIsEditorControl, rvaeccHasSelection,
rvaeccCanPaste, rvaeccCanUndo, rvaeccCopy, rvaeccCut, rvaeccPaste, rvaeccUndo);
TRVCustomItemPropertiesDialog = procedure (Sender: TObject;
Editor: TCustomRichViewEdit; var DoDefault: Boolean) of object;
TRVAEvent = procedure(Sender: TObject;
Editor: TCustomRichViewEdit) of object;
TRVGetFormClassEvent = procedure (Sender: TObject;
var FormClass: TFormClass) of object;
THFInfo = class
private
FFont: TFont;
procedure SetFont(const Value: TFont);
public
Text: String;
Alignment: TAlignment;
PrintOnFirstPage: Boolean;
constructor Create;
destructor Destroy; override;
property Font: TFont read FFont write SetFont;
end;
TrvAction = class;
TRVAPopupMenu = class;
TRVStyleNeededEvent = procedure (Sender: TrvAction; RVStyle: TRVStyle;
StyleInfo: TCustomRVInfo; var StyleNo: Integer) of object;
TRVAddStyleEvent = procedure (Sender: TrvAction; StyleInfo: TCustomRVInfo) of object;
TRVAEditEvent = procedure (Sender: TrvAction; Edit: TCustomRichViewEdit) of object;
{$IFDEF USERVKSDEVTE}
TRVCreateTeFormEvent = procedure (Sender: TForm; teForm: TTeForm) of object;
{$ENDIF}
TRVAFileOperation = (rvafoOpen, rvafoSave, rvafoExport, rvafoInsert);
TRVCustomFileOperationEvent = procedure (Sender: TrvAction; Edit: TCustomRichViewEdit;
const FileName: String; Operation: TRVAFileOperation;
var SaveFormat: TrvFileSaveFilter;
var CustomFilterIndex: Integer; var Success: Boolean) of object;
TRVADownloadEvent = procedure (Sender: TrvAction; const Source: String) of object;
TRVALiveSpellGetSuggestionsEvent = procedure (Sender: TRVAPopupMenu;
Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer;
Suggestions: TStrings) of object;
TRVALiveSpellIgnoreAllEvent = procedure (Sender: TRVAPopupMenu;
Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer) of object;
TRVALiveSpellAddEvent = procedure (Sender: TRVAPopupMenu;
Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer) of object;
TRVALiveSpellReplaceEvent = procedure (Sender: TRVAPopupMenu;
Edit: TCustomRichViewEdit; const Word, Correction: String; StyleNo: Integer) of object;
{$IFDEF USETB2K}
TRVA2LiveSpellGetSuggestionsEvent = procedure (Sender: TObject;
Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer;
Suggestions: TStrings) of object;
TRVA2LiveSpellIgnoreAllEvent = procedure (Sender: TObject;
Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer) of object;
TRVA2LiveSpellAddEvent = procedure (Sender: TObject;
Edit: TCustomRichViewEdit; const Word: String; StyleNo: Integer) of object;
TRVA2LiveSpellReplaceEvent = procedure (Sender: TObject;
Edit: TCustomRichViewEdit; const Word, Correction: String; StyleNo: Integer) of object;
{$ENDIF}
TRVASearchScope = (rvssFromCursor, rvssAskUser, rvssGlobal);
TRVAControlPanel = class (TComponent)
private
function GetDialogFontName: TFontName;
function GetUseXPThemes: Boolean;
procedure SetDialogFontName(const Value: TFontName);
procedure SetUseXPThemes(const Value: Boolean);
function GetDefaultControl: TCustomRichViewEdit;
procedure SetDefaultControl(const Value: TCustomRichViewEdit);
function GetColorDialog: TColorDialog;
procedure SetColorDialog(const Value: TColorDialog);
function GetTableGridStyle: TPenStyle;
procedure SetTableGridStyle(const Value: TPenStyle);
function GetRVFFilter: String;
procedure SetRVFFilter(const Value: String);
{$IFDEF USERVXML}
procedure SetXMLFilter(const Value: String);
function GetXMLFilter: String;
procedure SetRVXML(const Value: TRichViewXML);
function GetRVXML: TRichViewXML;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -