InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IComposeScanner Class Referenceabstract

#include <IComposeScanner.h>

Inheritance diagram for IComposeScanner:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_ICOMPOSESCANNER }
 

Public Member Functions

virtual TextIndex CopySurroundingWord (TextIndex position, WideString *copy, UID *pLanguageUID=nil, FuncIsWordChar func=nil)=0
 
virtual TextIndex CopyText (TextIndex position, int32 length, WideString *copy) const =0
 
virtual TextIndex CopyText (const RangeData &range, WideString *copy) const =0
 
virtual TextIndex FindSurroundingWord (TextIndex position, int32 *length, UID *pLanguageUID=nil, FuncIsWordChar wordFunc=nil)=0
 
virtual RangeData FindSurroundingWord (TextIndex position, UID *pLanguageUID=nil, FuncIsWordChar wordFunc=nil)=0
 
virtual TextIndex FindSurroundingWordUsingWordCharFuncOnly (TextIndex position, int32 *length, UID *pLanguageUID=nil, FuncIsWordChar wordFunc=nil)=0
 
virtual RangeData FindSurroundingWordUsingWordCharFuncOnly (TextIndex position, UID *pLanguageUID=nil, FuncIsWordChar wordFunc=nil)=0
 
virtual TextIndex FindSurroundingParagraph (TextIndex position, int32 *length, bool16 excludeEOS=kTrue, bool16 validatePara=kTrue) const =0
 
virtual RangeData FindSurroundingParagraph (TextIndex position, bool16 excludeEOS=kTrue, bool16 validatePara=kTrue) const =0
 
virtual const IAttrReportQueryAttributeAt (int32 startPosition, int32 endPosition, ClassID typeAttribute, int32 *length=nil, bool16 moveBackwards=kFalse) const =0
 
virtual const IAttrReportQueryAttributeAt (const RangeData &range, ClassID typeAttribute, int32 *length=nil, bool16 moveBackwards=kFalse) const =0
 
virtual void QueryAttributeAt (int32 startPosition, int32 endPosition, K2Vector< ClassID >::const_iterator firstAttribute, K2Vector< ClassID >::const_iterator endAttribute, AttributeBossList *results, int32 *length=nil, bool16 moveBackwards=kFalse) const =0
 
virtual IDrawingStyleGetCompleteStyleAt (TextIndex position, int32 *lenleft=nil)=0
 
virtual IDrawingStyleGetParagraphStyleAt (TextIndex position, int32 *lenleft=nil, TextIndex *paragraphStart=nil)=0
 
virtual const RunInStyleResultsGetRunInStylesResultsAt (TextIndex position, TextIndex *paragraphStart=nil)=0
 
virtual TextIterator QueryDataAt (TextIndex position, IDrawingStyle **newstyle, int32 *numChars)=0
 
virtual void AttributesChanged (TextIndex start, int32 length)=0
 
virtual void Clear ()=0
 
virtual void StartComposingNestedStyles ()=0
 
virtual void StopComposingNestedStyles ()=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

This is the primary iterator for reading a text model (a story). It can return characters and attributes for ranges of text

Member Function Documentation

virtual void IComposeScanner::AttributesChanged (TextIndex start,
int32 length 
)
pure virtual

Indicates that the model has changed for the indicated range, called automatically

virtual void IComposeScanner::Clear ()
pure virtual

Clears the cache. Shouldn't be necessary to call

virtual TextIndex IComposeScanner::CopySurroundingWord (TextIndex position,
WideStringcopy,
UIDpLanguageUID = nil,
FuncIsWordChar func = nil 
)
pure virtual

copies the word at the position. Uses FindSurroundingWord() to find the word, then copies it into copy

See Also
FindSurroundingWord
Parameters
positionCopy the word that contains this index
copyIs set to the word found by FindSurroundingWord(). Must be non-nil.
pLanguageUIDSet the language applied to the word if non-nil.
funcAllows word detection heuristics to be overridden.
Returns
the word's starting position.
virtual TextIndex IComposeScanner::CopyText (TextIndex position,
int32 length,
WideStringcopy 
) const
pure virtual

Copies the specified text into the WideString.

Parameters
positionCopy the word that contains this index
lengthHow many characters should be copied
copymust be non-nil. Is set to the text specified
Returns
Returns position
virtual TextIndex IComposeScanner::CopyText (const RangeDatarange,
WideStringcopy 
) const
pure virtual
See Also
CopyText
virtual TextIndex IComposeScanner::FindSurroundingParagraph (TextIndex position,
int32 * length,
bool16 excludeEOS = kTrue,
bool16 validatePara = kTrue 
) const
pure virtual
Returns
the paragraph's starting index, optionally including the end-of-story mark
Parameters
positionGet the paragraph that contains this index
lengthGet the length of the paragraph, can be nil but default parameter causes ambiguity.
excludeEOSif the paragraph ends at the story end (no CR) should the story end get counted or not?
validateParaOnly used in the debug build for more rigorous internal checks
virtual RangeData IComposeScanner::FindSurroundingParagraph (TextIndex position,
bool16 excludeEOS = kTrue,
bool16 validatePara = kTrue 
) const
pure virtual
virtual TextIndex IComposeScanner::FindSurroundingWord (TextIndex position,
int32 * length,
UIDpLanguageUID = nil,
FuncIsWordChar wordFunc = nil 
)
pure virtual
Returns
the word's starting index and optionally the language applied to the word
Parameters
positionGet the word that contains this index
lengthlength of the word, can be nil but default parameter causes ambiguity.
pLanguageUIDif non-nil, is set to the language at the position
wordFuncallows the "is a word" function to get overridden
virtual RangeData IComposeScanner::FindSurroundingWord (TextIndex position,
UIDpLanguageUID = nil,
FuncIsWordChar wordFunc = nil 
)
pure virtual
virtual TextIndex IComposeScanner::FindSurroundingWordUsingWordCharFuncOnly (TextIndex position,
int32 * length,
UIDpLanguageUID = nil,
FuncIsWordChar wordFunc = nil 
)
pure virtual
virtual RangeData IComposeScanner::FindSurroundingWordUsingWordCharFuncOnly (TextIndex position,
UIDpLanguageUID = nil,
FuncIsWordChar wordFunc = nil 
)
pure virtual
virtual IDrawingStyle* IComposeScanner::GetCompleteStyleAt (TextIndex position,
int32 * lenleft = nil 
)
pure virtual
Returns
a NON-ADDREF'D drawingstyle that reflects ALL attributes at the passed in location The returned length is not guaranteed to be precise. It may be that the next run shares these attributes due to the lazy combining that can occur.
Parameters
positionGet attributes for this location
lenleftIf non-nil, indicates how many characters (at least) share these attributes
virtual IDrawingStyle* IComposeScanner::GetParagraphStyleAt (TextIndex position,
int32 * lenleft = nil,
TextIndex * paragraphStart = nil 
)
pure virtual
Returns
a NON-ADDREF'D drawingstyle that reflects the paragraph attributes at the passed in location The returned length is not guaranteed to be precise. It may be that the next paragraph shares these attributes due to the lazy combining that can occur. Run-in styles can also affect the length
Parameters
positionGet attributes for this location
lenleftIf non-nil, indicates how many characters (at least) share these attributes
paragraphStartIf non-nil, indicates the position of the start of the paragraph containing position
virtual const IAttrReport* IComposeScanner::QueryAttributeAt (int32 startPosition,
int32 endPosition,
ClassID typeAttribute,
int32 * length = nil,
bool16 moveBackwards = kFalse 
) const
pure virtual
Returns
the specified attribute applied at startPosition. Will join runs when this attribute is unchanged until endPosition.
Parameters
startPositioninitial text location to start from
endPositiontext location to not bother looking beyond
typeAttributethe text attribute in question
lengthpointer to value that will contain the number of characters after startPosition that share the same attribute value for forward direction and number of characters from end position for backwards direction.
moveBackwardsspecifies the direction in which above stated length parameter is to be reported. The value is kTrue for backwards direction and kFalse for forward direction.
virtual const IAttrReport* IComposeScanner::QueryAttributeAt (const RangeDatarange,
ClassID typeAttribute,
int32 * length = nil,
bool16 moveBackwards = kFalse 
) const
pure virtual
virtual void IComposeScanner::QueryAttributeAt (int32 startPosition,
int32 endPosition,
K2Vector< ClassID >::const_iterator firstAttribute,
K2Vector< ClassID >::const_iterator endAttribute,
AttributeBossListresults,
int32 * length = nil,
bool16 moveBackwards = kFalse 
) const
pure virtual

This version of QueryAttributeAt works on collections of attributes.

Precondition
Params must not contain any duplicate ClassIDs. Results must be empty on input (results->CountBosses() == 0)
Postcondition
Results will contain attributes for each classID of params (results->CountBosses() == params.Length()) If length != nil on input, *length will be the number of characters starting at startPosition that have the same values for all of the given text attributes. length <= endPosition - startPosition
Parameters
startPositioninitial text location to start from
endPositiontext location to not bother looking beyond
firstAttributeiterator.begin() of list of attributes being examined
endAttributeiterator.end() of list of attributes being examined
resultsfilled with the list of attributes in question. Should NOT be nil.
lengthpointer to value that will contain the number of characters after startPosition that share the same attribute value for forward direction and number of characters from end position for backwards direction.
moveBackwardsspecifies the direction in which above stated length parameter is to be reported. The value is kTrue for backwards direction and kFalse for forward direction.
virtual TextIterator IComposeScanner::QueryDataAt (TextIndex position,
IDrawingStyle ** newstyle,
int32 * numChars 
)
pure virtual

This is the primary method that text composition uses to iterate the text model

Returns
an iterator on the buffer to characters. This buffer is referenced in the TextIterator, therefore, it is valid beyond the next call to the compose scanner.
Parameters
positionindex to get the data for
newstyleaddress of pointer to drawingstyle. If non-nil, the address will return pointing to an AddRef'd drawingstyle
numCharsif non-nil, number of characters (either 2 or 4 bytes) in the returned iterator that have the same style