📄 richview.pas
字号:
function GetFirstCheckpoint: TCheckpointData;
function GetNextCheckpoint(CheckpointData: TCheckpointData): TCheckpointData;
function GetLastCheckpoint: TCheckpointData;
function GetPrevCheckpoint(CheckpointData: TCheckpointData): TCheckpointData;
function GetItemCheckpoint(ItemNo: Integer):TCheckpointData;
function FindCheckpointByName(const Name: String): TCheckpointData;
function FindCheckpointByTag(Tag: Integer): TCheckpointData;
function GetCheckpointByNo(No: Integer): TCheckpointData;
procedure GetCheckpointInfo(CheckpointData: TCheckpointData;
var Tag: Integer; var Name: String;
var RaiseEvent: Boolean);
procedure GetCheckpointXY(CheckpointData: TCheckpointData; var X,Y: Integer);
function GetCheckpointYEx(CheckpointData: TCheckpointData): Integer;
function GetCheckpointItemNo(CheckpointData: TCheckpointData): Integer;
function GetCheckpointNo(CheckpointData: TCheckpointData): Integer;
function GetJumpPointY(id: Integer): Integer;
function GetJumpPointItemNo(id: Integer): Integer;
procedure GetJumpPointLocation(id: Integer; var RVData: TCustomRVFormattedData; var ItemNo: Integer);
function GetItemCoords(ItemNo: Integer;var Left,Top: Integer): Boolean;
function GetItemClientCoords(ItemNo: Integer;var Left,Top: Integer): Boolean;
procedure Clear;
procedure Format;
procedure FormatTail;
procedure AppendFrom(Source: TCustomRichView);
{$IFNDEF RVDONOTUSEHTML}
function SaveHTMLToStreamEx(Stream: TStream;
const Path, Title, ImagesPrefix, ExtraStyles,
ExternalCSS, CPPrefix: String;
Options: TRVSaveOptions):Boolean;
function SaveHTMLToStream(Stream: TStream; const Path, Title,ImagesPrefix: String;
Options: TRVSaveOptions):Boolean;
function SaveHTMLEx(const FileName, Title, ImagesPrefix, ExtraStyles,
ExternalCSS, CPPrefix: String;
Options: TRVSaveOptions):Boolean;
function SaveHTML(const FileName,Title,ImagesPrefix: String;
Options: TRVSaveOptions):Boolean;
{$ENDIF}
function SaveText(const FileName: String; LineWidth: Integer):Boolean;
function SaveTextToStream(const Path: String; Stream: TStream;
LineWidth: Integer;
SelectionOnly, TextOnly: Boolean):Boolean;
function LoadText(const FileName: String; StyleNo, ParaNo: Integer; AsSingleParagraph: Boolean):Boolean;
{$IFNDEF RVDONOTUSERVF}
function CreateLayoutInfo: TRVLayoutInfo;
procedure ApplyLayoutInfo (Layout: TRVLayoutInfo);
function LoadRVFFromStream(Stream: TStream):Boolean;
function InsertRVFFromStream(Stream: TStream; Index: Integer):Boolean;
function AppendRVFFromStream(Stream: TStream; ParaNo: Integer):Boolean;
function LoadRVF(const FileName: String):Boolean;
function SaveRVFToStream(Stream: TStream; SelectionOnly: Boolean):Boolean;
function SaveRVF(const FileName: String; SelectionOnly: Boolean):Boolean;
procedure CopyRVF;
{$ENDIF}
{$IFNDEF RVDONOTUSERTF}
function SaveRTFToStream(Stream: TStream; SelectionOnly: Boolean):Boolean;
function SaveRTF(const FileName: String; SelectionOnly: Boolean):Boolean;
procedure CopyRTF;
{$ENDIF}
{$IFNDEF RVDONOTUSERTFIMPORT}
function LoadRTFFromStream(Stream: TStream):Boolean;
function LoadRTF(const FileName: String):Boolean;
{$ENDIF}
{$IFNDEF RVDONOTUSEUNICODE}
function SaveTextW(const FileName: String; LineWidth: Integer):Boolean;
function SaveTextToStreamW(const Path: String; Stream: TStream;
LineWidth: Integer;
SelectionOnly, TextOnly: Boolean):Boolean;
function LoadTextW(const FileName: String; StyleNo, ParaNo: Integer; DefAsSingleParagraph: Boolean):Boolean;
procedure AddNLATag(const s: String; StyleNo, ParaNo, Tag: Integer);
function GetItemTextA(ItemNo: Integer): String;
procedure SetItemTextA(ItemNo: Integer; const s: String);
{$IFDEF RICHVIEWCBDEF3}
procedure AddNLWTag(const s: WideString; StyleNo, ParaNo, Tag: Integer);
procedure AddTextNLW(const s: WideString; StyleNo, FirstParaNo, OtherParaNo: Integer;
DefAsSingleParagraph: Boolean);
function GetSelTextW: WideString;
function GetItemTextW(ItemNo: Integer): WideString;
procedure SetItemTextW(ItemNo: Integer; const s: WideString);
{$ENDIF}
{$ENDIF}
procedure DeleteSection(const CpName: String);
procedure DeleteItems(FirstItemNo, Count: Integer);
procedure DeleteParas(FirstItemNo, LastItemNo: Integer);
procedure CopyText;
procedure CopyTextW;
procedure CopyImage;
procedure Copy;
function CopyDef: Boolean;
function GetSelectedImage: TGraphic;
function GetSelText: String;
function SelectionExists: Boolean;
procedure Deselect;
procedure SelectAll;
function SearchText(const s: String; SrchOptions: TRVSearchOptions): Boolean;
function GetItemStyle(ItemNo: Integer): Integer;
procedure GetBreakInfo(ItemNo: Integer; var AWidth: Byte;
var AStyle: TRVBreakStyle; var AColor: TColor;
var ATag: Integer);
procedure GetBulletInfo(ItemNo: Integer; var AName: String;
var AImageIndex: Integer;
var AImageList: TCustomImageList;
var ATag: Integer);
procedure GetHotspotInfo(ItemNo: Integer; var AName: String;
var AImageIndex, AHotImageIndex: Integer;
var AImageList: TCustomImageList;
var ATag: Integer);
procedure GetPictureInfo(ItemNo: Integer; var AName: String;
var Agr: TGraphic; var AVAlign: TRVVAlign;
var ATag: Integer);
procedure GetControlInfo(ItemNo: Integer; var AName: String;
var Actrl: TControl; var AVAlign: TRVVAlign;
var ATag: Integer);
procedure GetTextInfo(ItemNo: Integer; var AText: String;
var ATag: Integer);
function GetItemTag(ItemNo: Integer): Integer;
procedure SetItemText(ItemNo: Integer; const s: String);
function GetItemText(ItemNo: Integer): String;
function SetItemExtraIntProperty(ItemNo: Integer; Prop: TRVExtraItemProperty; Value: Integer): Boolean;
function GetItemExtraIntProperty(ItemNo: Integer; Prop: TRVExtraItemProperty; var Value: Integer): Boolean;
function IsParaStart(ItemNo: Integer): Boolean;
function GetItemPara(ItemNo: Integer): Integer;
function IsFromNewLine(ItemNo: Integer): Boolean;
procedure SetBreakInfo(ItemNo: Integer; AWidth: Byte;
AStyle: TRVBreakStyle; AColor: TColor;
ATag: Integer);
procedure SetBulletInfo(ItemNo: Integer; const AName: String;
AImageIndex: Integer;
AImageList: TCustomImageList;
ATag: Integer);
procedure SetHotspotInfo(ItemNo: Integer; const AName: String;
AImageIndex, AHotImageIndex: Integer;
AImageList: TCustomImageList;
ATag: Integer);
// ret value: reformatting needed
function SetPictureInfo(ItemNo: Integer; const AName: String;
Agr: TGraphic; AVAlign: TRVVAlign;
ATag: Integer): Boolean;
function SetControlInfo(ItemNo: Integer; const AName: String;
AVAlign: TRVVAlign; ATag: Integer): Boolean;
procedure SetItemTag(ItemNo: Integer; ATag: Integer);
procedure SetCheckpointInfo(ItemNo: Integer; ATag: Integer;
const AName: String;
ARaiseEvent: Boolean);
function RemoveCheckpoint(ItemNo: Integer): Boolean;
function FindControlItemNo(actrl: TControl): Integer;
procedure GetSelectionBounds(var StartItemNo, StartItemOffs,
EndItemNo, EndItemOffs: Integer;
Normalize: Boolean);
procedure SetSelectionBounds(StartItemNo, StartItemOffs,
EndItemNo, EndItemOffs: Integer);
procedure GetWordAt(X,Y: Integer; var RVData: TCustomRVFormattedData; var ItemNo: Integer; var Word: String); {$IFDEF RICHVIEWDEF4}overload;
function GetWordAt(X,Y: Integer): String; overload;{$ENDIF}
procedure SelectWordAt(X,Y: Integer);
procedure UpdatePaletteInfo; override;
function GetOffsBeforeItem(ItemNo: Integer): Integer;
function GetOffsAfterItem(ItemNo: Integer): Integer;
procedure SetAddParagraphMode(AllowNewPara: Boolean);
function SavePicture(DocumentSaveFormat: TRVSaveFormat;
const Path: String;
gr: TGraphic): String; virtual;
function GetSelectionRect: TRect;
function GetItem(ItemNo: Integer): TCustomRVItemInfo;
function GetItemNo(Item: TCustomRVItemInfo): Integer;
procedure GetFocusedItem(var ARVData: TCustomRVFormattedData; var AItemNo: Integer);
procedure DeleteUnusedStyles(TextStyles, ParaStyles, ListStyles: Boolean);
{$IFNDEF RVDONOTUSELISTS}
function SetListMarkerInfo(AItemNo, AListNo, AListLevel, AStartFrom, AParaNo: Integer; AUseStartFrom: Boolean): Integer;
procedure RemoveListMarker(ItemNo: Integer);
function GetListMarkerInfo(AItemNo: Integer; var AListNo, AListLevel, AStartFrom: Integer; var AUseStartFrom: Boolean): Integer;
{$ENDIF}
function GetLineNo(ItemNo, ItemOffs: Integer): Integer;
function GetItemAt(X,Y: Integer; var RVData: TCustomRVFormattedData; var ItemNo, OffsetInItem: Integer;
Strict: Boolean): Boolean;
property LineCount: Integer read GetLineCount;
property ItemCount: Integer read GetLineCount;
property FirstItemVisible: Integer read GetFirstItemVisible;
property LastItemVisible: Integer read GetLastItemVisible;
property RVFWarnings: TRVFWarnings read FRVFWarnings write FRVFWarnings;
property DocumentHeight: Integer read GetDocumentHeight;
property PageBreaksBeforeItems[Index: Integer]: Boolean
read GetPageBreaksBeforeItems write SetPageBreaksBeforeItems;
property BackgroundBitmap: TBitmap read GetBackBitmap write SetBackBitmap;
property BackgroundStyle: TBackgroundStyle read GetBackgroundStyle write SetBackgroundStyle;
property BottomMargin: Integer read FBottomMargin write FBottomMargin default 5;
property Color default clNone;
property CPEventKind : TCPEventKind read FCPEventKind write FCPEventKind;
property Cursor: TCursor read FCursor write FCursor;
property Delimiters : String read FDelimiters write FDelimiters stored StoreDelimiters;
property DoInPaletteMode;
property FirstJumpNo : Integer read GetFirstJumpNo write SetFirstJumpNo default 0;
property FullRedraw;
property HScrollVisible;
property HScrollMax;
property HScrollPos;
property InplaceEditor;
property LeftMargin : Integer read FLeftMargin write FLeftMargin default 5;
property MaxTextWidth: Integer read FMaxTextWidth write FMaxTextWidth default 0;
property MinTextWidth: Integer read FMinTextWidth write FMinTextWidth default 0;
property Options : TRVOptions read FOptions write FOptions
default [rvoAllowSelection, rvoScrollToEnd, rvoAutoCopyText,
rvoAutoCopyImage, rvoAutoCopyRVF, rvoAutoCopyRTF,
rvoDblClickSelectsWord, rvoRClickDeselects,
rvoFormatInvalidate,
rvoShowPageBreaks];
property RightMargin : Integer read FRightMargin write FRightMargin default 5;
property RTFOptions : TRVRTFOptions read FRTFOptions write FRTFOptions default [rvrtfDuplicateUnicode, rvrtfSaveEMFAsWMF, rvrtfSaveJpegAsJpeg];
property RTFReadProperties: TRVRTFReaderProperties read GetRTFReadProperties write SetRTFReadProperties;
property RVFOptions : TRVFOptions read FRVFOptions write FRVFOptions default [rvfoSavePicturesBody, rvfoSaveControlsBody, rvfoSaveBinary];
property RVFParaStylesReadMode: TRVFReaderStyleMode read FRVFParaStylesReadMode write FRVFParaStylesReadMode default rvf_sInsertMerge;
property RVFTextStylesReadMode: TRVFReaderStyleMode read FRVFTextStylesReadMode write FRVFTextStylesReadMode default rvf_sInsertMerge;
property Style : TRVStyle read FStyle write SetStyle;
property TabNavigation: TRVTabNavigationType read GetTabNavigation write SetTabNavigation default rvtnTab;
property TopMargin : Integer read FTopMargin write FTopMargin default 5;
property VScrollMax;
property VScrollPos;
property VScrollVisible;
property VSmallStep;
property OnRVDblClick : TRVDblClickEvent read FOnRVDblClick write FOnRVDblClick;
property OnCheckpointVisible: TRVCheckpointVisibleEvent read FOnCheckpointVisible write FOnCheckpointVisible;
property OnControlAction: TRVControlActionEvent read FOnControlAction write FOnControlAction;
property OnItemAction : TRVItemActionEvent read FOnItemAction write FOnItemAction;
property OnCopy : TNotifyEvent read FOnCopy write FOnCopy;
{$IFDEF RV_ODHC}
property OnDocumentHeightChange: TNotifyEvent read FOnDocumentHeightChange write FOnDocumentHeightChange;
{$ENDIF}
property OnJump : TJumpEvent read FOnJump write FOnJump;
property OnHTMLSaveImage: TRVHTMLSaveImageEvent read FOnHTMLSaveImage write FOnHTMLSaveImage;
property OnReadHyperlink: TRVReadHyperlink read FOnTReadHyperlink write FOnTReadHyperlink;
property OnRVMouseDown : TRVMouseEvent read FOnRVMouseDown write FOnRVMouseDown;
property OnRVMouseMove : TRVMouseMoveEvent read FOnRVMouseMove write FOnRVMouseMove;
property OnRVMouseUp : TRVMouseEvent read FOnRVMouseUp write FOnRVMouseUp;
property OnRVRightClick : TRVRightClickEvent read FOnRVRightClick write FOnRVRightClick;
property OnRVFControlNeeded: TRVFControlNeededEvent read FOnRVFControlNeeded write FOnRVFControlNeeded;
property OnRVFImageListNeeded: TRVFImageListNeededEvent read FOnRVFImageListNeeded write FOnRVFImageListNeeded;
property OnRVFPictureNeeded: TRVFPictureNeededEvent read FOnRVFPictureNeeded write FOnRVFPictureNeeded;
property OnSaveComponentToFile: TRVSaveComponentToFileEvent read FOnSaveComponentToFile write FOnSaveComponentToFile;
property OnSelect : TNotifyEvent read FOnSelect write FOnSelect;
property OnURLNeeded : TRVURLNeededEvent read FOnURLNeeded write FOnURLNeeded;
property OnSaveRTFExtra: TRVSaveRTFExtraEvent read FOnSaveRTFExtra write FOnSaveRTFExtra;
property OnSaveHTMLExtra: TRVSaveHTMLExtraEvent read FOnSaveHTMLExtra write FOnSaveHTMLExtra;
end;
TRichView = class (TCustomRichView)
published
{ Published standard properties }
property Align;
{$IFDEF RICHVIEWDEF4}
property Anchors;
property Constraints;
{$ENDIF}
property Color default clNone;
property Ctl3D;
{$IFDEF RICHVIEWDEF4}
property DragKind;
{$ENDIF}
property DragMode;
property Enabled;
property HelpContext;
property ParentCtl3D;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop default True;
property UseXPThemes;
property Visible;
{ Published standard events }
property OnClick;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -