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

Public Member Functions

 SnpManipulateTextModel ()
 
virtual ~SnpManipulateTextModel ()
 
ErrorCode InsertText (ITextModel *textModel, const TextIndex position, const WideString &text)
 
ErrorCode DeleteText (ITextModel *textModel, const TextIndex position, const int32 length)
 
ErrorCode ReplaceText (ITextModel *textModel, const TextIndex position, const int32 length, const WideString &data)
 
ErrorCode ApplyOverrides (ITextModel *textModel, const TextIndex position, const int32 length)
 
ErrorCode ClearOverrides (ITextModel *textModel, const TextIndex position, const int32 length)
 
ITextFocusQueryTextFocus (ITextFrameColumn *textFrameColumn)
 
ITextFocusQueryParcelTextFocus (ITextModel *textModel, const RangeData range)
 
ErrorCode SelectText (ISelectionManager *selectionManager, ITextFocus *textFocus)
 
ErrorCode ProcessCopyStoryRangeCmd (const UIDRef &sourceStory, TextIndex sourceStart, int32 sourceLength, const UIDRef &destStory, TextIndex destStart, int32 destLength)
 
ErrorCode CopyAll (const UIDRef &sourceStory, const UIDRef &destStory)
 
ErrorCode CopyInlines (const UIDRef &sourceStory, const UIDRef &destStory)
 
ErrorCode CopyTables (const UIDRef &sourceStory, const UIDRef &destStory)
 
UIDRef CreateTextFrame (const UIDRef &fromGraphicFrameUIDRef, UIDRef &storyUIDRef)
 
ErrorCode CopyOwnedItem (const UIDRef &sourceStory, const UIDRef &destStory, const ClassID &ownedItemType)
 

Detailed Description

The following 2.x code snippets have been consolidated into this snippet:

  • SnipCopyStory.cpp
  • SnipTextModel.cpp
See Also
ITextModel
ITextModelCmds
kCopyStoryRangeCmdBoss
ITextUtils

Constructor & Destructor Documentation

SnpManipulateTextModel::SnpManipulateTextModel ()
inline

Constructor.

virtual SnpManipulateTextModel::~SnpManipulateTextModel ()
inlinevirtual

Destructor.

Member Function Documentation

ErrorCode SnpManipulateTextModel::ApplyOverrides (ITextModeltextModel,
const TextIndex position,
const int32 length 
)

Apply paragraph alignment, the point size, leading and underline overrides using ITextModelCmds::ApplyCmd.

Parameters
textModelof story to be changed.
positionindex of first character to be formatted.
lengthnumber of characters to be formatted.
Returns
kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateTextModel::ClearOverrides (ITextModeltextModel,
const TextIndex position,
const int32 length 
)

Clear paragraph alignment, character point size, leading and underline overrides using ITextModelCmds::ApplyCmd.

Parameters
textModelof story to be changed.
positionindex of first character to be formatted.
lengthnumber of characters to be formatted.
Returns
kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateTextModel::CopyAll (const UIDRefsourceStory,
const UIDRefdestStory 
)

Copy all of the source story content to the destination story.

Parameters
sourceStoryUIDRef of story from which to copy content.
destStoryUIDRef of story to which content is to be copied.
Returns
kSuccess on success, some other ErrorCode otherwise.
ErrorCode SnpManipulateTextModel::CopyInlines (const UIDRefsourceStory,
const UIDRefdestStory 
)

Copy each inline graphic in the source story to the destination story.

Parameters
sourceStoryUIDRef of story from which to copy content.
destStoryUIDRef of story to which content is to be copied.
Returns
kSuccess on success, some other ErrorCode otherwise.
ErrorCode SnpManipulateTextModel::CopyOwnedItem (const UIDRefsourceStory,
const UIDRefdestStory,
const ClassIDownedItemType 
)

Collects and copies owned items.

Parameters
sourceStoryUIDRef of story from which to copy content.
destStoryUIDRef of story to which content is to be copied.
ownedItemTypekInlineBoss for inlines
Returns
kSuccess on success, some other ErrorCode otherwise.
ErrorCode SnpManipulateTextModel::CopyTables (const UIDRefsourceStory,
const UIDRefdestStory 
)

Copy each table in the source story to the destination story.

Parameters
sourceStoryUIDRef of story from which to copy content.
destStoryUIDRef of story to which content is to be copied.
Returns
kSuccess on success, some other ErrorCode otherwise.
UIDRef SnpManipulateTextModel::CreateTextFrame (const UIDReffromGraphicFrameUIDRef,
UIDRefstoryUIDRef 
)

Create a text frame alongside the given frame.

Parameters
fromGraphicFrameUIDRefIN references the spline the frame is to be created alongside.
storyUIDRefOUT the story associated with the newly created text frame.
Returns
reference to the new text frame's kSplineItemBoss object on success, UIDRef::gNull otherwise.
ErrorCode SnpManipulateTextModel::DeleteText (ITextModeltextModel,
const TextIndex position,
const int32 length 
)

Delete text from a story using SnpTextModelHelper::DeleteCmd.

Parameters
textModelof story to be changed.
positionindex first character to be deleted.
lengthnumber of characters to be deleted.
Returns
kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateTextModel::InsertText (ITextModeltextModel,
const TextIndex position,
const WideStringtext 
)

Insert text into a story using SnpTextModelHelper::InsertCmd.

Parameters
textModelof story to be changed.
positionindex at which insertion to be made.
textto be inserted.
Returns
kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateTextModel::ProcessCopyStoryRangeCmd (const UIDRefsourceStory,
TextIndex sourceStart,
int32 sourceLength,
const UIDRefdestStory,
TextIndex destStart,
int32 destLength 
)

Call SnpTextModelHelper::ProcessCopyStoryRangeCmd to copy a given range of text from the source story to the destination story.

Parameters
sourceStoryUIDRef of story from which to copy content
sourceStartindex of text to be copied
sourceLengthamount of text to be copied
destStoryUIDRef of story to which content is to be copied
destStartindex where text to be copied
destLength0 to insert text in destination story, >0 to replace
Precondition
0 <= sourceStart < ITextModel::GetPrimaryStoryThreadSpan() for sourceStory
1 <= sourceLength <= ITextModel::GetPrimaryStoryThreadSpan() for sourceStory
0 <= destStart < ITextModel::GetPrimaryStoryThreadSpan() for destStory
0 <= destLength <= ITextModel::GetPrimaryStoryThreadSpan() for destStory
Returns
kSuccess on success, some other ErrorCode otherwise.
See Also
kCopyStoryRangeCmdBoss
ITextUtils for wrapper methods.
ITextFocus * SnpManipulateTextModel::QueryParcelTextFocus (ITextModeltextModel,
const RangeData range 
)

Return text focus describing the whole range of characters in a parcel which contains the start of a text range

Parameters
textModelthat contains the text focus
rangeis the selected text range, the start of the range will be used to determined which parcel will be the focus frame/parcel
Returns
text focus describing the range of characters displayed in the parcel.
ITextFocus * SnpManipulateTextModel::QueryTextFocus (ITextFrameColumntextFrameColumn)

Return text focus describing the range of characters displayed in the given frame.

Parameters
textFrameColumn
Returns
text focus describing the range of characters displayed in the frame.
ErrorCode SnpManipulateTextModel::ReplaceText (ITextModeltextModel,
const TextIndex position,
const int32 length,
const WideStringdata 
)

Replace text in a story using SnpTextModelHelper::ReplaceCmd.

Parameters
textModelof story to be changed.
positionindex first character to be replaced.
lengthnumber of characters to be replaced.
datatext to be inserted.
Returns
kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateTextModel::SelectText (ISelectionManagerselectionManager,
ITextFocustextFocus 
)

Set a text selection.

Parameters
selectionManagerin which items are to be selected.
textFocusdescribing the text to be selected.
Returns
kSuccess on success, other ErrorCode otherwise.