Professional Documents
Culture Documents
Solutions 56
Solutions 56
Solutions 56
With this background, the solution becomes apparent. For each text story thread dictionary obtained from
ITextStoryThreadDictHier::NextUID, obtain the supported set of text story thread keys using
ITextStoryThreadDict::GetFirstKey/GetNextKey before calling ITextStoryThreadDict::QueryThread.
Sample code
SnpIterTableUseDictHier
SnpInspectTextModel::InspectStoryThreadDicts
Solution
When dealing with a selection, you need to implement a selection extension pattern, which allows you to
participate in the selection subsystem. As part of this extension pattern, you provide an add-in
implementation of a concrete selection interface on the kTextSuiteBoss (and associated add-in
implementation of an abstract selection interface on the kIntegratorSuiteBoss). For details on
implementing this extension pattern, see the “Selection” chapter of Adobe InDesign Products Programming
Guide.
Use ISelectionUtils::GetActiveSelection to obtain your abstract selection, which can then provide access to
the concrete selection.
ITextTarget (on kTextSuiteBoss) resides on the same boss class as your concrete selection.
ITextTarget::QueryTextModel provides the text model for the current selection. This interface provides
access to the text model as well as information on the range to which the selection applies.
Use ITextModel::QueryStoryThread along with the index provided by the ITextTarget, to obtain the text
story thread.
Solution
An inline graphic is represented within the text of a story using the special character kTextChar_Inline;
known as the anchor character. This character indicates to the text subsystem that there is an inline item
embedded at this position. The inline itself is represented on the owned item strand
(kOwnedItemStrandBoss). The owned item strand maintains a (persistent/UID-based) reference to the
actual inline item (kInlineBoss) through the IItemStrand interface.
Add the anchor character to the story at the required text index.This is done using standard text
content manipulation.