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
Property Align : TTextObjAlign
Property CParam : Integer
Property EmbeddedText : WideString
Property EmbeddedTextLength : Integer
Property Extra : TStringList
Property ExtraProp[const Name] : string
Property Frame : TWPTextObjFrames
Property Height : Integer
Property IParam : Integer
Property Mode : TWPTextObjModes
Property Name : string
Property Name_Spaces : string
Property ObjClass : string
Property Params : string
Property ParentPar : TParagraph
Property ParentPosInPar : Integer
Property ParentRTFPage : Integer
Property PositionMode : TTextObjType
Property RelX : Integer
Property RelY : Integer
Property RenderMode : TWPTextObjTextRenderMode
Property Source : string
Property StyleName : string
Property Tag : Integer
Property Width : Integer
Methods
Function _FrameToInt : Integer
Procedure _IntToFrame(amode:Integer)
Procedure _IntToMode(amode:Integer)
Procedure _IntToRenderMode(amode:Integer)
Function _ModeToInt : Integer
Function _RenderModeToInt : Integer
Procedure _SetObjType(x:Integer)
Procedure _SetRelXUntranslated(x:Integer)
Procedure _SetRelYUntranslated(x:Integer)
Function AGetWPSS(NoClassAndStyle:Boolean; HandleUTF8:Boolean) : AnsiString
Procedure ASetWPSS(aWPCSSString:AnsiString; HandleUTF8:Boolean)
Procedure Assign(Source:TWPTextObj)
Function Attach(Par:TParagraph) : Integer
Procedure BeforeDisplay(DestCanvas:TCanvas; r:TRect)
Function BeforeFormat : Boolean
Function BeforeFree : Boolean
Function CompareName(aCompareName:string) : Boolean
Function CompareSource(aText:string) : Boolean
Function CreateCopy(ForParentParagraph:TParagraph) : TWPTextObj
Procedure DataWasChanged(Sender:TObject; UpdatedText:string)
Function EmbeddedTextAsFloat : Extended
Procedure EmbeddedTextWidthAndLength(width:Integer; len:Integer)
Function GetContainedObject(OfTypes:TWPTextObjTypes) : TWPTextObj
Function GetEndTag(HostPar:TParagraph; Index:Integer) : TParagraph
Function GetExtraParam(Name:string; Default:string) : string
Function GetStartTag(HostPar:TParagraph; Index:Integer) : TParagraph
Function GetText : string
Function GetWHFromContents(factor:Single) : Boolean
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 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
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 |