Customize document actions
Typically, document actions are customized by changing the default template. Changing templates for LibreOffice or MS Office documents is not a big problem, supposed one is familiar with LibreOffice or MS Office (VB Script) document templates. HTML templates are, however, stored in the ODE resource database and may be changed only by changing the template definitions in this database. Updated HTML templates might be stored in an OSI directory, which might be set as OSI_PATH in the data source to be opened (see Data source definition).
When changing document templates used by Terminus and ClassEditor, one has to take into account, that three option variables are passed to the document generator, which allow to identify the root object instance (project, class, complex data type etc. One option (Collection) is passed in order to identify the collection, in which the instance is stored (extent) Two alternative options are passed in order to locate the root object instance (ItemName and ItemLoid). Item name is typically used in order to locate the instance in the collection passed in Collection. ItemLoid might be used for locating the instance in the scope of the database (see example below).
By implementing virtual templates (e.g. StartDocument()) for several data types, different documents might be generated depending on the data type of the selected object instance.
When referring to collection and object key value (ItemName), one has to select the proper collection for being opened in order to select the proper instance (see example below).
// using LOID
SET<VOID> object;
object.open(database,"VOID",AccessModes::Read);
if ( object.tryGet((int)%ItemLoid%) )
object.StartDocument();
// referring to Collection and ItemName options
switch ( %Collection% ) {
case "ODC_Project" :
ODC_Project(%ItemName%).ReferenceDocu();
break;
case "ODC_Module" :
ODC_Module(%ItemName%).ReferenceDocu();
break;
case "ODC_ImpClass" :
ODC_ImpClass(%ItemName%).ReferenceDocu();
break;
case "SDB_Structure" :
SDB_Structure(%ItemName%).ReferenceDocu();
break;
case "SDB_ValueList" :
SDB_ValueList(%ItemName%).ReferenceDocu();
break;
}