Programming Reference


ODTemplates

     

Class Definition File

ODTemps.idl

Class C++ Binding

ODTemps.xh

Class Hierarchy

SOMObject
   ODObject
      ODTemplates

Description

Stationery in OpenDoc behave like Workplace Shell templates. They can be dragged onto the document shell and inserted into the current document and onto the open desktop. When a stationery object is dropped, it starts the document shell with the stationery part as the root part of the document.

When a user installs OpenDoc for the first time, each part handler that is registered with the part registry causes the creation of a stationery document in the OpenDoc Stationery folder. Stationery documents can be created at runtime by calling the CreateTemplate method.

At installation, a Workplace Shell folder is created with the title "OpenDoc Stationery' and with an object ID of "<OD_TEMPS>'.   This object ID is a constant within the ODTemplates class. On each creation of a stationery document, the calling method does not need to specify the location of the stationery document being created when using this constant. However, the part creating a stationery document must specify a unique object ID for each stationery document it creates with the format "<OD_myobjid>' giving each stationery document a unique Workplace Shell object ID. This enables stationery documents to be removed from the folder, if necessary, and allows for easy discernment between "true' Workplace Shell objects and OpenDoc objects on the desktop.

Methods

The methods defined by the ODTemplates class include:

Overridden Methods

There are no methods overridden by the ODTemplates class.

   

CreateTemplate (OS/2)

This method creates a stationery document of the specified part with the content of the part's storage unit in the data file.

Signature
ODBoolean CreateTemplate (ODPart *part,
                          ODSession *session,
                          string ObjectID,
                          string ObjectTitle,
                          ODStorageUnit *unit)

Parameters

part  (ODPart *)  -  input 

A pointer to the part object of the calling part.

session  (ODSession *)  -  input 

A pointer to the session object of the calling part.

ObjectID  (string)  -  input 

A Workplace Shell object ID of the format <OD_myobjid> or kODNULL if the object ID is generated using the part kind name.

ObjectTitle  (string)  -  input 

A string to be used as the stationery document's title.

unit  (ODStorageUnit *)  -  input 

A pointer to the part's storage unit.

Returns

rv  (ODBoolean)  -  returns 

A flag indicating whether a stationery document was created.
kODTrue The stationery document was created.
kODFalse The stationery document was not created.

Remarks

This stationery document is placed in the OpenDoc Stationery folder on the desktop with the specified object ID as its Workplace Shell object ID.

Exception Handling
kODErrFocusNotRegistered The requested focus is not registered.
kODErrOutOfMemory There is not enough memory to allocate the focus-owner iterator object.

Related Methods

   

DeleteTemplate (OS/2)

This method deletes a stationery document with the specified object ID.

Signature
ODBoolean DeleteTemplate (string ObjectID)

Parameters

ObjectID  (string)  -  input 

The Workplace Shell object ID of the stationery document to be deleted.

Returns

rv  (ODBoolean)  -  returns 

A flag indicating whether a stationery document was deleted.
kODTrue The stationery document was deleted.
kODFalse The stationery document was not deleted.
 

GetStorageUnit (OS/2)

This method returns an empty storage unit into which the part can clone its storage unit.

Signature
ODStorageUnit *GetStorageUnit (ODSession *session)

Parameters

session  (ODSession *)  -  input 

A pointer to the session object of the calling part.

Returns

rv  (ODStorageUnit *)  -  returns 

A pointer to the new fully-operational storage unit.


[ Top | Previous | Next | Contents | Index | Documentation Homepage ]