Class TWPCustomRtfEdit
Hierarchy
System.TObject | System.Classes.TPersistent | System.Classes.TComponent | Vcl.Controls.TControl | Vcl.Controls.TWinControl | Vcl.Controls.TCustomControl | WPRTEDefs.TWPCustomRTFControl | TWPCustomRtfEdit
Subclasses
WPCTRMemo.TWPPreview | WPCTRRich.TWPCustomRichText | WPCTRStyleScroller.TWPStyleScroller
Description
>Description for Class TWPCustomRTFControl
Properties
Property AcceptFiles : Boolean
Property AcceptFilesOptions : TWPAcceptFilesOptions
Property ActiveFirstPar : TParagraph
Property ActiveLineLen : Integer
Property ActiveLineStart : Integer
Property ActiveParagraph : TParagraph
Property ActivePosInPar : Integer
Property ActiveSection : TWPRTFSectionProps
Property ActiveStyleName : string
Property ActiveText : TWPRTFDataBlock
Property AsString : string
Property AsWebpage : TWPWebPageFormat
Property AutomaticTextAttr : TCharacterAttr
Property AutoZoom : TWPAutoZoom
Property AutoZoomMin : Integer
Property AvailableDialogs : TWPCustomRtfEditDialogs
Property BevelEdges : TBevelEdges
Property BevelKind : TBevelKind
Property BodyText : TWPRTFDataBlock
Property BookmarkTextAttr : TCharacterAttrTags
Property BorderStyle : TBorderStyle
Property Canvas : TCanvas
Property CaretDisabled : Boolean
Property Cell[RowNr][ColNr] : TParagraph
Property ClickableCodes : TWPTextObjTypes
Property ClipboardOptions : TWPClipboardOptions
Property ClipboardOptionsEx : TWPClipboardOptionsEx
Property ColorDesktop : TColor
Property ColorDesktopTo : TColor
Property Columns : Integer
Property CPChar : Char
Property CPCharAttr : Cardinal
Property CPChars[index] : Char
Property CPColNr : Integer
Property CPLine : string
Property CPLineNr : Integer
Property CPLineNrLog : Integer
Property CPPage : Integer
Property CPPageLineNr : Integer
Property CPPar : string
Property CPParNr : Integer
Property CPPosInPar : Integer
Property CPPosition : Integer
Property CPPrevChar : Char
Property CPPrevWideChar : Char
Property CPWideChar : Char
Property CPWord : string
Property CPXPos : Integer
Property CPYPos : Integer
Property CurrentMouseButton : TMouseButton
Property CurrentZooming : Integer
Property CursorOnText : TWPRTFDataBlock
Property CustomSyntax : TWPAbstractCustomSyntax
Property DebugMode : TWPDebugMode
Property DefaultNumberIndent : Integer
Property DeskGradientHorizontal : Boolean
Property DisabledDialogsInPreview : TWPCustomRtfEditDialogs
Property DisplayedText : TWPRTFDataBlock
Property DropHandled : Boolean
Property EditBoxModes : TWPEditBoxModes
Property EditOptions : TWPEditOptions
Property EditOptionsEx : TWPEditOptionsEx
Property EditOptionsEx2 : TWPEditOptionsEx2
Property EditOptionsEx3 : TWPEditOptionsEx3
Property FieldObjectTextAttr : TCharacterAttr
Property Finder : TWPTextFinder
Property FirstPar : TParagraph
Property FMouseSelectCell : TParagraph
Property FMouseSizePar : TParagraph
Property FormatOptions : TWPFormatOptions
Property FormatOptionsEx : TWPFormatOptionsEx
Property FormatOptionsEx2 : TWPFormatOptionsEx2
Property FormatOptionsEx3 : TWPFormatOptionsEx3
Property FormCompletion : Boolean
Property FTextObjectUnderMouse : TWPTextObj
Property GraphicPopupMenu : TPopupMenu
Property HandleRichEditMsg : Boolean
Property HeaderFooter : TWPRTFDataCollection
Property HiddenTextAttr : TCharacterAttr
Property HideTableBorders : TWPHideTableBordersMode
Property HighLightColor : TColor
Property HighLightTextColor : TColor
Property HyperLinkCursor : TCursor
Property HyperlinkObj : TWPTextObj
Property HyperlinkTextAttr : TCharacterAttrTags
Property ImeMode : TImeMode
Property ImeName : TImeName
Property InBeforeChange : Boolean
Property InScrollTrackMode : Boolean
Property Inserting : Boolean
Property InsertPointAttr : TCharacterAttrTags
Property InWaitForPaintEditor : Boolean
Property KeyInLock : Boolean
Property LabelDef : TWPLabelDef
Property LastFileName : string
Property LastLoadPath : string
Property LastSavePath : string
Property LayoutMode : TWPLayoutMode
Property LeftOffset : Integer
Property Lines : TStrings
Property Memo : TWPRTFEnginePaint
Property Modified : Boolean
Property MouseMarginArea : TWPMouseMarginArea
Property MousePage : Integer
Property MouseX : Integer
Property MouseY : Integer
Property OneClickHyperlink : Boolean
Property PageColumns : Integer
Property PageCount : Integer
Property PageHintColor : TColor
Property PageMaxCount : Integer
Property PageMinCount : Integer
Property Pagenumber : Integer
Property PaperColor : TColor
Property PaperDefs : TWPPaperDefinitionCollection
Property PopupMenu : TPopupMenu
Property PrintParameter : TWPPrintParameter
Property ProtectedProp : TProtectProp
Property ProtectedTextAttr : TCharacterAttr
Property Readonly : Boolean
Property Resizing : Integer
Property Rows : Integer
Property RTFData : TWPRTFDataCollection
Property RTFText : TWPRTFBlobContents
Property RTFVariables : TWPRTFExtraDataCollection
Property ScrollBars : TScrollStyle
Property ScrollHorzMultiplicator : Single
Property ScrollVertMultiplicator : Single
Property SecurityOptions : TWPSecurityModes
Property SelectedObject : TWPTextObj
Property SelectionAsString : string
Property SelLength : Integer
Property SelRect : TRect
Property SelStart : Integer
Property SelText : string
Property ShowMergeFieldNames : Boolean
Property ShowPagenumber : Boolean
Property SinglePageMode : Boolean
Property SPANObjectTextAttr : TCharacterAttrTags
Property SpeechReconitionInterfaceMode : TWPSpeechReconitionInterfaceMode
Property SpellCheckStrategie : TWPSpellCheckStrategie
Property SpellIgnoredForObj : TWPTextObjTypes
Property TableAtEndOfCell : Boolean
Property TableCell : TParagraph
Property TableCellWidth : Integer
Property TableColCount : Integer
Property TableColNumber : Integer
Property TableRow : TParagraph
Property TableRowCount : Integer
Property TableRowNumber : Integer
Property text : string
Property TextColorCount : Integer
Property TextColorDefault : TColor
Property TextColors[Index] : TColor
Property TextLength : Integer
Property TextLoadFormat : string
Property TextLoadFormatClipboard : string
Property TextLoadSaveOptions : string
Property TextObjectCursor : TCursor
Property TextObjects : TWPObjectEnv
Property TextSaveFormat : string
Property TextSaveFormatClipboard : string
Property TopOffset : Integer
Property TopVisiblePar : TParagraph
Property Transparent : Boolean
Property ViewOptions : TWPViewOptions
Property ViewOptionsEx : TWPViewOptionsEx
Property ViewOptionsEx2 : TWPViewOptionsEx2
Property ViewPage : Integer
Property ViewRTFData : TWPRTFDataCollection
Property WantReturns : Boolean
Property WantTabs : Boolean
Property WordWrap : Boolean
Property WPDataSetAdapter : TWPDataSetAbstractAdapter
Property WPRTFPropsComponent : TWPRTFProps
Property WPTextObjectClasses : TWPTextObjectClasses
Property WriteObjectMode : TWPObjectWriteRTFModeGlobal
Property XBetween : Integer
Property XOffset : Integer
Property YBetween : Integer
Property YOffset : Integer
Property YOffsetNormal : Integer
Property Zooming : Integer
Methods
Procedure _BeforeChangeTopLeftOffset(offset_top:Integer; offset_left:Integer)
Function ActivePar : TParagraph
Function AddDynamicGrid(tablename:string; adapter:TWPDataSetAbstractAdapter; parent_grid:TParagraph; rowheigth:Integer; Options:TWPTableAddOptions; fieldlist:TStrings; RowGroupLevel:Integer; StyleForCells:TWPTextStyle; StyleForHeader:TWPTextStyle; StyleForFooter:TWPTextStyle; DoPrepareTemplateRow:TWPPrepareTemplateRow; TableAddCellCallBack:TWPTableAddCellEvent) : TParagraph
Procedure AddHistoryChar(aChar:Char)
Function AddParagraphs(type_outside:TWPParagraphType; count_inside:Integer; type_inside:TWPParagraphType; Options:TWPAddParagraphsOptions) : TParagraph
Function AddTable(colcount:Integer; lincount:Integer; Border:Boolean) : TParagraph
Procedure ADel(WPAT_Code:Byte)
Procedure AdjustPageXYToVisible(rtfpage:TWPVirtPage; X:Integer; Y:Integer)
Procedure AfterPrepareDoubleBuffer(Sender:TObject)
Function AGet(WPAT_Code:Byte; Value:Integer) : Boolean
Function AHasStyleDef(WPAT_Code:Integer) : Boolean
Function AppendAsSection(FromEditor:TWPCustomRtfEdit; Options:TWPAppendAsSectionOptions) : TWPRTFSectionProps
Function AsANSIString(FormatName:string; OnlySelection:Boolean; CellsAsParagraphs:Boolean) : AnsiString
Procedure ASet(WPAT_Code:Byte; Value:Integer)
Procedure ASetAdd(WPAT_Code:Byte; Value:Cardinal)
Procedure ASetDel(WPAT_Code:Byte; Value:Cardinal)
Procedure Assign(Source:TPersistent)
Procedure AssignPrintProperties(Source:TWPCustomRtfEdit)
Procedure AssignToFooter(Source:TObject; Range:TWPPagePropertyRange)
Procedure AssignToHeader(Source:TObject; Range:TWPPagePropertyRange)
Function AttrHelper : TWPStoredCharAttrInterface
Function BeginPrint(Title:string; StartPageNumber:Integer; aPrinter:TPrinter) : Boolean
Procedure BeginTable(TableName:string; trgap:Integer; l:Integer; r:Integer)
Procedure BeginUpdate(DisableReadonly:Boolean)
Function Bof : Boolean
Function BookmarkAtCP : TWPTextObj
Function BookmarkAtParLin(par:TParagraph; pos_in_par:Integer) : TWPTextObj
Function BookmarkAtXY(X:Integer; Y:Integer; Bookmark:TWPTextObj) : Boolean
Procedure BookmarkDelete(AName:string; Marks:Boolean; text:Boolean)
Procedure BookmarkDeleteAllMarkers
Function BookmarkDeleteInPar(NameStart:string; par:TParagraph) : Boolean
Procedure BookmarkDeleteMarkers(AName:string)
Function BookmarkFind(AName:string; DoGlobalSearch:Boolean) : Integer
Function BookmarkFirstInPar(par:TParagraph) : string
Function BookmarkFirstObjInPar(par:TParagraph) : TWPTextObj
Function BookmarkForceInPar(par:TParagraph; frmstr:string) : string
Procedure BookmarkGetList(list:TWPTextObjList; FromAllBlock:Boolean)
Function BookmarkInput(AName:string; PlaceCursorBetweenTags:Boolean) : TWPTextObj
Function BookmarkMoveTo(AName:string; DoGlobalSearch:Boolean) : Boolean
Function BookmarkMoveToNext(AName:string; FindAnyName:Boolean) : Boolean
Function BookmarkSelect(AName:string; OnlyText:Boolean) : Boolean
Procedure BrushStart(Mode:TWPFormatBrushMode)
Function CalcMousePageAtXY(WindowX:Integer; WindowY:Integer; UseMargins:Boolean) : Integer
Function CanObserve(ID:Integer) : Boolean
Function CanRedo : Boolean
Function CanUndo : Boolean
Function Changing : Boolean
Procedure CheckActiveText(CreateIfNecessary:Boolean)
Function CheckHasBody : Boolean
Procedure CleanTemporaryCharAttr
Procedure ClearEx(DontClearStyles:Boolean; DontResetPageSize:Boolean; ResetWritingAttr:Boolean)
Function ClearSelection(OverwriteProtection:Boolean; UpdateCursorPosition:Boolean) : Boolean
Function ClipbrdFormatName(cfFormat:Integer) : string
Procedure CMMouseEnter(Message:TMessage)
Procedure CMMouseLeave(Message:TMessage)
Function cmpFindInPar(Sender:TObject; par:TParagraph) : Boolean
Function cmpIsEmpty(Sender:TObject; par:TParagraph) : Boolean
Procedure CMRecreateWnd(Message:TMessage)
Function CodeDeletePairs(ObjType:TWPTextObjType; AName:string; Contents:Boolean) : Integer
Function CodeExistInText(Code:TWPTextObjType; GlobalSearch:Boolean; startpar:TParagraph) : Boolean
Function CodeInsideOf(X:Integer; Y:Integer; objtype:TWPTextObjType) : TWPTextObj
Function CodeListTags(Code:TWPTextObjType; AName:string; GlobalSearch:Boolean) : TWPTextObjList
Function CodeObjectAtXY(X:Integer; Y:Integer; Code:TWPTextObj) : Boolean
Function CodeSelectText(StartTag:TWPTextObj; IncludingTags:Boolean) : Boolean
Function CombineCells : Boolean
Function CombineCellsVertHorz : Boolean
Function CombineCellsVertically : Boolean
Function CombineTables : Boolean
Function ContextPopup : Boolean
Function ConvertTablesToText(poConversionMode:TWPConversionMode; psOther:string) : Integer
Function ConvertTableToText(poConversionMode:TWPConversionMode; psOther:string; aTable:TParagraph) : Boolean
Function ConvertToCPPosition(CountOfChar:Integer; CountForCR:Integer) : Integer
Function CopyAttr : string
Procedure CopyToClipboard(CompleteText:Boolean)
Procedure CopyToClipboardAttr(Mode:TWPFormatBrushMode)
Function CountLines : Integer
Function CountPages : Integer
Function CountParagraphs : Integer
Function CountWords : Integer
Function CPAttr : TWPTAttrEmulator
Function CPLogicalParagraphEnd : Integer
Function CPMoveBack : Boolean
Function CPMoveDownLine : Boolean
Function CPMoveDownPar : Boolean
Function CPMoveNext : Boolean
Function CPMoveTo(X:Integer; Y:Integer; DontLeaveDataBlock:Boolean) : Boolean
Function CPMoveToItem(Mode:TWPMoveItemMode; Previous:Boolean) : Boolean
Function CPMoveUpLine : Boolean
Function CPMoveUpPar : Boolean
Function CPPagenrAsDisplayed : Integer
Procedure CreateParams(Params:TCreateParams)
Function CurrentCharAttr : TWPCursorCharAttrInterface
Function CurrentEditField : string
Function DBChanging : Boolean
Function DefaultAttr : TWPOwnedCharAttrInterface
Procedure DelayedInvalidate(Code:Integer)
Procedure DelayedReformat(keepscrollposition:Boolean)
Procedure DeleteChar(Count:Integer)
Function DeleteColumn : Boolean
Procedure DeleteField(AName:string; Contents:Boolean)
Function DeleteFieldAtCP : Boolean
Procedure DeleteHyperlink(RemoveText:Boolean)
Function DeleteLeadingSpace(EmptyFieldsToo:Boolean; InFirstPar:Boolean) : Boolean
Procedure DeletePage(index:Integer)
Procedure DeleteParagraphBreaks(Mode:TWPDeleteParagraphBreakModes)
Function DeleteParWithCondition(Condition:TWPCheckParagraph) : Boolean
Function DeleteParWithEmptyFields : Boolean
Function DeleteParWithText(FindText:string) : Boolean
Function DeleteRow : Boolean
Function DeleteTable : Boolean
Function DeleteTrailingSpace(EmptyFieldsToo:Boolean; KeepPageBreakAtEnd:Boolean) : Boolean
Procedure DoAfterCompleteWordEvent(Key:Char)
Procedure DoAfterInitializeRTFDataObject(Sender:TObject)
Function DoAutoScroll(X:Integer; Y:Integer) : Boolean
Procedure DoBroadcastMsg(Sender:TWPRTFEngineEdit; Code:Integer; Param:TObject)
Procedure DoChangeZooming(Sender:TObject)
Procedure DoClick(PageNo:Integer; X:Integer; Y:Integer)
Procedure DoClickCreateHeaderFooter(Kind:TWPPagePropertyKind; Range:TWPPagePropertyRange)
Procedure DoClickEvent(PageNo:Integer; X:Integer; Y:Integer; Ignore:Boolean)
Procedure DoClickPage(PageNr:Integer)
Function DoClickPageHoverLink(aLinkObject:TObject) : Boolean
Procedure DoContextPopup(MousePos:TPoint; Handled:Boolean)
Procedure DoDblClick(PageNo:Integer; X:Integer; Y:Integer; Mode:TWPDoDblClickMode)
Procedure DoEndDrag(Target:TObject; X:Integer; Y:Integer)
Procedure DoHyperlinkEvent(openObj:TWPTextObj)
Procedure DoInitializedRTFData(Sender:TObject)
Procedure DoInitializeRTFDataObject(Sender:TObject)
Procedure DoMeasureTextPage(Sender:TObject; PageInfo:TWPMeasurePageParam)
Function DoMiddleButtonScroll(X:Integer; Y:Integer) : Boolean
Function DoMouseWheelDown(Shift:TShiftState; MousePos:TPoint) : Boolean
Function DoMouseWheelUp(Shift:TShiftState; MousePos:TPoint) : Boolean
Function DontAllowLeaveRTFDataBlock : Boolean
Procedure DoPaintDesktopBackground(Sender:TObject; Canvas:TCanvas; r:TRect)
Procedure DoPaintEnd(Sender:TObject)
Procedure DoPaintStart(Sender:TObject; ThisDoubleBuffer:TBitmap)
Procedure DoQueryDrag(doIt:Boolean; X:Integer; Y:Integer)
Procedure DoStartDrag(DragObject:TDragObject)
Procedure DoUpdate(WPUPD_Code:Integer; Param:Integer)
Procedure DoUpdateState(State:TWPEditBoxLinkMsg)
Procedure DragDrop(Source:TObject; X:Integer; Y:Integer)
Procedure DragOver(Source:TObject; X:Integer; Y:Integer; State:TDragState; Accept:Boolean)
Function DynObjectMoveTo(DynObj:TWPDynamicObject; par:TParagraph; posinpar:Integer) : Boolean
Procedure EMREPLACESEL(Message:TMessage)
Function EndPrint(aPrinter:TPrinter) : Boolean
Procedure EnumText(Callback:TWPEnumTextCallback; Mode:TWPEnumTextModes; AllTexts:Boolean)
Function Enviroment : TWPToolsBasicEnviroment
Function Eof : Boolean
Function ExitEditor : Boolean
Function FastAppendActiveLine(Source:TWPCustomRtfEdit) : Boolean
Function FastAppendText(Source:TWPCustomRtfEdit; AsNewSection:Boolean; Mode:TWPFastAppendTextMode) : TWPRTFSectionProps
Procedure FastAppendTextParID(Source:TWPCustomRtfEdit; id:Integer; ProtectedFlag:Boolean)
Procedure FastAppendTextWithParID(Source:TWPCustomRtfEdit; id:Integer)
Function FieldAtCP(aField:TWPTextObj) : Boolean
Function FieldExists(FieldName:string) : Boolean
Function FieldGetInPar(par:TParagraph; posinpar:Integer) : TWPTextObj
Procedure FieldGetList(list:TWPTextObjList; FromAllBlock:Boolean; NameStartWith:string)
Function FieldGetNameInPar(par:TParagraph; posinpar:Integer) : string
Procedure FieldGetNames(list:TStrings; FromAllBlock:Boolean)
Function FieldLocate(FieldName:string; fieldcommand:string; FromStart:Boolean; Modes:TWPFieldLocateOptions) : TWPTextObj
Function FieldReadText(FieldName:string) : string
Function FieldRename(OldName:string; NewName:string; FromAllBlocks:Boolean; CaseSensitive:Boolean) : Integer
Function FindCell(paragraphname:string) : TParagraph
Function FindNext : Boolean
Function FindParagraph(paragraphname:string) : TParagraph
Function FindParWithText(searchtext:string) : TParagraph
Function FindTable(TableName:string) : TParagraph
Function FindTextBoxPar(name:string; AutoCreate:TWPTextBoxAutoCreate) : TParagraph
Function FixFontsOfText(RelacementFonts:; Charset:Integer) : Integer
Function FontListAssign(list:TStrings; Modes:TWPFontListAssignMode) : Integer
Function FooterText(Range:TWPPagePropertyRange) : TWPRTFDataBlock
Function FootNoteAtCP : TWPTextObj
Function FootnoteFindNext : Boolean
Function FootnoteFindPrior : Boolean
Procedure FootnoteGetList(list:TWPTextObjList; FromAllBlock:Boolean)
Function FootNoteInsert(nr:Integer; str:string) : TWPTextObj
Procedure FrameLine(Mode:TWPFrameLineMode; ScreenPos:Integer)
Function GetActiveText : TWPRTFDataBlock
Function GetAsStringA : RawByteString
Procedure GetCellCommands(list:TStrings)
Procedure GetCellNames(list:TStrings)
Procedure GetCharAttr(Lock:TThreeState)
Function GetCodeTags(list:TWPTextObjList; Code:TWPTextObjType; AName:string; GlobalSearch:Boolean) : Boolean
Function GetColorNr(aColor:TColor) : Integer
Function GetCpLineNrLog : Integer
Function GetCPPageLineNr : Integer
Function GetCPXYPoint(ScreenPoint:TPoint) : Boolean
Function GetEditLink(editlink:IWPEditLinkCheck) : Boolean
Function GetEditLinkEx(editlink:IWPEditLinkCheck; par:TParagraph) : Boolean
Function GetFontName(nr:Integer) : TFontName
Function GetFontNr(AName:TFontName) : Integer
Function GetHistoryChars(Count:Integer) : string
Function GetImageAtXY(X:Integer; Y:Integer; img_x:Integer; img_y:Integer; img_w:Integer; img_h:Integer) : TWPTextObj
Function GetLineFromXY(ScreenX:Integer; ScreenY:Integer; par:TParagraph; posinpar:Integer) : Boolean
Function GetLogCPPos : Integer
Function GetLogParPos(cppos:Integer; par:TParagraph; posinpar:Integer) : Boolean
Function GetModified : Boolean
Function GetObjectFromXY(ScreenX:Integer; ScreenY:Integer; TextObject:TWPTextObj) : Boolean
Function GetObjXYBottomlineScreen(obj:TWPTextObj; X:Integer; Y:Integer; right_pos:Boolean) : Boolean
Function GetPagesAsString(FromPage:Integer; ToPage:Integer; format:string) : string
Procedure GetPaperBins(aPrinter:TPrinter; list:TStrings; FirstName:string)
Function GetPar(ParIndex:Integer) : TParagraph
Function GetParXYBaselineScreen(par:TParagraph; posinpar:Integer; X:Integer; Y:Integer) : Boolean
Function GetPointFromParLin(par:TParagraph; posinpar:Integer) : TPoint
Procedure GetPosition(Pos:Integer; lin:Integer; par:Integer; pos_in_par:Integer)
Function GetReadOnly : Boolean
Function GetRTFEngine : TWPRTFEngineBasis
Procedure GetSelectedCells(All:TList; Outer:TList)
Function GetSelectionAsStringA : RawByteString
Function GetSelPosLen(Pos:Integer; len:Integer) : Boolean
Function GetSelStartEnd(startpar:TParagraph; startpos:Integer; endpar:TParagraph; endpos:Integer) : Boolean
Function GetStyleNameForNr(StyleNr:Integer) : string
Function GetStyleNrForName(StyleName:string) : Integer
Function GetTextBuf(Buffer:PAnsiChar; BufSize:Integer) : Integer
Function GetTextFast : string
Function GetTextLen : Integer
Function GetTextObjectClasses : TWPTextObjectClasses
Function GetUNICODE(OnlySelection:Boolean) : WideString
Function GetXPositionTw : Integer
Function GetYPositionTw : Integer
Procedure GotoBody(LastLine:Boolean)
Function HandleDynObj(DynObj:TWPDynamicObject; X:Integer; Y:Integer; Touch:Boolean) : Boolean
Function HeaderText(Range:TWPPagePropertyRange) : TWPRTFDataBlock
Function HideParWithCondition(Condition:TWPCheckParagraph; DontShowOther:Boolean) : Boolean
Function HideSelection : Boolean
Function HyperlinkAtCP : TWPTextObj
Function HyperlinkConvertOldWPT3Links(OnlyIfHiddenTextWasFound:Boolean) : Integer
Function HyperlinkMoveTo(AName:string) : Boolean
Function HyperlinkSelect(URL:string; OnlyText:Boolean) : Boolean
Procedure ImageGetList(list:TWPTextObjList; FromAllBlock:Boolean)
Function InputCode(Code:TWPTextObjType; AName:string; Command:string; Options:TWPInputCodeOptions) : TWPTextObj
Function InputEditField(FieldName:string; DisplayText:string; PlaceCaret:Boolean; Command:string; format:Integer) : TWPTextObj
Function InputFootnote(InitText:string; Mode:TWPInputFootnoteModes) : TWPTextObj
Function InputHyperlink(URL:string) : TWPTextObj
Function InputInplaceEdit(EditName:string; InplaceClass:string; FieldWidth:Integer; FieldHeight:Integer; EditText:string; EditCommand:string; Params:string) : TWPTextObj
Function InputMergeField(FieldName:string; DisplayText:string; Command:string; format:Integer; DisplayChar:Char) : TWPTextObj
Function InputNewObject(objtype:TWPTextObjType; HasClosing:Boolean; IsClosing:Boolean; CharAttrIndex:Cardinal) : TWPTextObj
Function InputObject(obj:TWPObject) : TWPTextObj
Function InputParagraph(Count:Integer) : TParagraph
Function InputParagraphBand(ParagraphType:TWPParagraphType) : TParagraph
Function InputSection(Select:TWPRTFSectionPropsSelect; Mode:TWPInputSectionMode) : TWPRTFSectionProps
Function InputSingleCode(Code:TWPTextObjType; AName:string; Command:string) : TWPTextObj
Function InputSpanObjects(Attributes:TWPAbstractCharAttrInterface) : TWPTextObj
Procedure InputString(text:string; CodePage:Integer; PreserveSelectionAttr:Boolean)
Procedure InputStringInt(Value:Integer)
Procedure InputStringW(text:WideString; PreserveSelectionAttr:Boolean)
Function InputSymbol(unicodes:WideString; FontName:string; SkipLowUnicodes:Boolean) : TWPTextObj
Function InputTextbox(InitString:AnsiString; w:Integer; h:Integer; activate:Boolean; relx:Integer; rely:Integer) : TWPTextObj
Function InputTextField(Typ:TWPTextFieldType; FieldMask:string; FieldParams:string) : TWPTextObj
Function InputTextFieldName(FieldName:string; FieldMask:string; FieldParams:string) : TWPTextObj
Function InputTextProtection(Options:TWPInputCodeOptions) : TWPTextObj
Function InsertColumn(Before:Boolean) : Boolean
Function InsertPar : TParagraph
Function InsertRow : Boolean
Function InsertRowAbove : Boolean
Function InTable : Boolean
Function InternalCreateRTFEngine : TWPRTFEnginePaint
Function IsEmpty : Boolean
Function IsFirstLine : Boolean
Function IsLastLine : Boolean
Function IsLinkAtParPos(par:TParagraph; pos_in_par:Integer) : string
Function IsSelected : Boolean
Procedure KeyDown(Key:Word; Shift:TShiftState)
Function LoadCSSFile(CSSFileName:string; Merge:Boolean) : Integer
Function LoadCSSheet(StyleString:string; Merge:Boolean) : Integer
Function LoadFromBuffer(Buffer:PAnsiChar; bufferlen:Integer; FormatName:string; WithClear:Boolean) : Boolean
Function LoadFromFile(FileName:string; WithClear:Boolean; FormatName:string) : Boolean
Function LoadFromStream(s:TStream; FormatName:string; WithClear:Boolean) : Boolean
Function LoadFromString(X:WideString; FormatString:string; WithClear:Boolean) : Boolean
Procedure LoadPropertiesFromDFM
Function LoadSelectionFromFile(aFileName:string; FormatName:string; SelectText:Boolean) : Boolean
Function LoadSelectionFromStream(s:TStream; FormatName:string; SelectText:Boolean) : Boolean
Function LockRichtext : Boolean
Procedure LockScreen(allowpaint:Boolean; lock_cursorpos:Boolean)
Procedure MailMergeCallBack(Sender:TObject; inspname:string; Contents:TWPMMInsertTextContents)
Function MayLeaveRTFDataBlock(NewBlock:TWPRTFDataBlock) : Boolean
Procedure MergeActiveText(FieldName:string)
Procedure MergeEnumFields(FieldName:string; AllTexts:Boolean)
Procedure MergeText(FieldName:string; fieldcommand:string; AllTexts:Boolean)
Procedure MouseDown(Button:TMouseButton; Shift:TShiftState; X:Integer; Y:Integer)
Procedure MouseMove(Shift:TShiftState; X:Integer; Y:Integer)
Procedure MouseUp(Button:TMouseButton; Shift:TShiftState; X:Integer; Y:Integer)
Function MovePosition(how:TWPMoveMode; DoSelection:Boolean) : Boolean
Function MoveToCell(col:Integer; row:Integer; TableName:string) : Boolean
Function MoveToField(FieldName:string; from_start:Boolean) : Boolean
Function MoveToNextField(from_start:Boolean) : string
Function MoveToPreviousField(from_end:Boolean) : string
Function MoveToTable(TableName:string) : Boolean
Procedure NormalizeText(NormalizeTextMode:TWPNormalizeTextMode)
Procedure Notification(AComponent:TComponent; Operation:TOperation)
Function NrToColor(ColorIndex:Integer) : TColor
Function NumberStyles : TWPRTFNumberStyleCollection
Procedure ObserverAdded(ID:Integer; Observer:IObserver)
Procedure ObserverToggle(AObserver:IObserver; Value:Boolean)
Procedure OnToolBarSelection(Sender:TObject; Typ:TWpSelNr; str:string; num:Integer)
Function OpenCodeAt(par:TParagraph; posinpar:Integer; CheckedCodes:TWPTextObjTypes) : TWPTextObj
Function OpenCodeAtCP(Code:TWPTextObjType) : TWPTextObj
Function OpenCodes(par:TParagraph; posinpar:Integer; list:TWPTextObjList; CheckedCodes:TWPTextObjTypes; MaxCount:Integer) : TWPTextObj
Function OpenCodesAtCP(list:TWPTextObjList; Codes:TWPTextObjTypes) : TWPTextObj
Function OpenCodesAtCPDepth(Code:TWPTextObjType) : Integer
Function OpenDialog(DialogType:TWPCustomRtfEditDialog; Param:string) : Boolean
Procedure PaintBevels(Message:TWMNCPaint)
Procedure PaintTo(DC:HDC; X:Integer; Y:Integer)
Function ParStyleCPMoveTo(StyleName:string) : Boolean
Function ParStyleLocateFirst(StyleName:string; startpar:TParagraph) : Boolean
Function ParStyleMarkForReformat(StyleName:string) : Integer
Function ParStyleNormalizePar(StyleName:string) : Integer
Function ParStylePaint(StyleName:string; toCanvas:TCanvas; r:TRect) : Integer
Function ParStyles : TWPRTFStyleCollection
Procedure PasteAttr(atr:string)
Procedure PasteFromClipboard(Mode:TWPPasteTextMode)
Function PendingUpdate(WPUPD_Code:Integer) : Boolean
Function Print(aPrinter:TPrinter) : Boolean
Function PrintBottomPos : Integer
Function Printing : Boolean
Function PrintPages(FromPage:Integer; ToPage:Integer; aPrinter:TPrinter) : Boolean
Procedure ProcessDelayedUpdates
Procedure ProcessScrollEvent(Message:TWMScroll; vertical:Boolean)
Function ReadHyperlink(link:string; stamp:string) : Boolean
Function RecalcText(pars:Boolean; fields:Boolean) : Boolean
Function Redo : Boolean
Procedure Refresh(SpellCheck:Boolean)
Function RefreshAniImages : Boolean
Function SaveChanging : Boolean
Procedure SaveCSSFile(CSSFileName:string)
Function SaveCSSheet : string
Function SaveSelectionToStream(s:TStream; FormatName:string) : Boolean
Function SaveToFile(FileName:string; SelectionOnly:Boolean; FormatName:string) : Boolean
Function SaveToStream(s:TStream; FormatName:string) : Boolean
Function SaveToString(FormatName:string; OnlySelection:Boolean) : WideString
Procedure ScrollLinePos(par:TParagraph; posinpar:Integer; LimitScrolling:Boolean)
Procedure ScrollToPosition(Pos:Integer; RelX:Integer; RelY:Integer)
Procedure SelectCell(par:TParagraph; Add:Boolean)
Function SelectedTextAttr : TWPSelectedTextAttrInterface
Function SelectFieldAtCP(IncludingTags:Boolean; PlaceCursorBetweenTags:Boolean) : Boolean
Function SelectPage(PageNr:Integer) : Boolean
Function SelectPages(startpage:Integer; endpage:Integer) : Boolean
Procedure SelectParagraph(par:TParagraph)
Function SelectWordAtXY(X:Integer; Y:Integer; Extend:Boolean) : Boolean
Procedure SetActiveStyleName(X:string)
Procedure SetAsStringA(X:RawByteString)
Procedure SetFocusValues(Always:Boolean)
Procedure SetImageMode(Mode:TWPSetImageMode)
Procedure SetInnerCellBorders(Activate:Boolean; BorderWidth:Integer; Mode:TWPParagraphBordApply)
Procedure SetInWaitForPaintEditor(X:Boolean)
Procedure SetModified(Value:Boolean)
Procedure SetOuterCellBorders(Activate:Boolean; BorderWidth:Integer; Mode:TWPParagraphBordApply)
Function SetParStyle(X:string) : TWPRTFStyleElement
Procedure SetPosition(topos:Integer; tolin:Integer; topar:Integer; topos_in_par:Integer)
Procedure SetPositionXY(X:Integer; Y:Integer)
Procedure SetReadOnly(Value:Boolean)
Procedure SetRTFData(RTFData:TWPRTFDataCollection)
Procedure SetRTFDataOrProps(NewRTFData:TWPRTFDataCollection; NewRTFProps:TWPRTFProps)
Procedure SetScrollBarSize(horz:Boolean)
Procedure SetSelectionAsStringA(X:RawByteString)
Procedure SetSelPosLen(Pos:Integer; len:Integer; UpdateDisplay:Boolean)
Procedure SetTextObjectClasses(x:TWPTextObjectClasses)
Procedure SetUNICODE(data:WideString; InsertText:Boolean)
Procedure SetWPRTFPropsComponent(X:TWPRTFProps)
Procedure SetZoom(ZoomValue:string)
Procedure SetZoomMode(ZoomShortcutValue:Integer)
Function Spell_GetNextWord : string
Procedure Spell_IgnoreWord(AWord:string; MarkCorrect:Boolean)
Procedure Spell_ReplaceWord(s:string)
Procedure Spell_SelectWordXY(X:Integer; Y:Integer)
Function Spell_TopPosition : Integer
Function SplitCells(Before:Boolean) : Boolean
Function SplitCellsVertically : Boolean
Function SplitRow(mode:TWPSplitRowMode) : Boolean
Function SplitTable(PushApart:Boolean) : Boolean
Function StartSpellCheck(Mode:TWPStartSpellcheckMode) : Boolean
Procedure StartUpdate(WPUPD_Code:Integer; Param:Integer)
Function TableAdd(colcount:Integer; RowCount:Integer; Options:TWPTableAddOptions; StyleForNewCells:TWPTextStyle; CallBackForText:TWPTableAddCellEvent; StyleForHeader:TWPTextStyle; StyleForFooter:TWPTextStyle; WidthSourceRow:TParagraph; RowGroupLevel:Integer) : TParagraph
Procedure TableAdjustCellWidth(MinimumRightMargin:Integer)
Procedure TableFixAllCellWidths(SnapValue:Integer)
Procedure TableMakeCellWidthPC(AlsoSetTableWidthPC:Boolean)
Function TabstopAdd(PosInTwips:Integer; Kind:TTabKind; FillMode:TTabFill; FillColor:Integer) : Boolean
Function TabstopDelete(PosInTwips:Integer) : Boolean
Function TextCursor : TWPRTFDataCursor
Function TextHeight(resolution:Integer) : Integer
Procedure TextObjectsGetList(list:TWPTextObjList; ObjTypes:TWPTextObjTypes; FromAllBlock:Boolean)
Function TextWidth(resolution:Integer) : Integer
Function Undo : Boolean
Procedure UndoBufferSaveTo(aStyle:TWPTextStyle; Typ:TWPUndoType; Kind:TWPUndoKind)
Procedure UndoSaveState(Kind:TWPUndoKind)
Procedure UnLockScreen(RestoreScrollPosition:Boolean)
Procedure UpdateControlsPosition(hide_all:Boolean)
Procedure UpdateOnlyThisEditor
Procedure UpdatePrinterProperties(aPrinter:TPrinter; PaintPageNr:Integer; pw:Integer; ph:Integer)
Procedure UpdateThemedColors(mode:TWPUpdateThemedColorsMode)
Procedure WM_EM_GETSEL(Message:TMessage)
Procedure WM_EM_SETSEL(Message:TMessage)
Procedure WM_WPEM_EXGETSEL(Message:TMessage)
Procedure WM_WPEM_EXSETSEL(Message:TMessage)
Procedure WM_WPEM_GETCHARFORMAT(Message:TMessage)
Procedure WM_WPEM_GETTEXTRANGE(Message:TMessage)
Procedure WM_WPEM_SETCHARFORMAT(Message:TMessage)
Procedure WMClear(Message:TMessage)
Procedure WMCopy(Message:TMessage)
Procedure WMCut(Message:TMessage)
Procedure WMDropFiles(Msg:TWMDropFiles)
Procedure WMEraseBkgnd(Message:TWMEraseBkgnd)
Procedure WMGetDlgCode(Message:TWMNoParams)
Procedure WMGETTEXT(Message:TMessage)
Procedure WMGetTextLength(Message:TWMNoParams)
Procedure WMHScroll(Message:TWMScroll)
Procedure WMIMEComposition(Message:TMessage)
Procedure WMIMEEndComposition(Message:TMessage)
Procedure WMIMENOTIFY(Message:TMessage)
Procedure WMIMEStartComposition(Message:TMessage)
Procedure WMKillFocus(Message:TWMKillFocus)
Procedure WMNCPaint(Message:TWMNCPaint)
Procedure WMPaint(Message:TWMPaint)
Procedure WMPaste(Message:TMessage)
Procedure WMSetFocus(Message:TWMSetFocus)
Procedure WMSETTEXT(Message:TMessage)
Procedure WMTimer(Message:TMessage)
Procedure WMVScroll(Message:TWMScroll)
Procedure WMWPTOOLSUPDATE(Message:TMessage)
Procedure WndProc(Message:TMessage)
Events
AfterCompleteWordEvent : TWPAfterCompleteWordEvent= TWPAfterCompleteWordEvent
AfterCopyToClipboard : TWPAfterCopyToClipboardEvent= TWPAfterCopyToClipboardEvent
AfterDelayedUpdate : TWPOnDelayedUpdate= TWPOnDelayedUpdate
>AfterImageSaving : TWPAfterImageSaving= TWPAfterImageSaving
AfterLoadText : TNotifyEvent= procedure (Sender : TObject) of Object
AfterObjectSelection : TNotifyWPTextObjEvent= TNotifyWPTextObjEvent
>AfterPaintDesktopBackground : TWPOnPaintDesktopBackground= procedure(Sender: TObject; Canvas : TCanvas; R : TRect) of object;
AfterPasteImage : TWPOnAfterPasteImage= TWPOnAfterPasteImage
BeforeChange : TWPBeforeChangeEvent= TWPBeforeChangeEvent
BeforeCopyText : TOnBeforeCopyEvent= TOnBeforeCopyEvent
>BeforeCutText : TOnBeforeCopyEvent= TOnBeforeCopyEvent
>BeforeDestroyPaintPage : TWPBeforeDestroyPaintPage= procedure( Sender: TObject; RTF - Engine RTFEngine: TWPRTFEngineEdit; var ExternPageRef: TObject; var WatermarkRef: TObject) of object;
>BeforeDropText : TWPOnBeforeDropText= TWPOnBeforeDropText
>BeforeEditBoxNeedFocus : TWPAbortNotifyEvent= TWPAbortNotifyEvent
>BeforeInitializePar : TWPInitializeParEvent= procedure(Sender: TObject; RTFEngine: TWPRTFEngineBasis; RTFDataBlock: TWPRTFDataBlock; Par: TParagraph) of object;
This example hides paragraphs which contain empty merge fields and spaces only:
if par.HasObjects(false,[wpobjMergeField]) and
not par.IsNonSpace([wpobjMergeField]) then
include(par.prop, paprHidden)
else exclude(par.prop, paprHidden);
This code applies a special character style to bookmarked text. It needs a global integer variable "charstyleid".
var i : Integer;
inner_book : TWPTextObj;
begin
// This only done once!
if charstyleid=0 then
with WPRichText1.ParStyles.Add('CH1') do
begin
TextStyle.ASetColor( WPAT_CharBGColor, clGreen);
TextStyle.ASetCharStyle(tsTRUE, WPSTY_BOLD );
charstyleid := id;
end;
for I := 0 to par.CharCount-1 do
begin
inner_book := WPRichText1.CodeInsideOf(par,i,wpobjBookmark);
if inner_book>nil then
begin
WPRichText1.AttrHelper.CharAttr := par.CharAttr[i];
WPRichText1.AttrHelper.ASet(WPAT_CharStyleSheet, charstyleid );
par.CharAttr[i] := (par.CharAttr[i] and $FF000000) or
WPRichText1.AttrHelper.CharAttr;
end;
end;
end;
BeforeObjectSelection : TNotifyWPTextObjEventIgnore= TNotifyWPTextObjEventIgnore
>BeforeOverwriteFile : TWPBeforeOverwriteFile= TWPBeforeOverwriteFile
BeforePaintLayer : TWPInternBeforePaintLayerEvent= TWPInternBeforePaintLayerEvent
if InEditor and IsEditing and (RTFData.Kind = wpIsOwnerSelected) then
begin
Canvas.Brush.Style := bsSolid;
Canvas.Brush.Color := $eaefea;
Canvas.FillRect(r);
end;
BeforePasteImage : TWPOnBeforePasteImage= TWPOnBeforePasteImage
The property InsertedObj is assigned when the event BeforePasteImage has been triggered for images which are part of pasted RTF text. If an image was pasted as object loaded from the clipboard, InsertedObj will be nil since the event happens before the bitmap is actually inserted into the text.
BeforePasteText : TWPOnBeforePaste= TWPOnBeforePaste
This Example changes the attributes of the inserted text to 'Courier, 10.5, blue':
procedure TForm1.WPRichText1BeforePasteText(Sender: TObject;
RTFData: TWPRTFDataCollection; par: TParagraph; Stream: TStream;
Reader: TWPCustomTextReader; OnlyBodyText: Boolean;
var LoadedText: TWPRTFDataBlock);
var i : Integer;
CharAttrIndex : Cardinal;
begin
// This is an example to change the format
// of all inserted text to a given font and size
// 'AttrHelper' is our working horse to create the attribute
RTFData.RTFProps.AttrHelper.Clear;
RTFData.RTFProps.AttrHelper.SetFontName('Courier New');
RTFData.RTFProps.AttrHelper.SetFontSize(10.5);
RTFData.RTFProps.AttrHelper.SetColor(clBlue);
CharAttrIndex := RTFData.RTFProps.AttrHelper.CharAttr;
// At this point we can calculate another CharAttrIndex
while par>nil do
begin
for i:=0 to par.CharCount-1 do
begin
par.CharAttr[i] := CharAttrIndex;
end;
par := par.next;
end;
end;
This example converts a hyperlink before it is pasted:
procedure TForm1.WPRichText1BeforePasteText(Sender: TObject;
RTFData: TWPRTFDataCollection; par: TParagraph; Stream: TStream;
Reader: TWPCustomTextReader; OnlyBodyText: Boolean;
var LoadedText: TWPRTFDataBlock);
var
s : string;
a : Cardinal;
begin
if (par.Next=nil)
and (par.StartWithW('http://') or par.StartWithW('https://'))
and not par.HasText(#32)
then
begin
s := par.GetText(false, false);
a := par.CharAttr[0];
par.ClearText;
par.AppendNewObjectPair(wpobjHyperlink,'link',a).Source := s;
end;
end;
BeforeResize : TNotifyEvent= procedure (Sender : TObject) of Object
HyperLinkEvent : THyperLinkEvent= THyperLinkEvent
OnActivateHint : TWPActivateHintEvent= TWPActivateHintEvent
>OnActivatingHotStyle : TWPActivatingHotStyle= procedure(Sender: TObject; par: TParagraph; posinpar: Integer) of object;
>OnCalcPageNr : TWPOnCalcPageNr= procedure( Sender: TWPRTFEngineEdit; TextObject: TWPTextObj; RTFPageNr, PaintPageNr: Integer; var PrintedPageNr: Integer) of object;
Note, if the var PrintedPageNr is set to 0 nothing will be printed!
OnChange : TNotifyEvent= procedure (Sender : TObject) of Object
OnChangeCursorPos : TNotifyEvent= procedure (Sender : TObject) of Object
OnChangeLastFileName : TNotifyEvent= procedure (Sender : TObject) of Object
>OnChangeSelection : TNotifyEvent= procedure (Sender : TObject) of Object
>OnChangeViewMode : TNotifyEvent= procedure (Sender : TObject) of Object
OnChangeZooming : TNotifyEvent= procedure (Sender : TObject) of Object
OnCheckProtection : TWPCheckProtectedEvent= TWPCheckProtectedEvent
>OnClear : TNotifyEvent= procedure (Sender : TObject) of Object
OnClick : TWPCustomRtfEditClick= TWPCustomRtfEditClick
>OnClickCreateHeaderFooter : TWPClickCreateHeaderFooterEvent= TWPClickCreateHeaderFooterEvent
OnClickHotText : TWPClickHotTextEvent= TWPClickHotTextEvent
OnClickPage : TOnClickPageEvent= TOnClickPageEvent
>OnClickText : TWPClickTextEvent= TWPClickTextEvent
>OnCustomLinePaintAfter : TWPVirtPagePaintEvent= TWPVirtPagePaintEvent = procedure(Sender: TObject; RTFEngine: TWPRTFEngineBasis; param: TWPVirtPagePaintParam; EndOfPageRun: Boolean) of object;
The following example draws a line around each paragraph or consecuative paragraphs starting with one which contains $start and ends with one which containes $end.
procedure Form1.WPRichText1CustomLinePaintAfter(Sender: TObject;
RTFEngine: TWPRTFEngineBasis; Param: TWPVirtPagePaintParam;
EndOfPageRun: Boolean);
var r: TRect; par: TParagraph;
begin
if not EndOfPageRun then
begin
if Param.Tag = 0 then
begin
par := Param.Par;
if par.HasText('$start') then
begin
while par > nil do
begin
if par.HasText('$end') then
break;
par := par.next;
end;
Param.UseUntilIncludingPar := par;
end;
end;
Param.Tag := 1;
Param.CallAgainToClose := TRUE;
end
else
begin
r := Param.UnionRect;
Param.Canvas.Brush.Style := bsClear;
Param.Canvas.Pen.COlor := clRed;
Param.Canvas.Pen.Width := 0;
Param.Canvas.Rectangle(
r.Left, r.Top, r.Right, r.Bottom);
end;
end;
Note: The API UnionRect() deals differently with rectangle which have a height of 0 than Param.UnionRect!.
OnCustomLinePaintBefore : TWPVirtPagePaintEvent= TWPVirtPagePaintEvent = procedure(Sender: TObject; RTFEngine: TWPRTFEngineBasis; param: TWPVirtPagePaintParam; EndOfPageRun: Boolean) of object;
This example code will draw brackets into the left margin to show how paragraphs are linked together using the KeepN property:
procedure TWPTBXForm.WPRichText1CustomLinePaintBefore(Sender: TObject;
RTFEngine: TWPRTFEngineBasis; Param: TWPVirtPagePaintParam;
EndOfPageRun: Boolean);
var r: TRect; o: Integer; par: TParagraph; thiskeep, prevkeep, nextkeep: Boolean;
begin
if (Param.Par.ParentTable = nil) and (Param.PaintingInEditor) then
begin
if not EndOfPageRun then
begin
Param.CallAgainToClose := TRUE; // Make sure we get that EndOfPageRun!
end else
begin
par := Param.Par.prev;
prevkeep := (par > nil) and (par.AGetDef(WPAT_ParKeepN, 0) = 1);
thiskeep := Param.par.AGetDef(WPAT_ParKeepN, 0) = 1;
nextkeep := TRUE;
par := Param.Par.next;
if (par = nil) or (par.AGetDef(WPAT_ParKeepN, 0) = 0) then
begin
nextkeep := FALSE;
end;
r := Param.UnionRect;
o := 30;
Param.Canvas.Pen.Width := 0;
Param.Canvas.Pen.Color := clRed;
if thiskeep and not prevkeep then
begin
Param.Canvas.MoveTo(r.Left, r.Top);
Param.Canvas.LineTo(r.Left - o, r.Top);
end;
if thiskeep or prevkeep then
begin
Param.Canvas.MoveTo(r.Left - o, r.Top);
Param.Canvas.LineTo(r.Left - o, r.Bottom);
end;
if not thiskeep and prevkeep and not nextkeep then
begin
Param.Canvas.MoveTo(r.Left - o, r.Bottom);
Param.Canvas.LineTo(r.Left, r.Bottom);
end;
end;
end;
end;
OnDblClick : TWPCustomRtfEditClick= TWPCustomRtfEditClick
>OnDeactivateHotStyle : TWPDeactivateHotStyle= procedure(Sender: TObject) of object;
>OnDelayedUpdate : TWPOnDelayedUpdate= TWPOnDelayedUpdate
OnDrawUnderline : TWPOnDrawUnderlineEvent= procedure( Sender : TObject; Engine: TWPRTFEnginePaint; Stage : TWPDrawStage; Canvas: TCanvas; R : TRect; SpecialTextFlags: TWPSpecialCharacterAttrKinds; BaseY : Integer; var LineMode : Integer; var LineColor: TColor; PaintMode : TWPPaintModes; xres,yres : Integer; par : TParagraph; posinpar : Integer; var Ignore : Boolean ) of Object;
Example:
procedure TWPMiniEd.DoDrawUnderline(
Sender : TObject;
Engine: TWPRTFEnginePaint;
Stage : TWPDrawStage;
Canvas: TCanvas;
R : TRect;
SpecialTextFlags: TWPSpecialCharacterAttrKinds;
BaseY : Integer;
var LineMode : Integer;
var LineColor: TColor;
PaintMode : TWPPaintModes;
xres,yres : Integer;
par : TParagraph;
posinpar : Integer;
var Ignore : Boolean
);
var obj : TWPTextObj;
begin
if (wpHyperlink in SpecialTextFlags) and (wpDrawBackground in Stage) then
begin
obj := par.ObjectRef[posinpar];
if (obj=nil) or (obj.ObjType>wpobjHyperlink) then
obj := (Sender as TWPRichText).CodeInsideOf(par,posinpar,wpobjHyperlink);
if (obj>nil) and (Pos('wpcubed.com',obj.Source)>0) then
Canvas.Brush.Color := $FAAAFA
else Canvas.Brush.Color := $FAAAAA;
Canvas.Rectangle(r);
end;
end;
OnDropFile : TWPOnDropFileEvent= TWPOnDropFileEvent
>OnEditBoxChangeHeight : TWPChangeBoxEvent= TWPChangeBoxEvent
OnEditBoxChangeWidth : TWPChangeBoxEvent= TWPChangeBoxEvent
OnEditFieldCheckInputString : TWPEditFieldCheckInputStringEvent= procedure( Sender : TObject; field : TWPTextObj; var text : WideString; var abort : Boolean) of Object;
OnEditFieldFocus : TWPEditFieldFocusEvent= TWPEditFieldFocusEvent
>OnEditFieldGetSize : TWPEditFieldGetSize= TWPEditFieldGetSize
>OnEditStateChanged : TEditStateEvent= TEditStateEvent
>OnGetAttributeColor : TWPGetAttrColorEvent= procedure( Sender: TObject; var CharStyle: TCharacterAttr; par: TParagraph; posinpar: Integer) of object;
procedure TWPMiniEd.WPRichText1GetAttributeColor(Sender: TObject;
var CharStyle: TCharacterAttr; par: TParagraph; posinpar: Integer);
begin
if CharStyle.CharStyle=wpInsertpoints then
begin
CharStyle.BackgroundColor := clYellow;
CharStyle.UseBackgroundColor := true;
end;
end;
In the event you can modify the flag "AlsoUseForPrintout" which defaults to the setting in the special text property. Only if AlsoUseForPrintout is true, the setting will be used at printtime.If you
OnGetPageGapText : string= string
OnGetSpecialText : TWPOnGetSpecialTextEvent= TWPOnGetSpecialTextEvent
OnHyperlinkObjGetTextEx : TWPOnTextObjGetTextEvent= procedure( RefCanvas: TCanvas; TXTObject: TWPTextObj; var PrintString: WideString; var WidthInPix: Integer; var HeightInPix: Integer; var PaintObject: TWPTextObj; Xres, YRes: Integer) of object;
The event will only be triggered if FormatOptions include the flag wpShowHyperlinkCodes!
OnInitializedRTFData : TWPOnInitializeRTFDataObjectEvent= TWPOnInitializeRTFDataObjectEvent
OnInitializeRTFDataObject : TWPOnInitializeRTFDataObjectEvent= TWPOnInitializeRTFDataObjectEvent
Alternatively you can assign a global TWPRTFProps object to make different RTF editors work with different texts but the same properties, such as style and color tables:
WPGlobalRTFProps : TWPRTFProps; // global variable
// in the main form, the MDI parent
procedure TWPGlobalStyle.FormCreate(Sender: TObject);
begin
// Inititialize WPGlobalRTFProps
WPGlobalRTFProps := TWPRTFProps.Create(nil);
end;
// in the MDI child:
procedure TWPGlobalStyleChild.WPRichText1InitializeRTFDataObject(
Sender: TObject; var RTFDataObject: TWPRTFDataCollection;
var RTFPropsObject: TWPRTFProps);
begin
RTFPropsObject := WPGlobalRTFProps;
end;
OnInternPaintPar : TWPInternPaintParEvent= TWPInternPaintParEvent
// Color paragraphs which are inside of an bookmark
procedure TForm1.WPRichText1InternPaintPar(Sender: TObject;
Stage: TWPInternPaintParEventStage; Editor: TWPRTFEnginePaint;
var LineData: TWPVirtPageImageLineRef; ThisRTFpage: TWPVirtPage;
Par: TParagraph; LineNr: Integer; Canvas: TCanvas; var ParColorOverride,
TextColorOverride: TColor; var AnyObject: TObject; var IgnoreOutput: Boolean); begin
if (Stage=wpBeforeLineText) and
not Par.HasObjects(false, [wpobjBookmark]) and
(WPRichText1.CodeInsideOf(par,0,wpobjBookmark)=nil)
then
begin
Canvas.Brush.Color := clLime;
Canvas.FillRect(Rect(LineData.x, LineData.Y, LineData.x+LineData.w, LineData.Y+LineData.h));
end;
end;
// Check each character in a line and color background
var i, l, x : Integer;
inner_book : TWPTextObj;
begin
if (Stage=wpBeforeLineText) then
begin
Canvas.Brush.Color := clLime;
l := par.LineLength(LineNr);
i := Par.LineOffset(LineNr);
x := LineData.x;
while l>0 do
begin
inc(x, par.CharPos[i].xoff);
inner_book := WPRichText1.CodeInsideOf(par,i,wpobjBookmark);
if inner_book>nil then
begin
// set color based on inner_book.Name
Canvas.FillRect(Rect(x, LineData.Y, x+par.CharPos[i].Width, LineData.Y+LineData.h));
end;
inc(i);
dec(l);
end;
end;
end;
OnLeaveRTFDataBlock : TWPLeaveRTFDataBlockEvent= TWPLeaveRTFDataBlockEvent
This code will disable the editing of any footer text:
procedure TForm1.WPRichText1LeaveRTFDataBlock(Sender: TObject; FromBlock,
ToBlock: TWPRTFDataBlock; var Allowed: Boolean);
begin
Allowed := ToBlock.Kind > wpIsFooter;
end;
Please note: If the anchor of a text box is in the header and the tex box is clicked, the header will be activated anyway. This is necessary because otherwise reizing and moving would not be possible. You can use EditOptionsEx2: wpDontSelectImageInOnMailMergeGetText : TWPMailMergeGetTextEvent= TWPMailMergeGetTextEvent
OnMeasureTextPage : TWPMeasurePageEvent= procedure(Sender: TObject; PageInfo: TWPMeasurePageParam) of object;
OnMouseDown : TMouseEvent= TMouseEvent
>OnMouseDownWord : TWPMouseDownRightEvent= TWPMouseDownRightEvent
OnMouseEnter : TNotifyEvent= procedure (Sender : TObject) of Object
>OnMouseLeave : TNotifyEvent= procedure (Sender : TObject) of Object
>OnMouseUp : TMouseEvent= TMouseEvent
>OnNewRTFDataBlock : TWPNewRTFDataBlockEvent= TWPNewRTFDataBlockEvent
procedure TForm1.WPRichText1NewRTFDataBlock(Sender: TObject;
RTFDataBlock: TWPRTFDataBlock);
begin
if RTFDataBlock.Kind=wpIsBody then
begin
// a) Set first paragraph attribute
// RTFDataBlock.FirstPar.ASetColor(WPAT_CharColor, clRed);
// RTFDataBlock.FirstPar.ASetFontName('Courier New');
// b) Set default character attribute
RTFDataBlock.RTFProps.AttrHelper.Clear;
RTFDataBlock.RTFProps.AttrHelper.SetFontName('Times new Roman');
RTFDataBlock.RTFProps.AttrHelper.SetFontSize(9.5);
RTFDataBlock.FirstPar.LoadedCharAttr :=
RTFDataBlock.RTFProps.AttrHelper.CharAttr;
// c) create a default text
RTFDataBlock.FirstPar.SetText('Please type here ...');
end;
end;
OnOpenDialog : TWPCustomRtfEditDialogEvent= TWPCustomRtfEditDialogEvent
procedure TForm1.WPRichText1OpenDialog(Sender: TObject;
DiaType: TWPCustomRtfEditDialog; var ResultValue: Boolean);
begin
if DiaType in [wpdiaSectionPageSetup, wpdiaPageSetup] then
begin
WPPagePropDlg1.Execute;
ResultValue := true;
end else
if DiaType=wpdiaTabstops then
begin
WPTabDlg1.Execute;
ResultValue := true;
end;
end;
wpTriggerOpenDialogForSectionProps must be used in EditOptionsExOnPaint : TNotifyEvent= procedure (Sender : TObject) of Object
OnPaintDesktopBackground : TWPOnPaintDesktopBackground= procedure(Sender: TObject; Canvas : TCanvas; R : TRect) of object;
procedure TForm1.WPRichText1PaintDesktopBackground(Sender: TObject;
Canvas: TCanvas; R: TRect);
begin
// This would paint the TWPRichText, too - but TWPRichText is locked for repaint during this event
AdvOfficePager1.PaintTo(Canvas, -WPRichText1.Left, -WPRichText1.Top);
end;
OnPaintExternPage : TWPOnPaintExternPageEvent= procedure( Sender: TObject; RTFEngine: TWPRTFEnginePaint; prCanvas: TCanvas; xoff, yoff: Integer; r: TRect; PaintPageNr: Integer; ExternPageRef: TObject; DestXRes, DestYRes: Integer) of object;
procedure TWPExternalP.WPRichText1PaintExternPage(Sender: TObject;
RTFEngine: TWPRTFEnginePaint; prCanvas: TCanvas; xoff, yoff: Integer;
r: TRect; PaintPageNr: Integer; ExternPageRef: TObject; DestXRes,
DestYRes: Integer);
begin
prCanvas.StretchDraw( r, ExternPageRef as TGraphic );
end;
This code adds external pages to the document:
var PageRef : TWPRTFExternPageRef;
begin
// We add a page at a certain location. The data object we added
// Is freed automatically unless we set in the
// returned TWPRTFExternPageRef object the property DontFreeExternPage
// to true
PageRef := WPRichText1.Memo.ExternPageRefAdd(
wpAsPageX,
PageNr,
0,
aPage,
nil
);
// This values are optional
PageRef.PageWidth := MulDiv( pw, 1440, WPScreenPixelsPerInch);
PageRef.PageHeight := MulDiv( ph, 1440, WPScreenPixelsPerInch);
end;
OnPaintPageHint : TWPPaintPageHintEvent= TWPPaintPageHintEvent
OnPaintTextFrameRect : TWPPaintTextFrameRect= procedure( Sender : TObject; Engine: TWPRTFEnginePaint; Canvas: TCanvas; PageNr : Integer; FrameNr : Integer; Page : TWPVirtPage; x1,y1,x2,y2 : Integer; Options : Pointer; var Done : Boolean ) of Object;
Canvas.Brush.Style := bsSolid;
Canvas.Brush.Color := $fffffa;
Canvas.FillRect(Rect(x1,y1,x2,y2));
OnPaintWatermark : TWPOnPaintWatermarkEvent= procedure( Sender: TObject; RTFEngine: TWPRTFEnginePaint; toCanvas: TCanvas; PageRect: TRect; PaintPageNr: Integer; RTFPageNr: Integer; WaterMarkRef: TObject; XRes, YRes: Integer; CurrentZoom: Single; PaintMode: TWPPaintModes) of object;
uses ... WPRTEPaint, WPRTEDefsConsts, WPRTEEdit;
procedure TForm2.WPRichText1PaintWatermark(Sender: TObject;
RTFEngine: TWPRTFEnginePaint; toCanvas: TCanvas; PageRect: TRect; PaintPageNr,
RTFPageNr: Integer; WaterMarkRef: TObject; XRes, YRes: Integer;
CurrentZoom: Single; PaintMode: TWPPaintModes);
begin
// You can also draw an image in the background
// toCanvas.StretchDraw(PageRect, Image1.Picture.Graphic);
BackgroundRTF.Memo.OverridePageCount := WPRichText1.PageCount;
BackgroundRTF.Memo.OverridePageOffset := PaintPageNr;
BackgroundRTF.PaintPageOnCanvas(
0,
PageRect.Left,
PageRect.Top,
PageRect.Width,
PageRect.Height,
toCanvas,
[wppGrayAll, wppGrayHeaderFooter, wppWhiteIsTransparent ],
0,
0,
-1,
-1,
[wpNoViewPortAPI, // Internally used
wpNoViewPortOrgAPI]
);
end;
OnPrepareImageforSaving : TWPPrepareImageforSavingEvent= TWPPrepareImageforSavingEvent
procedure TForm1.WPRichText1PrepareImageforSaving(
RTFData: TWPRTFDataCollection; Writer: TWPCustomTextWriter;
TextObject: TWPTextObj; var DontSave: Boolean);
begin
// use WPIOHTML, WPOBJ_IMAGE
if (Writer is TWPHTMLWriter) and TextObject.IsImage and
(TextObject.Source='') and (TextObject.ObjRef.FileName='') and
(TextObject.ObjRef.StreamName='') then
begin
TextObject.ObjRef.FileName :=
TextObject.ObjRef.SaveToFile(Writer.SavePath,Writer.SaveName,'_img%d');
end;
end;
note: To clean up you can use the event AfterImageSaving.OnPrepareParForPaint : TWPInitializeParEvent= procedure(Sender: TObject; RTFEngine: TWPRTFEngineBasis; RTFDataBlock: TWPRTFDataBlock; Par: TParagraph) of object;
OnPrintPage : Boolean= Boolean
Result := WPRichText1.PaintPageOnCanvas(n - 1, xoff, yoff,
0, 0, Printer.Canvas, Mode, 0,
0, -1, -1, []);
OnQueryDrag : TWPQueryDragEvent= TWPQueryDragEvent
OnRequestHTTPImage : TWPRequestHTTPImageEvent= TWPRequestHTTPImageEvent
OnRequestHTTPString : TWPRequestHTTPStringEvent= TWPRequestHTTPStringEvent
OnRequestStyle : TWPOnRequestStyleEvent= TWPOnRequestStyleEvent
>OnResize : TNotifyEvent= procedure (Sender : TObject) of Object
OnSearchReplaceMessage : TWPSearchReplaceMessageEvent= TWPSearchReplaceMessageEvent
OnSetFocus : TNotifyEvent= procedure (Sender : TObject) of Object
OnSetupPrinterEvent : TWPSetupPrinterEvent= TWPSetupPrinterEvent
OnStartSpellCheck : TWPStartSpellcheckEvent= TWPStartSpellcheckEvent
>OnTestForLinkEvent : TWPTestForLinkEvent= TWPTestForLinkEvent
procedure TForm1.DoTestLink(Sender: TObject; par : TParagraph;
var posinpar, len : Integer; var IsLink : Boolean);
var s : string;
begin
if par.CompareW(posinpar,'http://') then IsLink := TRUE;
end;
OnTextObjectClick : TTextObjectClickEvent= TTextObjectClickEvent
procedure TForm1.WPRichText1TextObjectClick(Sender: TWPCustomRtfEdit;
pobj: TWPTextObj; obj: TWPObject; var Ignore: Boolean);
begin
if (obj>nil) and
((WPRichText1.TextCursor.SelectedObject>pobj)
or (GetAsyncKeyState(VK_CONTROL) 0)
)then
obj.Edit;
end;
procedure TForm1.WPRichText1TextObjectDblClick(Sender: TWPCustomRtfEdit;
pobj: TWPTextObj; obj: TWPObject; var Ignore: Boolean);
begin
if (obj>nil) then
begin
obj.Edit;
Ignore := true;
end;
end;
OnTextObjectDblClick : TTextObjectClickEvent= TTextObjectClickEvent
>OnTextObjectMouseDown : TTextObjectMouseEvent= TTextObjectMouseEvent
>OnTextObjectMouseMove : TTextObjectMouseEvent= TTextObjectMouseEvent
>OnTextObjectMouseUp : TTextObjectMouseEvent= TTextObjectMouseEvent
>OnTextObjectMove : TTextObjectResizeEvent= TTextObjectResizeEvent
>OnTextObjectMovePosition : TTextObjectResizeEvent= TTextObjectResizeEvent
OnTextObjectPaint : TWPTextObjectPaintEvent= procedure( Sender: TObject; pobj: TWPTextObj; toCanvas: TCanvas; XRes, YRes: Integer; X, Y, W, H, BASE: Integer; PageRef: TWPVirtPage; Modes: TWPTextObjectPaintModes; const CanvasExtraAttr: TWPPaintExtraParams; var ContinueMode: TWPTextObjectPaintResult) of object;
procedure TForm1.WPRichText1TextObjectPaint(Sender: TObject; pobj: TWPTextObj;
toCanvas: TCanvas; XRes, YRes, X, Y, W, H, BASE: Integer;
PageRef: TWPVirtPage; Modes: TWPTextObjectPaintModes;
const CanvasExtraAttr: TWPPaintExtraParams;
var ContinueMode: TWPTextObjectPaintResult);
var mem : TMemoryStream;
begin
if (pobj.Name>'') and pobj.IsImage then
begin
mem := TMemoryStream.Create;
Placeholder.Picture.Bitmap.SaveToStream(mem);
mem.Position := 0;
pobj.LoadObjFromStream(
'BMP',
mem
);
mem.Free;
pobj.Name := ''; // dont call me again
end;
end;
Please note that the "Sender" ofd this event is the innner Memo control of type TWPRTFEnginePaint, not the TWPRichText.OnTextObjGetTextEx : TWPOnTextObjGetTextEvent= procedure( RefCanvas: TCanvas; TXTObject: TWPTextObj; var PrintString: WideString; var WidthInPix: Integer; var HeightInPix: Integer; var PaintObject: TWPTextObj; Xres, YRes: Integer) of object;
It can be used to to calculate dynamic contents for text objects. You can access the current page as WPRichText.Memo._MeasureObjectCurrPage. This reference may be nil! You can also read the current page number: WPRichText.Memo._CurrPaintedObjPageNumber
You can either pass a result value and / or paint the string directly.
procedure TForm1.OnPaintSum(Sender: TWPTextObj; OutCanvas: TCanvas; xres, yres: Integer; x, Y, w, h, BASE: Integer);
begin
if Sender.NameIs('anyname') then
begin
OutCanvas.TextOut(X+w-OutCanvas.TextWidth(Sender.Params),Y+base,Sender.Params);
end;
end;
procedure TForm1.WPRichText1TextObjGetTextEx(RefCanvas: TCanvas;
TXTObject: TWPTextObj; var PrintString: WideString; var WidthInPix,
HeightInPix: Integer; var PaintObject: TWPTextObj; Xres, YRes: Integer);
begin
if TXTObject.NameIs('anyname') then
begin
PrintString := ' ';
PaintObject := TXTObject;
TXTObject.Params := '99.12';
PaintObject.OnPaint := OnPaintSum;
end;
end;
This example code will render date and time fields as MS Word would do. It requires the "Source" to hold the format in the form \@ d. mmmmm yyyyy
procedure TWPMiniEd.WPRichText1TextObjGetTextEx(RefCanvas: TCanvas;
TXTObject: TWPTextObj; var PrintString: WideString; var WidthInPix,
HeightInPix: Integer; var PaintObject: TWPTextObj; Xres, YRes: Integer);
var s : string;
begin
// Interpret \@ d. mmmmm yyyyy
if (Pos('\@',TXTObject.Source)>0) and TXTObject.NameIs('TIME') or TXTObject.NameIs('DATE') then
begin
s := Trim(StringReplace( TXTObject.Source, '\@', '', [rfReplaceAll]));
s := AnsiDequotedStr(s,'"');
PrintString := FormatDateTime(s, Now);
end;
end;
This event allows it to intercept the drawing, measuring and evaluation of a text object.
If you are using the FireMonkey edition of wptools
OnToolBarSelectionEvent : TWPToolBarSelectionEvent= TWPToolBarSelectionEvent
>OnUndoStateChanged : TNotifyEvent= procedure (Sender : TObject) of Object
>OnUpdateExternScrollbar : TWPUpdateExternScrollbar= TWPUpdateExternScrollbar
Example:
// Update the position of the scrollbar
procedure TForm1.WPRichText1UpdateExternScrollbar(
Sender: TWPCustomRtfEdit; ScrollBar: TScrollStyle; Range, Page,
Pos: Integer);
begin
if ScrollBar=ssVertical then
begin
ScrollBar1.PageSize := Page;
ScrollBar1.Max := Range;
ScrollBar1.Position := Pos;
end;
end;
// Change position when Scroll event happens
procedure TForm1.ScrollBar1Scroll(Sender: TObject;
ScrollCode: TScrollCode; var ScrollPos: Integer);
begin
WPRichText1.TopOffset := Round(ScrollPos / WPRichText1.ScrollVertMultiplicator);
end;
OnWorkOnTextChanged : TNotifyEvent= procedure (Sender : TObject) of Object
>Used or referenced by
-Function TWPSuperMerge.GetEditor : TWPCustomRTFControl |
-Function TWPSuperMerge.GetEditor : TWPCustomRTFControl |
-Procedure TWPCustomAttrDlg.ChangeApplied(aEditBox:TWPCustomRtfEdit) |