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

#include <SnpXMLSampleHelper.h>

Inheritance diagram for SnpXMLSampleHelper:
SnpXMLHelper

Public Member Functions

 SnpXMLSampleHelper ()
 
virtual ~SnpXMLSampleHelper ()
 
UIDRef AcquireParaStyle (const UIDRef &documentUIDRef, const PMString &name)
 
UIDRef AcquireCharStyle (const UIDRef &documentUIDRef, const PMString &name)
 
UIDRef AcquireStyle (const UIDRef &documentUIDRef, const PMString &name, const PMIID &styleIID, const ClassID &createCmdClassID)
 
UIDRef CreateRectangleFrame (const UIDRef &documentUIDRef, const PMRect &rect, int32 spreadNum, int32 pageNum)
 
ErrorCode CreateSampleDTD (const IDFile &file)
 
ErrorCode CreateSampleTaggedStory (const UIDRef &textModelUIDRef, bool16 noOptionalContent=kFalse)
 
ErrorCode CreateSampleXML (const IDFile &file, bool16 extendedElements=kFalse)
 
UIDRef CreateStoryThroughFrame (const UIDRef &documentUIDRef, const PMRect &rect, int32 spreadNum, int32 pageNum)
 
ErrorCode CreateTableThroughFrame (const UIDRef &documentUIDRef, const PMRect &rect, UIDRef &outTableUIDRef, UIDRef &outTextModelUIDRef, int32 nRows=2, int32 nCols=2)
 
void GetNextRect (PMRect &outRect)
 
IDFile GetSampleFile (const PMString &extension)
 
ErrorCode InsertStyledLine (const UIDRef &textModelUIDRef, const PMString &lineText, const TextIndex &insertionPoint, const UIDRef &styleUIDRef, TextIndex &outNextTextIndex)
 
void ResetRectCounts ()
 
void SaveLineToStream (const PMString &str, IPMStream *stream)
 
- Public Member Functions inherited from SnpXMLHelper
 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)
 

Additional Inherited Members

- Protected Member Functions inherited from SnpXMLHelper
ErrorCode InsertText (const UIDRef &textModelUIDRef, const PMString &data, const TextIndex &position)
 

Detailed Description

Creates sample XML/DTD content, and implements non-XML related features used by the snippet samples involving XML.

Constructor & Destructor Documentation

SnpXMLSampleHelper::SnpXMLSampleHelper ()
inline

Constructor

virtual SnpXMLSampleHelper::~SnpXMLSampleHelper ()
inlinevirtual

Destructor

Member Function Documentation

UIDRef SnpXMLSampleHelper::AcquireCharStyle (const UIDRefdocumentUIDRef,
const PMStringname 
)

Obtain reference to a character style by name; create if it doesn't already exist

Precondition
documentUIDRef should allow IDocument to be instantiated
Parameters
documentUIDRefspecifies document of interest
namespecifies name of style we're looking for
Returns
UIDRef from which IStyleInfo can be instantiated
UIDRef SnpXMLSampleHelper::AcquireParaStyle (const UIDRefdocumentUIDRef,
const PMStringname 
)

Obtain reference to a paragraph style by name; create if it doesn't already exist

Precondition
documentUIDRef should allow IDocument to be instantiated
Parameters
documentUIDRefspecifies document of interest
namespecifies name of style we're looking for
Returns
UIDRef from which IStyleInfo can be instantiated
UIDRef SnpXMLSampleHelper::AcquireStyle (const UIDRefdocumentUIDRef,
const PMStringname,
const PMIIDstyleIID,
const ClassIDcreateCmdClassID 
)

Obtain reference to style (kStyleBoss)

Precondition
documentUIDRef should allow IDocument to be instantiated
Parameters
documentUIDRefdocument of interest
namespecifies name of style we're looking for
styleIIDPMIID for name table with styles in it: for instance IID_IPARASTYLEGROUPMANAGER
createCmdClassIDfor instance kCreateParaStyleCmdBoss
Returns
UIDRef from which IStyleInfo can be instantiated
UIDRef SnpXMLSampleHelper::CreateRectangleFrame (const UIDRefdocumentUIDRef,
const PMRectrect,
int32 spreadNum,
int32 pageNum 
)

Create a rectangle page item (empty graphic frame)

Precondition
documentUIDRef should allow IDocument to be instantiated
Parameters
documentUIDRefdocument of interest
rectThe rectangle to create
spreadNumIndex of the target spread
pageNumIndex of the target page
Returns
UIDRef of the created rectangle frame
ErrorCode SnpXMLSampleHelper::CreateSampleDTD (const IDFilefile)

Create an instance of a DTD that is used in some of these mini-snippets

Parameters
file[in]The file to write to.
Returns
ErrorCode
ErrorCode SnpXMLSampleHelper::CreateSampleTaggedStory (const UIDReftextModelUIDRef,
bool16 noOptionalContent = kFalse 
)

Create a story with some sample contet and tagged.

Parameters
textModelUIDRefThe story to tag
noOptionalContentIf kFalse optional content will be added
Returns
ErrorCode
ErrorCode SnpXMLSampleHelper::CreateSampleXML (const IDFilefile,
bool16 extendedElements = kFalse 
)

Create instance of XML file for import samples.

Parameters
fileThe file to write to.
extendedElementsIf kTrue a copyright line will be added.
Returns
ErrorCode
UIDRef SnpXMLSampleHelper::CreateStoryThroughFrame (const UIDRefdocumentUIDRef,
const PMRectrect,
int32 spreadNum,
int32 pageNum 
)

Create a text frame, and return reference to the new story associated.

Precondition
documentUIDRef should allow IDocument to be instantiated
Parameters
documentUIDRefdocument in which objects should be created
rectbounding box for frame
spreadNumspecifies spread index that should be ancestor for content
pageNumwhich page on given spread
Returns
UIDRef for the graphic frame created, from which IGraphicFrameData can be instantiated
ErrorCode SnpXMLSampleHelper::CreateTableThroughFrame (const UIDRefdocumentUIDRef,
const PMRectrect,
UIDRefoutTableUIDRef,
UIDRefoutTextModelUIDRef,
int32 nRows = 2,
int32 nCols = 2 
)

Create a text frame, and in it a table

Precondition
documentUIDRef should allow IDocument to be instantiated
Parameters
documentUIDRefdocument in which objects should be created
rectbounding box for frame
outTableUIDRefreference to table (kTableModelBoss) created, from which ITableModel can be instantiated
outTextModelUIDRefreference to story (kTextStoryBoss) created, from which ITextModel can be instantiated
nRowsnumber of rows in table to create
nColsnumber of columns to create
Returns
ErrorCode kSuccess on success, or ErrorCode otherwise
void SnpXMLSampleHelper::GetNextRect (PMRectoutRect)

Get a new rect for shape's position on the page; these don't overlap until there are more than about 10 page items

Parameters
[out]outRectThe rectangle
IDFile SnpXMLSampleHelper::GetSampleFile (const PMStringextension)

Return a filename to be used for these mini-snippets, with variable ending.

Parameters
extensionspecifies the last part of the filename to create, could be a short extension or a longer part of the filename
Returns
IDFile that encapsulates constructed path
ErrorCode SnpXMLSampleHelper::InsertStyledLine (const UIDReftextModelUIDRef,
const PMStringlineText,
const TextIndex & insertionPoint,
const UIDRefstyleUIDRef,
TextIndex & outNextTextIndex 
)

Insert some text as a CR terminated line and apply a style to it

Precondition
textModelUIDRef should allow ITextModel to be instantiated
Parameters
textModelUIDRefidentifies story (kTextStoryBoss) into which we're inserting text
lineTextspecifies text to insert
insertionPointwhere in the story to insert the text
styleUIDRefspecifies run-style to apply to the text inserted
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise
See Also
SnpTextModelHelper
void SnpXMLSampleHelper::ResetRectCounts ()

Reset the rect counts to zero, to start positioning shapes from the page origin again. Rect-counts are just used to avoid overlapping created page items.

void SnpXMLSampleHelper::SaveLineToStream (const PMStringstr,
IPMStreamstream 
)

Save string as CR-terminated line to stream.

Precondition
stream should not be nil
Parameters
strstring to save
streamspecifies stream into which to save it