Professional Documents
Culture Documents
To copy text within the same story, source and destination references should be the same. When
specifying ranges for this operation, take care they do not overlap.
Before performing the modification, check the model to ensure it is not locked
(ITextModel::IsModelLocked).
Solution
To move text within and between stories, use the command provided by the
ITextUtils::QueryMoveStoryCommand utility facade. Variants of this API allow common use cases of text
move to be handled; for example, moving a range from source to a range in the destination and moving
the complete source story to the end of the destination story.
To move text within the same story, source and destination references should be the same. When
specifying ranges for this operation, take care they do not overlap.
Before performing the modification, check the model to ensure it is not locked
(ITextModel::IsModelLocked).
Sample code
Solution
To be able to deal with distinct text units like table cell contents or footnotes, a hierarchy is built on top of
the simple linear model maintained by the various strands. The nodes of this hierarchy are represented by
text story thread dictionaries (ITextStoryThreadDict, maintained on boss classes representing the
subcomponent, such as kFootnoteReferenceBoss). The root of the hierarchy is the primary story thread.
(All stories have a primary story thread; see ITextModel::GetPrimaryStoryThreadSpan.). Story thread
dictionaries maintain a mapping to a set of text story threads (ITextStoryThread). For example, the story
thread dictionary for a table is on the table model (kTableModelBoss). It maintains the mapping to the
actual text story threads for each cell (kTextCellContentBoss). The dictionary provides the mechanism
required to iterate through all text story threads it manages.
The story (kTextModelBoss) models the inherent hierarchy using ITextStoryThreadDictHier. Using
ITextStoryThreadDictHier::NextUID, you can access all story threads in the order in which they appear
within the story.