#include <styles.h>
Inheritance diagram for WizOpStyleRecordHandler:
Public Member Functions | |
WizOpStyleRecordHandler () | |
Makes sure data members are initialized to safe values. | |
virtual | ~WizOpStyleRecordHandler () |
Makes sure data members are unheaped properly. | |
virtual UINT32 * | GetTagList () |
Provides the record handler system with a list of records handled by this handler. | |
virtual BOOL | Init (BaseCamelotFilter *pFilter) |
Initialises the WizOpStyleRecordHandler. | |
virtual BOOL | HandleRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. | |
virtual BOOL | EndImport () |
Informs the record handler that importing is over Reverses all the stuff done in Init(). Should it be done in BeginImport? | |
WizOpStyle * | FindStyleFromRecordReference (XFileRef RecordRef) const |
Finds an imported style, given the record number. | |
Protected Member Functions | |
WizOpStyleRecordHandler (const WizOpStyleRecordHandler &Other) | |
Warns us that we've done a destructor but we haven't done either of these. | |
WizOpStyleRecordHandler & | operator= (const WizOpStyleRecordHandler &Other) |
WizOpStyle * | AddStyle (const StringBase &Name, const StringBase &Question, const StringBase &WizOpName, const StringBase &Param) |
Adds a WizOpStyle to the importing document's WizOpStyles component. | |
BOOL | AddRecordReference (XFileRef RecordRef, const WizOpStyle &ImportedStyle) |
We need to remember the record numbers of the styles so that Style References can find the style they want. This function associates a record number with the newly imported style to that end. | |
WizOpStyles & | GetTentativeStyles () |
This provides descriptions for the define units records.Data Access. | |
Private Member Functions | |
CC_DECLARE_DYNAMIC (WizOpStyleRecordHandler) | |
Private Attributes | |
WizOpStyles * | m_pTentativeStyles |
List | m_ImportedItems |
Definition at line 422 of file styles.h.
|
Makes sure data members are initialized to safe values.
Definition at line 1363 of file styles.cpp. 01363 : 01364 m_pTentativeStyles(NULL) 01365 { 01366 }
|
|
Makes sure data members are unheaped properly.
Definition at line 1379 of file styles.cpp. 01380 { 01381 if (!m_ImportedItems.IsEmpty()) 01382 { 01383 TRACE( _T("WizOpStyleRecordHandler - Imported items left over\n")); 01384 } 01385 }
|
|
Warns us that we've done a destructor but we haven't done either of these.
Definition at line 1399 of file styles.cpp. 01400 { 01401 TRACE( _T("WizOpStyleRecordHandler - Copy constructor not implemented")); 01402 }
|
|
We need to remember the record numbers of the styles so that Style References can find the style they want. This function associates a record number with the newly imported style to that end.
Definition at line 1624 of file styles.cpp. 01625 { 01626 BOOL Ok = TRUE; 01627 01628 StyleRecordReference* pNewRecRef = new StyleRecordReference(ImportedStyle, RecordRef); 01629 01630 Ok = (pNewRecRef != NULL); 01631 01632 if (Ok) 01633 { 01634 m_ImportedItems.AddHead(pNewRecRef); 01635 } 01636 01637 return Ok; 01638 }
|
|
Adds a WizOpStyle to the importing document's WizOpStyles component.
Definition at line 1586 of file styles.cpp. 01588 { 01589 WizOpStyle* pStyleToUse = NULL; 01590 01591 WizOp* const pWizOp = GetWizOps().FindWizOpFromInternalName(WizOpName); 01592 01593 if (pWizOp != NULL) 01594 { 01595 WizOpStyle NewStyle(Name, Question, *pWizOp, Param); 01596 pStyleToUse = (WizOpStyle*)GetTentativeStyles().CopyComponentData(NewStyle); 01597 } 01598 01599 return pStyleToUse; 01600 }
|
|
|
|
Informs the record handler that importing is over Reverses all the stuff done in Init(). Should it be done in BeginImport?
Reimplemented from CXaraFileRecordHandler. Definition at line 1488 of file styles.cpp. 01489 { 01490 BOOL Ok = TRUE; 01491 01492 m_ImportedItems.DeleteAll(); 01493 01494 Ok = CXaraFileRecordHandler::EndImport(); 01495 01496 return Ok; 01497 }
|
|
Finds an imported style, given the record number.
Definition at line 1653 of file styles.cpp. 01654 { 01655 WizOpStyle* pFoundStyle = NULL; 01656 01657 StyleRecordReference* pCurrentSRR = (StyleRecordReference*)m_ImportedItems.GetHead(); 01658 01659 while (pCurrentSRR != NULL) 01660 { 01661 if (pCurrentSRR->GetRecordRef() == RecordRef) 01662 { 01663 pFoundStyle = (WizOpStyle*)&(pCurrentSRR->GetStyle()); 01664 break; 01665 } 01666 else 01667 { 01668 pCurrentSRR = (StyleRecordReference*)m_ImportedItems.GetNext(pCurrentSRR); 01669 } 01670 } 01671 01672 return pFoundStyle; 01673 }
|
|
Provides the record handler system with a list of records handled by this handler.
Implements CXaraFileRecordHandler. Definition at line 1424 of file styles.cpp. 01425 { 01426 static UINT32 TagList[] = {TAG_WIZOP_STYLE, 01427 CXFRH_TAG_LIST_END}; 01428 01429 return (UINT32*)&TagList; 01430 }
|
|
This provides descriptions for the define units records.Data Access.
Definition at line 1776 of file styles.cpp. 01777 { 01778 // This static dummy object is used for returning in the ERROR2 case 01779 // The original used to return a ptr to a local variable, which is a tad dangerous. 01780 // This solution is not ideal, because there's a permanent instance of an object 01781 // that will probably never be used. 01782 static WizOpStyles Dummy; 01783 01784 ERROR2IF(m_pTentativeStyles == NULL, Dummy, "NULL Member"); 01785 01786 return *m_pTentativeStyles; 01787 }
|
|
Handles the given record.
Implements CXaraFileRecordHandler. Definition at line 1512 of file styles.cpp. 01513 { 01514 ENSURE_NOT_NULL(pRecord); 01515 ERROR2IF(pRecord->GetTag() != TAG_WIZOP_STYLE, FALSE, "I don't handle this tag type"); 01516 01517 String_64 OpName; 01518 String_256 Question; 01519 String_256 Param; 01520 String_256 StyleName; 01521 01522 BOOL ok = pRecord->ReadUnicode(OpName, 64); 01523 01524 if (ok) 01525 { 01526 ok = pRecord->ReadUnicode(Question, 256); 01527 } 01528 01529 if (ok) 01530 { 01531 ok = pRecord->ReadUnicode(Param, 256); 01532 } 01533 01534 if (ok) 01535 { 01536 ok = pRecord->ReadUnicode(StyleName, 256); 01537 } 01538 01539 if (ok) 01540 { 01541 // We managed to read it all OK so add a new Style to the styles we've imported 01542 // and remember its record number for reference purposes 01543 WizOpStyle* pStyleToUse = AddStyle(StyleName, Question, OpName, Param); 01544 if (pStyleToUse == NULL) 01545 { 01546 BaseCamelotFilter* const pFilter = GetBaseCamelotFilter(); 01547 ENSURE_NOT_NULL(pFilter); 01548 pFilter->AppendWarning(_R(IDS_STYLE_OF_UNKNOWN_WIZOP)); 01549 } 01550 else 01551 { 01552 ok = AddRecordReference(pRecord->GetRecordNumber(), *pStyleToUse); 01553 } 01554 01555 } 01556 01557 if (!ok) 01558 { 01559 BaseCamelotFilter* const pFilter = GetBaseCamelotFilter(); 01560 ENSURE_NOT_NULL(pFilter); 01561 pFilter->GotError(_R(IDE_FILE_READ_ERROR)); 01562 } 01563 01564 return ok; 01565 }
|
|
Initialises the WizOpStyleRecordHandler.
Reimplemented from CamelotRecordHandler. Definition at line 1446 of file styles.cpp. 01447 { 01448 BOOL Ok = TRUE; 01449 01450 Ok = CamelotRecordHandler::Init(pFilter); 01451 01452 Document* const pDoc = GetDocument(); 01453 Ok = (pDoc != NULL); 01454 01455 if (Ok) 01456 { 01457 m_pTentativeStyles = (WizOpStyles*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(WizOpStyles)); 01458 Ok = (m_pTentativeStyles != NULL); 01459 } 01460 01461 // give this WizOpStyleRecordHandler to the style component so it can call us back 01462 if (Ok) 01463 { 01464 Ok = m_pTentativeStyles->SetRecordHandler(*this); 01465 } 01466 01467 return Ok; 01468 }
|
|
Definition at line 1404 of file styles.cpp. 01405 { 01406 TRACE( _T("WizOpStyleRecordHandler - Assignment operator not implemented")); 01407 return *this; 01408 }
|
|
|
|
|