Class TWPTextObj

Hierarchy

System.TObject | TWPTextObj

Description

TWPTextObj is used as reference object. It can be linked to a graphic or used for bookmarks and hyperlinks.
Embedded TWPTextObj objects are used for various tasks and embedded graphics. In the paragraph, a reference to an object is stored. The object is not used directly since all objects are stored in the list handled by the RTFProps and can be shared between different RTFData objects. TWPTextObj is used as such a reference which can (but does not have to) to a shared object (Formerly PTTextObj!)
References to embedded objects are stored in the paragraphs which they are owned by. You can get a pointer to the reference at a certain position using the array ObjectRef[]; You can assign an object after it was was created or copied using CreateCopy or after it was detached from its previous owner using Unlink.

Implementation notes:
All objects are stored in the array FTextObjectRefs - the index+1 in this array is stored in a separate array as word - the ObjectIndex.
This makes it quicker to find a certain object in the text since not all paragraphs and all characters have to be searched. It also avoids leaking of TWPTextObj instances when object references are set to 0. Big Advantage: Since a TWPTextObj is unique to a paragraph it is possible to update that paragraph when the properties are changed. WPTools 4 used references which were globally allocated and it was possible to use them at different locations. So one was never certain at which paragraph an object was used.

Properties

Methods

Function GetStartTag(HostPar:TParagraph; Index:Integer) : TParagraph

Function GetText : string

Function GetWHFromContents(factor:Single) : Boolean

Procedure Initialize

Function InplaceEditor : TWPToolsInplaceEditorAbstractBase

Function IsBitmap : Boolean

Function IsEndTag : Boolean

Function IsFORMCHECKBOX : Boolean

Function IsImage(OrTextBox:Boolean) : Boolean

Function IsSelected : Boolean

Function IsStartTag : Boolean

Function LoadObjFromFile(FileName:string; DataCollection:TWPRTFDataCollectionBase) : Boolean

Function LoadObjFromGraphic(Graphic:TGraphic; DataCollection:TWPRTFDataCollectionBase) : Boolean

Function LoadObjFromStream(FileExt:string; Stream:TStream; DataCollection:TWPRTFDataCollectionBase) : Boolean

Function LoadVCLBase64(objclassname:string; Source:TMemoryStream) : TWPObject

Function LoadVCLBinary(objclassname:string; Source:TMemoryStream) : TWPObject

Procedure MakeExtra(createstrings:Boolean)

Procedure MakeStyle(createstyle:Boolean)

Function NameIs(aName:string) : Boolean

Function NewTag : Integer

Function SaveEmbeddedTextToStream(stream:TStream; FormatString:string; FFileExtension:string; ExcludingObjects:Boolean) : Boolean

Function ScaleWH(dw:Integer; dh:Integer) : Boolean

Function ScaleWHScreen(dw:Integer; dh:Integer; res:Integer) : Boolean

Function SelectEmbeddedText(AlsoSelectTags:Boolean) : Boolean

Function SetName(x:string) : TWPTextObj

Procedure SetTag(x:Integer)

Function StartTag : TWPTextObj

Function Unlink : TWPTextObj

Procedure UpdateSpecialTextFlags(InheritedParFlags:TWPSpecialCharacterAttrKinds; UseOpening:Boolean; UseClosing:Boolean)

Events

OnCheckProtection : Boolean= Boolean

This event is can be used to protect selected objects. It is used together with the ProtectedProp property. At least one flag must be used in ProtectedProp. If this event is specified the ppIsMailMerge and similar flags are overruled!
Set Result to TRUE if object may not be deletd, otherwise use TRUE

OnDestroy : TNotifyEvent= procedure (Sender : TObject) of Object

Use this event to make sure you don't use an invalid object

OnPaint : TWPTextObjPaintEvent= TWPTextObjPaintEvent

Use this event to create an owner draw object. The reference WPRichText.Memo._DoTextObjPaintCurrPage contains a pointer to the TWPVirtPage which is currently beeing painted. This reference can be used to calculate values "on the fly".

Used or referenced by

-Function WPGetFieldProp(aObj:TWPTextObj; Id:Integer; Value:WideString) : Boolean