WizOpStyleRefRecordHandler Class Reference

Handles the reading of WizOpStyleRef records in the v2 file format. More...

#include <tmpltatr.h>

Inheritance diagram for WizOpStyleRefRecordHandler:

CamelotRecordHandler CXaraFileRecordHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 WizOpStyleRefRecordHandler ()
BOOL Init (BaseCamelotFilter *pFilter)
 Initialises the WizOpStyleRecordHandler.
virtual UINT32GetTagList ()
 Provides the record handler system with a list of records handled by this handler.
virtual BOOL HandleRecord (CXaraFileRecord *pCXaraFileRecord)
 Handles the given TAG_WIZOP record.

Protected Member Functions

WizOpStylesGetImportedStyles () const
 Data access.

Private Member Functions

 CC_DECLARE_DYNAMIC (WizOpStyleRefRecordHandler)

Private Attributes

WizOpStylesm_pStyleComponent

Detailed Description

Handles the reading of WizOpStyleRef records in the v2 file format.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/06/97

Definition at line 246 of file tmpltatr.h.


Constructor & Destructor Documentation

WizOpStyleRefRecordHandler::WizOpStyleRefRecordHandler  )  [inline]
 

Definition at line 252 of file tmpltatr.h.

00252 : m_pStyleComponent(NULL) {}


Member Function Documentation

WizOpStyleRefRecordHandler::CC_DECLARE_DYNAMIC WizOpStyleRefRecordHandler   )  [private]
 

WizOpStyles & WizOpStyleRefRecordHandler::GetImportedStyles  )  const [protected]
 

Data access.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/06/97
Returns:
Errors: Will ERROR2 if the Init function failed

Definition at line 1445 of file tmpltatr.cpp.

01446 {
01447     // This static dummy object is used for returning in the ERROR2 case
01448     // The original used to return a ptr to a local variable, which is a tad dangerous.
01449     // This solution is not ideal, because there's a permanent instance of an object
01450     // that will probably never be used.
01451     static WizOpStyles Dummy;
01452 
01453     ERROR2IF(m_pStyleComponent == NULL, Dummy, "NULL Member");
01454 
01455     return *m_pStyleComponent;
01456 }

UINT32 * WizOpStyleRefRecordHandler::GetTagList  )  [virtual]
 

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

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/06/97
Returns:
Ptr to a list of tag values, terminated by CXFRH_TAG_LIST_END
Notes: Don't ever extend this. Derive a class from it. See GeneralAttrRecordHandler for how not to do it.

Implements CXaraFileRecordHandler.

Definition at line 1339 of file tmpltatr.cpp.

01340 {
01341     static const UINT32 TagList[] = { TAG_WIZOP_STYLEREF, CXFRH_TAG_LIST_END};
01342 
01343     return (UINT32*)&TagList;
01344 }

BOOL WizOpStyleRefRecordHandler::HandleRecord CXaraFileRecord pRecord  )  [virtual]
 

Handles the given TAG_WIZOP record.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/06/97
Parameters:
pCXaraFileRecord = ptr to record to handle [INPUTS]
Returns:
TRUE if handled successfuly FALSE otherwise

Errors: If pCXaraFileRecord isn't a TAG_WIZOP record

Implements CXaraFileRecordHandler.

Definition at line 1396 of file tmpltatr.cpp.

01397 {
01398     ERROR2IF(pRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
01399     ERROR2IF(pRecord->GetTag() != TAG_WIZOP_STYLEREF, FALSE, "I don't handle this tag type");
01400 
01401     XFileRef            StyleRecordRef;
01402 
01403     BOOL                Ok = pRecord->ReadINT32(&StyleRecordRef);
01404     if (Ok)
01405     {
01406         WizOpStyle* const pStyle = GetImportedStyles().FindStyleFromRecordReference(StyleRecordRef);
01407         if (pStyle != NULL)
01408         {
01409             // We managed to read it all OK so add a new StyleRefAttribute to the tree
01410             StyleReferenceAttribute* const pNewAttribute = new StyleReferenceAttribute(*pStyle);
01411         
01412             if (pNewAttribute != NULL)
01413             {
01414                 Ok = InsertNode(pNewAttribute);
01415             }
01416             else
01417             {
01418                 Ok = FALSE;
01419             }
01420         }
01421         else
01422         {
01423             BaseCamelotFilter* const pFilter = GetBaseCamelotFilter();
01424             ENSURE_NOT_NULL(pFilter);
01425             pFilter->AppendWarning(_R(IDS_STYLE_NOT_FOUND));
01426         }
01427     }
01428 
01429     return Ok;
01430 }

BOOL WizOpStyleRefRecordHandler::Init BaseCamelotFilter pFilter  )  [virtual]
 

Initialises the WizOpStyleRecordHandler.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/07/97
Returns:
TRUE if ok FALSE otherwise

Reimplemented from CamelotRecordHandler.

Definition at line 1360 of file tmpltatr.cpp.

01361 {
01362     BOOL Ok = TRUE;
01363 
01364     Ok = CamelotRecordHandler::Init(pFilter);
01365 
01366     Document* const pDoc = GetDocument();
01367     Ok = (pDoc != NULL);
01368 
01369     if (Ok)
01370     {
01371         m_pStyleComponent = (WizOpStyles*)pDoc->GetDocComponent( CC_RUNTIME_CLASS(WizOpStyles) );
01372         Ok = (m_pStyleComponent != NULL);
01373     }
01374 
01375     return Ok;
01376 }


Member Data Documentation

WizOpStyles* WizOpStyleRefRecordHandler::m_pStyleComponent [private]
 

Definition at line 268 of file tmpltatr.h.


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