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

#include <ITextObjectParent.h>

Inheritance diagram for ITextObjectParent:
IPMUnknown

Classes

class  RangeIter
 
class  SingleRangeIter
 Helper class for those implemenations that only have a single range. More...
 

Public Types

enum  { kDefaultIID = IID_ITEXTOBJECTPARENT }
 

Public Member Functions

virtual RangeIterCreateRangeIterFor (const ScriptInfo::RequestContext &context, ScriptID childType) const =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 interface must be implemented for any scripting object that wants to act as a parent of text objects in the scripting DOM.

For example, you might have a scripting resource like the following. Note that the provider should be set to the kTextScriptProviderBoss, which knows how to use the ITextObjectParent implementations to service GetObject requests and Count events (

See Also
IScriptProvider).
Provider

{

    kTextScriptProviderBoss,

    {

        Parent{ kFootnoteObjectScriptElement },



        RepresentObject{ kTextObjectScriptElement },

        RepresentObject{ kInsertionPointObjectScriptElement },

        RepresentObject{ kCharacterObjectScriptElement },

        RepresentObject{ kWordObjectScriptElement },

        RepresentObject{ kLineObjectScriptElement },

        RepresentObject{ kParagraphObjectScriptElement },

        RepresentObject{ kTextStyleRangeObjectScriptElement },



        CollectionMethod{ kCountMethodScriptElement },

    }

}

The implementation should be aggregated onto a boss that also aggregates the IScript. For example:

Class

{

    kFootnoteReferenceBoss,

    kInvalidClass,

    {

        ...

        IID_ITEXTSTORYTHREAD,       kFootnoteStoryThreadImpl,

        IID_ISCRIPT,                kFootnoteScriptImpl,

        IID_ITEXTOBJECTPARENT,      kFootnoteTextObjectParentImpl,

        ...

    }

}

Note that it is possible to be a host for these objects without actually being the true parent. Consider the case of the MultiColumnTextFrame - it wants to return the Lines, Words, etc within it's composed span but the true parent of the objects will be the Story.

Implementations that wish to be full parents must implement the ITextStoryThread::QueryParent() method to return a IScript object. In the example above, the Footnote simply returns a pointer to itself since it has an IScript interface.

Member Function Documentation

virtual RangeIter* ITextObjectParent::CreateRangeIterFor (const ScriptInfo::RequestContextcontext,
ScriptID childType 
) const
pure virtual

Returns a RangeIter object that can be used to return one or more ranges of a specific TextModel where TextObjects can be found.

Returns
Pointer to new RangeIter object that must be deleted by the caller when it is done.