LiveEffectRecordHandler Class Reference

Handles the reading of live effects records. More...

#include <nodeliveeffect.h>

Inheritance diagram for LiveEffectRecordHandler:

CamelotRecordHandler CXaraFileRecordHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 LiveEffectRecordHandler ()
 ~LiveEffectRecordHandler ()
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.
virtual BOOL IsStreamed (UINT32 Tag)
 Function to find out if the record is streamed or not.
virtual BOOL HandleStreamedRecord (CXaraFile *pCXFile, UINT32 Tag, UINT32 Size, UINT32 RecordNumber)
 This is the bitmap streamed record handler. It handles the loading of bitmap definitions.

Private Member Functions

 CC_DECLARE_DYNAMIC (LiveEffectRecordHandler)

Detailed Description

Handles the reading of live effects records.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/09/2004
See also:
-

Definition at line 130 of file nodeliveeffect.h.


Constructor & Destructor Documentation

LiveEffectRecordHandler::LiveEffectRecordHandler  )  [inline]
 

Definition at line 136 of file nodeliveeffect.h.

00136 : CamelotRecordHandler() {}

LiveEffectRecordHandler::~LiveEffectRecordHandler  )  [inline]
 

Definition at line 137 of file nodeliveeffect.h.

00137 {}


Member Function Documentation

LiveEffectRecordHandler::CC_DECLARE_DYNAMIC LiveEffectRecordHandler   )  [private]
 

UINT32 * LiveEffectRecordHandler::GetTagList  )  [virtual]
 

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

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

Implements CXaraFileRecordHandler.

Definition at line 4736 of file nodeliveeffect.cpp.

04737 {
04738     static UINT32 TagList[] = { TAG_LIVE_EFFECT,
04739                                 TAG_LOCKED_EFFECT,
04740                                 TAG_FEATHER_EFFECT,
04741 
04742                                 CXFRH_TAG_LIST_END};
04743 
04744     return (UINT32*)&TagList;
04745 }

BOOL LiveEffectRecordHandler::HandleRecord CXaraFileRecord pCXaraFileRecord  )  [virtual]
 

Handles the given record.

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

Implements CXaraFileRecordHandler.

Definition at line 4798 of file nodeliveeffect.cpp.

04799 {
04800     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"LiveEffectRecordHandler::HandleRecord pCXaraFileRecord is NULL");
04801 
04802     BOOL ok = TRUE;
04803     INT32 tag = pCXaraFileRecord->GetTag();
04804     switch (tag)
04805     {
04806     case TAG_LIVE_EFFECT:
04807         {
04808             // read in the record ---------------------------------------------------------
04809             // read flags
04810             BYTE Flags;
04811             if (ok) ok = pCXaraFileRecord->ReadBYTE(&Flags);
04812 
04813             // Read resolution
04814             double dPixelsPerInch;
04815             if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&dPixelsPerInch);
04816 
04817             // Read Effect ID
04818             String_256 strPostProID;
04819             if (ok) ok = pCXaraFileRecord->ReadUnicode(&strPostProID);
04820 
04821             // Read Display Name
04822             String_256 strDisplayName;
04823             if (ok) ok = pCXaraFileRecord->ReadUnicode(&strDisplayName);
04824 
04825             // Read edits list
04826 //          _bstr_t bstrXML;
04827 //          if (ok) ok = pCXaraFileRecord->ReadBSTR(&bstrXML, pCXaraFileRecord->GetSize());
04828             StringVar strXML;
04829             if (ok) ok = pCXaraFileRecord->ReadUTF16STR(&strXML, pCXaraFileRecord->GetSize());
04830 
04831             // process the record ---------------------------------------------------------
04832             if (ok)
04833             {
04834                 NodeLiveEffect* pLE = new NodeLiveEffect();
04835 
04836                 pLE->m_dPixelsPerInch = dPixelsPerInch;
04837 
04838                 pLE->m_strPostProID = strPostProID;
04839 
04840                 pLE->m_strDisplayName = strDisplayName;
04841 
04842 PORTNOTETRACE("other","LiveEffectRecordHandler::HandleRecord - removed use of XML");
04843 #ifndef EXCLUDE_FROM_XARALX
04844                 VARIANT_BOOL varResult;
04845                 IXMLDOMDocumentPtr pxmlDoc = CXMLUtils::NewDocument();
04846                 HRESULT hr = pxmlDoc->loadXML(bstrXML, &varResult);
04847                 ok =  (SUCCEEDED(hr) && VARIANT_TRUE == varResult);
04848                 if (ok) pLE->m_pEditsDoc = pxmlDoc;
04849 #else
04850     pLE->m_pEditsDoc = NULL;
04851     pLE->m_vstrEdits = strXML;
04852 #endif
04853 
04854                 if (ok) ok = InsertNode(pLE);
04855             }
04856             return ok;
04857         }
04858         break;
04859 
04860     case TAG_LOCKED_EFFECT:
04861         {
04862             // read in the record ---------------------------------------------------------
04863             // read flags
04864             BYTE Flags;
04865             if (ok) ok = pCXaraFileRecord->ReadBYTE(&Flags);
04866 
04867             // Read resolution
04868             double dPixelsPerInch;
04869             if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&dPixelsPerInch);
04870 
04871             // Read bitmap ref
04872             INT32 BitmapRef;
04873             if (ok) ok = pCXaraFileRecord->ReadINT32(&BitmapRef);
04874 
04875             // Read coords
04876             DocCoord tc[3];
04877             if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&tc[0], 0, 0);
04878             if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&tc[1], 0, 0);
04879             if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&tc[2], 0, 0);
04880 
04881             // Read Effect ID
04882             String_256 strPostProID;
04883             if (ok) ok = pCXaraFileRecord->ReadUnicode(&strPostProID);
04884 
04885             // Read Display Name
04886             String_256 strDisplayName;
04887             if (ok) ok = pCXaraFileRecord->ReadUnicode(&strDisplayName);
04888 
04889             // Read edits list
04890 //          _bstr_t bstrXML;
04891 //          if (ok) ok = pCXaraFileRecord->ReadBSTR(&bstrXML, pCXaraFileRecord->GetSize());
04892             StringVar strXML;
04893             if (ok) ok = pCXaraFileRecord->ReadUTF16STR(&strXML, pCXaraFileRecord->GetSize());
04894 
04895             // process the record ---------------------------------------------------------
04896             if (ok)
04897             {
04898                 NodeLockedEffect* pLE = new NodeLockedEffect();
04899 
04900                 pLE->m_bIsDestructive = !((Flags & 0x02) == 0x02);      // Flag set in file when NOT destructive for back-compatibility
04901 
04902                 pLE->m_dPixelsPerInch = dPixelsPerInch;
04903                 pLE->m_strPostProID = strPostProID;
04904                 pLE->m_strDisplayName = strDisplayName;
04905                 pLE->m_PGram[0] = tc[0];
04906                 pLE->m_PGram[1] = tc[1];
04907                 pLE->m_PGram[2] = tc[2];
04908 
04909 PORTNOTETRACE("other","LiveEffectRecordHandler::HandleRecord - removed use of XML");
04910 #ifndef EXCLUDE_FROM_XARALX
04911                 VARIANT_BOOL varResult;
04912                 IXMLDOMDocumentPtr pxmlDoc = CXMLUtils::NewDocument();
04913                 HRESULT hr = pxmlDoc->loadXML(bstrXML, &varResult);
04914                 ok =  (SUCCEEDED(hr) && VARIANT_TRUE == varResult);
04915                 if (ok) pLE->m_pEditsDoc = pxmlDoc;
04916 #else
04917     pLE->m_pEditsDoc = NULL;
04918     pLE->m_vstrEdits = strXML;
04919 #endif
04920 
04921                 // Convert the bmp reference into a kernel bmp
04922                 if (ok)
04923                 {
04924                     KernelBitmap* pBitmap = NULL;
04925                     pBitmap = GetReadBitmapReference(BitmapRef);
04926                     pBitmap->GetActualBitmap()->SetHidden(TRUE);        // We don't want the user to see this bitmap in the gallery
04927                     ok = (pBitmap != NULL);
04928                     if (ok) pLE->m_BitmapRef.Attach(pBitmap);
04929                 }
04930 
04931                 if (ok) ok = InsertNode(pLE);
04932             }
04933 
04934             return ok;
04935         }
04936         break;
04937 
04938 #ifdef FEATHER_EFFECT
04939     case TAG_FEATHER_EFFECT:
04940         {
04941             // read in the record ---------------------------------------------------------
04942             // read flags
04943             BYTE Flags;
04944             if (ok) ok = pCXaraFileRecord->ReadBYTE(&Flags);
04945 
04946             // Read resolution
04947             double dPixelsPerInch;
04948             if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&dPixelsPerInch);
04949 
04950             // Read Effect ID
04951             String_256 strPostProID;
04952             if (ok) ok = pCXaraFileRecord->ReadUnicode(&strPostProID);
04953 
04954             // Read Display Name
04955             String_256 strDisplayName;
04956             if (ok) ok = pCXaraFileRecord->ReadUnicode(&strDisplayName);
04957 
04958             // Read feather details
04959             MILLIPOINT mpFeatherSize = 0;
04960             double dBias = 0;
04961             double dGain = 0;
04962             if (ok) ok = pCXaraFileRecord->ReadINT32(&mpFeatherSize);
04963             if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&dBias);
04964             if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&dGain);
04965 
04966             // process the record ---------------------------------------------------------
04967             if (ok)
04968             {
04969                 NodeFeatherEffect* pFE = new NodeFeatherEffect();
04970 
04971                 pFE->m_dPixelsPerInch = dPixelsPerInch;
04972 
04973                 pFE->m_strPostProID = strPostProID;
04974 
04975                 pFE->m_strDisplayName = strDisplayName;
04976 
04977                 pFE->SetFeatherSize(mpFeatherSize);
04978 
04979                 CProfileBiasGain Profile((AFp)dBias, (AFp)dGain);
04980                 pFE->SetProfile(Profile);
04981 
04982                 if (ok) ok = InsertNode(pFE);
04983             }
04984 
04985             return ok;
04986         }
04987         break;
04988 #endif
04989 
04990     default:
04991         ERROR3_PF(("I don't handle records with the tag (%d)\n", pCXaraFileRecord->GetTag()));
04992         break;
04993     }
04994 
04995     return FALSE;
04996 }

BOOL LiveEffectRecordHandler::HandleStreamedRecord CXaraFile pCXFile,
UINT32  Tag,
UINT32  Size,
UINT32  RecordNumber
[virtual]
 

This is the bitmap streamed record handler. It handles the loading of bitmap definitions.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/01/2004
Parameters:
pCXFile = access to the CXaraFile class [INPUTS] Tag = the tag value Size = size of record RecordNumber = the record number in the file
Returns:
TRUE if handled ok FALSE otherwise

Errors: -

See also:
-

Reimplemented from CXaraFileRecordHandler.

Definition at line 5020 of file nodeliveeffect.cpp.

05021 {
05022     ERROR2IF(pCXFile == NULL,FALSE,"BitmapRecordHandler::HandleStreamedRecord pCXFile is NULL");
05023 
05024     ERROR3_PF(("Unimplemented!", Tag));
05025 
05026     return TRUE;
05027 }

BOOL LiveEffectRecordHandler::IsStreamed UINT32  Tag  )  [virtual]
 

Function to find out if the record is streamed or not.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/01/2004
Parameters:
The tag of the record [INPUTS]
Returns:
TRUE if this is a streamed record FALSE otherwise

Errors: -

See also:
-

Reimplemented from CamelotRecordHandler.

Definition at line 4763 of file nodeliveeffect.cpp.

04764 {
04765     // We handle both types so check what we need to do by the tag we have been given
04766     BOOL Streamed = FALSE;
04767     switch (Tag)
04768     {
04769         case TAG_LIVE_EFFECT:
04770         case TAG_LOCKED_EFFECT:
04771         case TAG_FEATHER_EFFECT:
04772             Streamed = FALSE;
04773 
04774             break;
04775         default:
04776             Streamed = FALSE;
04777             ERROR3_PF(("LiveEffectRecordHandler::IsStreamed I don't handle records with the tag (%d)\n", Tag));
04778             break;
04779     }
04780 
04781     return Streamed;
04782 }


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