rechtext.cpp

Go to the documentation of this file.
00001 // $Id: rechtext.cpp 1688 2006-08-10 12:05:20Z gerry $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 /********************************************************************************************
00099 
00100 >   rechtext.cpp
00101 
00102     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
00103     Created:    09/07/96
00104     Purpose:    Text record handler for the new file format
00105 
00106 ********************************************************************************************/
00107 
00108 #include "camtypes.h"
00109 
00110 //#include "ccpanose.h"
00111 
00112 //#include "txtattr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00113 
00114 #include "nodetext.h"
00115 #include "nodetxtl.h"
00116 #include "nodetxts.h"
00117 
00118 //#include "cxfdefs.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00119 #include "cxftags.h"
00120 //#include "cxfrec.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00121 //#include "cxfrech.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00122 
00123 #include "impstr.h"
00124 #include "rechtext.h"
00125 
00126 #include "fontman.h"
00127 //#include "doccomp.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00128 #include "fontcomp.h"
00129 
00130 // to match the declare in the header file
00131 CC_IMPLEMENT_DYNAMIC(TextObjRecordHandler, CamelotRecordHandler);
00132 CC_IMPLEMENT_DYNAMIC(TextAttrRecordHandler, CamelotRecordHandler);
00133 CC_IMPLEMENT_DYNAMIC(FontDefRecordHandler, CamelotRecordHandler);
00134 
00135 // Declare smart memory handling in Debug builds
00136 #define new CAM_DEBUG_NEW
00137 
00138 /********************************************************************************************
00139 
00140 >   BOOL TextObjRecordHandler::BeginImport()
00141 
00142     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00143     Created:    21/8/96
00144     Inputs:     -
00145     Returns:    TRUE if ok, FALSE otherwise
00146     Purpose:    Informs the handler that importing is about to begin.
00147 
00148                 Inits vars prior to importing.
00149 
00150 ********************************************************************************************/
00151 
00152 BOOL TextObjRecordHandler::BeginImport()
00153 {
00154     pLastInsertedTextStory = NULL;
00155 
00156     return TRUE;
00157 }
00158 
00159 /********************************************************************************************
00160 
00161 >   UINT32 *TextObjRecordHandler::GetTagList()
00162 
00163     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
00164     Created:    09/07/96
00165     Inputs:     -
00166     Returns:    UINT32* to an array of records handled by this class.
00167     Purpose:    Returns an array of records handled by this class.
00168 
00169 ********************************************************************************************/
00170 
00171 UINT32 *TextObjRecordHandler::GetTagList()
00172 {
00173     static UINT32 TagList[] = {TAG_TEXT_STORY_SIMPLE,
00174                                 TAG_TEXT_STORY_COMPLEX,
00175                                 TAG_TEXT_STORY_SIMPLE_START_LEFT,
00176                                 TAG_TEXT_STORY_SIMPLE_START_RIGHT,
00177                                 TAG_TEXT_STORY_SIMPLE_END_LEFT,
00178                                 TAG_TEXT_STORY_SIMPLE_END_RIGHT,
00179                                 TAG_TEXT_STORY_COMPLEX_START_LEFT,
00180                                 TAG_TEXT_STORY_COMPLEX_START_RIGHT,
00181                                 TAG_TEXT_STORY_COMPLEX_END_LEFT,
00182                                 TAG_TEXT_STORY_COMPLEX_END_RIGHT,
00183                                 TAG_TEXT_STORY_WORD_WRAP_INFO,
00184                                 TAG_TEXT_STORY_INDENT_INFO,
00185                                 TAG_TEXT_LINE,
00186                                 TAG_TEXT_STRING,
00187                                 TAG_TEXT_CHAR,
00188                                 TAG_TEXT_EOL,
00189                                 TAG_TEXT_KERN,
00190                                 TAG_TEXT_CARET,
00191                                 TAG_TEXT_LINE_INFO,
00192                                 TAG_TEXT_TAB,
00193                                 CXFRH_TAG_LIST_END};
00194     return TagList;
00195 }
00196 
00197 /********************************************************************************************
00198 
00199 >   BOOL TextObjRecordHandler::HandleRecord(CXaraFileRecord *pCXaraFileRecord)
00200 
00201     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
00202     Created:    09/07/96
00203     Inputs:     pCXaraFileRecord - pointer to a CXaraFileRecord to read
00204     Returns:    TRUE if successful, FALSE otherwise
00205     Purpose:    Handles reading a text attribute record from a CXaraFile.
00206 
00207 ********************************************************************************************/
00208 
00209 BOOL TextObjRecordHandler::HandleRecord(CXaraFileRecord *pCXaraFileRecord)
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 }
00243 
00244 /********************************************************************************************
00245 
00246 >   BOOL TextObjRecordHandler::InsertTextStoryNode(TextStory* pTextStory)
00247 
00248     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00249     Created:    21/8/96
00250     Inputs:     -
00251     Returns:    TRUE if ok, FALSE otherwise
00252     Purpose:    Informs the handler that importing is about to begin.
00253 
00254                 Inits vars prior to importing.
00255 
00256 ********************************************************************************************/
00257 
00258 BOOL TextObjRecordHandler::InsertTextStoryNode(TextStory* pTextStory)
00259 {
00260     ERROR2IF(pTextStory == NULL,FALSE,"NULL text story ptr");
00261 
00262     pLastInsertedTextStory = pTextStory;
00263 
00264     return InsertNode(pTextStory);
00265 }
00266 
00267 
00268 /********************************************************************************************
00269 
00270 >   BOOL TextObjRecordHandler::ReadTextStorySimple(CXaraFileRecord *pCXaraFileRecord)
00271     BOOL TextObjRecordHandler::ReadTextStoryComplex(CXaraFileRecord *pCXaraFileRecord)
00272     BOOL TextObjRecordHandler::ReadTextStorySimpleStartLeft(CXaraFileRecord *pCXaraFileRecord)
00273     BOOL TextObjRecordHandler::ReadTextStorySimpleStartRight(CXaraFileRecord *pCXaraFileRecord)
00274     BOOL TextObjRecordHandler::ReadTextStorySimpleEndLeft(CXaraFileRecord *pCXaraFileRecord)
00275     BOOL TextObjRecordHandler;:ReadTextStorySimpleEndRight(CXaraFileRecord *pCXaraFileRecord)
00276     BOOL TextObjRecordHandler::ReadTextStoryComplexStartLeft(CXaraFileRecord *pCXaraFileRecord)
00277     BOOL TextObjRecordHandler::ReadTextStoryComplexStartRight(CXaraFileRecord *pCXaraFileRecord)
00278     BOOL TextObjRecordHandler::ReadTextStoryComplexEndLeft(CXaraFileRecord *pCXaraFileRecord)
00279     BOOL TextObjRecordHandler;:ReadTextStoryComplexEndRight(CXaraFileRecord *pCXaraFileRecord)
00280     BOOL TextObjRecordHandler::ReadTextString(CXaraFileRecord *pCXaraFileRecord)
00281     BOOL TextObjRecordHandler::ReadTextLine(CXaraFileRecord *pCXaraFileRecord)
00282     BOOL TextObjRecordHandler::ReadTextChar(CXaraFileRecord *pCXaraFileRecord)
00283     BOOL TextObjRecordHandler::ReadTextEOL(CXaraFileRecord *pCXaraFileRecord)
00284     BOOL TextObjRecordHandler::ReadTextKern(CXaraFileRecord *pCXaraFileRecord)
00285     BOOL TextObjRecordHandler::ReadTextCaret(CXaraFileRecord *pCXaraFileRecord)
00286     BOOL TextObjRecordHandler::ReadTextInvalid(CXaraFileRecord *pCXaraFileRecord)
00287 
00288     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
00289     Created:    10/07/96
00290     Inputs:     pCXaraFileRecord    - CXaraFileRecord to read
00291     Returns:    TRUE if successful, FALSE otherwise
00292     Purpose:    Handles reading a text object from the filter
00293 
00294 ********************************************************************************************/
00295 
00296 BOOL TextObjRecordHandler::ReadTextStorySimple(CXaraFileRecord *pCXaraFileRecord)
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 }
00315 
00316 BOOL TextObjRecordHandler::ReadTextStoryComplex(CXaraFileRecord *pCXaraFileRecord)
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 }
00334 
00335 BOOL TextObjRecordHandler::ReadTextStorySimpleStartLeft(CXaraFileRecord *pCXaraFileRecord)
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 }
00355 
00356 BOOL TextObjRecordHandler::ReadTextStorySimpleStartRight(CXaraFileRecord *pCXaraFileRecord)
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 }
00378 
00379 BOOL TextObjRecordHandler::ReadTextStorySimpleEndLeft(CXaraFileRecord *pCXaraFileRecord)
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 }
00403 
00404 BOOL TextObjRecordHandler::ReadTextStorySimpleEndRight(CXaraFileRecord *pCXaraFileRecord)
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 }
00426 
00427 BOOL TextObjRecordHandler::ReadTextStoryComplexStartLeft(CXaraFileRecord *pCXaraFileRecord)
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 }
00454 
00455 BOOL TextObjRecordHandler::ReadTextStoryComplexStartRight(CXaraFileRecord *pCXaraFileRecord)
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 }
00484 
00485 BOOL TextObjRecordHandler::ReadTextStoryComplexEndLeft(CXaraFileRecord *pCXaraFileRecord)
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 }
00515 
00516 BOOL TextObjRecordHandler::ReadTextStoryComplexEndRight(CXaraFileRecord *pCXaraFileRecord)
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 }
00545 
00546 BOOL TextObjRecordHandler::ReadTextStoryWordWrapInfo(CXaraFileRecord *pCXaraFileRecord)
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 }
00577 
00578 BOOL TextObjRecordHandler::ReadTextStoryIndentInfo(CXaraFileRecord *pCXaraFileRecord)
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 }
00601 
00602 BOOL TextObjRecordHandler::ReadTextLine(CXaraFileRecord *pCXaraFileRecord)
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 }
00613 
00614 BOOL TextObjRecordHandler::ReadTextLineInfo(CXaraFileRecord *pCXaraFileRecord)
00615 {
00616     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
00617     return TRUE;
00618 }
00619 
00620 BOOL TextObjRecordHandler::ReadTextString(CXaraFileRecord *pCXaraFileRecord)
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 }
00664     
00665 BOOL TextObjRecordHandler::ReadTextChar(CXaraFileRecord *pCXaraFileRecord)
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 }
00680 
00681 BOOL TextObjRecordHandler::ReadTextEOL(CXaraFileRecord *pCXaraFileRecord)
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 }
00692 
00693 BOOL TextObjRecordHandler::ReadTextTab(CXaraFileRecord *pCXaraFileRecord)
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 }
00704 
00705 BOOL TextObjRecordHandler::ReadTextKernCode(CXaraFileRecord *pCXaraFileRecord)
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 }
00719     
00720 BOOL TextObjRecordHandler::ReadTextCaret(CXaraFileRecord *pCXaraFileRecord)
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 }
00731 
00732 BOOL TextObjRecordHandler::ReadTextInvalid(CXaraFileRecord *pCXaraFileRecord)
00733 {
00734     ERROR3("Attempt to read an invalid text object.");
00735     return FALSE;
00736 }
00737 
00738 /********************************************************************************************
00739 
00740 >   BOOL TextObjRecordHandler::ReadAutoKern ( CXaraFileRecord   *pCXaraFileRecord,
00741                                               TextStory         *pStory )
00742 
00743     Author:     Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
00744     Created:    12/11/00
00745     Inputs:     pCXaraFileRecord    - A pointer to a file record.
00746                 pStory              - The text story being read in from the file.
00747     Returns:    TRUE                - The text story was read OK.
00748                 FALSE               - A file error occured.
00749     Purpose:    Reads an AutoKern record from the file. This class is necessary because
00750                 there is no ReadBOOLnoError function. Using a ReadINT32noError without the
00751                 if statement will cause a number of compiler warnings to be thrown, so this
00752                 way cleans things up somewhat.
00753 
00754 ********************************************************************************************/
00755 
00756 BOOL TextObjRecordHandler::ReadAutoKern ( CXaraFileRecord   *pCXaraFileRecord,
00757                                           TextStory         *pStory )
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 }
00783 
00784 /********************************************************************************************
00785 
00786 >   void TextObjRecordHandler::GetRecordDescriptionText(CXaraFileRecord* pCXaraFileRecord, StringBase *pStr)
00787     void TextObjRecordHandler::DescribeStoryVanilla(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00788     void TextObjRecordHandler::DescribeStoryStartLeft(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00789     void TextObjRecordHandler::DescribeStoryStartRight(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00790     void TextObjRecordHandler::DescribeStoryEndLeft(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00791     void TextObjRecordHandler::DescribeStoryEndRight(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00792     void TextObjRecordhandler::DescribeLine(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00793     void TextObjRecordHandler::DescribeString(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00794     void TextObjRecordHandler::DescribeChar(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00795     void TextObjRecordHandler::DescribeEOL(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00796     void TextObjRecordHandler::DescribeKern(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00797     void TextObjRecordHandler::DescribeCaret(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00798     void TextObjRecordHandler::DescribeInvalid(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00799 
00800     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
00801     Created:    11/07/96
00802     Inputs:     pCXaraFileRecord    - CXaraFileRecord to describe
00803                 pStr                - string to add description to
00804     Returns:    -   
00805     Purpose:    Functions to describe text object records for debugging purposes
00806 
00807 ********************************************************************************************/
00808 
00809 #ifdef XAR_TREE_DIALOG
00810 void TextObjRecordHandler::GetRecordDescriptionText(CXaraFileRecord* pCXaraFileRecord, StringBase *pStr)
00811 {
00812     if (pCXaraFileRecord!=NULL || pStr!=NULL)
00813     {
00814         GetRecordInfo(pCXaraFileRecord, pStr);
00815 
00816         switch (pCXaraFileRecord->GetTag())
00817         {
00818         case TAG_TEXT_STORY_SIMPLE              : DescribeStorySimple(pCXaraFileRecord, pStr); break;
00819         case TAG_TEXT_STORY_COMPLEX             : DescribeStoryComplex(pCXaraFileRecord, pStr); break;
00820         case TAG_TEXT_STORY_SIMPLE_START_LEFT   : DescribeStorySimpleStartLeft(pCXaraFileRecord, pStr); break;
00821         case TAG_TEXT_STORY_SIMPLE_START_RIGHT  : DescribeStorySimpleStartRight(pCXaraFileRecord, pStr); break;
00822         case TAG_TEXT_STORY_SIMPLE_END_LEFT     : DescribeStorySimpleEndLeft(pCXaraFileRecord, pStr); break;
00823         case TAG_TEXT_STORY_SIMPLE_END_RIGHT    : DescribeStorySimpleEndRight(pCXaraFileRecord, pStr); break;
00824         case TAG_TEXT_STORY_COMPLEX_START_LEFT  : DescribeStoryComplexStartLeft(pCXaraFileRecord, pStr); break;
00825         case TAG_TEXT_STORY_COMPLEX_START_RIGHT : DescribeStoryComplexStartRight(pCXaraFileRecord, pStr); break;
00826         case TAG_TEXT_STORY_COMPLEX_END_LEFT    : DescribeStoryComplexEndLeft(pCXaraFileRecord, pStr); break;
00827         case TAG_TEXT_STORY_COMPLEX_END_RIGHT   : DescribeStoryComplexEndRight(pCXaraFileRecord, pStr); break;
00828         case TAG_TEXT_STORY_WORD_WRAP_INFO      : DescribeStoryWordWrapInfo(pCXaraFileRecord, pStr); break;
00829         case TAG_TEXT_STORY_INDENT_INFO         : DescribeStoryIndentInfo(pCXaraFileRecord, pStr); break;
00830 
00831         case TAG_TEXT_LINE                      : DescribeLine(pCXaraFileRecord, pStr); break;
00832         case TAG_TEXT_STRING                    : DescribeString(pCXaraFileRecord, pStr); break;
00833         case TAG_TEXT_CHAR                      : DescribeChar(pCXaraFileRecord, pStr); break;
00834         case TAG_TEXT_EOL                       : DescribeEOL(pCXaraFileRecord, pStr); break;
00835         case TAG_TEXT_KERN                      : DescribeKern(pCXaraFileRecord, pStr); break;
00836         case TAG_TEXT_CARET                     : DescribeCaret(pCXaraFileRecord, pStr); break;
00837         case TAG_TEXT_LINE_INFO                 : DescribeLineInfo(pCXaraFileRecord, pStr); break;
00838         default                                 : DescribeInvalid(pCXaraFileRecord, pStr); break;
00839         }
00840     }
00841 }
00842 
00843 void TextObjRecordHandler::DescribeStorySimple(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00844 {
00845     (*pStr) += _T("Text Story (Simple)\r\n");
00846 }
00847 
00848 void TextObjRecordHandler::DescribeStoryComplex(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00849 {
00850     (*pStr) += _T("Text Story (Complex)\r\n");
00851 }
00852 
00853 void TextObjRecordHandler::DescribeStorySimpleStartLeft(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00854 {
00855     (*pStr) += _T("Text Story - Start Left (Simple)\r\n");
00856 }
00857 
00858 void TextObjRecordHandler::DescribeStorySimpleStartRight(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00859 {
00860     (*pStr) += _T("Text Story - Start Right (Simple)\r\n");
00861 }
00862 
00863 void TextObjRecordHandler::DescribeStorySimpleEndLeft(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00864 {
00865     (*pStr) += _T("Text Story - End Left (Simple)\r\n");
00866 }
00867 
00868 void TextObjRecordHandler::DescribeStorySimpleEndRight(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00869 {
00870     (*pStr) += _T("Text Story - End Right (Simple)\r\n");
00871 }
00872 
00873 void TextObjRecordHandler::DescribeStoryComplexStartLeft(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00874 {
00875     (*pStr) += _T("Text Story - Start Left (Complex)\r\n");
00876 }
00877 
00878 void TextObjRecordHandler::DescribeStoryComplexStartRight(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00879 {
00880     (*pStr) += _T("Text Story - Start Right (Complex)\r\n");
00881 }
00882 
00883 void TextObjRecordHandler::DescribeStoryComplexEndLeft(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00884 {
00885     (*pStr) += _T("Text Story - End Left (Complex)\r\n");
00886 }
00887 
00888 void TextObjRecordHandler::DescribeStoryComplexEndRight(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00889 {
00890     (*pStr) += _T("Text Story - End Right (Complex)\r\n");
00891 }
00892 
00893 void TextObjRecordHandler::DescribeStoryWordWrapInfo(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00894 {
00895     TCHAR s[256];
00896 
00897     (*pStr) += _T("Text Story Word Wrap Infor\r\n");
00898 
00899     INT32 Width;
00900     BYTE WordWrapOn;
00901 
00902     pCXaraFileRecord->ReadINT32(&Width);
00903     pCXaraFileRecord->ReadBYTE(&WordWrapOn);
00904 
00905     camSprintf(s, _T("Width : \t%ld\r\n"),Width);
00906     (*pStr) += s;
00907     camSprintf(s, _T("Word Wrap On : \t%ld\r\n"),WordWrapOn);
00908     (*pStr) += s;
00909 }
00910 
00911 
00912 void TextObjRecordHandler::DescribeStoryIndentInfo(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00913 {
00914     TCHAR s[256];
00915 
00916     (*pStr) += _T("Text Story Indent Info\r\n");
00917 
00918     INT32 LeftIndent;
00919     INT32 RightIndent;
00920 
00921     pCXaraFileRecord->ReadINT32(&LeftIndent);
00922     pCXaraFileRecord->ReadINT32(&RightIndent);
00923 
00924     camSprintf(s, _T("Left indent : \t%ld\r\n"),LeftIndent);
00925     (*pStr) += s;
00926     camSprintf(s, _T("Right indent : \t%ld\r\n"),RightIndent);
00927     (*pStr) += s;
00928 }
00929 
00930 
00931 void TextObjRecordHandler::DescribeLine(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00932 {
00933     (*pStr) += _T("Text Line\r\n");
00934 }
00935 
00936 void TextObjRecordHandler::DescribeLineInfo(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00937 {
00938     TCHAR s[256];
00939 
00940     INT32 Width,Height,DistFromPreviousLine;
00941 
00942     pCXaraFileRecord->ReadINT32(&Width);
00943     pCXaraFileRecord->ReadINT32(&Height);
00944     pCXaraFileRecord->ReadINT32(&DistFromPreviousLine);
00945 
00946     (*pStr) += _T("Text Line info\r\n");
00947     camSprintf(s, _T("Width : \t%ld\r\n"),Width);
00948     (*pStr) += s;
00949     camSprintf(s, _T("Height: \t%ld\r\n"),Height);
00950     (*pStr) += s;
00951     camSprintf(s, _T("Dist from previous line: \t%ld\r\n"),DistFromPreviousLine);
00952     (*pStr) += s;
00953 
00954     (*pStr) += _T("\r\n'Dist from previous line' is the y distance between\r\n");
00955     (*pStr) += _T("this line's base line and the previous line's base line\r\n");
00956 }
00957 
00958 void TextObjRecordHandler::DescribeString(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00959 {
00960     TCHAR s[256];
00961 
00962     UINT32 RecSize = pCXaraFileRecord->GetSize();
00963     WCHAR MyWChar;
00964     UINT32 i;
00965 
00966     (*pStr) += _T("Text String\r\nString = ");
00967 
00968     for (i=0; i<RecSize/2; i++)
00969     {
00970         pCXaraFileRecord->ReadWCHAR(&MyWChar);
00971         camSprintf(s, _T("%lc"), MyWChar);
00972         (*pStr) += s;
00973     }
00974 
00975     (*pStr) += _T("\r\n");
00976 }
00977 
00978 void TextObjRecordHandler::DescribeChar(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00979 {
00980     TCHAR s[256];
00981 
00982     WCHAR MyWChar;
00983 
00984     pCXaraFileRecord->ReadWCHAR(&MyWChar);
00985 
00986     camSprintf(s, _T("Text Char\r\nChar = %lc\r\n"), MyWChar);
00987     (*pStr) += s;
00988 }
00989 
00990 void TextObjRecordHandler::DescribeEOL(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00991 {
00992     (*pStr) += _T("Text EOL\r\n");
00993 }
00994 
00995 void TextObjRecordHandler::DescribeKern(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
00996 {
00997     TCHAR s[256];
00998 
00999     INT32 KernX, KernY;
01000     pCXaraFileRecord->ReadINT32(&KernX);
01001     pCXaraFileRecord->ReadINT32(&KernY);
01002 
01003     camSprintf(s, _T("Text Kern Code\r\nKern Code = DocCoord(%ld, %ld)"), KernX, KernY);
01004     (*pStr) += s;
01005 }
01006 
01007 void TextObjRecordHandler::DescribeCaret(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01008 {
01009     (*pStr) += _T("Text Caret\r\n");
01010 }
01011 
01012 void TextObjRecordHandler::DescribeInvalid(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01013 {
01014     (*pStr) += _T("Text Object - Invalid\r\n");
01015 }
01016 
01017 #endif
01018 
01019 /********************************************************************************************
01020 
01021 >   UINT32 *TextAttrRecordHandler::GetTagList()
01022 
01023     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
01024     Created:    09/07/96
01025     Inputs:     -
01026     Returns:    UINT32* to an array of records handled by this class.
01027     Purpose:    Returns an array of records handled by this class.
01028 
01029 ********************************************************************************************/
01030 
01031 UINT32 *TextAttrRecordHandler::GetTagList()
01032 {
01033     static UINT32 TagList[] = {TAG_TEXT_LINESPACE_RATIO,
01034                                 TAG_TEXT_LINESPACE_ABSOLUTE,
01035                                 TAG_TEXT_JUSTIFICATION_LEFT,
01036                                 TAG_TEXT_JUSTIFICATION_CENTRE,
01037                                 TAG_TEXT_JUSTIFICATION_RIGHT,
01038                                 TAG_TEXT_JUSTIFICATION_FULL,
01039                                 TAG_TEXT_FONT_SIZE,
01040                                 TAG_TEXT_FONT_TYPEFACE,
01041                                 TAG_TEXT_BOLD_ON,
01042                                 TAG_TEXT_BOLD_OFF,
01043                                 TAG_TEXT_ITALIC_ON,
01044                                 TAG_TEXT_ITALIC_OFF,
01045                                 TAG_TEXT_UNDERLINE_ON,
01046                                 TAG_TEXT_UNDERLINE_OFF,
01047                                 TAG_TEXT_SCRIPT_ON,
01048                                 TAG_TEXT_SCRIPT_OFF,
01049                                 TAG_TEXT_SUPERSCRIPT_ON,
01050                                 TAG_TEXT_SUBSCRIPT_ON,
01051                                 TAG_TEXT_TRACKING,
01052                                 TAG_TEXT_ASPECT_RATIO,
01053                                 TAG_TEXT_BASELINE,
01054                                 TAG_TEXT_LEFT_INDENT,
01055                                 TAG_TEXT_RIGHT_INDENT,
01056                                 TAG_TEXT_FIRST_INDENT,
01057                                 TAG_TEXT_RULER,
01058                                 CXFRH_TAG_LIST_END};
01059     return TagList;
01060 }
01061 
01062 /********************************************************************************************
01063 
01064 >   BOOL TextAttrRecordHandler::HandleRecord(CXaraFileRecord *pCXaraFileRecord)
01065 
01066     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
01067     Created:    09/07/96
01068     Inputs:     pCXaraFileRecord - pointer to a CXaraFileRecord to read
01069     Returns:    TRUE if successful, FALSE otherwise
01070     Purpose:    Handles reading a text attribute record from a CXaraFile.
01071 
01072 ********************************************************************************************/
01073 
01074 BOOL TextAttrRecordHandler::HandleRecord(CXaraFileRecord *pCXaraFileRecord)
01075 {
01076     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord==NULL");
01077     
01078     BOOL ok;
01079 
01080     switch (pCXaraFileRecord->GetTag())
01081     {
01082         case TAG_TEXT_LINESPACE_RATIO       : ok = ReadTextLineSpaceRatio(pCXaraFileRecord); break;
01083         case TAG_TEXT_LINESPACE_ABSOLUTE    : ok = ReadTextLineSpaceAbsolute(pCXaraFileRecord); break;
01084         case TAG_TEXT_JUSTIFICATION_LEFT    : ok = ReadTextJustificationLeft(pCXaraFileRecord); break;
01085         case TAG_TEXT_JUSTIFICATION_CENTRE  : ok = ReadTextJustificationCentre(pCXaraFileRecord); break;
01086         case TAG_TEXT_JUSTIFICATION_RIGHT   : ok = ReadTextJustificationRight(pCXaraFileRecord); break;
01087         case TAG_TEXT_JUSTIFICATION_FULL    : ok = ReadTextJustificationFull(pCXaraFileRecord); break;
01088         case TAG_TEXT_FONT_SIZE             : ok = ReadTextFontSize(pCXaraFileRecord); break;
01089         case TAG_TEXT_FONT_TYPEFACE         : ok = ReadTextFontTypeface(pCXaraFileRecord); break;
01090         case TAG_TEXT_BOLD_ON               : ok = ReadTextBoldOn(pCXaraFileRecord); break;
01091         case TAG_TEXT_BOLD_OFF              : ok = ReadTextBoldOff(pCXaraFileRecord); break;
01092         case TAG_TEXT_ITALIC_ON             : ok = ReadTextItalicOn(pCXaraFileRecord); break;
01093         case TAG_TEXT_ITALIC_OFF            : ok = ReadTextItalicOff(pCXaraFileRecord); break;
01094         case TAG_TEXT_UNDERLINE_ON          : ok = ReadTextUnderlineOn(pCXaraFileRecord); break;
01095         case TAG_TEXT_UNDERLINE_OFF         : ok = ReadTextUnderlineOff(pCXaraFileRecord); break;
01096         case TAG_TEXT_SCRIPT_ON             : ok = ReadTextScriptOn(pCXaraFileRecord); break;
01097         case TAG_TEXT_SCRIPT_OFF            : ok = ReadTextScriptOff(pCXaraFileRecord); break;
01098         case TAG_TEXT_SUPERSCRIPT_ON        : ok = ReadTextSuperscriptOn(pCXaraFileRecord); break;
01099         case TAG_TEXT_SUBSCRIPT_ON          : ok = ReadTextSubscriptOn(pCXaraFileRecord); break;
01100         case TAG_TEXT_TRACKING              : ok = ReadTextTracking(pCXaraFileRecord); break;
01101         case TAG_TEXT_ASPECT_RATIO          : ok = ReadTextAspectRatio(pCXaraFileRecord); break;
01102         case TAG_TEXT_BASELINE              : ok = ReadTextBaseline(pCXaraFileRecord); break;
01103         case TAG_TEXT_LEFT_INDENT           : ok = ReadTextLeftIndent(pCXaraFileRecord); break;
01104         case TAG_TEXT_RIGHT_INDENT          : ok = ReadTextRightIndent(pCXaraFileRecord); break;
01105         case TAG_TEXT_FIRST_INDENT          : ok = ReadTextFirstIndent(pCXaraFileRecord); break;
01106         case TAG_TEXT_RULER                 : ok = ReadTextRuler(pCXaraFileRecord); break;
01107         default                             : ok = ReadTextInvalid(pCXaraFileRecord); break;
01108     }
01109 
01110     return ok;
01111 }
01112 
01113 /********************************************************************************************
01114 
01115 >   BOOL TextAttrRecordHandler::ReadTextStoryVanilla(CXaraFileRecord *pCXaraFileRecord)
01116     BOOL TextAttrRecordHandler::ReadTextString(CXaraFileRecord *pCXaraFileRecord)
01117     BOOL TextAttrRecordHandler::ReadTextKernCode(CXaraFileRecord *pCXaraFileRecord)
01118     BOOL TextAttrRecordHandler::ReadTextCaret(CXaraFileRecord *pCXaraFileRecord)
01119     BOOL TextAttrRecordHandler::ReadTextLineSpaceRatio(CXaraFileRecord *pCXaraFileRecord)
01120     BOOL TextAttrRecordHandler::ReadTextLineSpaceAbsolute(CXaraFileRecord *pCXaraFileRecord)
01121     BOOL TextAttrRecordHandler::ReadTextJustificationLeft(CXaraFileRecord *pCXaraFileRecord)
01122     BOOL TextAttrRecordHandler::ReadTextJustificationCentre(CXaraFileRecord *pCXaraFileRecord)
01123     BOOL TextAttrRecordHandler::ReadTextJustificationRight(CXaraFileRecord *pCXaraFileRecord)
01124     BOOL TextAttrRecordHandler::ReadTextJustificationFull(CXaraFileRecord *pCXaraFileRecord)
01125     BOOL TextAttrRecordHandler::ReadTextFontSize(CXaraFileRecord *pCXaraFileRecord)
01126     BOOL TextAttrRecordHandler::ReadTextFontTypeface(CXaraFileRecord *pCXaraFileRecord)
01127     BOOL TextAttrRecordHandler::ReadTextBoldOn(CXaraFileRecord *pCXaraFileRecord)
01128     BOOL TextAttrRecordHandler::ReadTextBoldOff(CXaraFileRecord *pCXaraFileRecord)
01129     BOOL TextAttrRecordHandler::ReadTextItalicOn(CXaraFileRecord *pCXaraFileRecord)
01130     BOOL TextAttrRecordHandler::ReadTextItalicOff(CXaraFileRecord *pCXaraFileRecord)
01131     BOOL TextAttrRecordHandler::ReadTextUnderlineOn(CXaraFileRecord *pCXaraFileRecord)
01132     BOOL TextAttrRecordHandler::ReadTextUnderlineOff(CXaraFileRecord *pCXaraFileRecord)
01133     BOOL TextAttrRecordHandler::ReadTextScriptOn(CXaraFileRecord *pCXaraFileRecord)
01134     BOOL TextAttrRecordHandler::ReadTextScriptOff(CXaraFileRecord *pCXaraFileRecord)
01135     BOOL TextAttrRecordHandler::ReadTextSuperscriptOn(CXaraFileRecord *pCXaraFileRecord)
01136     BOOL TextAttrRecordHandler::ReadTextSubscriptOn(CXaraFileRecord *pCXaraFileRecord)
01137     BOOL TextAttrRecordHandler::ReadTextTracking(CXaraFileRecord *pCXaraFileRecord)
01138     BOOL TextAttrRecordHandler::ReadTextAspectRatio(CXaraFileRecord *pCXaraFileRecord)
01139     BOOL TextAttrRecordHandler::ReadTextBaseline(CXaraFileRecord *pCXaraFileRecord)
01140     BOOL TextAttrRecordHandler::ReadTextInvalid(CXaraFileRecord *pCXaraFileRecord)
01141 
01142     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
01143     Created:    09/07/96
01144     Inputs:     pCXaraFileRecord - pointer to a CXaraFileRecord to load
01145     Returns:    TRUE if successful, FALSE otherwise
01146     Purpose:    Read text attributes for the new file format
01147 
01148 ********************************************************************************************/
01149 
01150 BOOL TextAttrRecordHandler::ReadTextLineSpaceRatio(CXaraFileRecord *pCXaraFileRecord)
01151 {
01152     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01153 
01154     BOOL ok = TRUE;
01155     AttrTxtLineSpace *pAttr = new AttrTxtLineSpace();
01156     FIXED16 Ratio;
01157 
01158     if (ok) ok = pCXaraFileRecord->ReadFIXED16(&Ratio);
01159 
01160     pAttr->Value.IsRatio = TRUE;
01161     pAttr->Value.Value = 0;
01162     pAttr->Value.Ratio = Ratio;
01163     
01164     if (ok) ok = InsertNode(pAttr);
01165 
01166     return ok;
01167 }
01168 
01169 BOOL TextAttrRecordHandler::ReadTextLineSpaceAbsolute(CXaraFileRecord *pCXaraFileRecord)
01170 {
01171     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01172 
01173     BOOL ok = TRUE;
01174     AttrTxtLineSpace *pAttr = new AttrTxtLineSpace();
01175     MILLIPOINT Value;
01176 
01177     if (ok) ok = pCXaraFileRecord->ReadINT32(&Value);
01178 
01179     pAttr->Value.IsRatio = FALSE;
01180     pAttr->Value.Value = Value;
01181     pAttr->Value.Ratio = 0;
01182     
01183     if (ok) ok = InsertNode(pAttr);
01184 
01185     return ok;
01186 }
01187 
01188 BOOL TextAttrRecordHandler::ReadTextJustificationLeft(CXaraFileRecord *pCXaraFileRecord)
01189 {
01190     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01191 
01192     BOOL ok = TRUE;
01193     AttrTxtJustification *pAttr = new AttrTxtJustification();
01194 
01195     pAttr->Value.justification = JLEFT;
01196 
01197     if (ok) ok = InsertNode(pAttr);
01198 
01199     return ok;
01200 }
01201 
01202 BOOL TextAttrRecordHandler::ReadTextJustificationCentre(CXaraFileRecord *pCXaraFileRecord)
01203 {
01204     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01205 
01206     BOOL ok = TRUE;
01207     AttrTxtJustification *pAttr = new AttrTxtJustification();
01208 
01209     pAttr->Value.justification = JCENTRE;
01210 
01211     if (ok) ok = InsertNode(pAttr);
01212 
01213     return ok;
01214 }
01215 
01216 BOOL TextAttrRecordHandler::ReadTextJustificationRight(CXaraFileRecord *pCXaraFileRecord)
01217 {
01218     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01219 
01220     BOOL ok = TRUE;
01221     AttrTxtJustification *pAttr = new AttrTxtJustification();
01222 
01223     pAttr->Value.justification = JRIGHT;
01224 
01225     if (ok) ok = InsertNode(pAttr);
01226 
01227     return ok;
01228 }
01229 
01230 BOOL TextAttrRecordHandler::ReadTextJustificationFull(CXaraFileRecord *pCXaraFileRecord)
01231 {
01232     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01233 
01234     BOOL ok = TRUE;
01235     AttrTxtJustification *pAttr = new AttrTxtJustification();
01236 
01237     pAttr->Value.justification = JFULL;
01238 
01239     if (ok) ok = InsertNode(pAttr);
01240 
01241     return ok;
01242 }
01243 
01244 BOOL TextAttrRecordHandler::ReadTextFontSize(CXaraFileRecord *pCXaraFileRecord)
01245 {
01246     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01247 
01248     BOOL ok = TRUE;
01249     AttrTxtFontSize *pAttr = new AttrTxtFontSize();
01250     MILLIPOINT Size;
01251 
01252     if (ok) ok = pCXaraFileRecord->ReadINT32(&Size);
01253 
01254     pAttr->Value.FontSize = Size;
01255 
01256     if (ok) ok = InsertNode(pAttr);
01257 
01258     return ok;
01259 }
01260 
01261 BOOL TextAttrRecordHandler::ReadTextFontTypeface(CXaraFileRecord *pCXaraFileRecord)
01262 {
01263     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter pCXaraFileRecord==NULL.");
01264 
01265     BOOL ok = TRUE;
01266     
01267     INT32 RecordNumber;
01268 
01269     if (ok) ok = pCXaraFileRecord->ReadINT32(&RecordNumber);
01270 
01271     FontComponent *pFontComponent = GetFontComponent();
01272     
01273     WORD FontHandle;
01274     BOOL IsBold;
01275     BOOL IsItalic;
01276 
01277     if (ok) ok = pFontComponent->GetFontInformation(RecordNumber, &FontHandle, &IsBold, &IsItalic);
01278 
01279     if (ok)
01280     {
01281         AttrTxtFontTypeface *pAttr = new AttrTxtFontTypeface();
01282 
01283         pAttr->Value.HTypeface = FontHandle;
01284         pAttr->Value.IsBold = IsBold;
01285         pAttr->Value.IsItalic = IsItalic;
01286 
01287         ok = InsertNode(pAttr);
01288     }
01289 
01290     return ok;
01291 }
01292 
01293 BOOL TextAttrRecordHandler::ReadTextBoldOn(CXaraFileRecord *pCXaraFileRecord)
01294 {
01295     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01296 
01297     BOOL ok = TRUE;
01298     AttrTxtBold *pAttr = new AttrTxtBold();
01299 
01300     pAttr->Value.BoldOn = TRUE;
01301 
01302     if (ok) ok = InsertNode(pAttr);
01303 
01304     return ok;
01305 }
01306 
01307 BOOL TextAttrRecordHandler::ReadTextBoldOff(CXaraFileRecord *pCXaraFileRecord)
01308 {
01309     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01310 
01311     BOOL ok = TRUE;
01312     AttrTxtBold *pAttr = new AttrTxtBold();
01313 
01314     pAttr->Value.BoldOn = FALSE;
01315 
01316     if (ok) ok = InsertNode(pAttr);
01317 
01318     return ok;
01319 }
01320 
01321 BOOL TextAttrRecordHandler::ReadTextItalicOn(CXaraFileRecord *pCXaraFileRecord)
01322 {
01323     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01324 
01325     BOOL ok = TRUE;
01326     AttrTxtItalic *pAttr = new AttrTxtItalic();
01327 
01328     pAttr->Value.ItalicOn = TRUE;
01329 
01330     if (ok) ok = InsertNode(pAttr);
01331 
01332     return ok;
01333 }
01334 
01335 BOOL TextAttrRecordHandler::ReadTextItalicOff(CXaraFileRecord *pCXaraFileRecord)
01336 {
01337     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01338 
01339     BOOL ok = TRUE;
01340     AttrTxtItalic *pAttr = new AttrTxtItalic();
01341 
01342     pAttr->Value.ItalicOn = FALSE;
01343 
01344     if (ok) ok = InsertNode(pAttr);
01345 
01346     return ok;
01347 }
01348 
01349 BOOL TextAttrRecordHandler::ReadTextUnderlineOn(CXaraFileRecord *pCXaraFileRecord)
01350 {
01351     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01352 
01353     BOOL ok = TRUE;
01354     AttrTxtUnderline *pAttr = new AttrTxtUnderline();
01355 
01356     pAttr->Value.Underlined = TRUE;
01357 
01358     if (ok) ok = InsertNode(pAttr);
01359 
01360     return ok;
01361 }
01362 
01363 BOOL TextAttrRecordHandler::ReadTextUnderlineOff(CXaraFileRecord *pCXaraFileRecord)
01364 {
01365     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01366 
01367     BOOL ok = TRUE;
01368     AttrTxtUnderline *pAttr = new AttrTxtUnderline();
01369 
01370     pAttr->Value.Underlined = FALSE;
01371 
01372     if (ok) ok = InsertNode(pAttr);
01373 
01374     return ok;
01375 }
01376 
01377 BOOL TextAttrRecordHandler::ReadTextScriptOn(CXaraFileRecord *pCXaraFileRecord)
01378 {
01379     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01380 
01381     BOOL ok = TRUE;
01382     AttrTxtScript *pAttr = new AttrTxtScript();
01383     FIXED16 Offset;
01384     FIXED16 Size;
01385 
01386     if (ok) ok = pCXaraFileRecord->ReadFIXED16(&Offset);
01387     if (ok) ok = pCXaraFileRecord->ReadFIXED16(&Size);
01388 
01389     pAttr->Value.Offset = Offset;
01390     pAttr->Value.Size = Size;
01391 
01392     if (ok) ok = InsertNode(pAttr);
01393 
01394     return ok;
01395 }
01396 
01397 BOOL TextAttrRecordHandler::ReadTextScriptOff(CXaraFileRecord *pCXaraFileRecord)
01398 {
01399     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01400 
01401     BOOL ok = TRUE;
01402     AttrTxtScript *pAttr = new AttrTxtScript();
01403 
01404     pAttr->Value.Offset = 0;
01405     pAttr->Value.Size = 1;
01406 
01407     if (ok) ok = InsertNode(pAttr);
01408 
01409     return ok;
01410 }
01411 
01412 BOOL TextAttrRecordHandler::ReadTextSuperscriptOn(CXaraFileRecord *pCXaraFileRecord)
01413 {
01414     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01415 
01416     BOOL ok = TRUE;
01417     AttrTxtScript *pAttr = new AttrTxtScript();
01418 
01419     pAttr->Value.Offset = FIXED16(Text_SuperScriptOffset);
01420     pAttr->Value.Size = FIXED16(Text_SuperScriptSize);
01421 
01422     if (ok) ok = InsertNode(pAttr);
01423 
01424     return ok;
01425 }
01426 
01427 BOOL TextAttrRecordHandler::ReadTextSubscriptOn(CXaraFileRecord *pCXaraFileRecord)
01428 {
01429     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01430 
01431     BOOL ok = TRUE;
01432     AttrTxtScript *pAttr = new AttrTxtScript();
01433 
01434     pAttr->Value.Offset = FIXED16(Text_SubScriptOffset);
01435     pAttr->Value.Size = FIXED16(Text_SubScriptSize);
01436 
01437     if (ok) ok = InsertNode(pAttr);
01438 
01439     return ok;
01440 }
01441 
01442 BOOL TextAttrRecordHandler::ReadTextTracking(CXaraFileRecord *pCXaraFileRecord)
01443 {
01444     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01445 
01446     BOOL ok = TRUE;
01447     AttrTxtTracking *pAttr = new AttrTxtTracking();
01448     MILLIPOINT Tracking;
01449 
01450     if (ok) ok = pCXaraFileRecord->ReadINT32(&Tracking);
01451 
01452     pAttr->Value.Tracking = Tracking;
01453 
01454     if (ok) ok = InsertNode(pAttr);
01455 
01456     return ok;
01457 }
01458 
01459 BOOL TextAttrRecordHandler::ReadTextAspectRatio(CXaraFileRecord *pCXaraFileRecord)
01460 {
01461     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01462 
01463     BOOL ok = TRUE;
01464     AttrTxtAspectRatio *pAttr = new AttrTxtAspectRatio();
01465     FIXED16 AspectRatio;
01466 
01467     if (ok) ok = pCXaraFileRecord->ReadFIXED16(&AspectRatio);
01468 
01469     pAttr->Value.AspectRatio = AspectRatio;
01470 
01471     if (ok) ok = InsertNode(pAttr);
01472 
01473     return ok;
01474 }
01475 
01476 BOOL TextAttrRecordHandler::ReadTextBaseline(CXaraFileRecord *pCXaraFileRecord)
01477 {
01478     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01479 
01480     BOOL ok = TRUE;
01481     AttrTxtBaseLine *pAttr = new AttrTxtBaseLine();
01482     MILLIPOINT BaseLine;
01483 
01484     if (ok) ok = pCXaraFileRecord->ReadINT32(&BaseLine);
01485 
01486     pAttr->Value.Value = BaseLine;
01487 
01488     if (ok) ok = InsertNode(pAttr);
01489 
01490     return ok;
01491 }
01492 
01493 /********************************************************************************************
01494 
01495 >   BOOL TextAttrRecordHandler::ReadTextLeftIndent(CXaraFileRecord *pCXaraFileRecord)
01496     BOOL TextAttrRecordHandler::ReadTextRightIndent(CXaraFileRecord *pCXaraFileRecord)
01497     BOOL TextAttrRecordHandler::ReadTextFirstIndent(CXaraFileRecord *pCXaraFileRecord)
01498     BOOL TextAttrRecordHandler::ReadTextRuler(CXaraFileRecord *pCXaraFileRecord)
01499 
01500     Author:     Martin Wuerthner <xara@mw-software.com>
01501     Created:    04/07/06
01502     Inputs:     pCXaraFileRecord - pointer to a CXaraFileRecord to load
01503     Returns:    TRUE if successful, FALSE otherwise
01504     Purpose:    Read text attributes for the new file format
01505 
01506 ********************************************************************************************/
01507 
01508 BOOL TextAttrRecordHandler::ReadTextLeftIndent(CXaraFileRecord *pCXaraFileRecord)
01509 {
01510     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01511 
01512     AttrTxtLeftMargin *pAttr = new AttrTxtLeftMargin();
01513     MILLIPOINT Value;
01514 
01515     BOOL ok = pCXaraFileRecord->ReadINT32(&Value);
01516     pAttr->Value.Value = Value;
01517     if (ok) ok = InsertNode(pAttr);
01518     return ok;
01519 }
01520 
01521 BOOL TextAttrRecordHandler::ReadTextRightIndent(CXaraFileRecord *pCXaraFileRecord)
01522 {
01523     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01524 
01525     AttrTxtRightMargin *pAttr = new AttrTxtRightMargin();
01526     MILLIPOINT Value;
01527 
01528     BOOL ok = pCXaraFileRecord->ReadINT32(&Value);
01529     pAttr->Value.Value = Value;
01530     if (ok) ok = InsertNode(pAttr);
01531     return ok;
01532 }
01533 
01534 BOOL TextAttrRecordHandler::ReadTextFirstIndent(CXaraFileRecord *pCXaraFileRecord)
01535 {
01536     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01537 
01538     AttrTxtFirstIndent *pAttr = new AttrTxtFirstIndent();
01539     MILLIPOINT Value;
01540 
01541     BOOL ok = pCXaraFileRecord->ReadINT32(&Value);
01542     pAttr->Value.Value = Value;
01543     if (ok) ok = InsertNode(pAttr);
01544     return ok;
01545 }
01546 
01547 BOOL TextAttrRecordHandler::ReadTextRuler(CXaraFileRecord *pCXaraFileRecord)
01548 {
01549     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord == NULL.");
01550 
01551     AttrTxtRuler *pAttr = new AttrTxtRuler();
01552 
01553     UINT16 NumEntries;
01554     BOOL ok = pCXaraFileRecord->ReadUINT16(&NumEntries);
01555     TRACEUSER("wuerthne", _T("reading ruler attribute with %d entries"), NumEntries);
01556     while(ok && NumEntries--)
01557     {
01558         BYTE TypeAndFlags;
01559         MILLIPOINT Position;
01560         WCHAR DecimalPointChar = WCHAR(0);
01561         WCHAR TabFillerChar = WCHAR(0);
01562         ok = pCXaraFileRecord->ReadBYTE(&TypeAndFlags);
01563 
01564         BOOL HasTabFiller = TypeAndFlags & 4;
01565         TxtTabType Type = TxtTabType(TypeAndFlags & 3);
01566 
01567         if (ok) ok = pCXaraFileRecord->ReadINT32(&Position);
01568         if (TxtTabType(Type) == DecimalTab && ok)
01569             ok = pCXaraFileRecord->ReadWCHAR(&DecimalPointChar);
01570         if (HasTabFiller && ok) ok = pCXaraFileRecord->ReadWCHAR(&TabFillerChar);
01571         if (ok) pAttr->Value.AddTabStop(TxtTabType(Type), Position, DecimalPointChar, TabFillerChar);
01572     }
01573 
01574     if (ok) ok = InsertNode(pAttr);
01575     return ok;
01576 }
01577 
01578 /********************************************************************************************
01579 
01580 >   BOOL TextAttrRecordHandler::ReadTextInvalid(CXaraFileRecord *pCXaraFileRecord)
01581 
01582     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
01583     Created:    09/07/96
01584     Inputs:     pCXaraFileRecord - pointer to a CXaraFileRecord to load
01585     Returns:    FALSE
01586 
01587 ********************************************************************************************/
01588 
01589 BOOL TextAttrRecordHandler::ReadTextInvalid(CXaraFileRecord *pCXaraFileRecord)
01590 {
01591     ERROR3("Attempt to read an invalid text attribute.");
01592     return FALSE;
01593 }
01594 
01595 /********************************************************************************************
01596 
01597 >   void TextAttrRecordHandler::GetRecordDescriptionText(CXaraFileRecord* pCXaraFileRecord, StringBase *pStr)
01598     void TextAttrRecordHandler::DescribeLineSpaceRatio(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01599     void TextAttrRecordHandler::DescribeLineSpaceAbsolute(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01600     void TextAttrRecordHandler::DescribeJustificationLeft(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01601     void TextAttrRecordHandler::DescribeJustificationCentre(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01602     void TextAttrRecordHandler::DescribeJustificationRight(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01603     void TextAttrRecordHandler::DescribeJustificationFull(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01604     void TextAttrRecordHandler::DescribeFontSize(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01605     void TextAttrRecordHandler::DescribeFontTypeface(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01606     void TextAttrRecordHandler::DescribeBoldOn(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01607     void TextAttrRecordHandler::DescribeBoldOff(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01608     void TextAttrRecordHandler::DescribeItalicOn(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01609     void TextAttrRecordHandler::DescribeItalicOff(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01610     void TextAttrRecordHandler::DescribeUnderlineOn(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01611     void TextAttrRecordHandler::DescribeUnderlineOff(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01612     void TextAttrRecordHandler::DescribeScriptOn(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01613     void TextAttrRecordHandler::DescribeScriptOff(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01614     void TextAttrRecordHandler::DescribeSuperscriptOn(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01615     void TextAttrRecordHandler::DescribeSubscriptOn(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01616     void TextAttrRecordHandler::DescribeTracking(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01617     void TextAttrRecordHandler::DescribeAspectRatio(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01618     void TextAttrRecordHandler::DescribeBaseline(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01619     void TextAttrRecordHandler::DescribeInvalid(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01620 
01621     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
01622     Created:    09/07/96
01623     Inputs:     pCXaraFileRecord    - CXaraFileRecord to describe
01624                 pStr                - string to append text to
01625     Returns:    -
01626     Purpose:    Function to describe the text attribute records
01627 
01628 ********************************************************************************************/
01629 
01630 #ifdef XAR_TREE_DIALOG
01631 void TextAttrRecordHandler::GetRecordDescriptionText(CXaraFileRecord* pCXaraFileRecord, StringBase* pStr)
01632 {
01633     if (pCXaraFileRecord!=NULL || pStr!=NULL)
01634     {
01635         GetRecordInfo(pCXaraFileRecord, pStr);
01636 
01637         switch (pCXaraFileRecord->GetTag())
01638         {
01639         case TAG_TEXT_LINESPACE_RATIO       : DescribeLineSpaceRatio(pCXaraFileRecord, pStr); break;
01640         case TAG_TEXT_LINESPACE_ABSOLUTE    : DescribeLineSpaceAbsolute(pCXaraFileRecord, pStr); break;
01641         case TAG_TEXT_JUSTIFICATION_LEFT    : DescribeJustificationLeft(pCXaraFileRecord, pStr); break;
01642         case TAG_TEXT_JUSTIFICATION_CENTRE  : DescribeJustificationCentre(pCXaraFileRecord, pStr); break;
01643         case TAG_TEXT_JUSTIFICATION_RIGHT   : DescribeJustificationRight(pCXaraFileRecord, pStr); break;
01644         case TAG_TEXT_JUSTIFICATION_FULL    : DescribeJustificationFull(pCXaraFileRecord, pStr); break;
01645         case TAG_TEXT_FONT_SIZE             : DescribeFontSize(pCXaraFileRecord, pStr); break;
01646         case TAG_TEXT_FONT_TYPEFACE         : DescribeFontTypeface(pCXaraFileRecord, pStr); break;
01647         case TAG_TEXT_BOLD_ON               : DescribeBoldOn(pCXaraFileRecord, pStr); break;
01648         case TAG_TEXT_BOLD_OFF              : DescribeBoldOff(pCXaraFileRecord, pStr); break;
01649         case TAG_TEXT_ITALIC_ON             : DescribeItalicOn(pCXaraFileRecord, pStr); break;
01650         case TAG_TEXT_ITALIC_OFF            : DescribeItalicOff(pCXaraFileRecord, pStr); break;
01651         case TAG_TEXT_UNDERLINE_ON          : DescribeUnderlineOn(pCXaraFileRecord, pStr); break;
01652         case TAG_TEXT_UNDERLINE_OFF         : DescribeUnderlineOff(pCXaraFileRecord, pStr); break;
01653         case TAG_TEXT_SCRIPT_ON             : DescribeScriptOn(pCXaraFileRecord, pStr); break;
01654         case TAG_TEXT_SCRIPT_OFF            : DescribeScriptOff(pCXaraFileRecord, pStr); break;
01655         case TAG_TEXT_SUPERSCRIPT_ON        : DescribeSuperscriptOn(pCXaraFileRecord, pStr); break;
01656         case TAG_TEXT_SUBSCRIPT_ON          : DescribeSubscriptOn(pCXaraFileRecord, pStr); break;
01657         case TAG_TEXT_TRACKING              : DescribeTracking(pCXaraFileRecord, pStr); break;
01658         case TAG_TEXT_ASPECT_RATIO          : DescribeAspectRatio(pCXaraFileRecord, pStr); break;
01659         case TAG_TEXT_BASELINE              : DescribeBaseline(pCXaraFileRecord, pStr); break;
01660         default                             : DescribeInvalid(pCXaraFileRecord, pStr); break;
01661         }
01662     }
01663 }
01664 
01665 void TextAttrRecordHandler::DescribeLineSpaceRatio(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01666 {
01667     TCHAR s[256];
01668 
01669     FIXED16 Value;
01670     pCXaraFileRecord->ReadFIXED16(&Value);
01671 
01672     camSprintf(s, _T("Text Attribute - Line Spacing (Ratio)\r\n"));
01673     (*pStr) += s;
01674     camSprintf(s, _T("Line spacing = %f\r\n"), Value.MakeDouble());
01675     (*pStr) += s;
01676 }
01677 
01678 void TextAttrRecordHandler::DescribeLineSpaceAbsolute(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01679 {
01680     TCHAR s[256];
01681 
01682     INT32 Value;
01683     pCXaraFileRecord->ReadINT32(&Value);
01684 
01685     camSprintf(s, _T("Text Attribute - Line Spacing (Absolute)\r\n"));
01686     (*pStr) += s;
01687     camSprintf(s, _T("Line spacing = %ld\r\n"), Value);
01688     (*pStr) += s;
01689 }
01690 
01691 void TextAttrRecordHandler::DescribeJustificationLeft(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01692 {
01693     TCHAR s[256];
01694 
01695     camSprintf(s, _T("Text Attribute - Justification (Left)\r\n"));
01696     (*pStr) += s;
01697 }
01698 
01699 void TextAttrRecordHandler::DescribeJustificationCentre(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01700 {
01701     TCHAR s[256];
01702 
01703     camSprintf(s, _T("Text Attribute - Justification (Centre)\r\n"));
01704     (*pStr) += s;
01705 }
01706 
01707 void TextAttrRecordHandler::DescribeJustificationRight(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01708 {
01709     TCHAR s[256];
01710 
01711     camSprintf(s, _T("Text Attribute - Justification (Right)\r\n"));
01712     (*pStr) += s;
01713 }
01714 
01715 void TextAttrRecordHandler::DescribeJustificationFull(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01716 {
01717     TCHAR s[256];
01718 
01719     camSprintf(s, _T("Text Attribute - Justification (Full)\r\n"));
01720     (*pStr) += s;
01721 }
01722 
01723 void TextAttrRecordHandler::DescribeFontSize(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01724 {
01725     TCHAR s[256];
01726 
01727     MILLIPOINT Value;
01728     pCXaraFileRecord->ReadINT32(&Value);
01729     
01730     camSprintf(s, _T("Text Attribute - Font Size\r\n"));
01731     (*pStr) += s;
01732     camSprintf(s, _T("Font size = %ld\r\n"), Value);
01733     (*pStr) += s;
01734 }
01735 
01736 void TextAttrRecordHandler::DescribeFontTypeface(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01737 {
01738     TCHAR s[256];
01739 
01740     INT32 RecordNumber;
01741 
01742     pCXaraFileRecord->ReadINT32(&RecordNumber);
01743 
01744     camSprintf(s, _T("Text Attribute - Typeface\r\n"));
01745     (*pStr) += s;
01746 
01747     camSprintf(s, _T("Record Number = %ld\r\n"), RecordNumber);
01748     (*pStr) += s;
01749 }
01750 
01751 void TextAttrRecordHandler::DescribeBoldOn(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01752 {
01753     TCHAR s[256];
01754 
01755     camSprintf(s, _T("Text Attribute - Bold (On)\r\n"));
01756     (*pStr) += s;
01757 }
01758 
01759 void TextAttrRecordHandler::DescribeBoldOff(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01760 {
01761     TCHAR s[256];
01762 
01763     camSprintf(s, _T("Text Attribute - Bold (Off)\r\n"));
01764     (*pStr) += s;
01765 }
01766 
01767 void TextAttrRecordHandler::DescribeItalicOn(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01768 {
01769     TCHAR s[256];
01770 
01771     camSprintf(s, _T("Text Attribute - Italic (On)\r\n"));
01772     (*pStr) += s;
01773 }
01774 
01775 void TextAttrRecordHandler::DescribeItalicOff(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01776 {
01777     TCHAR s[256];
01778 
01779     camSprintf(s, _T("Text Attribute - Italic (Off)\r\n"));
01780     (*pStr) += s;
01781 }
01782 
01783 void TextAttrRecordHandler::DescribeUnderlineOn(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01784 {
01785     TCHAR s[256];
01786 
01787     camSprintf(s, _T("Text Attribute - Underline (On)\r\n"));
01788     (*pStr) += s;
01789 }
01790 
01791 void TextAttrRecordHandler::DescribeUnderlineOff(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01792 {
01793     TCHAR s[256];
01794 
01795     camSprintf(s, _T("Text Attribute - Underline (Off)\r\n"));
01796     (*pStr) += s;
01797 }
01798 
01799 void TextAttrRecordHandler::DescribeScriptOn(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01800 {
01801     TCHAR s[256];
01802 
01803     FIXED16 Offset;
01804     FIXED16 Size;
01805     pCXaraFileRecord->ReadFIXED16(&Offset);
01806     pCXaraFileRecord->ReadFIXED16(&Size);
01807 
01808     camSprintf(s, _T("Text Attribute - Script (On)\r\n"));
01809     (*pStr) += s;
01810     camSprintf(s, _T("Offset = %f\r\n"), Offset.MakeDouble());
01811     (*pStr) += s;
01812     camSprintf(s, _T("Offset = %f\r\n"), Size.MakeDouble());
01813     (*pStr) += s;
01814 }
01815 
01816 void TextAttrRecordHandler::DescribeScriptOff(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01817 {
01818     TCHAR s[256];
01819 
01820     camSprintf(s, _T("Text Attribute - Script (Off)\r\n"));
01821     (*pStr) += s;
01822 }
01823 
01824 void TextAttrRecordHandler::DescribeSuperscriptOn(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01825 {
01826     TCHAR s[256];
01827 
01828     camSprintf(s, _T("Text Attribute - Superscript (On)\r\n"));
01829     (*pStr) += s;
01830 }
01831 
01832 void TextAttrRecordHandler::DescribeSubscriptOn(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01833 {
01834     TCHAR s[256];
01835 
01836     camSprintf(s, _T("Text Attribute - Subscript (On)\r\n"));
01837     (*pStr) += s;
01838 }
01839 
01840 void TextAttrRecordHandler::DescribeTracking(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01841 {
01842     TCHAR s[256];
01843 
01844     MILLIPOINT Value;
01845     pCXaraFileRecord->ReadINT32(&Value);
01846 
01847     camSprintf(s, _T("Text Attribute - Tracking\r\n"));
01848     (*pStr) += s;
01849     camSprintf(s, _T("Tracking = %ld\r\n"), Value);
01850     (*pStr) += s;
01851 }
01852     
01853 void TextAttrRecordHandler::DescribeAspectRatio(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01854 {
01855     TCHAR s[256];
01856 
01857     FIXED16 Value;
01858     pCXaraFileRecord->ReadFIXED16(&Value);
01859 
01860     camSprintf(s, _T("Text Attribute - Aspect Ratio\r\n"));
01861     (*pStr) += s;
01862     camSprintf(s, _T("Aspect Ratio = %f\r\n"), Value.MakeDouble());
01863     (*pStr) += s;
01864 }
01865 
01866 void TextAttrRecordHandler::DescribeBaseline(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01867 {
01868     TCHAR s[256];
01869 
01870     MILLIPOINT Value;
01871     pCXaraFileRecord->ReadINT32(&Value);
01872 
01873     camSprintf(s, _T("Text Attribute - Baseline Shift\r\n"));
01874     (*pStr) += s;
01875     camSprintf(s, _T("Baseline shift = %ld\r\n"), Value);
01876     (*pStr) += s;
01877 }
01878 
01879 void TextAttrRecordHandler::DescribeInvalid(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01880 {
01881     TCHAR s[256];
01882 
01883     camSprintf(s,_T("Record Number = %d\r\n"), pCXaraFileRecord->GetRecordNumber());
01884     (*pStr) += s;
01885     camSprintf(s, _T("Tag = %d\r\n"), pCXaraFileRecord->GetTag());
01886     (*pStr) += s;
01887     camSprintf(s, _T("Size = %d\r\n\r\n"), pCXaraFileRecord->GetSize());
01888     (*pStr) += s;
01889 
01890     camSprintf(s, _T("Text Attribute - Invalid\r\n"));
01891     (*pStr) += s;
01892 }
01893 
01894 #endif  // XAR_TREE_DIALOG
01895 
01896 /********************************************************************************************
01897 
01898 >   UINT32 *FontDefRecordHandler::GetTagList()
01899 
01900     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
01901     Created:    12/08/96
01902     Inputs:     -
01903     Returns:    UINT32* to an array of records handled by this class.
01904     Purpose:    Returns an array of records handled by this class.
01905 
01906 ********************************************************************************************/
01907 
01908 UINT32 *FontDefRecordHandler::GetTagList()
01909 {
01910     static UINT32 TagList[] = {TAG_FONT_DEF_TRUETYPE,
01911                                 TAG_FONT_DEF_ATM,
01912                                 CXFRH_TAG_LIST_END};
01913     return TagList;
01914 }
01915 
01916 /********************************************************************************************
01917 
01918 >   BOOL FontDefRecordHandler::HandleRecord(CXaraFileRecord *pCXaraFileRecord)
01919 
01920     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
01921     Created:    09/07/96
01922     Inputs:     pCXaraFileRecord - pointer to a CXaraFileRecord to read
01923     Returns:    TRUE if successful, FALSE otherwise
01924     Purpose:    Handles reading a text attribute record from a CXaraFile.
01925 
01926 ********************************************************************************************/
01927 
01928 BOOL FontDefRecordHandler::HandleRecord(CXaraFileRecord *pCXaraFileRecord)
01929 {
01930     ERROR2IF(pCXaraFileRecord==NULL, FALSE, "Parameter CXaraFileRecord==NULL");
01931     
01932     BOOL ok;
01933 
01934     FontComponent *pFontComponent = GetFontComponent();
01935 
01936     ok = pFontComponent->ReadFontDefinition(pCXaraFileRecord);
01937 
01938     return ok;
01939 }
01940 
01941 /********************************************************************************************
01942 
01943 >   void FontDefRecordHandler::GetRecordDescriptionText(CXaraFileRecord* pCXaraFileRecord, StringBase *pStr)
01944     void FontDefRecordHandler::DescribeFontDefTrueType(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01945     void FontDefRecordHandler::DescribeFontDefATM(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01946     void FontDefRecordHandler::DescribeFontDefInvalid(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01947 
01948     Author:     Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
01949     Created:    12/08/96
01950     Inputs:     pCXaraFileRecord    - CXaraFileRecord to describe
01951                 pStr                - string to append text to
01952     Returns:    -
01953     Purpose:    Function to describe the text attribute records
01954 
01955 ********************************************************************************************/
01956 
01957 #ifdef XAR_TREE_DIALOG
01958 void FontDefRecordHandler::GetRecordDescriptionText(CXaraFileRecord* pCXaraFileRecord, StringBase *pStr)
01959 {
01960     if (pCXaraFileRecord!=NULL || pStr!=NULL)
01961     {
01962         GetRecordInfo(pCXaraFileRecord, pStr);
01963 
01964         switch (pCXaraFileRecord->GetTag())
01965         {
01966         case TAG_FONT_DEF_TRUETYPE      : DescribeFontDefTrueType(pCXaraFileRecord, pStr); break;
01967         case TAG_FONT_DEF_ATM           : DescribeFontDefATM(pCXaraFileRecord, pStr); break;
01968         default                         : DescribeFontDefInvalid(pCXaraFileRecord, pStr); break;
01969         }
01970     }
01971 }
01972 
01973 void FontDefRecordHandler::DescribeFontDefTrueType(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01974 {
01975     TCHAR buf[256];
01976     TCHAR FontName[64];
01977     TCHAR FaceName[32];
01978     CCPanose MyCCPanose;
01979 
01980     pCXaraFileRecord->ReadUnicode(FontName, 64);
01981     pCXaraFileRecord->ReadUnicode(FaceName, 32);
01982     pCXaraFileRecord->ReadCCPanose(&MyCCPanose);
01983 
01984     camSprintf(buf, _T("Font Definition - Truetype\r\n"));
01985     (*pStr) += buf;
01986     camSprintf(buf, _T("Full font name - %s\r\n"), FontName);
01987     (*pStr) += buf;
01988     camSprintf(buf, _T("TypeFace name - %s\r\n"), FaceName);
01989     (*pStr) += buf;
01990 
01991     MyCCPanose.GetDebugDetails(pStr);
01992     
01993 }
01994 
01995 void FontDefRecordHandler::DescribeFontDefATM(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
01996 {
01997     TCHAR buf[256];
01998     TCHAR FontName[64];
01999     TCHAR FaceName[32];
02000     CCPanose MyCCPanose;
02001     
02002     pCXaraFileRecord->ReadUnicode(FontName, 64);
02003     pCXaraFileRecord->ReadUnicode(FaceName, 32);
02004     pCXaraFileRecord->ReadCCPanose(&MyCCPanose);
02005 
02006     camSprintf(buf, _T("Font Definition - ATM\r\n"));
02007     (*pStr) += buf;
02008     camSprintf(buf, _T("Full font name - %s\r\n"), FontName);
02009     (*pStr) += buf;
02010     camSprintf(buf, _T("TypeFace name - %s\r\n"), FaceName);
02011     (*pStr) += buf;
02012 
02013     MyCCPanose.GetDebugDetails(pStr);
02014     
02015 }
02016 
02017 void FontDefRecordHandler::DescribeFontDefInvalid(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr)
02018 {
02019     TCHAR s[256];
02020 
02021     camSprintf(s, _T("Font Definition - Invalid\r\n"));
02022     (*pStr) += s;
02023 }
02024 
02025 #endif  // _DEBUG

Generated on Sat Nov 10 03:46:43 2007 for Camelot by  doxygen 1.4.4