📄 profdhtmledit.pas
字号:
FBgColor: TColor;
FBorderColor: TColor;
FWidth: Word;
FHeight: Word;
FAlign: THTMLAlign;
FVAlign: THTMLVAlign;
FNoWrap: Boolean;
FWidthInPercent: Boolean;
FHeightInPercent: Boolean;
public
constructor Create;
published
property Align: THTMLAlign read FAlign write FAlign default haDefault;
property VAlign: THTMLVAlign read FVAlign write FVAlign default haVDefault;
property Background: TFileName read FBackground write FBackground;
property BgColor: TColor read FBgColor write FBgColor default clNone;
property BorderColor: TColor read FBorderColor write FBorderColor default clNone;
property NoWrap: Boolean read FNoWrap write FNoWrap default False;
property Width: Word read FWidth write FWidth default 0;
property WidthInPercent: Boolean read FWidthInPercent write FWidthInPercent default False;
property Height: Word read FHeight write FHeight default 0;
property HeightInPercent: Boolean read FHeightInPercent write FHeightInPercent default False;
property ObjectClass: WideString read FClassName write FClassName;
end;
TProfDHTMLEditTagsSubstitutionItem = class(TCollectionItem)
private
FOriginalTag, FReplacementTag: WideString;
public
procedure Assign(Source: TPersistent); override;
published
property OriginalTag: WideString read FOriginalTag write FOriginalTag;
property ReplacementTag: WideString read FReplacementTag write FReplacementTag;
end;
{$IFNDEF VER120}{$IFNDEF VER125}{$IFNDEF VER130}{$IFNDEF VER140}{$IFNDEF VER150}{$IFNDEF VER170}{$IFNDEF VER180}
TOwnedCollection = class(TCollection)
private
FOwner: TPersistent;
protected
function GetOwner: TPersistent; override;
public
constructor Create(AOwner: TPersistent; ItemClass: TCollectionItemClass);
end;
{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}
TProfDHTMLEditTagsSubstitution = class(TOwnedCollection)
end;
THTMLFontSize = 0..7;
TTextSize = ( TextSizeSmallest, TextSizeSmaller, TextSizeMedium, TextSizeLarger, TextSizeLargest );
TJustify = ( JustifyNone, JustifyLeft, JustifyCenter, JustifyRight, JustifyFull );
TClear = ( ClearNone, ClearLeft, ClearRight, ClearBoth );
TProfDHTMLEditSourceCodeOption =
(
LowercaseElementNames,
TerminateEmptyElements,
AddSpaceInTerminatedEmptyElements,
TerminateComments,
LowercaseAttributeNames,
QuoteAttributeValues,
UnminimizeBooleanAttributes,
LowercaseStylePropertyNames,
UseEntityReferences,
Preserve8BitCharacters,
HideBaseElement,
ExcludeFileProtocol,
ExcludeBaseURL,
UseBackSlashAsPathDelimiter,
IndentSource,
AddNbsp
);
TProfDHTMLEditSourceCodeOptions = set of TProfDHTMLEditSourceCodeOption;
IHTMLChangeSink = interface(IUnknown) { Minimum availability Internet Explorer 5.5 }
['{3050F64A-98B5-11CF-BB82-00AA00BDCE0B}']
function Notify: HRESULT; stdcall;
end;
TCustomProfDHTMLEdit = class;
TProfDHTMLEditChangeSink = class(TInterfacedObject, IHTMLChangeSink)
private
FOwner: TCustomProfDHTMLEdit;
FCalling: Boolean;
function Notify: HRESULT; stdcall;
public
constructor Create(AOwner: TCustomProfDHTMLEdit);
end;
IHTMLChangeLog = interface(IUnknown) { Minimum availability Internet Explorer 5.5 }
['{3050F649-98B5-11CF-BB82-00AA00BDCE0B}']
function GetNextChange(pbBuffer: PByte; nBufferSize: Integer; out pnRecordLength: Integer): HRESULT; stdcall;
end;
TProfDHTMLEditDocumentCompleteReason =
(
dcrUndefined
, dcrCreate
, dcrTimeout
, dcrLoadURL
, dcrLoadFromFile
, dcrStop
, dcrClearUndo
, dcrOpenDialog
, dcrLoadURLError
{$IFDEF SUPPORT_VERSION_1}
, dcrEditMode
, dcrCreate2
, dcrNewDocument
, dcrNewDocument2
, dcrLoadFromFile2
, dcrOpenDialog2
, dcrSetSource
, dcrSetSource2
, dcrSetSource3
, dcrLoadURL2
, dcrClearUndo2
, dcrSetBaseURL
{$ENDIF}
);
TProfDHTMLEditPrivateMethod = function (const param: WideString): Boolean of object;
TCustomProfDHTMLEdit = class(TProfOleControl)
private
FTimeout: Double;
FDomStop: IDispatch;
FCapturedElement: IDispatch;
FHTMLChangeLog: IHTMLChangeLog;
FFindText: WideString;
FSaveBody: WideString;
FDOCTYPE: WideString;
FChangeSink: TProfDHTMLEditChangeSink;
FTableAttrs: TProfDHTMLEditTableAttrs;
FTableCellAttrs: TProfDHTMLEditTableCellAttrs;
FTagsSubstitution: TProfDHTMLEditTagsSubstitution;
FParagraphStyles: TStringList;
FUpdateCount: Integer;
FColumn: Integer;
FResizeColumn: Integer;
FColumnAdjust: Integer;
FRow: Integer;
FResizeRow: Integer;
FRowAdjust: Integer;
FCharCode: Word;
FSourceCodeOptions: TProfDHTMLEditSourceCodeOptions;
FDocumentCompleteReason: TProfDHTMLEditDocumentCompleteReason;
FIgnoreKeyDown, FIgnoreKeyUp: Byte;
FTableMouseLocation, FMouseMoveMouseLocation: Byte;
FUseBrOnCarriageReturn: Boolean;
FNeedRepairDiv, FNeedRepairBr: Boolean;
FMatchWholeWordsOnly, FMatchCase: Boolean;
FCursorOverriden, FTableColRowResizing, FTableResizingRow: Boolean;
FUseDOMJustify: Boolean;
FUseDOMStop: Boolean;
FWantTabs: Boolean;
{$IFNDEF VER100}{$IFNDEF VER110}
FSpellCheck: Byte;
FPaintSpellingErrors_Increment: Boolean;
FSpellInterfaceList: TInterfaceList;
FEMGETLINEWParam, FEMLINEINDEXWParam, FEMPOSFROMCHARWParam, FEMPOSFROMCHARLParam: Integer;
FEMCHARFROMPOSx, FEMCHARFROMPOSy: Integer;
FSpellMarkupPointerEMGETLINE, FSpellMarkupPointerEMLINEINDEX, FSpellMarkupServices,
FSpellTxtRange, FSpellMarkupPointer_End: IUnknown;
{$ENDIF}{$ENDIF}
FOnMouseLeave: TNotifyEvent;
FOnMouseEnter: TNotifyEvent;
FOnDisplayChanged: TNotifyEvent;
FOnCreate: TNotifyEvent;
FOnSetBaseURL: TNotifyEvent;
FOnSetBrowseMode: TNotifyEvent;
FOnNewDocument: TNotifyEvent;
FOnLoadURL: TNotifyEvent;
FOnLoadURLError: TNotifyEvent;
FOnStop: TNotifyEvent;
FOnSetSource: TNotifyEvent;
FOnOpenDialog: TNotifyEvent;
FOnLoadFromFile: TNotifyEvent;
FOnTimeout: TNotifyEvent;
FOnOpenDialogCancel: TNotifyEvent;
FOnChange: TNotifyEvent;
procedure ClickHandler(Sender: TObject);
procedure DblClickHandler(Sender: TObject);
procedure KeyDownHandler(Sender: TObject);
procedure KeyPressHandler(Sender: TObject);
procedure KeyUpHandler(Sender: TObject);
procedure MouseDownHandler(Sender: TObject);
procedure MouseUpHandler(Sender: TObject);
procedure MouseMoveHandler(Sender: TObject);
procedure MouseOverHandler(Sender: TObject);
procedure MouseOutHandler(Sender: TObject);
procedure DisplayChangedHandler(Sender: TObject);
procedure ReadyStateChangeHandler(Sender: TObject); virtual; abstract;
procedure RepairDiv;
procedure RepairBr;
procedure SetupRepairBr(const D: IDispatch; const AUndoHint: WideString);
function ApplySpanDivClass(Span: Boolean; const StyleClass: WideString): Boolean;
function RemoveSpanDivClass(Span: Boolean): Boolean;
function ToggleSpanDivClass(Span: Boolean; const StyleClass: WideString): Boolean;
function IsNormalStyle: Boolean;
procedure CreateTempParagraph;
procedure RemoveParagraph;
function CloseParagraph: Boolean;
function ToggleList(Ordered: Boolean): Boolean;
function GetTableMouseLocation(p: IDispatch): Integer;
procedure SetCursor(ACursor: TCursor);
procedure SaveBody;
procedure DoSetModified(Value: Boolean); virtual; abstract;
function GetSource2: WideString;
function GetHead2: WideString;
function GetBody2: WideString;
function UseSourceCodePreservation: Boolean; virtual; abstract;
function AdjustPreservedOuterHTML(const S: WideString): WideString;
procedure AdjustPreservedHead(var S: WideString);
procedure AdjustHead(var S: WideString);
function ParseOuterHTML(const P: IDispatch; const Level: Integer; const ElementList: TStringList; const D: IDispatch): WideString;
procedure AdjustText(var S: WideString);
procedure CheckAmpInLinks(var S: WideString);
procedure AddHeader(var S: WideString);
function DoClearUndo(AReason: TProfDHTMLEditDocumentCompleteReason): Boolean; virtual; abstract;
procedure CreateChangeLog;
procedure RaiseTimeout;
function CallAndWait(const dom_stop: IDispatch; const Code: TProfDHTMLEditDocumentCompleteReason; const Method: TProfDHTMLEditPrivateMethod; const param: WideString): Boolean; virtual; abstract;
function GetTRISTATE(const cmdID: WideString; cmdID1, cmdID2: DWORD): Boolean;
procedure DontSetAbout(const dummy: AnsiString);
procedure DontSetTableAttrs(dummy: TProfDHTMLEditTableAttrs);
procedure DontSetTableCellAttrs(dummy: TProfDHTMLEditTableCellAttrs);
procedure DontSetTagsSubstitution(dummy: TProfDHTMLEditTagsSubstitution);
function GetSource: WideString;
procedure SetSource(const Value: WideString); virtual; abstract;
procedure SetBaseURL(const Value: WideString); virtual; abstract;
procedure SetModified(Value: Boolean);
function GetBullets: Boolean;
procedure SetBullets(Value: Boolean);
function GetNumbering: Boolean;
procedure SetNumbering(Value: Boolean);
function GetFontName: WideString;
procedure SetFontName(const Value: WideString);
function GetFontHTMLSize: THTMLFontSize;
procedure SetFontHTMLSize(Value: THTMLFontSize);
function GetParagraphStyle: WideString;
procedure SetParagraphStyle(const Value: WideString);
function GetBgColor: TColor;
procedure SetBgColor(Value: TColor);
function GetBackground: TFileName;
procedure SetBackground(const Value: TFileName);
function GetBold: Boolean;
procedure SetBold(Value: Boolean);
function GetItalic: Boolean;
procedure SetItalic(Value: Boolean);
function GetUnderline: Boolean;
procedure SetUnderline(Value: Boolean);
function GetStrikeOut: Boolean;
procedure SetStrikeOut(Value: Boolean);
function GetJustify: TJustify;
procedure SetJustify(Value: TJustify);
function GetTextIndent: Integer;
procedure SetTextIndent(Pixels: Integer);
function GetLeftMargin: Integer;
procedure SetLeftMargin(Pixels: Integer);
function GetRightMargin: Integer;
procedure SetRightMargin(Pixels: Integer);
procedure SetTitle(const Value: WideString);
function GetForeColor: TColor;
procedure SetForeColor(Value: TColor);
function GetBackColor: TColor;
procedure SetBackColor(Value: TColor);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -