BitmapPropertiesRecordHandler Class Reference

Handles the reading of bitmap properties records. More...

#include <rechbmpp.h>

Inheritance diagram for BitmapPropertiesRecordHandler:

CamelotRecordHandler CXaraFileRecordHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 BitmapPropertiesRecordHandler ()
 ~BitmapPropertiesRecordHandler ()
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 (BitmapPropertiesRecordHandler)

Detailed Description

Handles the reading of bitmap properties records.

Author:
Andy_Hills (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/10/00
See also:
-

Definition at line 117 of file rechbmpp.h.


Constructor & Destructor Documentation

BitmapPropertiesRecordHandler::BitmapPropertiesRecordHandler  )  [inline]
 

Definition at line 123 of file rechbmpp.h.

00123 : CamelotRecordHandler() {}

BitmapPropertiesRecordHandler::~BitmapPropertiesRecordHandler  )  [inline]
 

Definition at line 124 of file rechbmpp.h.

00124 {}


Member Function Documentation

BitmapPropertiesRecordHandler::CC_DECLARE_DYNAMIC BitmapPropertiesRecordHandler   )  [private]
 

UINT32 * BitmapPropertiesRecordHandler::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 138 of file rechbmpp.cpp.

00139 {
00140     static UINT32 TagList[] = {TAG_BITMAP_PROPERTIES, TAG_XPE_BITMAP_PROPERTIES, CXFRH_TAG_LIST_END};
00141 
00142     return (UINT32*)&TagList;
00143 }

BOOL BitmapPropertiesRecordHandler::HandleRecord CXaraFileRecord pCXaraFileRecord  )  [virtual]
 

Handles the given record.

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

Implements CXaraFileRecordHandler.

Definition at line 196 of file rechbmpp.cpp.

00197 {
00198     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"BitmapPropertiesRecordHandler::HandleRecord pCXaraFileRecord is NULL");
00199 
00200     BOOL ok = TRUE;
00201     UINT32 tag = pCXaraFileRecord->GetTag();
00202 
00203     // read in the record ---------------------------------------------------------
00204 
00205     // read bitmap reference
00206     INT32 BmpRef = 0;
00207     INT32 MasterRef = 0;
00208     String_256 BitmapName;
00209     ok = pCXaraFileRecord->ReadINT32(&BmpRef);
00210 
00211     // read flags
00212     BYTE Flags;
00213     if (ok) ok = pCXaraFileRecord->ReadBYTE(&Flags);
00214 
00215     // read other stuff
00216     BYTE Temp;
00217     for( INT32 i=0; i<7; i++ )
00218     {
00219         if (ok) ok = pCXaraFileRecord->ReadBYTE(&Temp);
00220     }
00221 
00222     // Read XPE master ref and XML edits list
00223 //  _bstr_t bstrXML;
00224     StringVar strXML;
00225     if (ok && tag==TAG_XPE_BITMAP_PROPERTIES)
00226     {
00227         ok = pCXaraFileRecord->ReadINT32(&MasterRef);
00228 
00229         if (ok) ok = pCXaraFileRecord->ReadUnicode(&BitmapName);
00230 
00231 //      if (ok) ok = pCXaraFileRecord->ReadBSTR(&bstrXML, pCXaraFileRecord->GetSize());
00232         if (ok) ok = pCXaraFileRecord->ReadUTF16STR(&strXML, pCXaraFileRecord->GetSize());
00233     }
00234 
00235     // process the record ---------------------------------------------------------
00236 
00237     // look up the bitmap from BmpRef
00238 
00239     if (BmpRef == 0)
00240     {
00241         // no such bitmap
00242         ok = FALSE;
00243     }
00244     else
00245     {
00246         KernelBitmap *pBitmap = NULL;
00247         pBitmap = GetReadBitmapReference(BmpRef);
00248 
00249         if (pBitmap == NULL)
00250         {
00251             // no such bitmap
00252             ok = FALSE;
00253         }
00254         else
00255         {
00256             // process the flags
00257             BOOL bSmoothWhenScaledUp = Flags & 0x01;
00258             pBitmap->SetInterpolation(bSmoothWhenScaledUp);
00259 
00260             // Setup XPE info
00261             // (If we don't have it, it's not important - this bitmap will just lose
00262             //  it's XPE edit info and will become its own master)
00263 PORTNOTETRACE("other","BitmapPropertiesRecordHandler::HandleRecord - remove XML code");
00264 #ifndef EXCLUDE_FROM_XARALX
00265             if (tag==TAG_XPE_BITMAP_PROPERTIES && MasterRef!=0)
00266             {
00267                 KernelBitmap* pMasterBitmap = NULL;
00268                 pMasterBitmap = GetReadBitmapReference(MasterRef);
00269 
00270                 VARIANT_BOOL varResult;
00271                 IXMLDOMDocumentPtr pxmlDoc = CXMLUtils::NewDocument();
00272                 HRESULT hr = pxmlDoc->loadXML(bstrXML, &varResult);
00273                 if (pMasterBitmap && SUCCEEDED(hr) && VARIANT_TRUE == varResult)
00274                 {
00275                     // We now know that this master bitmap will be used
00276                     // so add it to the document's bitmap list...
00277                     // Get the bitmap list from the current document
00278                     Document* pDoc = Document::GetCurrent();
00279                     BitmapList* pBmpList = pDoc->GetBitmapList();
00280                     if (!pBmpList->FindDuplicateBitmap(pMasterBitmap->ActualBitmap))
00281                         // and then attach the bitmap
00282                         pMasterBitmap->Attach(pBmpList);
00283 
00284                     // See whether we need to regenerate this bitmap from the
00285                     // Master and the Edits...
00286                     if (pBitmap->IsDefaultBitmap())
00287                     {
00288                         XPEEditOp::DoProcessBitmap(pBitmap, pMasterBitmap, pxmlDoc);
00289                     }
00290 
00291                     pBitmap->SetXPEInfo(pMasterBitmap, pxmlDoc);    // Can only do this after DoProcessBitmap...
00292                 }
00293 
00294                 pBitmap->SetName(BitmapName);                       // ...and this, because process may create new OILBitmap
00295             }
00296 #endif
00297         }
00298     }
00299 
00300     return ok;
00301 }

BOOL BitmapPropertiesRecordHandler::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 325 of file rechbmpp.cpp.

00326 {
00327     ERROR2IF(pCXFile == NULL,FALSE,"BitmapRecordHandler::HandleStreamedRecord pCXFile is NULL");
00328 
00329     if (Tag!=TAG_XPE_BITMAP_PROPERTIES)
00330     {
00331         ERROR3_PF(("BitmapPropertiesRecordHandler::HandleStreamedRecord I don't handle records with the tag (%d)\n", Tag));
00332         return FALSE;
00333     }
00334     ERROR3_PF(("Unimplemented!", Tag));
00335 
00336     return TRUE;
00337 }

BOOL BitmapPropertiesRecordHandler::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 161 of file rechbmpp.cpp.

00162 {
00163     // We handle both types so check what we need to do by the tag we have been given
00164     BOOL Streamed = FALSE;
00165     switch (Tag)
00166     {
00167         case TAG_BITMAP_PROPERTIES:
00168             Streamed = FALSE;
00169             break;
00170         case TAG_XPE_BITMAP_PROPERTIES:
00171             Streamed = FALSE;
00172             break;
00173         default:
00174             Streamed = FALSE;
00175             ERROR3_PF(("BitmapPropertiesRecordHandler::IsStreamed I don't handle records with the tag (%d)\n", Tag));
00176             break;
00177     }
00178 
00179     return Streamed;
00180 }


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