Overview of the ParaStatus object

Build 1501 on 14/Nov/2017  This topic last edited on: 10/Oct/2016, at 13:07

Objects belonging to the ParaStatus class represent the typographical attributes of paragraphs of a text, i.e. all the attributes that determine how a paragraph will be set: leading, indents, quadding etc.

ParaStatus objects are implemented by TedLib.dll. It is possible to create to create ParaStatus objects from any 32 bit application - including The Shell - but they are useful only when editing a text, so only in Ted and Fred.

ParaStatus can be obtained from a text being edited using the GetParaStatus, GetParaParaStatus and GetDefaultParaStatus functions, e.g:

Dim objPS = Text.GetParaStatus

A ParaStatus objects has a number of properties, each one corresponding to a paragraph typographical attribute. Each one of these properties can be set - modifying the corresponding attribute - or queried - returning the value of the corresponding attribute.

Each one of these properties can also be 'without value'. This happens when the corresponding typographical attribute has not been set, or it has multiple values, or it has been explicitely chose as 'don't change' in a dialog.

Attempts to query the value of a property that does not have a value causes a run-time error in the execution of the script.

For each one of the main properties there is a boolean function that specifies if the corresponding property has a value. The name of these boolean functions is the same of the properties prefixed with 'Has', so the Leading property holds the paragraph's leading and the HasLeading function returns true if Leading has a value.

Each attribute property has a value either if the text has no selection, or if the correponding attribute has the same value in each of the selected paragraphs, e.g.:

Dim objPS = Text.GetParaStatus

If Not objPS.HasLeading Then

 MsgBox ("The selected text contains multiple paragraphs with different leadings")

Else

If Text.TestTextSelection Then

   MsgBox ("The selected paragraoh(s) uses the leading " & objPS.Leading)

Else

   MsgBox ("The current paragraph has the leading " & objPS.Leading)

End If

End If

The values that are assigned to attribute properties are validated: attempts to assign invalid values causes run-time errors. So it is not possible to assign to the Leading property a negative value.

One last example to put everything together, the following simple script modifies the seleced paragraphs to be centered and without hyphenation:

dim objPS = Text.GetParaStatus

objPS.App = 1

objPS.LastApp = 1

objPS.Hyp = False

Text.SetParaStatus (objPS)