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

#include <SnpXMLHelper.h>

Inheritance diagram for SnpXMLHelper:
SnpXMLSampleHelper

Public Member Functions

 SnpXMLHelper ()
 
virtual ~SnpXMLHelper ()
 
UIDRef AcquireTag (const UIDRef &documentUIDRef, const PMString &tagName)
 
ErrorCode AssociateDTD (const UIDRef &documentUIDRef, const IDFile &dtdFile)
 
PMString AsString (const UIDRef &tagUIDRef)
 
PMString AsString (const XMLReference &xmlReference)
 
ErrorCode ChangeTagName (const UIDRef &tagUIDRef, const PMString &newTagName)
 
PMString GetClassFrom (const ClassID &classID)
 
PMString GetClassFrom (const UIDRef &objUIDRef)
 
XMLReference GetRootXMLReference (const UIDRef &documentUIDRef)
 
TextIndex InsertTaggedText (const UIDRef &textModelUIDRef, const PMString &pstr, TextIndex startIndex, const PMString &tagName)
 
ErrorCode PlaceElement (const XMLReference &xmlRef, const UIDRef &graphicFrameUIDRef)
 
ErrorCode SetExportFromSelected (const UIDRef &workspaceUIDRef, bool16 state)
 
ErrorCode SetImportIntoSelected (const UIDRef &workspaceUIDRef, bool16 state)
 
ErrorCode SetRootTag (const UIDRef &documentUIDRef, const PMString &tagName)
 
ErrorCode ShowHideTaggedFrames (bool16 setVisible)
 
ErrorCode TagStory (const UIDRef &textModelUIDRef, const PMString &tagName)
 
ErrorCode TagTable (const UIDRef &tableModelUIDRef, const PMString &tableTagName, const PMString &cellTagName, XMLReference &outCreatedXMLReference)
 
ErrorCode TagTextRange (const UIDRef &textModelUIDRef, const PMString &tagName, TextIndex startIndex, TextIndex endIndex)
 

Protected Member Functions

ErrorCode InsertText (const UIDRef &textModelUIDRef, const PMString &data, const TextIndex &position)
 

Detailed Description

Provides XML-related methods, some of which are wrappers around methods on facades (IXMLElementCommands, IXMLTagCommands, IXMLUtils).

See Also
IXMLElementCommands, IXMLTagCommands, IXMLUtils

Constructor & Destructor Documentation

SnpXMLHelper::SnpXMLHelper ()
inline

Constructor

virtual SnpXMLHelper::~SnpXMLHelper ()
inlinevirtual

Destructor

Member Function Documentation

UIDRef SnpXMLHelper::AcquireTag (const UIDRefdocumentUIDRef,
const PMStringtagName 
)

Obtain a reference to a tag (kXMLTagBoss) by name. If the tag exists in the tag-list of the specified document with the given name, a reference to the existing tag is returned. If the tag doesn't exist then it is created.

Precondition
documentUIDRef should allow IDocument to be instantiated
Parameters
documentUIDRefidentifies document in which the tag is to be created/acquired
tagNamespecifies tag of interest.
Returns
UIDRef of kXMLTagBoss, from which IXMLTag can be instantiated
ErrorCode SnpXMLHelper::AssociateDTD (const UIDRefdocumentUIDRef,
const IDFiledtdFile 
)

Associate (import) a DTD with the logical structure of a document

Precondition
documentUIDRef should allow IDocument to be instantiated
Parameters
documentUIDRefspecifies document of interest
dtdFilespecifies the DTD file to associate with the document
Returns
ErrorCode kSuccess on success, some other ErrorCode otherwise
PMString SnpXMLHelper::AsString (const UIDReftagUIDRef)

Return a description of the tag object (kXMLTagBoss) supplied

Precondition
tagUIDRef should allow IXMLTag to be instantiated
Parameters
tagUIDRefspecifies tag object (kXMLTagBoss) of interest
Returns
PMString containing description of the tag
PMString SnpXMLHelper::AsString (const XMLReferencexmlReference)

Return a description of the XML element (IIDXMLElement) supplied.

Parameters
xmlReferencespecifies XML element of interest
Returns
PMString containing description of the XML element
ErrorCode SnpXMLHelper::ChangeTagName (const UIDReftagUIDRef,
const PMStringnewTagName 
)

Mutator for the name of a tag

Precondition
tagUIDRef should allow IXMLTag to be instantiated
Parameters
tagUIDRefspecifies the tag (kXMLTagBoss) of interest
newTagName
Returns
ErrorCode
PMString SnpXMLHelper::GetClassFrom (const ClassIDclassID)

Return the class of an object as a PMString, in debug or release.

Parameters
classID
Returns
PMString containing the name of the class
PMString SnpXMLHelper::GetClassFrom (const UIDRefobjUIDRef)

Return the class of an object as a PMString, in debug or release.

Parameters
objUIDRefspecifies object of interest
Returns
PMString containing the name fo the class
XMLReference SnpXMLHelper::GetRootXMLReference (const UIDRefdocumentUIDRef)

Get a reference to the root element (kTextXMLElementBoss) in the logical structure.

Precondition
documentUIDRef should allow IDocument to be instantiated
Parameters
documentUIDRefspecifies document (kDocBoss) of interest, from which IDocument can be instantiated
Returns
XMLReference
TextIndex SnpXMLHelper::InsertTaggedText (const UIDReftextModelUIDRef,
const PMStringpstr,
TextIndex startIndex,
const PMStringtagName 
)

Inserts a tagged text range into a story.

Precondition
textModelUIDRef should allow ITextModel to be instantiated
Parameters
textModelUIDRefspecifies the story (kTextStoryBoss) of interest
pstrcontains the text to tag
startIndexwhere the text is to be inserted into the story
tagNamespecifies the tag by name
Returns
TextIndex indicating new insertion point just after the text inserted
ErrorCode SnpXMLHelper::InsertText (const UIDReftextModelUIDRef,
const PMStringdata,
const TextIndex & position 
)
protected

Helper method that is used by InsertTaggedText.

Parameters
textModelUIDRef
data
position
Returns
ErrorCode
ErrorCode SnpXMLHelper::PlaceElement (const XMLReferencexmlRef,
const UIDRefgraphicFrameUIDRef 
)

Places element (IIDXMLElement) into graphic frame.

Precondition
graphicFrameUIDRef should allow IGraphicFrameData to be instantiated
object specified by graphicFrameUIDRef should support IXMLUtils::IsTaggablePageItem
Parameters
xmlRefspecifies element of interest
graphicFrameUIDRefgraphic frame into which content should be placed
Returns
ErrorCode
ErrorCode SnpXMLHelper::SetExportFromSelected (const UIDRefworkspaceUIDRef,
bool16 state 
)

Set the preference to export from selected element, used by export provider.

Precondition
workspaceUIDRef should allow IWorkspace to be instantiated
Parameters
workspaceUIDRef
state
Returns
ErrorCode
ErrorCode SnpXMLHelper::SetImportIntoSelected (const UIDRefworkspaceUIDRef,
bool16 state 
)

Set preference for import provider to import into selected node

Precondition
workspaceUIDRef should allow IWorkspace to be instantiated
Parameters
workspaceUIDRef
state
Returns
ErrorCode
ErrorCode SnpXMLHelper::SetRootTag (const UIDRefdocumentUIDRef,
const PMStringtagName 
)

Set name of the root element's tag

Precondition
documentUIDRef should allow IDocument to be instantiated
Parameters
documentUIDRef
tagName
Returns
ErrorCode
ErrorCode SnpXMLHelper::ShowHideTaggedFrames (bool16 setVisible)

Control visibility of tagged frame decoration.

Parameters
setVisible
Returns
ErrorCode
ErrorCode SnpXMLHelper::TagStory (const UIDReftextModelUIDRef,
const PMStringtagName 
)

Tag story (kTextStoryBoss)

Precondition
textModelUIDRef should allow instantiating ITextModel
Parameters
textModelUIDRef
tagName
Returns
ErrorCode
ErrorCode SnpXMLHelper::TagTable (const UIDReftableModelUIDRef,
const PMStringtableTagName,
const PMStringcellTagName,
XMLReferenceoutCreatedXMLReference 
)

Tag a table (kTableModelBoss).

Precondition
tableModelUIDRef should allow instantiating ITableModel
Parameters
tableModelUIDRef
tableTagName
cellTagName
Returns
ErrorCode
ErrorCode SnpXMLHelper::TagTextRange (const UIDReftextModelUIDRef,
const PMStringtagName,
TextIndex startIndex,
TextIndex endIndex 
)

Create a tagged text range.

Precondition
textModelUIDRef should allow instantiating ITextModel
startIndex, endIndex should lie in same story thread (ITextStoryThread)
Parameters
textModelUIDRef
tagName
startIndex
endIndex
Returns
ErrorCode