#include <SnpTextModelHelper.h>
|
| | SnpTextModelHelper () |
| |
| virtual | ~SnpTextModelHelper () |
| |
| ErrorCode | InsertText (ITextModel *textModel, const TextIndex position, const boost::shared_ptr< WideString > &text) |
| |
| ErrorCode | DeleteText (ITextModel *textModel, const TextIndex position, const int32 length) |
| |
| ErrorCode | ReplaceText (ITextModel *textModel, const TextIndex position, const int32 length, const boost::shared_ptr< WideString > &text) |
| |
| ErrorCode | ApplyOverrides (ITextModel *textModel, const TextIndex position, const int32 length, const boost::shared_ptr< AttributeBossList > &attr, ClassID whichStrand) |
| |
| ErrorCode | ClearOverrides (ITextModel *textModel, const TextIndex position, const int32 length, const boost::shared_ptr< AttributeBossList > &attr, ClassID whichStrand) |
| |
| ErrorCode | ProcessCopyStoryRangeCmd (const UIDRef &sourceStory, TextIndex sourceStart, int32 sourceLength, const UIDRef &destStory, TextIndex destStart, int32 destLength) |
| |
| bool16 | IsStoryOverset (InterfacePtr< ITextModel > textModel) |
| |
| bool16 | IsTextFrameOverset (const InterfacePtr< ITextFrameColumn > textFrameColumn) |
| |
| bool16 | IsParcelOverset (const InterfacePtr< IParcel > parcel) |
| |
| IParcel * | QueryParcelContaining (ITextModel *textModel, const TextIndex at) |
| |
| InDesign::TextRange | GetParcelTextRange (IParcel *parcel) |
| |
| WideString | GetWideStringFromTextRange (const InDesign::TextRange &range) |
| |
| WideString | GetWideStringFromParcel (IParcel *parcel) |
| |
- Provide helper method to insert, replace, delete text in a story using ITextModelCmds.
- Provide helper method to apply/clear text attributes overrides using ITextModelCmds.
- Provide helper method to copy text from one story to another using kCopyStoryRangeCmdBoss.
- Provide helper method to detect if a story or parcel is overset.
- Provide helper method to determine that parcel that displays a given TextIndex.
- Provide helper method to determine the range of characters displayed by a parcel.
- See Also
- ITextModel
- ITextModelCmds
- IParcel
- IParcelList
- ITextParcelList
- ITextParcelListComposer
| SnpTextModelHelper::SnpTextModelHelper | ( | | ) | |
| SnpTextModelHelper::~SnpTextModelHelper | ( | | ) | |
| virtual |
| ErrorCode SnpTextModelHelper::ApplyOverrides | ( | ITextModel * | textModel, |
| | const TextIndex | position, |
| | const int32 | length, |
| | const boost::shared_ptr< AttributeBossList > & | attr, |
| | ClassID | whichStrand |
| ) | | |
Apply paragraph alignment, the point size, leading and underline overrides using ITextModelCmds::ApplyCmd.
- Parameters
| textModel | of story to be changed. |
| position | index of first character to be formatted. |
| length | number of characters to be formatted. |
| attr | attribute boss lists that contains the point size, leading and underline overrides we want to apply here. |
| whichStrand | which strand this attribute overrides are to apply, it has to be either kParaAttrStrandBoss or kCharAttrStrandBoss. |
- Returns
- kSuccess on success, other ErrorCode otherwise.
| ErrorCode SnpTextModelHelper::ClearOverrides | ( | ITextModel * | textModel, |
| | const TextIndex | position, |
| | const int32 | length, |
| | const boost::shared_ptr< AttributeBossList > & | attr, |
| | ClassID | whichStrand |
| ) | | |
Clear paragraph alignment, character point size, leading and underline overrides using ITextModelCmds::ApplyCmd.
- Parameters
| textModel | of story to be changed. |
| position | index of first character to be formatted. |
| length | number of characters to be formatted. |
| attr | attribute boss lists that contains the point size, leading and underline overrides we want to clear here. |
| whichStrand | which strand this attribute overrides are to apply, it has to be either kParaAttrStrandBoss or kCharAttrStrandBoss. |
- Returns
- kSuccess on success, other ErrorCode otherwise.
| ErrorCode SnpTextModelHelper::DeleteText | ( | ITextModel * | textModel, |
| | const TextIndex | position, |
| | const int32 | length |
| ) | | |
Delete text from a story using ITextModelCmds::DeleteCmd.
- Parameters
| textModel | of story to be changed. |
| position | index first character to be deleted. |
| length | number of characters to be deleted. |
- Returns
- kSuccess on success, other ErrorCode otherwise.
Return the range of text displayed by the given parcel.
- Parameters
- Returns
- the range of text displayed by the given parcel.
Return string containing the text displayed in the given parcel.
- Parameters
| parcel | specifies the object whose text is wanted. |
- Returns
- string containing the text displayed in the given parcel.
Return string containing the given range of text from the text model.
- Parameters
| range | specifies the text model and range of characters wanted. |
- Returns
- string containing the given range of text from the text model.
| ErrorCode SnpTextModelHelper::InsertText | ( | ITextModel * | textModel, |
| | const TextIndex | position, |
| | const boost::shared_ptr< WideString > & | text |
| ) | | |
Insert text into a story using ITextModelCmds::InsertCmd.
- Parameters
| textModel | of story to be changed. |
| position | index at which insertion to be made. |
| text | to be inserted. |
- Returns
- kSuccess on success, other ErrorCode otherwise.
Detect if a parcel is overset.
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.
| ErrorCode SnpTextModelHelper::ProcessCopyStoryRangeCmd | ( | const UIDRef & | sourceStory, |
| | TextIndex | sourceStart, |
| | int32 | sourceLength, |
| | const UIDRef & | destStory, |
| | TextIndex | destStart, |
| | int32 | destLength |
| ) | | |
Process kCopyStoryRangeCmdBoss to copy a given range of text from the source story to the destination story. By specifying a destLength
0 the text copied from the source story can replace text in the
destination story. The sourceStory and destStory UIDRefs can refer to the same story if text is to be copied around inside a story or they can refer to different stories in the same document or to stories in different documents.
- Parameters
| sourceStory | UIDRef of story from which to copy content |
| sourceStart | index of text to be copied |
| sourceLength | amount of text to be copied |
| destStory | UIDRef of story to which content is to be copied |
| destStart | index where text to be copied |
| destLength | 0 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.
| IParcel * SnpTextModelHelper::QueryParcelContaining | ( | ITextModel * | textModel, |
| | const TextIndex | at |
| ) | | |
Return interface pointer to parcel that displays the given TextIndex or nil if the TextIndex is not displayed.
- Parameters
- Returns
- interface pointer to parcel that displays the given TextIndex or nil if the TextIndex is not displayed.
| ErrorCode SnpTextModelHelper::ReplaceText | ( | ITextModel * | textModel, |
| | const TextIndex | position, |
| | const int32 | length, |
| | const boost::shared_ptr< WideString > & | text |
| ) | | |
Replace text in a story using ITextModelCmds::ReplaceCmd.
- Parameters
| textModel | of story to be changed. |
| position | index first character to be replaced. |
| length | number of characters to be replaced. |
| text | text to replace. |
- Returns
- kSuccess on success, other ErrorCode otherwise.