UnitsRecordHandler Class Reference

Provide a units record handler for the new native and web file formats. This asks the units document component to import the unit definitions for us. More...

#include <rechunit.h>

Inheritance diagram for UnitsRecordHandler:

CamelotRecordHandler CXaraFileRecordHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 UnitsRecordHandler ()
 ~UnitsRecordHandler ()
virtual BOOL BeginImport ()
 Initialises the units record handler.
virtual UINT32GetTagList ()
 Provides the record handler system with a list of records handled by this handler.
virtual BOOL HandleRecord (CXaraFileRecord *pCXaraFileRecord)
 Handles the given record.

Protected Attributes

UnitListComponentpUnitsComponent

Private Member Functions

 CC_DECLARE_DYNAMIC (UnitsRecordHandler)

Detailed Description

Provide a units record handler for the new native and web file formats. This asks the units document component to import the unit definitions for us.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/96
See also:
UnitListDocComponent;

Definition at line 124 of file rechunit.h.


Constructor & Destructor Documentation

UnitsRecordHandler::UnitsRecordHandler  )  [inline]
 

Definition at line 130 of file rechunit.h.

00130 : CamelotRecordHandler() {}

UnitsRecordHandler::~UnitsRecordHandler  )  [inline]
 

Definition at line 131 of file rechunit.h.

00131 {}


Member Function Documentation

BOOL UnitsRecordHandler::BeginImport  )  [virtual]
 

Initialises the units record handler.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/96
Parameters:
0 [INPUTS]
Returns:
TRUE if ok FALSE otherwise

Errors: -

See also:
-

Reimplemented from CXaraFileRecordHandler.

Definition at line 135 of file rechunit.cpp.

00136 {
00137     pUnitsComponent = GetUnitDocComponent();
00138 
00139     return (pUnitsComponent != NULL);
00140 }

UnitsRecordHandler::CC_DECLARE_DYNAMIC UnitsRecordHandler   )  [private]
 

UINT32 * UnitsRecordHandler::GetTagList  )  [virtual]
 

Provides the record handler system with a list of records handled by this handler.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/96
Parameters:
- [INPUTS]
Returns:
Ptr to a list of tag values, terminated by CXFRH_TAG_LIST_END
See also:
-

Implements CXaraFileRecordHandler.

Definition at line 156 of file rechunit.cpp.

00157 {
00158     static UINT32 TagList[] = {TAG_DEFINE_PREFIXUSERUNIT, TAG_DEFINE_SUFFIXUSERUNIT,
00159                               TAG_DEFINE_DEFAULTUNITS,
00160                               CXFRH_TAG_LIST_END};
00161 
00162     return (UINT32*)&TagList;
00163 }

BOOL UnitsRecordHandler::HandleRecord CXaraFileRecord pCXaraFileRecord  )  [virtual]
 

Handles the given record.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/96
Parameters:
pCXaraFileRecord = ptr to record to handle [INPUTS]
Returns:
TRUE if handled successfuly FALSE otherwise
See also:
-

Implements CXaraFileRecordHandler.

Definition at line 179 of file rechunit.cpp.

00180 {
00181 // WEBSTER - markn 17/12/96
00182 // No unit record handling needed
00183 #ifdef WEBSTER
00184     return TRUE;
00185 #else
00186     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"UnitsRecordHandler::HandleRecord pCXaraFileRecord is NULL");
00187 
00188     BOOL ok = TRUE;
00189     Document * pDoc = GetDocument();
00190     INT32 Tag = pCXaraFileRecord->GetTag();
00191     switch (Tag)
00192     {
00193          case TAG_DEFINE_DEFAULTUNITS:
00194             // Ask the units document component class to import those default display units for us
00195             // If we are just importing data from this document into an existing one,
00196             // then don't import this data.
00197             if (IsImporting())
00198                 break;
00199             if (pUnitsComponent)
00200                 pUnitsComponent->ImportDefaultDisplayUnits(pCXaraFileRecord, pDoc);
00201             else
00202                 ERROR3("UnitsRecordHandler::HandleRecord no pUnitsComponent");
00203             break;
00204          case TAG_DEFINE_PREFIXUSERUNIT:
00205          case TAG_DEFINE_SUFFIXUSERUNIT:
00206             // Ask the units document component class to import this user unit definition for us
00207             if (pUnitsComponent)
00208                 pUnitsComponent->ImportUserUnitDefinition(pCXaraFileRecord, pDoc, Tag);
00209             else
00210                 ERROR3("UnitsRecordHandler::HandleRecord no pUnitsComponent");
00211             break;
00212 
00213         default:
00214             ok = FALSE;
00215             ERROR3_PF(("UnitsRecordHandler::HandleRecord I don't handle records with the tag (%d)\n",pCXaraFileRecord->GetTag()));
00216             break;
00217     }
00218 
00219     return ok;
00220 #endif // WEBSTER
00221 }


Member Data Documentation

UnitListComponent* UnitsRecordHandler::pUnitsComponent [protected]
 

Definition at line 147 of file rechunit.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:02:41 2007 for Camelot by  doxygen 1.4.4