StrokeAttrRecordHandler Class Reference

#include <strkattr.h>

Inheritance diagram for StrokeAttrRecordHandler:

CamelotRecordHandler CXaraFileRecordHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 StrokeAttrRecordHandler ()
 ~StrokeAttrRecordHandler ()
virtual UINT32GetTagList ()
 Provides the record handler system with a list of records handled by this handler - all StrokeType attributes: Stroke (by type) Stroke (by vector subtree definition) Stroke (airbrush) Variable width function (predefined) Variable width function (recorded).
virtual BOOL HandleRecord (CXaraFileRecord *pCXaraFileRecord)
 Handles loading of the given StrokeType attribute record.
virtual BOOL BeginSubtree (UINT32 Tag)
 Informs the record handler that a subtree is following a tag of type 'Tag'.
virtual BOOL EndSubtree (UINT32 Tag)
 Informs the record handler that a subtree that followed a tag of type 'Tag' has ended.

Private Member Functions

 CC_DECLARE_DYNAMIC (StrokeAttrRecordHandler)

Detailed Description

Definition at line 384 of file strkattr.h.


Constructor & Destructor Documentation

StrokeAttrRecordHandler::StrokeAttrRecordHandler  )  [inline]
 

Definition at line 389 of file strkattr.h.

00389 : CamelotRecordHandler() {}

StrokeAttrRecordHandler::~StrokeAttrRecordHandler  )  [inline]
 

Definition at line 390 of file strkattr.h.

00390 {}


Member Function Documentation

BOOL StrokeAttrRecordHandler::BeginSubtree UINT32  Tag  )  [virtual]
 

Informs the record handler that a subtree is following a tag of type 'Tag'.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/3/97
Parameters:
Tag = tag value of the tag this handler last handled [INPUTS]
Returns:
TRUE if this func wants exclusive handling of the tag FALSE otherwise
If you override this func and you do not wish other parts of the system to be informed of the subtree start, you should return TRUE

Reimplemented from CXaraFileRecordHandler.

Definition at line 1955 of file strkattr.cpp.

01956 {
01957     // We only want to know about following subtrees when doing stroke definition records.
01958     // If we are doing one, then we grab the subtree so nobody else can faff about with it
01959     if (Tag != TAG_STROKEDEFINITION)
01960         return(FALSE);
01961 
01962     return(TRUE);
01963 }

StrokeAttrRecordHandler::CC_DECLARE_DYNAMIC StrokeAttrRecordHandler   )  [private]
 

BOOL StrokeAttrRecordHandler::EndSubtree UINT32  Tag  )  [virtual]
 

Informs the record handler that a subtree that followed a tag of type 'Tag' has ended.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/3/97
Parameters:
Tag = tag value of the tag this handler last handled [INPUTS]
Returns:
TRUE if this func wants exclusive handling of the tag FALSE otherwise
If you override this func and you do not wish other parts of the system to be informed of the subtree end, you should return TRUE

Reimplemented from CXaraFileRecordHandler.

Definition at line 1985 of file strkattr.cpp.

01986 {
01987     // We only want to know about following subtrees when doing custom print mark records.
01988     // If we are doing one, then we grab the subtree so nobody else can faff about with it
01989     if (Tag != TAG_STROKEDEFINITION)
01990         return(FALSE);
01991 
01992 #if !defined(EXCLUDE_FROM_RALPH)
01993     // OK, it is the end of a stroke definition record, so complete the import
01994     StrokeComponent::EndImportStroke(this);
01995 #endif
01996     
01997     return(TRUE);
01998 }

UINT32 * StrokeAttrRecordHandler::GetTagList  )  [virtual]
 

Provides the record handler system with a list of records handled by this handler - all StrokeType attributes: Stroke (by type) Stroke (by vector subtree definition) Stroke (airbrush) Variable width function (predefined) Variable width function (recorded).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/1/97
Returns:
A list of tag values, terminated by CXFRH_TAG_LIST_END
See also:
StrokeTypeAttrRecordHandler::HandleRecord

Implements CXaraFileRecordHandler.

Definition at line 1769 of file strkattr.cpp.

01770 {
01771     static UINT32 TagList[] =
01772     {
01773         TAG_STROKEDEFINITION,
01774         TAG_STROKETYPE,
01775         TAG_STROKEAIRBRUSH,
01776 
01777         TAG_VARIABLEWIDTHFUNC,
01778         TAG_VARIABLEWIDTHTABLE,
01779 
01780         CXFRH_TAG_LIST_END
01781     };
01782 
01783     return(TagList);
01784 }

BOOL StrokeAttrRecordHandler::HandleRecord CXaraFileRecord pCXaraFileRecord  )  [virtual]
 

Handles loading of the given StrokeType attribute record.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/1/97
Parameters:
pCXaraFileRecord - The record to handle - may not be NULL [INPUTS]
Returns:
TRUE if handled successfuly
See also:
AttrStrokeType::WritePreChildrenNative; AttrOverprintFill::WritePreChildrenNative; AttrPrintOnAllPlates::WritePreChildrenNative

Implements CXaraFileRecordHandler.

Definition at line 1806 of file strkattr.cpp.

01807 {
01808     ERROR3IF(pCXaraFileRecord == NULL, "pCXaraFileRecord is NULL");
01809 
01810     NodeAttribute *pNewNode = NULL;
01811     
01812     switch (pCXaraFileRecord->GetTag())
01813     {
01814         case TAG_STROKEDEFINITION:
01815             return(StrokeComponent::StartImportStroke(this, pCXaraFileRecord));
01816 
01817 
01818         case TAG_STROKETYPE:
01819             {
01820                 UINT32 Handle = 0x01000000;
01821                 pCXaraFileRecord->ReadUINT32(&Handle);
01822 
01823                 pNewNode = new AttrStrokeType;
01824                 if (pNewNode != NULL)
01825                 {
01826                     PathProcessorStroke *pProcessor = NULL;
01827 
01828                     switch ((Handle >> 24) & 0xff)
01829                     {
01830                         case 0:
01831                             // Complex vector stroke
01832                             {
01833                                 StrokeHandle NewHandle = StrokeComponent::FindImportedStroke(Handle & 0x00ffffff);
01834                                 if (NewHandle != StrokeHandle_NoStroke)
01835                                     pProcessor = new PathProcessorStrokeVector;
01836 
01837                                 if (pProcessor != NULL)
01838                                     ((PathProcessorStrokeVector *)pProcessor)->SetStrokeDefinition(NewHandle);
01839                             }
01840                             break;
01841 
01842                         case 1:
01843                             // Simple old-style constant width line. Use pProcessor == NULL
01844                             break;
01845 
01846                         case 2:
01847                             // Simple variable-width stroke
01848                             pProcessor = new PathProcessorStroke;
01849                             break;
01850 
01851                         default:
01852                             ERROR3("Unknown/Unsupported stroke type");
01853                             break;
01854                     }
01855 
01856                     if (pProcessor != NULL)
01857                         ((StrokeTypeAttrValue *)pNewNode->GetAttributeValue())->SetPathProcessor(pProcessor);
01858                 }
01859             }
01860             break;
01861 
01862 
01863         case TAG_STROKEAIRBRUSH:
01864             {
01865                 // Airbrushes currently only hold an intensity-function, so we simply read that
01866                 // function and build an airbrush-stroke attribute around it.
01867                 ValueFunction *pValFunc = ValueFunction::ReadFileRecord(pCXaraFileRecord);
01868                 if (pValFunc != NULL)
01869                 {
01870                     pNewNode = new AttrStrokeType;
01871                     if (pNewNode != NULL)
01872                     {
01873                         PathProcessorStrokeAirbrush *pProcessor = new PathProcessorStrokeAirbrush;
01874                         if (pProcessor != NULL)
01875                         {
01876                             pProcessor->SetIntensityFunction(pValFunc);
01877                             ((StrokeTypeAttrValue *)pNewNode->GetAttributeValue())->SetPathProcessor(pProcessor);
01878                         }
01879                         else
01880                         {
01881                             delete pNewNode;
01882                             pNewNode = NULL;
01883                         }
01884                     }
01885                 }
01886 
01887                 if (pNewNode == NULL)   // We failed, so clean up
01888                     delete pValFunc;
01889             }
01890             break;
01891 
01892 
01893         case TAG_VARIABLEWIDTHFUNC:
01894             // Create a new variable-width attribute
01895             pNewNode = new AttrVariableWidth;
01896             if (pNewNode != NULL)
01897             {
01898                 // and fill in the value with the appropriate function definition
01899                 VariableWidthID Function = VarWidth_NotPredefined;
01900                 if (pCXaraFileRecord->ReadUINT32((UINT32 *)&Function))
01901                 {
01902                     if ((UINT32)Function != 0)
01903                         ((VariableWidthAttrValue *)pNewNode->GetAttributeValue())->SetWidthFunction(Function);
01904                 }
01905             }
01906             break;
01907 
01908 
01909         case TAG_VARIABLEWIDTHTABLE:
01910             {
01911                 ValueFunction *pValFunc = ValueFunction::ReadFileRecord(pCXaraFileRecord);
01912                 if (pValFunc != NULL)
01913                 {
01914                     pNewNode = new AttrVariableWidth;
01915                     if (pNewNode != NULL)
01916                         ((VariableWidthAttrValue *)pNewNode->GetAttributeValue())->SetWidthFunction(pValFunc);
01917                     else
01918                         delete pValFunc;
01919                 }
01920             }
01921             break;
01922 
01923         default:
01924             ERROR3_PF(("I don't handle records with the tag (%d)\n", pCXaraFileRecord->GetTag()));
01925             break;
01926     }
01927 
01928     ERROR3IF(pNewNode == NULL, "Failed to load stroke information");
01929 
01930     // Get the base class to insert the new node for us
01931     if (pNewNode != NULL)
01932         InsertNode(pNewNode);
01933     return(TRUE);
01934 }


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