📄 profdhtmledit.pas
字号:
function InsertTable(NumRows, NumCols: Integer; const Caption: WideString{$IFNDEF VER100}= ''{$ENDIF}): Boolean; virtual; abstract;
function CanInsertTable: Boolean; virtual; abstract;
function AlterTable(NumRows, NumCols: Integer; const Caption: WideString{$IFNDEF VER100}= ''{$ENDIF}): Boolean;
function IsTableSelected: Boolean; virtual; abstract;
function TableInsertRow: Boolean; virtual; abstract;
function CanTableInsertRow: Boolean; virtual; abstract;
function TableDeleteRow: Boolean; virtual; abstract;
function CanTableDeleteRow: Boolean; virtual; abstract;
function TableInsertColumn: Boolean; virtual; abstract;
function CanTableInsertColumn: Boolean; virtual; abstract;
function TableDeleteColumn: Boolean; virtual; abstract;
function CanTableDeleteColumn: Boolean; virtual; abstract;
function TableInsertCell: Boolean; virtual; abstract;
function CanTableInsertCell: Boolean; virtual; abstract;
function TableDeleteCell: Boolean; virtual; abstract;
function CanTableDeleteCell: Boolean; virtual; abstract;
function TableSplitCell: Boolean; virtual; abstract;
function CanTableSplitCell: Boolean; virtual; abstract;
function TableMergeCells: Boolean; virtual; abstract;
function CanTableMergeCells: Boolean; virtual; abstract;
function IsTableCellSelected: Boolean;
function IsTableRangeSelected: Boolean;
function GetTableInfo(var ANumRows, ANumCols: Integer; var ACaption: WideString;
AAttrs: TProfDHTMLEditTableAttrs{$IFNDEF VER100}= nil{$ENDIF}): Boolean;
function GetTableCellAttrs(AResult: TProfDHTMLEditTableCellAttrs): Boolean;
function SetTableAttrs(AAttrs: TProfDHTMLEditTableAttrs): Boolean;
function SetTableCellAttrs(AAttrs: TProfDHTMLEditTableCellAttrs): Boolean;
function AddCSS(const ACssText: WideString): Boolean;
function AddCSSFile(const FilenameOrURL: WideString): Boolean;
function CanAddCSS: Boolean;
function CanAddCSSFile: Boolean;
function GetStyleClasses(AResult: TStrings): Boolean;
function ApplySpanClass(const StyleClass: WideString): Boolean;
function ApplyDivClass(const StyleClass: WideString): Boolean;
function RemoveSpanClass: Boolean;
function RemoveDivClass: Boolean;
function ToggleSpanClass(const StyleClass: WideString): Boolean;
function ToggleDivClass(const StyleClass: WideString): Boolean;
function ShowEditMenu(X, Y: Integer): Boolean; virtual;
function GetCaretPos: TPoint;
function ToggleAbsolutePositioning: Boolean;
function HrefAtPoint(X, Y: Integer): WideString;
function SrcAtPoint(X, Y: Integer): WideString;
function Find(const AText: WideString; MatchWholeWordsOnly, MatchCase: Boolean): Boolean;
function FindNext: Boolean;
function ToggleSubScript: Boolean;
function ToggleSuperScript: Boolean;
function DeleteWord: Boolean;
function ShowAboutBox: Boolean;
function UndoHint: WideString;
function RedoHint: WideString;
property BaseURL: WideString read GetBaseURL write SetBaseURL;
property FileName: WideString read GetFileName;
property BackColor: TColor read GetBackColor write SetBackColor;
property Body: WideString read GetBody;
property Bold: Boolean read GetBold write SetBold;
property Bullets: Boolean read GetBullets write SetBullets;
property Busy: Boolean read GetBusy;
property FontHTMLSize: THTMLFontSize read GetFontHTMLSize write SetFontHTMLSize;
property FontName: WideString read GetFontName write SetFontName;
property ForeColor: TColor read GetForeColor write SetForeColor;
property Head: WideString read GetHead;
property Italic: Boolean read GetItalic write SetItalic;
property LeftMargin: Integer read GetLeftMargin write SetLeftMargin;
property Modified: Boolean read GetModified write SetModified;
property Numbering: Boolean read GetNumbering write SetNumbering;
property ParagraphStyle: WideString read GetParagraphStyle write SetParagraphStyle;
property PlainText: WideString read GetPlainText write SetPlainText;
property PlainTextEx: WideString read GetPlainTextEx;
property RightMargin: Integer read GetRightMargin write SetRightMargin;
property Source: WideString read GetSource write SetSource;
property StrikeOut: Boolean read GetStrikeOut write SetStrikeOut;
property TextIndent: Integer read GetTextIndent write SetTextIndent;
property TextSize: TTextSize read GetTextSize write SetTextSize;
property Title: WideString read GetTitle write SetTitle;
property Underline: Boolean read GetUnderline write SetUnderline;
property SubScript: Boolean read GetSubScript write SetSubScript;
property SuperScript: Boolean read GetSuperScript write SetSuperScript;
property SelStart: Integer read GetSelStart write SetSelStart;
property SelLength: Integer read GetSelLength write SetSelLength;
property SelText: WideString read GetSelText write SetSelText;
property SelHTML: WideString read GetSelHTML write SetSelHTML;
property ObjectTag: WideString read GetObjectTag;
property ObjectHTML: WideString read GetObjectHTML write SetObjectHTML;
property ObjectID: WideString read GetObjectID write SetObjectID;
property ObjectName: WideString read GetObjectName write SetObjectName;
property ObjectClass: WideString read GetObjectClass write SetObjectClass;
property ObjectStyle: WideString read GetObjectStyle write SetObjectStyle;
property ObjectSize: TSize read GetObjectSize;
property InsertMode: Boolean read GetInsertMode write SetInsertMode;
property WindowHandle: HWND read GetWindowHandle;
property Background: TFileName read GetBackground write SetBackground;
property BgColor: TColor read GetBgColor write SetBgColor default clNone;
property Justify: TJustify read GetJustify write SetJustify default JustifyNone;
property LinkColor: TColor read GetLinkColor write SetLinkColor default clNone;
property LinkColorVisited: TColor read GetVLinkColor write SetVLinkColor default clNone;
property LinkColorActive: TColor read GetALinkColor write SetALinkColor default clNone;
property TextColor: TColor read GetTextColor write SetTextColor default clNone;
published
property TabOrder;
property TabStop default True;
property Align;
property Tag;
property Visible;
property Enabled;
property PopupMenu;
{$IFNDEF VER100}{$IFNDEF VER110}
property Anchors;
property ShowHint;
property ParentShowHint;
{$ENDIF}{$ENDIF}
property About: AnsiString read GetAbout write DontSetAbout;
property TableAttrs: TProfDHTMLEditTableAttrs read FTableAttrs write DontSetTableAttrs;
property TableCellAttrs: TProfDHTMLEditTableCellAttrs read FTableCellAttrs write DontSetTableCellAttrs;
property TagsSubstitution: TProfDHTMLEditTagsSubstitution read FTagsSubstitution write DontSetTagsSubstitution;
property Timeout: Double read FTimeout write SetTimeout;
property UseBrOnCarriageReturn: Boolean read FUseBrOnCarriageReturn write FUseBrOnCarriageReturn default False;
property SourceCodeOptions: TProfDHTMLEditSourceCodeOptions read FSourceCodeOptions write FSourceCodeOptions default [LowercaseElementNames, TerminateEmptyElements, AddSpaceInTerminatedEmptyElements, TerminateComments, LowercaseAttributeNames, QuoteAttributeValues, UnminimizeBooleanAttributes, LowercaseStylePropertyNames, UseEntityReferences, Preserve8BitCharacters, HideBaseElement, ExcludeFileProtocol, ExcludeBaseURL, UseBackSlashAsPathDelimiter, IndentSource, AddNbsp];
property DOCTYPE: WideString read FDOCTYPE write FDOCTYPE;
property WantTabs: Boolean read FWantTabs write FWantTabs default False;
{$IFNDEF VER100}{$IFNDEF VER110}{$IFNDEF VER120}{$IFNDEF VER125}
property OnContextPopup;
{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}
property OnClick;
property OnDblClick;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseUp;
property OnMouseMove;
property OnEnter;
property OnExit;
property OnDragDrop; { non-OLE drag and drop }
property OnDragOver; { non-OLE drag and drop }
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
property OnDisplayChanged: TNotifyEvent read FOnDisplayChanged write FOnDisplayChanged;
property OnCreate: TNotifyEvent read FOnCreate write FOnCreate;
property OnNewDocument: TNotifyEvent read FOnNewDocument write FOnNewDocument;
property OnSetBaseURL: TNotifyEvent read FOnSetBaseURL write FOnSetBaseURL;
property OnSetBrowseMode: TNotifyEvent read FOnSetBrowseMode write FOnSetBrowseMode;
property OnSetSource: TNotifyEvent read FOnSetSource write FOnSetSource;
property OnLoadURL: TNotifyEvent read FOnLoadURL write FOnLoadURL;
property OnLoadURLError: TNotifyEvent read FOnLoadURLError write FOnLoadURLError;
property OnOpenDialog: TNotifyEvent read FOnOpenDialog write FOnOpenDialog;
property OnLoadFromFile: TNotifyEvent read FOnLoadFromFile write FOnLoadFromFile;
property OnStop: TNotifyEvent read FOnStop write FOnStop;
property OnTimeout: TNotifyEvent read FOnTimeout write FOnTimeout;
property OnOpenDialogCancel: TNotifyEvent read FOnOpenDialogCancel write FOnOpenDialogCancel;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
{$IFDEF SUPPORT_VERSION_1}
TDHTMLEditShowContextMenu = procedure(Sender: TObject; xPos, yPos: Integer) of object;
TDHTMLEditContextMenuAction = procedure(Sender: TObject; itemIndex: Integer) of object;
TProfDHTMLEdit = class(TCustomProfDHTMLEdit)
private
FDocumentComplete: TNotifyEvent;
FDisplayChanged: TNotifyEvent;
FShowContextMenu: TDHTMLEditShowContextMenu;
FContextMenuAction: TDHTMLEditContextMenuAction;
FMouseDown: TNotifyEvent;
FMouseMove: TNotifyEvent;
FMouseUp: TNotifyEvent;
FMouseOut: TNotifyEvent;
FMouseOver: TNotifyEvent;
FClick: TNotifyEvent;
FDblClick: TNotifyEvent;
FKeyDown: TNotifyEvent;
FKeyPress: TNotifyEvent;
FKeyUp: TNotifyEvent;
FBlur: TNotifyEvent;
FReadyStateChange: TNotifyEvent;
FOnClearUndo: TNotifyEvent;
FUseSourceCodePreservation: Boolean;
procedure InitControlData; override;
procedure GetProperty(Index: Integer; var Value: TVarData);
procedure SetProperty(Index: Integer; const Value: TVarData);
function GetWideStringProp(Index: Integer): WideString;
procedure SetWideStringProp(Index: Integer; const Value: WideString);
function GetAbout: AnsiString; override;
function RuntimeBrowseMode: Boolean; override;
function RuntimeUseDivOnCarriageReturn: Boolean; override;
function RuntimeShowDetails: Boolean; override;
function RuntimeSourceCodePreservation: Boolean; override;
procedure RuntimeSetShowDetails(Value: Boolean);
function private_NewDocument(const param: WideString): Boolean; override;
function private_SetSource(const param: WideString): Boolean;
function private_SetBaseURL(const param: WideString): Boolean;
function private_LoadURL(const param: WideString): Boolean; override;
function private_LoadFromFile(const param: WideString): Boolean; override;
function private_OpenDialog(const param: WideString): Boolean;
procedure private_SaveToFile(const param: WideString); override;
procedure private_SaveDialog(const param: WideString);
function GetBusy: Boolean; override;
function GetFileName: WideString; override;
function GetBaseURL: WideString; override;
procedure SetBaseURL(const Value: WideString); override;
function GetModified: Boolean; override;
function GetTitle: WideString; override;
function GetHTML: WideString; override;
function ReadDOM: IDispatch; override;
procedure DoSetModified(Value: Boolean); override;
function DoClearUndo(AReason: TProfDHTMLEditDocumentCompleteReason): Boolean; override;
procedure SetShowBrTags(Value: Boolean);
procedure SetShowCommentTags(Value: Boolean);
procedure DocumentCompleteHandler(Sender: TObject);
procedure ShowContextMenuHandler(Sender: TObject; xPos: Integer; yPos: Integer);
procedure ContextMenuActionHandler(Sender: TObject; itemIndex: Integer);
procedure ReadyStateChangeHandler(Sender: TObject); override;
function MSSource: WideString; override;
function UseSourceCodePreservation: Boolean; override;
procedure SetSource(const Value: WideString); override;
function CallAndWait(const dom_stop: IDispatch; const Code: TProfDHTMLEditDocumentCompleteReason; const Method: TProfDHTMLEditPrivateMethod; const param: WideString): Boolean; override;
procedure BlurHandler(Sender: TObject);
{$IFNDEF VER100}{$IFNDEF VER110}
procedure CMBiDiModeChanged(var Message: TMessage); message CM_BIDIMODECHANGED;
{$ENDIF}{$ENDIF}
procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
procedure WMSetFocus(var Message: TWMSetFocus); message WM_SETFOCUS;
protected
procedure WndProc(var Message: TMessage); override;
{$IFNDEF VER100}
procedure RequestAlign; override;
{$ENDIF}
function GetWordBoolProp(Index: Integer): WordBool;
procedure SetWordBoolProp(Index: Integer; Value: WordBool);
function GetIntegerProp(Index: Integer): Integer;
procedure SetIntegerProp(Index: Integer; Value: Integer);
public
constructor Create(AOwner: TComponent); override;
function CanGetDOM: Boolean; override;
function GetDOM(out P: IDispatch): Boolean; override;
function NewDocument: Boolean; override;
function OpenDialog(const InitialDir: TFileName{$IFNDEF VER100}=''{$ENDIF}): TFileName; override;
function SaveDialog(const InitialDir: TFileName{$IFNDEF VER100}=''{$ENDIF}): TFileName; override;
function SaveToFile(const AFileName: TFileName): Boolean; override;
function InsertTable(NumRows, NumCols: Integer; const Caption: WideString{$IFNDEF VER100}= ''{$ENDIF}): Boolean; override;
function CanInsertTable: Boolean; override;
function IsTableSelected: Boolean; override;
function TableInsertRow: Boolean; override;
function CanTableInsertRow: Boolean; override;
function TableDeleteRow: Boolean; override;
function CanTableDeleteRow: Boolean; override;
function TableInsertColumn: Boolean; override;
function CanTableInsertColumn: Boolean; override;
function TableDeleteColumn: Boolean; override;
function CanTableDeleteColumn: Boolean; override;
function TableInsertCell: Boolean; override;
function CanTableInsertCell: Boolean; override;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -