InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SnpEstimateTextDepth Class Reference

Public Member Functions

 SnpEstimateTextDepth ()
 
virtual ~SnpEstimateTextDepth ()
 
ErrorCode EstimateTextDepth (const InterfacePtr< ITextParcelList > &textParcelList, ParcelKey fromParcelKey, int32 numberOfParcels, PMReal &estimatedDepth)
 
ErrorCode EstimateStoryDepth (const InterfacePtr< ITextModel > &textModel, PMReal &estimatedDepth)
 
ErrorCode EstimateFrameDepth (const InterfacePtr< ITextFrameColumn > &textFrameColumn, PMReal &estimatedDepth)
 
ErrorCode EstimateParcelDepth (const InterfacePtr< IParcel > &parcel, PMReal &estimatedDepth)
 
bool16 IsStoryOverset (InterfacePtr< ITextModel > textModel)
 
bool16 IsTextFrameOverset (const InterfacePtr< ITextFrameColumn > textFrameColumn)
 
bool16 IsParcelOverset (const InterfacePtr< IParcel > parcel)
 
IParcelQueryParcelContaining (ITextModel *textModel, const TextIndex at)
 
InDesign::TextRange GetParcelTextRange (IParcel *parcel)
 
WideString GetWideStringFromTextRange (const InDesign::TextRange &range)
 
WideString GetWideStringFromParcel (IParcel *parcel)
 

Detailed Description

  • How to estimate the composed depth of text using the parcel architecture,
  • how to make sure text is fully composed,
  • how to detect if a story or parcel is overset,
  • how to determine that parcel that displays a given TextIndex,
  • how to determine the range of characters displayed by a parcel,
  • composed text is displayed in parcels (IParcel), this allows text to be displayed in both text frames, table text cells and in the future other objects that support the parcel architecture.

Consolidated the following 2.x snippets in here so far:

  • SnipIsStoryOverset
  • SnipIsTextFrameOverset
See Also
IParcel
IParcelList
ITextParcelList
ITextParcelListComposer
IWaxIterator

Constructor & Destructor Documentation

SnpEstimateTextDepth::SnpEstimateTextDepth ()
inline

Constructor.

virtual SnpEstimateTextDepth::~SnpEstimateTextDepth ()
inlinevirtual

Destructor.

Member Function Documentation

ErrorCode SnpEstimateTextDepth::EstimateFrameDepth (const InterfacePtr< ITextFrameColumn > & textFrameColumn,
PMRealestimatedDepth 
)

Estimates the composed depth of a text frame.

Parameters
textFrameColumnto be measured.
estimatedDepththe composed depth of the text in the frame.
Returns
kSuccess on success, kFailure otherwise.
ErrorCode SnpEstimateTextDepth::EstimateParcelDepth (const InterfacePtr< IParcel > & parcel,
PMRealestimatedDepth 
)

Estimates the composed depth of a parcel.

Parameters
parcelto be measured.
estimatedDepththe composed depth of the text in the parcel.
Returns
kSuccess on success, kFailure otherwise.
ErrorCode SnpEstimateTextDepth::EstimateStoryDepth (const InterfacePtr< ITextModel > & textModel,
PMRealestimatedDepth 
)

Estimates the composed depth of a story.

Parameters
textModelof story to be measured.
estimatedDepththe composed depth of the text in the story.
Returns
kSuccess on success, kFailure otherwise.
ErrorCode SnpEstimateTextDepth::EstimateTextDepth (const InterfacePtr< ITextParcelList > & textParcelList,
ParcelKey fromParcelKey,
int32 numberOfParcels,
PMRealestimatedDepth 
)

Estimates the depth of the text in a parcel as the y position of the last line of wax (IWaxLine) in the parcel minus the y position of the first line plus the height of the first line.

Parameters
textParcelListgives range of text in each parcel.
fromParcelKeyIParcelList index of first parcel to be considered
numberOfParcelsmust be >=1
estimatedDepththe composed depth of the text in the parcels.
Returns
kSuccess on success, kFailure otherwise.
InDesign::TextRange SnpEstimateTextDepth::GetParcelTextRange (IParcelparcel)

Return the range of text displayed by the given parcel.

Parameters
parcel
Returns
the range of text displayed by the given parcel.
WideString SnpEstimateTextDepth::GetWideStringFromParcel (IParcelparcel)

Return string containing the text displayed in the given parcel.

Parameters
parcelspecifies the object whose text is wanted.
Returns
string containing the text displayed in the given parcel.
WideString SnpEstimateTextDepth::GetWideStringFromTextRange (const InDesign::TextRangerange)

Return string containing the given range of text from the text model.

Parameters
rangespecifies the text model and range of characters wanted.
Returns
string containing the given range of text from the text model.
bool16 SnpEstimateTextDepth::IsStoryOverset (InterfacePtr< ITextModeltextModel)

Detect if the text in a story is overset via ITextUtils::IsOverset.

Parameters
textModelfor story to be tested.
Returns
kTrue if overset, kFalse otherwise.
See Also
ITextUtils::IsOverset
bool16 SnpEstimateTextDepth::IsTextFrameOverset (const InterfacePtr< ITextFrameColumntextFrameColumn)

Detect if a text frame is overset. When a frame is not large enough to show all of the remaining characters of the the story it displays it is considered by this method as overset.

IParcel * SnpEstimateTextDepth::QueryParcelContaining (ITextModeltextModel,
const TextIndex at 
)

Return interface pointer to parcel that displays the given TextIndex or nil if the TextIndex is not displayed.

Parameters
textModel
at
Returns
interface pointer to parcel that displays the given TextIndex or nil if the TextIndex is not displayed.