You are on page 1of 1

CHAPTER 2: Text Stories 50

Use ITextTarget::QueryTextModel to get the text model for the selection. This interface provides other
information about the text selection, like its range.

To manipulate the model through the selection, add a new suite interface onto the kTextSuiteBoss class.
This provides the mechanism required to keep actual selection types separate from the selection
architecture. For an example, see the use of the interface IDataUpdaterSuite in the XmlDataUpdater
plug-in.

Accessing a story, given a page item


You can get from a page item to (potentially) the text story representing the text it contains.

Solution

Use ITextUtils::GetSelectedTextItemsFromUIDList on kUtilsBoss to extract text item entities from a list of


UID items. Specifying a nonnil UIDList for either of the out parameters causes the associated UIDList to be
populated with the set of page items containing text.

IGraphicFrameData::GetTextContentUID (the interface is on the page item) provides kInvalidUID if the


page item is not a text container. This more direct approach is more effective if you are interested only in
whether the page item contains text, rather than getting access to the text.

Sample code

SnpManipulateTextFrame

Creating a story
You can create a story programmatically.

Solution

Stories are rarely created directly. Normally, they are created as a side effect of creating a text frame.

Sample code

SDKLayoutHelper::CreateTextFrame

Related APIs

 The kNewStoryCmdBoss command creates a new story. It is unlikely you will have to use this
command directly.

 The kCreateMultiColumnItemCmdBoss command creates a text frame (and the associated story).

Deleting a story
You can delete a story programmatically.

You might also like