#include <rechtext.h>
Inheritance diagram for TextObjRecordHandler:
Public Member Functions | |
TextObjRecordHandler () | |
~TextObjRecordHandler () | |
UINT32 * | GetTagList () |
Returns an array of records handled by this class. | |
BOOL | HandleRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles reading a text attribute record from a CXaraFile. | |
virtual BOOL | BeginImport () |
Informs the handler that importing is about to begin. | |
Private Member Functions | |
CC_DECLARE_DYNAMIC (TextObjRecordHandler) | |
BOOL | ReadTextStorySimple (CXaraFileRecord *pCXaraFileRecord) |
Handles reading a text object from the filter. | |
BOOL | ReadTextStoryComplex (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextStorySimpleStartLeft (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextStorySimpleStartRight (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextStorySimpleEndLeft (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextStorySimpleEndRight (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextStoryComplexStartLeft (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextStoryComplexStartRight (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextStoryComplexEndLeft (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextStoryComplexEndRight (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextStoryWordWrapInfo (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextStoryIndentInfo (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextLine (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextString (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextChar (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextEOL (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextKernCode (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextTab (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextCaret (CXaraFileRecord *PCXaraFileRecord) |
BOOL | ReadTextLineInfo (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadTextInvalid (CXaraFileRecord *pCXaraFileRecord) |
BOOL | ReadAutoKern (CXaraFileRecord *pCXaraFileRecord, TextStory *pStory) |
Reads an AutoKern record from the file. This class is necessary because there is no ReadBOOLnoError function. Using a ReadINT32noError without the if statement will cause a number of compiler warnings to be thrown, so this way cleans things up somewhat. | |
BOOL | InsertTextStoryNode (TextStory *pTextStory) |
Informs the handler that importing is about to begin. | |
Private Attributes | |
TextStory * | pLastInsertedTextStory |
Definition at line 125 of file rechtext.h.
|
Definition at line 131 of file rechtext.h. 00131 { pLastInsertedTextStory = NULL; };
|
|
Definition at line 132 of file rechtext.h.
|
|
Informs the handler that importing is about to begin.
Reimplemented from CXaraFileRecordHandler. Definition at line 152 of file rechtext.cpp. 00153 { 00154 pLastInsertedTextStory = NULL; 00155 00156 return TRUE; 00157 }
|
|
|
|
|
Handles reading a text attribute record from a CXaraFile.
Implements CXaraFileRecordHandler. Definition at line 209 of file rechtext.cpp. 00210 { 00211 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord==NULL"); 00212 00213 BOOL ok; 00214 00215 switch (pCXaraFileRecord->GetTag()) 00216 { 00217 case TAG_TEXT_STORY_SIMPLE : ok = ReadTextStorySimple(pCXaraFileRecord); break; 00218 case TAG_TEXT_STORY_COMPLEX : ok = ReadTextStoryComplex(pCXaraFileRecord); break; 00219 case TAG_TEXT_STORY_SIMPLE_START_LEFT : ok = ReadTextStorySimpleStartLeft(pCXaraFileRecord); break; 00220 case TAG_TEXT_STORY_SIMPLE_START_RIGHT : ok = ReadTextStorySimpleStartRight(pCXaraFileRecord); break; 00221 case TAG_TEXT_STORY_SIMPLE_END_LEFT : ok = ReadTextStorySimpleEndLeft(pCXaraFileRecord); break; 00222 case TAG_TEXT_STORY_SIMPLE_END_RIGHT : ok = ReadTextStorySimpleEndRight(pCXaraFileRecord); break; 00223 case TAG_TEXT_STORY_COMPLEX_START_LEFT : ok = ReadTextStoryComplexStartLeft(pCXaraFileRecord); break; 00224 case TAG_TEXT_STORY_COMPLEX_START_RIGHT : ok = ReadTextStoryComplexStartRight(pCXaraFileRecord); break; 00225 case TAG_TEXT_STORY_COMPLEX_END_LEFT : ok = ReadTextStoryComplexEndLeft(pCXaraFileRecord); break; 00226 case TAG_TEXT_STORY_COMPLEX_END_RIGHT : ok = ReadTextStoryComplexEndRight(pCXaraFileRecord); break; 00227 case TAG_TEXT_STORY_WORD_WRAP_INFO : ok = ReadTextStoryWordWrapInfo(pCXaraFileRecord); break; 00228 case TAG_TEXT_STORY_INDENT_INFO : ok = ReadTextStoryIndentInfo(pCXaraFileRecord); break; 00229 00230 case TAG_TEXT_LINE : ok = ReadTextLine(pCXaraFileRecord); break; 00231 case TAG_TEXT_STRING : ok = ReadTextString(pCXaraFileRecord); break; 00232 case TAG_TEXT_CHAR : ok = ReadTextChar(pCXaraFileRecord); break; 00233 case TAG_TEXT_EOL : ok = ReadTextEOL(pCXaraFileRecord); break; 00234 case TAG_TEXT_KERN : ok = ReadTextKernCode(pCXaraFileRecord); break; 00235 case TAG_TEXT_CARET : ok = ReadTextCaret(pCXaraFileRecord); break; 00236 case TAG_TEXT_LINE_INFO : ok = ReadTextLineInfo(pCXaraFileRecord); break; 00237 case TAG_TEXT_TAB : ok = ReadTextTab(pCXaraFileRecord); break; 00238 default : ok = ReadTextInvalid(pCXaraFileRecord); break; 00239 } 00240 00241 return ok; 00242 }
|
|
Informs the handler that importing is about to begin.
Definition at line 258 of file rechtext.cpp. 00259 { 00260 ERROR2IF(pTextStory == NULL,FALSE,"NULL text story ptr"); 00261 00262 pLastInsertedTextStory = pTextStory; 00263 00264 return InsertNode(pTextStory); 00265 }
|
|
Reads an AutoKern record from the file. This class is necessary because there is no ReadBOOLnoError function. Using a ReadINT32noError without the if statement will cause a number of compiler warnings to be thrown, so this way cleans things up somewhat.
Definition at line 756 of file rechtext.cpp. 00758 { 00759 INT32 AutoKern; 00760 00761 // Attempt to read the autokern record from the .xar file. 00762 if ( pCXaraFileRecord->ReadINT32noError ( &AutoKern ) ) 00763 { 00764 // Is the auto kern flag set? 00765 if ( AutoKern ) 00766 { 00767 // Yes - set autokerning to be TRUE. 00768 pStory->SetAutoKerning ( TRUE ); 00769 } 00770 else 00771 { 00772 // Nope - so set the flag to FALSE. 00773 pStory->SetAutoKerning ( FALSE ); 00774 } 00775 00776 // The file record was read OK. 00777 return TRUE; 00778 } 00779 00780 // There was a file I/O error. 00781 return FALSE; 00782 }
|
|
Definition at line 720 of file rechtext.cpp. 00721 { 00722 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter pCXaraFileRecord == NULL."); 00723 00724 BOOL ok = TRUE; 00725 CaretNode *pCaret = new CaretNode(); 00726 00727 if (ok) ok = InsertNode(pCaret); 00728 00729 return ok; 00730 }
|
|
Definition at line 665 of file rechtext.cpp. 00666 { 00667 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00668 00669 BOOL ok = TRUE; 00670 WCHAR MyWChar; 00671 00672 TextChar *pChar = new TextChar(); 00673 00674 if (ok) ok = pCXaraFileRecord->ReadWCHAR(&MyWChar); 00675 pChar->SetUnicodeValue(MyWChar); 00676 if (ok) ok = InsertNode(pChar); 00677 00678 return ok; 00679 }
|
|
Definition at line 681 of file rechtext.cpp. 00682 { 00683 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00684 00685 BOOL ok = TRUE; 00686 EOLNode *pEOL = new EOLNode(); 00687 00688 if (ok) ok = InsertNode(pEOL); 00689 00690 return ok; 00691 }
|
|
Definition at line 732 of file rechtext.cpp.
|
|
Definition at line 705 of file rechtext.cpp. 00706 { 00707 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter pCXaraFileRecord == NULL."); 00708 00709 BOOL ok = TRUE; 00710 DocCoord MyKern; 00711 KernCode *pKern = new KernCode(); 00712 00713 if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MyKern,0,0); 00714 pKern->SetValue(MyKern); 00715 if (ok) ok = InsertNode(pKern); 00716 00717 return ok; 00718 }
|
|
Definition at line 602 of file rechtext.cpp. 00603 { 00604 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00605 00606 BOOL ok = TRUE; 00607 TextLine *pLine = new TextLine(); 00608 00609 if (ok) ok = InsertNode(pLine); 00610 00611 return ok; 00612 }
|
|
Definition at line 614 of file rechtext.cpp. 00615 { 00616 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00617 return TRUE; 00618 }
|
|
Definition at line 316 of file rechtext.cpp. 00317 { 00318 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00319 00320 Matrix MyMatrix; 00321 00322 BOOL ok = TRUE; 00323 TextStory *pStory = new TextStory(); 00324 00325 if (ok) ok = pCXaraFileRecord->ReadMatrix(&MyMatrix); 00326 if (ok) ok = ReadAutoKern ( pCXaraFileRecord, pStory ); 00327 00328 pStory->SetStoryMatrix(MyMatrix); 00329 00330 if (ok) ok = InsertTextStoryNode(pStory); 00331 00332 return ok; 00333 }
|
|
Definition at line 485 of file rechtext.cpp. 00486 { 00487 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00488 00489 Matrix MyMatrix; 00490 ANGLE MyRotation; 00491 ANGLE MyShear; 00492 00493 BOOL ok = TRUE; 00494 00495 TextStory *pStory = new TextStory(); 00496 00497 if (ok) ok = pCXaraFileRecord->ReadMatrix(&MyMatrix); 00498 pStory->SetStoryMatrix(MyMatrix); 00499 00500 if (ok) ok = pCXaraFileRecord->ReadANGLE(&MyRotation); 00501 pStory->SetCharsRotation(MyRotation); 00502 00503 if (ok) ok = pCXaraFileRecord->ReadANGLE(&MyShear); 00504 pStory->SetCharsShear(MyShear); 00505 00506 if (ok) ok = ReadAutoKern ( pCXaraFileRecord, pStory ); 00507 00508 pStory->SetCharsScale(-1.0); 00509 pStory->ReverseTextOnPath(); 00510 00511 if (ok) ok = InsertTextStoryNode(pStory); 00512 00513 return ok; 00514 }
|
|
Definition at line 516 of file rechtext.cpp. 00517 { 00518 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00519 00520 Matrix MyMatrix; 00521 ANGLE MyRotation; 00522 ANGLE MyShear; 00523 00524 BOOL ok = TRUE; 00525 00526 TextStory *pStory = new TextStory(); 00527 00528 if (ok) ok = pCXaraFileRecord->ReadMatrix(&MyMatrix); 00529 pStory->SetStoryMatrix(MyMatrix); 00530 00531 if (ok) ok = pCXaraFileRecord->ReadANGLE(&MyRotation); 00532 pStory->SetCharsRotation(MyRotation); 00533 00534 if (ok) ok = pCXaraFileRecord->ReadANGLE(&MyShear); 00535 pStory->SetCharsShear(MyShear); 00536 00537 if (ok) ok = ReadAutoKern ( pCXaraFileRecord, pStory ); 00538 00539 pStory->ReverseTextOnPath(); 00540 00541 if (ok) ok = InsertTextStoryNode(pStory); 00542 00543 return ok; 00544 }
|
|
Definition at line 427 of file rechtext.cpp. 00428 { 00429 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00430 00431 Matrix MyMatrix; 00432 ANGLE MyRotation; 00433 ANGLE MyShear; 00434 00435 BOOL ok = TRUE; 00436 00437 TextStory *pStory = new TextStory(); 00438 00439 if (ok) ok = pCXaraFileRecord->ReadMatrix(&MyMatrix); 00440 pStory->SetStoryMatrix(MyMatrix); 00441 00442 if (ok) ok = pCXaraFileRecord->ReadANGLE(&MyRotation); 00443 pStory->SetCharsRotation(MyRotation); 00444 00445 if (ok) ok = pCXaraFileRecord->ReadANGLE(&MyShear); 00446 pStory->SetCharsShear(MyShear); 00447 00448 if (ok) ok = ReadAutoKern ( pCXaraFileRecord, pStory ); 00449 00450 if (ok) ok = InsertTextStoryNode(pStory); 00451 00452 return ok; 00453 }
|
|
Definition at line 455 of file rechtext.cpp. 00456 { 00457 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00458 00459 Matrix MyMatrix; 00460 ANGLE MyRotation; 00461 ANGLE MyShear; 00462 00463 BOOL ok = TRUE; 00464 00465 TextStory *pStory = new TextStory(); 00466 00467 if (ok) ok = pCXaraFileRecord->ReadMatrix(&MyMatrix); 00468 pStory->SetStoryMatrix(MyMatrix); 00469 00470 if (ok) ok = pCXaraFileRecord->ReadANGLE(&MyRotation); 00471 pStory->SetCharsRotation(MyRotation); 00472 00473 if (ok) ok = pCXaraFileRecord->ReadANGLE(&MyShear); 00474 pStory->SetCharsShear(MyShear); 00475 00476 if (ok) ok = ReadAutoKern ( pCXaraFileRecord, pStory ); 00477 00478 pStory->SetCharsScale(-1.0); 00479 00480 if (ok) ok = InsertTextStoryNode(pStory); 00481 00482 return ok; 00483 }
|
|
Definition at line 578 of file rechtext.cpp. 00579 { 00580 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00581 00582 BOOL ok = TRUE; 00583 00584 if (pLastInsertedTextStory != NULL) 00585 { 00586 INT32 LeftIndent; 00587 INT32 RightIndent; 00588 00589 if (ok) ok = pCXaraFileRecord->ReadINT32(&LeftIndent); 00590 if (ok) ok = pCXaraFileRecord->ReadINT32(&RightIndent); 00591 00592 if (ok) 00593 { 00594 pLastInsertedTextStory->SetLeftIndent(LeftIndent); 00595 pLastInsertedTextStory->SetRightIndent(RightIndent); 00596 } 00597 } 00598 00599 return ok; 00600 }
|
|
Handles reading a text object from the filter.
Definition at line 296 of file rechtext.cpp. 00297 { 00298 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00299 00300 DocCoord MyCoord; 00301 Matrix MyMatrix; 00302 00303 BOOL ok = TRUE; 00304 TextStory *pStory = new TextStory(); 00305 00306 if (ok) ok = pCXaraFileRecord->ReadCoord(&MyCoord); 00307 if (ok) ok = ReadAutoKern ( pCXaraFileRecord, pStory ); 00308 MyMatrix = Matrix(MyCoord); 00309 pStory->SetStoryMatrix(MyMatrix); 00310 00311 if (ok) ok = InsertTextStoryNode(pStory); 00312 00313 return ok; 00314 }
|
|
Definition at line 379 of file rechtext.cpp. 00380 { 00381 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00382 00383 DocCoord MyCoord; 00384 Matrix MyMatrix; 00385 00386 BOOL ok = TRUE; 00387 TextStory *pStory = new TextStory(); 00388 00389 if (ok) ok = pCXaraFileRecord->ReadCoord(&MyCoord); 00390 if (ok) ok = ReadAutoKern ( pCXaraFileRecord, pStory ); 00391 00392 MyMatrix = Matrix(MyCoord); 00393 pStory->SetStoryMatrix(MyMatrix); 00394 00395 pStory->ReverseTextOnPath(); 00396 00397 pStory->SetCharsScale(-1.0); 00398 00399 if (ok) ok = InsertTextStoryNode(pStory); 00400 00401 return ok; 00402 }
|
|
Definition at line 404 of file rechtext.cpp. 00405 { 00406 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00407 00408 DocCoord MyCoord; 00409 Matrix MyMatrix; 00410 00411 BOOL ok = TRUE; 00412 TextStory *pStory = new TextStory(); 00413 00414 if (ok) ok = pCXaraFileRecord->ReadCoord(&MyCoord); 00415 if (ok) ok = ReadAutoKern ( pCXaraFileRecord, pStory ); 00416 00417 MyMatrix = Matrix(MyCoord); 00418 pStory->SetStoryMatrix(MyMatrix); 00419 00420 pStory->ReverseTextOnPath(); 00421 00422 if (ok) ok = InsertTextStoryNode(pStory); 00423 00424 return ok; 00425 }
|
|
Definition at line 335 of file rechtext.cpp. 00336 { 00337 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00338 00339 DocCoord MyCoord; 00340 Matrix MyMatrix; 00341 00342 BOOL ok = TRUE; 00343 TextStory *pStory = new TextStory(); 00344 00345 if (ok) ok = pCXaraFileRecord->ReadCoord(&MyCoord); 00346 if (ok) ok = ReadAutoKern ( pCXaraFileRecord, pStory ); 00347 00348 MyMatrix = Matrix(MyCoord); 00349 pStory->SetStoryMatrix(MyMatrix); 00350 00351 if (ok) ok = InsertTextStoryNode(pStory); 00352 00353 return ok; 00354 }
|
|
Definition at line 356 of file rechtext.cpp. 00357 { 00358 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00359 00360 DocCoord MyCoord; 00361 Matrix MyMatrix; 00362 00363 BOOL ok = TRUE; 00364 TextStory *pStory = new TextStory(); 00365 00366 if (ok) ok = pCXaraFileRecord->ReadCoord(&MyCoord); 00367 if (ok) ok = ReadAutoKern ( pCXaraFileRecord, pStory ); 00368 00369 MyMatrix = Matrix(MyCoord); 00370 pStory->SetStoryMatrix(MyMatrix); 00371 00372 pStory->SetCharsScale(-1.0); 00373 00374 if (ok) ok = InsertTextStoryNode(pStory); 00375 00376 return ok; 00377 }
|
|
Definition at line 546 of file rechtext.cpp. 00547 { 00548 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00549 00550 BOOL ok = TRUE; 00551 00552 if (pLastInsertedTextStory != NULL) 00553 { 00554 INT32 Width; 00555 BYTE WordWrapOn; 00556 00557 if (ok) ok = pCXaraFileRecord->ReadINT32(&Width); 00558 if (ok) ok = pCXaraFileRecord->ReadBYTE(&WordWrapOn); 00559 00560 // Never word wrap in Ralph builds 00561 // This is to prevent text stories overflowing when a font has been substituted. 00562 // It was decided that it is better for each individual line to extend past the format width, rather than 00563 // letting the story potentially create extra lines due to formatting width characters into the same width 00564 #if defined(EXCLUDE_FROM_RALPH) 00565 WordWrapOn = FALSE; 00566 #endif 00567 00568 if (ok) 00569 { 00570 pLastInsertedTextStory->SetStoryWidth(Width); 00571 pLastInsertedTextStory->SetWordWrapping(WordWrapOn != 0); 00572 } 00573 } 00574 00575 return ok; 00576 }
|
|
Definition at line 620 of file rechtext.cpp. 00621 { 00622 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00623 00624 BOOL ok = TRUE; 00625 WCHAR MyWChar; 00626 00627 // Text strings are not converted into N text chars here. 00628 // Instead, the first char in the string is inserted into the tree. 00629 // This marks where the rest of the string should appear. 00630 // A ptr to the resultant char, and a copy of the string record, is placed inside 00631 // a ImportedString object. This object is added to the string list for this text story. 00632 // 00633 // After this record is read in, any subsequent child attr recs that apply to the whole string will 00634 // get applied to the first text char we've just added. 00635 // 00636 // On post-import, the text story runs through it's list of imported strings, expanding them 00637 // into a series of text chars. As it does this, it copies the child attrs of the first char 00638 // (i.e. the char inserted in this func) to all the rest of the text chars in the string. 00639 // This ensures that all the chars in the string will look the same. 00640 00641 00642 // Create a TextChar to hold the first char in the string. Then insert it into the tree 00643 TextChar* pChar = new TextChar(); 00644 if (ok) ok = (pChar != NULL); 00645 if (ok) ok = pCXaraFileRecord->ReadWCHAR(&MyWChar); 00646 if (ok) pChar->SetUnicodeValue(MyWChar); 00647 if (ok) ok = InsertNode(pChar); 00648 00649 if (ok) 00650 { 00651 // Keep a ptr to the inserted TextChar, and copy of the string, so that the rest of the 00652 // string can be expanded after all the relevant attrs have come in. 00653 00654 ImportedString* pImportedString = new ImportedString(pChar,pCXaraFileRecord); 00655 TextStory* pTextStory = pChar->FindParentStory(); 00656 if (pTextStory != NULL && pImportedString != NULL) 00657 pTextStory->AddImportedString(pImportedString); 00658 else 00659 ok = FALSE; 00660 } 00661 00662 return ok; 00663 }
|
|
Definition at line 693 of file rechtext.cpp. 00694 { 00695 ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL."); 00696 00697 BOOL ok = TRUE; 00698 HorizontalTab *pTab = new HorizontalTab(); 00699 00700 if (ok) ok = InsertNode(pTab); 00701 00702 return ok; 00703 }
|
|
Definition at line 171 of file rechtext.h. |