WPTools Manual



Search


(press enter to search)

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 _FrameToInt : Integer

Procedure _IntToFrame(amode:Integer)

Procedure _IntToMode(amode:Integer)

Procedure _IntToRenderMode(amode:Integer)

Function _ModeToInt : Integer

Function _RenderModeToInt : Integer

Procedure _SetObjType(x:TWPTextObjType)

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

Procedure ConvertToSingularObj

Create

Function CreateCopy(ForParentParagraph:TParagraph) : TWPTextObj

Procedure DataWasChanged(Sender:TObject; UpdatedText:string)

Function DeleteExtraProp(Name:string) : Boolean

Destroy

Function EmbeddedTextAsFloat : Extended

Procedure EmbeddedTextWidthAndLength(width:Integer; len:Integer)

Function EndTag : TWPTextObj

Function EnumEmbeddedText(Mode:TWPTextObjEnumEmbeddedText; Callback:TWPTextObjEnumEmbeddedTextCallback; Data:TObject) : Boolean

Function FreeTheEndTag : Boolean

Function GetAlign : TTextObjAlign

Function GetContainedObject(OfTypes:TWPTextObjTypes; CompareName:string) : TWPTextObj

Function GetEmbeddedText : WideString

Function GetEmbeddedTextLength : Integer

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

Function GetExtraParam(Name:string; Default:string) : string

Function GetExtraProp(Name:string) : string

Function GetHeight : Integer

Function GetName_Spaces : string

Function GetObjRef : TWPObject

Function GetParentPosInPar : Integer

Function GetPositionMode : TTextObjType

Function GetRelX : Integer

Function GetRelY : Integer

Function GetSource : string

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

Function GetText : string

Function GetWHFromContents(factor:Single) : Boolean

Function GetWidth : Integer

Function HasExtraProp(Name:string) : 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

Procedure Set_Name(x:string)

Procedure SetAlign(x:TTextObjAlign)

Procedure SetEmbeddedText(x:WideString)

Procedure SetExtraProp(Name:string; Value:string)

Procedure SetHeight(x:Integer)

Function SetName(x:string) : TWPTextObj

Procedure SetName_Spaces(x:string)

Procedure SetObjFrame(x:TWPTextObjFrames)

Procedure SetObjMode(x:TWPTextObjModes)

Procedure SetObjRef(x:TWPObject)

Procedure SetParams(x:string)

Procedure SetParentRTFPage(x:Integer)

Procedure SetPositionMode(x:TTextObjType)

Procedure SetRelX(x:Integer)

Procedure SetRelY(x:Integer)

Procedure SetSource(x:string)

Procedure SetTag(x:Integer)

Procedure SetWidth(x:Integer)

Procedure SetWrap(x:TTextObjWrap)

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= procedure(Sender: TWPTextObj; OutCanvas: TCanvas; xres, yres: Integer; x, Y, w, h, BASE: TWPXYType ) of object;

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