#include <rechattr.h>
Inheritance diagram for GeneralAttrRecordHandler:
Public Member Functions | |
GeneralAttrRecordHandler () | |
~GeneralAttrRecordHandler () | |
virtual UINT32 * | GetTagList () |
Provides the record handler system with a list of records handled by this handler. | |
virtual BOOL | HandleRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. | |
Private Member Functions | |
CC_DECLARE_DYNAMIC (GeneralAttrRecordHandler) | |
BOOL | HandleQualityRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. The record has to be a quality record (and I don't mean a record of high grade). | |
BOOL | HandleUserValueRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. The record has to be a UserAttribute (ValueAttribute) record. | |
BOOL | HandleWebAddressRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. The record has to be a WebAddress record. | |
BOOL | HandleWebAddressBoundingBoxRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. The record has to be a WebAddressBoundingBox record. |
Definition at line 222 of file rechattr.h.
|
Definition at line 228 of file rechattr.h. 00228 : CamelotRecordHandler() {}
|
|
Definition at line 229 of file rechattr.h.
|
|
|
|
Provides the record handler system with a list of records handled by this handler.
Implements CXaraFileRecordHandler. Definition at line 138 of file rechattr.cpp. 00139 { 00140 static UINT32 TagList[] = { TAG_QUALITY, 00141 TAG_USERVALUE, 00142 TAG_WEBADDRESS, 00143 TAG_WEBADDRESS_BOUNDINGBOX, 00144 CXFRH_TAG_LIST_END}; 00145 00146 return (UINT32*)&TagList; 00147 }
|
|
Handles the given record. The record has to be a quality record (and I don't mean a record of high grade).
Definition at line 212 of file rechattr.cpp. 00213 { 00214 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL"); 00215 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_QUALITY,FALSE,"I don't handle this tag type"); 00216 00217 INT32 Quality = 0; 00218 BOOL ok = pCXaraFileRecord->ReadINT32(&Quality); 00219 00220 if (ok) 00221 { 00222 AttrQuality* pQual = new AttrQuality; 00223 if (pQual != NULL) 00224 { 00225 pQual->Value.QualityValue.SetQuality(Quality); 00226 ok = InsertNode(pQual); 00227 } 00228 else 00229 ok = FALSE; 00230 } 00231 00232 return ok; 00233 }
|
|
Handles the given record.
Implements CXaraFileRecordHandler. Definition at line 163 of file rechattr.cpp. 00164 { 00165 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL"); 00166 00167 BOOL ok = TRUE; 00168 00169 switch (pCXaraFileRecord->GetTag()) 00170 { 00171 case TAG_QUALITY: 00172 ok = HandleQualityRecord(pCXaraFileRecord); 00173 break; 00174 00175 case TAG_USERVALUE: 00176 ok = HandleUserValueRecord(pCXaraFileRecord); 00177 break; 00178 00179 case TAG_WEBADDRESS: 00180 ok = HandleWebAddressRecord(pCXaraFileRecord); 00181 break; 00182 00183 case TAG_WEBADDRESS_BOUNDINGBOX: 00184 ok = HandleWebAddressBoundingBoxRecord(pCXaraFileRecord); 00185 break; 00186 00187 default: 00188 ok = FALSE; 00189 ERROR3_PF(("I don't handle records with the tag (%d)\n",pCXaraFileRecord->GetTag())); 00190 break; 00191 } 00192 00193 return ok; 00194 }
|
|
Handles the given record. The record has to be a UserAttribute (ValueAttribute) record.
Definition at line 250 of file rechattr.cpp. 00251 { 00252 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL"); 00253 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_USERVALUE,FALSE,"I don't handle this tag type"); 00254 00255 String_256 Key; 00256 String_256 Value; 00257 BOOL ok = TRUE; 00258 if (ok) ok = pCXaraFileRecord->ReadUnicode((LPTSTR)Key, 256); 00259 if (ok) ok = pCXaraFileRecord->ReadUnicode((LPTSTR)Value, 256); 00260 00261 if (ok) 00262 { 00263 //We need to test the Key, to see if this is an old-style Web Address 00264 String_256 strKey=Key; 00265 String_256 strWebAddressKey(_R(IDS_USERATTRKEY_WEBADDRESS)); 00266 00267 //If this is an old-style Web Address 00268 if (strKey==strWebAddressKey) 00269 { 00270 //Then put it in the node tree 00271 AttrWebAddress* pAttrWebAddress = new AttrWebAddress((TCHAR*)Value); 00272 00273 if (pAttrWebAddress) 00274 ok = InsertNode(pAttrWebAddress); 00275 else 00276 ok = FALSE; 00277 } 00278 else 00279 { 00280 // We wrote out the INT32 key, so Key is actually that 00281 AttrUser* const pNewAttr = new AttrUser(Key, Value); 00282 00283 if (pNewAttr != NULL) 00284 { 00285 ok = InsertNode(pNewAttr); 00286 } 00287 else 00288 { 00289 ok = FALSE; 00290 } 00291 } 00292 00293 } 00294 00295 return ok; 00296 }
|
|
Handles the given record. The record has to be a WebAddressBoundingBox record.
Definition at line 362 of file rechattr.cpp. 00363 { 00364 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL"); 00365 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_WEBADDRESS_BOUNDINGBOX,FALSE,"I don't handle this tag type"); 00366 00367 //There will be two coordinates at the start of the file, which will describe the 00368 //bounding box of the clickable area of this attribute 00369 00370 //We don't need these: the bounding box of the clickable area of this attribute 00371 //is the bounding box of the this attribute's parent node. So we throw them away. 00372 DocCoord dcThrowAway; 00373 pCXaraFileRecord->ReadCoordInterleaved(&dcThrowAway); 00374 pCXaraFileRecord->ReadCoordInterleaved(&dcThrowAway); 00375 00376 //Now get the size of the record 00377 UINT32 ulSize=pCXaraFileRecord->GetSize(); 00378 00379 //And allocate two buffers of that size to put the URL and Frame strings in 00380 TCHAR* pcURL=new TCHAR[ulSize]; 00381 TCHAR* pcFrame=new TCHAR[ulSize]; 00382 BOOL ok = TRUE; 00383 00384 //Read in the strings 00385 if (ok) ok = pCXaraFileRecord->ReadUnicode(pcURL, ulSize); 00386 if (ok) ok = pCXaraFileRecord->ReadUnicode(pcFrame, ulSize); 00387 00388 //And create a new Web Address attribute out of them 00389 if (ok) 00390 { 00391 AttrWebAddress* pAttrWebAddress = new AttrWebAddress(pcURL, TRUE, pcFrame); 00392 00393 if (pAttrWebAddress) 00394 ok = InsertNode(pAttrWebAddress); 00395 else 00396 ok = FALSE; 00397 } 00398 00399 delete pcURL; 00400 delete pcFrame; 00401 00402 return ok; 00403 }
|
|
Handles the given record. The record has to be a WebAddress record.
Definition at line 313 of file rechattr.cpp. 00314 { 00315 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL"); 00316 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_WEBADDRESS,FALSE,"I don't handle this tag type"); 00317 00318 //First let's get the size of the record 00319 UINT32 ulSize=pCXaraFileRecord->GetSize(); 00320 00321 //And allocate two buffers of that size to put the URL and Frame strings in 00322 TCHAR* pcURL=new TCHAR[ulSize]; 00323 TCHAR* pcFrame=new TCHAR[ulSize]; 00324 BOOL ok = TRUE; 00325 00326 //Read in the strings 00327 if (ok) ok = pCXaraFileRecord->ReadUnicode(pcURL, ulSize); 00328 if (ok) ok = pCXaraFileRecord->ReadUnicode(pcFrame, ulSize); 00329 00330 //And create a new Web Address attribute out of them 00331 if (ok) 00332 { 00333 AttrWebAddress* pAttrWebAddress = new AttrWebAddress(pcURL, FALSE, pcFrame); 00334 00335 if (pAttrWebAddress) 00336 ok = InsertNode(pAttrWebAddress); 00337 else 00338 ok = FALSE; 00339 } 00340 00341 delete pcURL; 00342 delete pcFrame; 00343 00344 return ok; 00345 }
|