TemplateAttrRecordHandler Class Reference

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

#include <tmpltatr.h>

Inheritance diagram for TemplateAttrRecordHandler:

CamelotRecordHandler CXaraFileRecordHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

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.

Private Member Functions

 CC_DECLARE_DYNAMIC (TemplateAttrRecordHandler)

Detailed Description

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

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

Definition at line 175 of file tmpltatr.h.


Member Function Documentation

TemplateAttrRecordHandler::CC_DECLARE_DYNAMIC TemplateAttrRecordHandler   )  [private]
 

UINT32 * TemplateAttrRecordHandler::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 632 of file tmpltatr.cpp.

00633 {
00634     static const UINT32 TagList[] = { TAG_WIZOP, CXFRH_TAG_LIST_END};
00635 
00636     return (UINT32*)&TagList;
00637 }

BOOL TemplateAttrRecordHandler::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 656 of file tmpltatr.cpp.

00657 {
00658     ERROR2IF(pRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
00659     ERROR2IF(pRecord->GetTag() != TAG_WIZOP, FALSE, "I don't handle this tag type");
00660 
00661     String_64 OpName;
00662     String_256 Question;
00663     String_256 Param;
00664     String_256 PatchSpace;
00665 
00666     BOOL ok = pRecord->ReadUnicode(OpName, 64);
00667 
00668     if (ok)
00669     {
00670         ok = pRecord->ReadUnicode(Question, 256);
00671     }
00672 
00673     if (ok)
00674     {
00675         ok = pRecord->ReadUnicode(Param, 256);
00676     }
00677 
00678     if (ok)
00679     {
00680         ok = pRecord->ReadUnicode(PatchSpace, 256);
00681     }
00682 
00683     BaseCamelotFilter* pFilter = GetBaseCamelotFilter();
00684     if (ok)
00685     {
00686         NodeSetSentinel * pNodeSetSentinel = pFilter->GetDocument()->GetSetSentinel();
00687 
00688         if (pNodeSetSentinel)
00689         {
00690             Node * pContextNode = pFilter->GetInsertContextNode();
00691 
00692             // dont add the attrib if it is a duplicate and it is in the sentinel
00693             if ((pNodeSetSentinel != pContextNode->FindParent() &&
00694                 pNodeSetSentinel != pContextNode ) ||
00695                 SliceHelper::LookupNameGalleryItem(Param) == NULL)
00696             {
00697                 // We managed to read it all OK so add a new TemplateAttribute to the tree
00698                 TemplateAttribute* pNewAttribute = new TemplateAttribute(OpName, Question, Param);  
00699                 ok = (pNewAttribute != 0) && InsertNode(pNewAttribute);
00700 
00701                 // JCF: Web files don't include records for the NodeSetSentinel or its child
00702                 // ObjectName attributes, so make sure that a copy of the TemplateAttribute
00703                 // is inserted as a child of the sentinel as well, if there isn't one already
00704                 // in place.
00705                 if (ok && pNewAttribute->IsAnObjectName())
00706                 {
00707                     // Register/insert the imported ObjectName with the doc's NodeSetSentinel.
00708                     ok = pNodeSetSentinel->OnLoadName(pFilter, pNewAttribute);
00709                 }
00710             }
00711         }
00712     }
00713 
00714     if (!ok)
00715     {
00716         ENSURE_NOT_NULL(pFilter);
00717         pFilter->GotError(_R(IDE_FILE_READ_ERROR));
00718     }
00719 
00720     return ok;
00721 }


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