00001 // $Id: txtattr.cpp 1568 2006-07-27 13:03:38Z phil $ 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 //This file contains the implementation of the TextStory attributes, both the Attribute 00100 //value classes and the Node classes 00101 00102 // ** Important ** 00103 //Here are some naming conventions for you to break, there a bit odd but at least they conform 00104 //to the way other attribs have been named. 00105 00106 //All attribute values have the form Txt<AttribName>Attribute 00107 //All attribute nodes have the form AttrTxt<AttribName> 00108 00109 // Here is a list of the attributes defined in this file 00110 // The attribute values are defined first, followed by the NodeAttributes 00111 00112 //Value Class Node Class New file format export class 00113 00114 //TxtFontTypefaceAttribute AttrTxtFontTypeface CXaraFileTxtFontTypeface 00115 //TxtBoldAttribute AttrTxtBold CXaraFileTxtBold 00116 //TxtItalicAttribute AttrTxtItalic CXaraFileTxtItalic 00117 //TxtUnderlineAttribute AttrTxtUnderline CXaraFileTxtUnderline 00118 //TxtAspectRatioAttribute AttrTxtAspectRatio CXaraFileTxtAspectRatio 00119 //TxtJustificationAttribute AttrTxtJustification CXaraFileTxtJustification 00120 //TxtTrackingAttribute AttrTxtTracking CXaraFileTxtTracking 00121 //TxtFontSizeAttribute AttrTxtFontSize CXaraFileTxtFontSize 00122 //TxtScriptAttribute AttrTxtScript CXaraFileTxtScript 00123 //TxtBaseLineAttribute AttrTxtBaseLine CXaraFileTxtBaseLine 00124 //TxtLineSpaceAttribute AttrTxtLineSpace CXaraFileTxtLineSpace 00125 00126 // The export code for the new file format has been placed in separate classes, in another 00127 // file, to avoid the monster rebuilds generated when this file gets changed. 00128 00129 /* 00130 */ 00131 00132 // FontDataItemHandle 00133 00134 #include "camtypes.h" 00135 //#include "txtattr.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00136 //#include "simon.h" 00137 //#include "rndrgn.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00138 //#include "attrmgr.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00139 //#include "ink.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00140 //#include "mario.h" 00141 //#include "peter.h" 00142 #include "nodetxts.h" 00143 //#include "app.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00144 #include "fontman.h" 00145 #include "nodetext.h" 00146 #include "cxftext.h" 00147 00148 DECLARE_SOURCE("$Revision: 1568 $"); 00149 00150 00151 // All IMPLEMENTS here 00152 CC_IMPLEMENT_DYNAMIC(TxtBaseClassAttribute, AttributeValue) 00153 CC_IMPLEMENT_DYNCREATE(TxtFontTypefaceAttribute, TxtBaseClassAttribute) 00154 CC_IMPLEMENT_DYNCREATE(TxtBoldAttribute, TxtBaseClassAttribute) 00155 CC_IMPLEMENT_DYNCREATE(TxtItalicAttribute, TxtBaseClassAttribute) 00156 CC_IMPLEMENT_DYNCREATE(TxtUnderlineAttribute, TxtBaseClassAttribute) 00157 CC_IMPLEMENT_DYNCREATE(TxtAspectRatioAttribute, TxtBaseClassAttribute) 00158 CC_IMPLEMENT_DYNCREATE(TxtJustificationAttribute, TxtBaseClassAttribute) 00159 CC_IMPLEMENT_DYNCREATE(TxtTrackingAttribute, TxtBaseClassAttribute) 00160 CC_IMPLEMENT_DYNCREATE(TxtFontSizeAttribute, TxtBaseClassAttribute) 00161 CC_IMPLEMENT_DYNCREATE(TxtScriptAttribute, TxtBaseClassAttribute) 00162 CC_IMPLEMENT_DYNCREATE(TxtBaseLineAttribute, TxtBaseClassAttribute) 00163 CC_IMPLEMENT_DYNCREATE(TxtLineSpaceAttribute, TxtBaseClassAttribute) 00164 CC_IMPLEMENT_DYNCREATE(TxtLeftMarginAttribute, TxtBaseClassAttribute) 00165 CC_IMPLEMENT_DYNCREATE(TxtRightMarginAttribute, TxtBaseClassAttribute) 00166 CC_IMPLEMENT_DYNCREATE(TxtFirstIndentAttribute, TxtBaseClassAttribute) 00167 CC_IMPLEMENT_DYNCREATE(TxtRulerAttribute, TxtBaseClassAttribute) 00168 00169 00170 CC_IMPLEMENT_DYNCREATE(AttrTxtBase, NodeAttribute) 00171 CC_IMPLEMENT_DYNCREATE(AttrTxtFontTypeface, AttrTxtBase) 00172 CC_IMPLEMENT_DYNCREATE(AttrTxtBold, AttrTxtBase) 00173 CC_IMPLEMENT_DYNCREATE(AttrTxtItalic, AttrTxtBase) 00174 CC_IMPLEMENT_DYNCREATE(AttrTxtUnderline, AttrTxtBase) 00175 CC_IMPLEMENT_DYNCREATE(AttrTxtAspectRatio, AttrTxtBase) 00176 CC_IMPLEMENT_DYNCREATE(AttrTxtJustification, AttrTxtBase) 00177 CC_IMPLEMENT_DYNCREATE(AttrTxtTracking, AttrTxtBase) 00178 CC_IMPLEMENT_DYNCREATE(AttrTxtFontSize, AttrTxtBase) 00179 CC_IMPLEMENT_DYNCREATE(AttrTxtScript, AttrTxtBase) 00180 CC_IMPLEMENT_DYNCREATE(AttrTxtBaseLine, AttrTxtBase) 00181 CC_IMPLEMENT_DYNCREATE(AttrTxtLineSpace, AttrTxtBase) 00182 CC_IMPLEMENT_DYNCREATE(AttrTxtLeftMargin, AttrTxtBase) 00183 CC_IMPLEMENT_DYNCREATE(AttrTxtRightMargin, AttrTxtBase) 00184 CC_IMPLEMENT_DYNCREATE(AttrTxtFirstIndent, AttrTxtBase) 00185 CC_IMPLEMENT_DYNCREATE(AttrTxtRuler, AttrTxtBase) 00186 00187 CC_IMPLEMENT_DYNCREATE(CharDescription, CCObject) 00188 00189 00190 // Declare smart memory handling in Debug builds 00191 #define new CAM_DEBUG_NEW 00192 00193 // ------------------------------------------------------------------------------------------- 00194 // AttrTxtBase methods 00195 00196 AttrTxtBase::AttrTxtBase() { } 00197 AttrTxtBase::AttrTxtBase(Node* ContextNode, 00198 AttachNodeDirection Direction, 00199 BOOL Locked, 00200 BOOL Mangled, 00201 BOOL Marked, 00202 BOOL Selected 00203 ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected) 00204 { 00205 } 00206 00207 // ----------------------------------------------------------------------------------------- 00208 // TxtFontTypeface methods 00209 00210 /******************************************************************************************** 00211 00212 > TxtFontTypefaceAttribute::TxtFontTypefaceAttribute() 00213 00214 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00215 Created: 13/03/95 00216 Purpose: Default Constuctor for TxtFontTypefaceAttribute 00217 The default typeface handle is 0 which represents the default font 00218 00219 SeeAlso: 00220 00221 ********************************************************************************************/ 00222 00223 TxtFontTypefaceAttribute::TxtFontTypefaceAttribute() 00224 { 00225 HTypeface = 0; // Default font 00226 IsBold = FALSE; 00227 IsItalic = FALSE; 00228 } 00229 00230 00231 /******************************************************************************************** 00232 00233 > TxtFontTypefaceAttribute::TxtFontTypefaceAttribute(UINT32 TypefaceHandle) 00234 00235 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00236 Created: 13/3/95 00237 Inputs: TypeFaceHandle: A typeface handle value 00238 Outputs: - 00239 Returns: - 00240 Purpose: TextFontTypefaceAttribute constructor 00241 Errors: - 00242 SeeAlso: - 00243 00244 ********************************************************************************************/ 00245 00246 TxtFontTypefaceAttribute::TxtFontTypefaceAttribute(UINT32 TypefaceHandle) 00247 { 00248 HTypeface = (WORD)TypefaceHandle; 00249 IsBold = FALSE; 00250 IsItalic = FALSE; 00251 } 00252 00253 00254 00255 /******************************************************************************************** 00256 00257 > void TxtFontTypefaceAttribute::Render(RenderRegion *pRegion) 00258 00259 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00260 Created: 13/03/95 00261 Inputs: pRegion - the render region to render this attribute into. 00262 Purpose: Sets the TxtFontTypeface attribute for the given render region. 00263 SeeAlso: - 00264 00265 ********************************************************************************************/ 00266 00267 void TxtFontTypefaceAttribute::Render(RenderRegion *pRegion, BOOL Temp) 00268 { 00269 pRegion->SetTxtFontTypeface(this, Temp); 00270 } 00271 00272 /******************************************************************************************** 00273 00274 > void TxtFontTypefaceAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 00275 00276 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00277 Created: 13/03/95 00278 Inputs: pRegion - the render region to restore the attribute into. 00279 Temp - TRUE if this is a temporary attribute, FALSE if it is 00280 permanent (e.g. it's in a document tree). 00281 Purpose: Restores the TxtFontTypefaceAttribute attribute for the given render region. 00282 SeeAlso: - 00283 00284 ********************************************************************************************/ 00285 00286 void TxtFontTypefaceAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 00287 { 00288 pRegion->RestoreTxtFontTypeface(this, Temp); 00289 } 00290 00291 /******************************************************************************************** 00292 00293 > TxtFontTypefaceAttribute& TxtFontTypefaceAttribute::operator=(TxtFontTypefaceAttribute& Attrib) 00294 00295 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00296 Created: 13/03/95 00297 Inputs: Attrib - the attribute to copy 00298 00299 Returns: Usual semantics for equality. 00300 Purpose: Make the Attribute the same as the other. 00301 00302 ********************************************************************************************/ 00303 00304 TxtFontTypefaceAttribute& TxtFontTypefaceAttribute::operator=(TxtFontTypefaceAttribute& Attrib) 00305 { 00306 HTypeface = Attrib.HTypeface; 00307 IsBold = Attrib.IsBold; 00308 IsItalic = Attrib.IsItalic; 00309 00310 return *this; 00311 } 00312 00313 /******************************************************************************************** 00314 00315 > INT32 TxtFontTypefaceAttribute::operator==(const TxtFontTypefaceAttribute& Attrib) 00316 00317 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 00318 Created: 23/8/94 00319 Inputs: Attrib - the attribute to compare this attribute with 00320 Returns: Usual semantics for equality. 00321 Purpose: Comparison operator. See NodeAttribute::operator== for 00322 a description of why it's required. 00323 SeeAlso: NodeAttribute::operator== 00324 00325 ********************************************************************************************/ 00326 00327 INT32 TxtFontTypefaceAttribute::operator==(const TxtFontTypefaceAttribute& Attrib) 00328 { 00329 return (Attrib.HTypeface == HTypeface && 00330 Attrib.IsBold == IsBold && 00331 Attrib.IsItalic == IsItalic); 00332 } 00333 00334 /******************************************************************************************** 00335 00336 > void TxtFontTypefaceAttribute ::SimpleCopy(AttributeValue *pValue) 00337 00338 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00339 Created: 13/03/95 00340 Inputs: pAttr - pointer to the AttributeValue to copy. 00341 Purpose: See AttributeValue::SimpleCopy 00342 00343 ********************************************************************************************/ 00344 00345 void TxtFontTypefaceAttribute::SimpleCopy(AttributeValue *pValue) 00346 { 00347 ERROR3IF(!IS_A(pValue, TxtFontTypefaceAttribute), 00348 "Invalid Attribute value passed to TxtFontTypefaceAttribute::SimpleCopy"); 00349 // We may as well just use our assignment operator. 00350 *this = *((TxtFontTypefaceAttribute*)pValue); 00351 } 00352 00353 00354 /******************************************************************************************** 00355 00356 > BOOL TxtFontTypefaceAttribute::IsDifferent(AttributeValue *pAttr) 00357 00358 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00359 Created: 13/03/95 00360 Purpose: See base class version. 00361 Errors: The two attributes are not of the same type. 00362 SeeAlso: AttributeValue::IsDifferent 00363 00364 ********************************************************************************************/ 00365 00366 BOOL TxtFontTypefaceAttribute::IsDifferent(AttributeValue *pAttr) 00367 { 00368 // This must be at least a FillGeometryAttribute... 00369 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtFontTypefaceAttribute)), 00370 "Different attribute types in TxtFontTypefaceAttribute::IsDifferent()"); 00371 00372 // Check they are NOT the same. 00373 return ( !(*((TxtFontTypefaceAttribute *)pAttr) == *this) ); 00374 } 00375 00376 /******************************************************************************************** 00377 00378 > BOOL TxtFontTypefaceAttribute::Init() 00379 00380 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00381 Created: 13/03/95 00382 Returns: TRUE - initialised ok; FALSE if not. 00383 Purpose: Registers default attribute 00384 Errors: Out of memory. 00385 SeeAlso: AttributeManager 00386 00387 ********************************************************************************************/ 00388 00389 BOOL TxtFontTypefaceAttribute::Init() 00390 { 00391 TxtFontTypefaceAttribute *pAttr = new TxtFontTypefaceAttribute; 00392 if (pAttr==NULL) 00393 // error message has already been set by new 00394 return FALSE; 00395 00396 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 00397 pAttr); 00398 00399 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtFontTypefaceAttribute"); 00400 00401 return TRUE; 00402 } 00403 00404 /******************************************************************************************** 00405 00406 > NodeAttribute *TxtFontTypefaceAttribute::MakeNode() 00407 00408 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00409 Created: 13/03/95 00410 Returns: Pointer to the new node, or NULL if out of memory. 00411 Purpose: Make a AttrTextFontTypeface node, see base class 00412 Errors: Out of memory 00413 SeeAlso: AttributeValue::MakeNode 00414 00415 ********************************************************************************************/ 00416 00417 NodeAttribute *TxtFontTypefaceAttribute::MakeNode() 00418 { 00419 // Create new attribute node 00420 AttrTxtFontTypeface* pAttr = new AttrTxtFontTypeface(); 00421 if (pAttr==NULL) 00422 // error message has already been set by new 00423 return NULL; 00424 00425 // Copy attribute value into the new node. 00426 pAttr->Value.SimpleCopy(this); 00427 00428 // Return the new node 00429 return pAttr; 00430 } 00431 00432 00433 // ----------------------------------------------------------------------------------------- 00434 // TxtFontSizeAttribute methods 00435 00436 /******************************************************************************************** 00437 00438 > TxtFontSizeAttribute::TxtFontSizeAttribute() 00439 00440 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00441 Created: 13/03/95 00442 Purpose: Default Constuctor for TxtFontSizeAttribute 00443 The default FontSize attribute value is 16000mp (16pt) 00444 00445 SeeAlso: 00446 00447 ********************************************************************************************/ 00448 00449 TxtFontSizeAttribute::TxtFontSizeAttribute() 00450 { 00451 FontSize = 16000; // Default font 00452 } 00453 00454 00455 /******************************************************************************************** 00456 00457 > TxtFontSizeAttribute::TxtFontSizeAttribute(MILLIPOINT FontSize) 00458 00459 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00460 Created: 13/3/95 00461 Inputs: FontSize: The font size in mp 00462 Outputs: - 00463 Returns: - 00464 Purpose: TextFontTypefaceAttribute constructor 00465 Errors: - 00466 SeeAlso: - 00467 00468 ********************************************************************************************/ 00469 00470 TxtFontSizeAttribute::TxtFontSizeAttribute(MILLIPOINT fontSize) 00471 { 00472 FontSize = fontSize; 00473 } 00474 00475 00476 00477 /******************************************************************************************** 00478 00479 > void TxtFontSizeAttribute::Render(RenderRegion *pRegion) 00480 00481 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00482 Created: 13/03/95 00483 Inputs: pRegion - the render region to render this attribute into. 00484 Purpose: Sets the TxtFontSizeAttribute attribute for the given render region. 00485 SeeAlso: - 00486 00487 ********************************************************************************************/ 00488 00489 void TxtFontSizeAttribute::Render(RenderRegion *pRegion, BOOL Temp) 00490 { 00491 pRegion->SetTxtFontSize(this, Temp); 00492 } 00493 00494 /******************************************************************************************** 00495 00496 > void TxtFontSizeAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 00497 00498 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00499 Created: 13/03/95 00500 Inputs: pRegion - the render region to restore the attribute into. 00501 Temp - TRUE if this is a temporary attribute, FALSE if it is 00502 permanent (e.g. it's in a document tree). 00503 Purpose: Restores the TxtFontSizeAttribute attribute for the given render region. 00504 SeeAlso: - 00505 00506 ********************************************************************************************/ 00507 00508 void TxtFontSizeAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 00509 { 00510 pRegion->RestoreTxtFontSize(this, Temp); 00511 } 00512 00513 /******************************************************************************************** 00514 00515 > TxtFontSizeAttribute& TxtFontSizeAttribute::operator=(TxtFontSizeAttribute& Attrib) 00516 00517 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00518 Created: 13/03/95 00519 Inputs: Attrib - the attribute to copy 00520 00521 Returns: Usual semantics for equality. 00522 Purpose: Make the Attribute the same as the other. 00523 00524 ********************************************************************************************/ 00525 00526 TxtFontSizeAttribute& TxtFontSizeAttribute::operator=(TxtFontSizeAttribute& Attrib) 00527 { 00528 FontSize = Attrib.FontSize; 00529 return *this; 00530 } 00531 00532 /******************************************************************************************** 00533 00534 > INT32 TxtFontSizeAttribute::operator==(const TxtFontSizeAttribute& Attrib) 00535 00536 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00537 Created: 20/03/95 00538 Inputs: Attrib - the attribute to compare this attribute with 00539 Returns: Usual semantics for equality. 00540 Purpose: Comparison operator. See NodeAttribute::operator== for 00541 a description of why it's required. 00542 SeeAlso: NodeAttribute::operator== 00543 00544 ********************************************************************************************/ 00545 00546 INT32 TxtFontSizeAttribute::operator==(const TxtFontSizeAttribute& Attrib) 00547 { 00548 return (Attrib.FontSize == FontSize); 00549 } 00550 00551 /******************************************************************************************** 00552 00553 > void TxtFontSizeAttribute ::SimpleCopy(AttributeValue *pValue) 00554 00555 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00556 Created: 13/03/95 00557 Inputs: pAttr - pointer to the AttributeValue to copy. 00558 Purpose: See AttributeValue::SimpleCopy 00559 00560 ********************************************************************************************/ 00561 00562 void TxtFontSizeAttribute::SimpleCopy(AttributeValue *pValue) 00563 { 00564 ERROR3IF(!IS_A(pValue, TxtFontSizeAttribute), 00565 "Invalid Attribute value passed to TxtFontSizeAttribute::SimpleCopy"); 00566 // We may as well just use our assignment operator. 00567 *this = *((TxtFontSizeAttribute*)pValue); 00568 } 00569 00570 00571 /******************************************************************************************** 00572 00573 > BOOL TxtFontSizeAttribute::IsDifferent(AttributeValue *pAttr) 00574 00575 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00576 Created: 13/03/95 00577 Purpose: See base class version. 00578 Errors: The two attributes are not of the same type. 00579 SeeAlso: AttributeValue::IsDifferent 00580 00581 ********************************************************************************************/ 00582 00583 BOOL TxtFontSizeAttribute::IsDifferent(AttributeValue *pAttr) 00584 { 00585 // This must be at least a FillGeometryAttribute... 00586 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtFontSizeAttribute)), 00587 "Different attribute types in TxtFontSizeAttribute::IsDifferent()"); 00588 00589 // Check they are NOT the same. 00590 return ( !(*((TxtFontSizeAttribute *)pAttr) == *this) ); 00591 } 00592 00593 /******************************************************************************************** 00594 00595 > BOOL TxtFontSizeAttribute::Init() 00596 00597 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00598 Created: 13/03/95 00599 Returns: TRUE - initialised ok; FALSE if not. 00600 Purpose: Registers default attribute 00601 Errors: Out of memory. 00602 SeeAlso: AttributeManager 00603 00604 ********************************************************************************************/ 00605 00606 BOOL TxtFontSizeAttribute::Init() 00607 { 00608 TxtFontSizeAttribute *pAttr = new TxtFontSizeAttribute; 00609 if (pAttr==NULL) 00610 // error message has already been set by new 00611 return FALSE; 00612 00613 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 00614 pAttr); 00615 00616 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtFontSizeAttribute"); 00617 00618 return TRUE; 00619 } 00620 00621 /******************************************************************************************** 00622 00623 > NodeAttribute *TxtFontSizeAttribute::MakeNode() 00624 00625 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00626 Created: 13/03/95 00627 Returns: Pointer to the new node, or NULL if out of memory. 00628 Purpose: Make a AttrTextFontTypeface node, see base class 00629 Errors: Out of memory 00630 SeeAlso: AttributeValue::MakeNode 00631 00632 ********************************************************************************************/ 00633 00634 NodeAttribute *TxtFontSizeAttribute::MakeNode() 00635 { 00636 // Create new attribute node 00637 AttrTxtFontSize* pAttr = new AttrTxtFontSize(); 00638 if (pAttr==NULL) 00639 // error message has already been set by new 00640 return NULL; 00641 00642 // Copy attribute value into the new node. 00643 pAttr->Value.SimpleCopy(this); 00644 00645 // Return the new node 00646 return pAttr; 00647 } 00648 00649 00650 00651 // ----------------------------------------------------------------------------------------- 00652 // TxtBoldAttribute methods 00653 00654 /******************************************************************************************** 00655 00656 > TxtBoldAttribute::TxtBoldAttribute() 00657 00658 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00659 Created: 13/03/95 00660 Purpose: Default Constuctor for TxtBoldAttribute 00661 The Bold state is set to FALSE 00662 00663 SeeAlso: 00664 00665 ********************************************************************************************/ 00666 00667 TxtBoldAttribute::TxtBoldAttribute() 00668 { 00669 BoldOn = FALSE; 00670 } 00671 00672 00673 /******************************************************************************************** 00674 00675 > TxtBoldAttribute::TxtBoldAttribute(BOOL boldOn) 00676 00677 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00678 Created: 13/3/95 00679 Inputs: boldOn: BOOL value indicating the initial bold state 00680 Outputs: - 00681 Returns: - 00682 Purpose: TxtBoldAttribute constructor 00683 Errors: - 00684 SeeAlso: - 00685 00686 ********************************************************************************************/ 00687 00688 TxtBoldAttribute::TxtBoldAttribute(BOOL boldOn) 00689 { 00690 BoldOn = boldOn; 00691 } 00692 00693 00694 00695 /******************************************************************************************** 00696 00697 > void TxtBoldAttribute::Render(RenderRegion *pRegion) 00698 00699 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00700 Created: 13/03/95 00701 Inputs: pRegion - the render region to render this attribute into. 00702 Purpose: Sets the TxtBoldAttribute attribute for the given render region. 00703 SeeAlso: - 00704 00705 ********************************************************************************************/ 00706 00707 void TxtBoldAttribute::Render(RenderRegion *pRegion, BOOL Temp) 00708 { 00709 pRegion->SetTxtBold(this, Temp); 00710 } 00711 00712 /******************************************************************************************** 00713 00714 > void TxtBoldAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 00715 00716 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00717 Created: 13/03/95 00718 Inputs: pRegion - the render region to restore the attribute into. 00719 Temp - TRUE if this is a temporary attribute, FALSE if it is 00720 permanent (e.g. it's in a document tree). 00721 Purpose: Restores the TxtBoldAttribute attribute for the given render region. 00722 SeeAlso: - 00723 00724 ********************************************************************************************/ 00725 00726 void TxtBoldAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 00727 { 00728 pRegion->RestoreTxtBold(this, Temp); 00729 } 00730 00731 /******************************************************************************************** 00732 00733 > TxtBoldAttribute& TxtBoldAttribute::operator=(TxtBoldAttribute& Attrib) 00734 00735 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00736 Created: 13/03/95 00737 Inputs: Attrib - the attribute to copy 00738 00739 Returns: Usual semantics for equality. 00740 Purpose: Make the Attribute the same as the other. 00741 00742 ********************************************************************************************/ 00743 00744 TxtBoldAttribute& TxtBoldAttribute::operator=(TxtBoldAttribute& Attrib) 00745 { 00746 BoldOn = Attrib.BoldOn; 00747 return *this; 00748 } 00749 00750 /******************************************************************************************** 00751 00752 > INT32 TxtBoldAttribute::operator==(const TxtBoldAttribute& Attrib) 00753 00754 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 00755 Created: 23/8/94 00756 Inputs: Attrib - the attribute to compare this attribute with 00757 Returns: Usual semantics for equality. 00758 Purpose: Comparison operator. See NodeAttribute::operator== for 00759 a description of why it's required. 00760 SeeAlso: NodeAttribute::operator== 00761 00762 ********************************************************************************************/ 00763 00764 INT32 TxtBoldAttribute::operator==(const TxtBoldAttribute& Attrib) 00765 { 00766 return (Attrib.BoldOn == BoldOn); 00767 } 00768 00769 /******************************************************************************************** 00770 00771 > void TxtBoldAttribute ::SimpleCopy(AttributeValue *pValue) 00772 00773 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00774 Created: 13/03/95 00775 Inputs: pAttr - pointer to the AttributeValue to copy. 00776 Purpose: See AttributeValue::SimpleCopy 00777 00778 ********************************************************************************************/ 00779 00780 void TxtBoldAttribute::SimpleCopy(AttributeValue *pValue) 00781 { 00782 ERROR3IF(!IS_A(pValue, TxtBoldAttribute), 00783 "Invalid Attribute value passed to TxtBoldAttribute::SimpleCopy"); 00784 // We may as well just use our assignment operator. 00785 *this = *((TxtBoldAttribute*)pValue); 00786 } 00787 00788 00789 /******************************************************************************************** 00790 00791 > BOOL TxtBoldAttribute::IsDifferent(AttributeValue *pAttr) 00792 00793 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00794 Created: 13/03/95 00795 Purpose: See base class version. 00796 Errors: The two attributes are not of the same type. 00797 SeeAlso: AttributeValue::IsDifferent 00798 00799 ********************************************************************************************/ 00800 00801 BOOL TxtBoldAttribute::IsDifferent(AttributeValue *pAttr) 00802 { 00803 // This must be at least a FillGeometryAttribute... 00804 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtBoldAttribute)), 00805 "Different attribute types in TxtBoldAttribute::IsDifferent()"); 00806 00807 // Check they are NOT the same. 00808 return ( !(*((TxtBoldAttribute *)pAttr) == *this) ); 00809 } 00810 00811 /******************************************************************************************** 00812 00813 > BOOL TxtBoldAttribute::Init() 00814 00815 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00816 Created: 13/03/95 00817 Returns: TRUE - initialised ok; FALSE if not. 00818 Purpose: Registers default attribute 00819 Errors: Out of memory. 00820 SeeAlso: AttributeManager 00821 00822 ********************************************************************************************/ 00823 00824 BOOL TxtBoldAttribute::Init() 00825 { 00826 TxtBoldAttribute *pAttr = new TxtBoldAttribute; 00827 if (pAttr==NULL) 00828 // error message has already been set by new 00829 return FALSE; 00830 00831 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 00832 pAttr); 00833 00834 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtBoldAttribute"); 00835 00836 return TRUE; 00837 } 00838 00839 /******************************************************************************************** 00840 00841 > NodeAttribute *TxtBoldAttribute::MakeNode() 00842 00843 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00844 Created: 13/03/95 00845 Returns: Pointer to the new node, or NULL if out of memory. 00846 Purpose: Make a AttrTextFontTypeface node, see base class 00847 Errors: Out of memory 00848 SeeAlso: AttributeValue::MakeNode 00849 00850 ********************************************************************************************/ 00851 00852 NodeAttribute *TxtBoldAttribute::MakeNode() 00853 { 00854 // Create new attribute node 00855 AttrTxtBold* pAttr = new AttrTxtBold(); 00856 if (pAttr==NULL) 00857 // error message has already been set by new 00858 return NULL; 00859 00860 // Copy attribute value into the new node. 00861 pAttr->Value.SimpleCopy(this); 00862 00863 // Return the new node 00864 return pAttr; 00865 } 00866 00867 00868 // ----------------------------------------------------------------------------------------- 00869 // TxtItalicAttribute methods 00870 00871 /******************************************************************************************** 00872 00873 > TxtItalicAttribute::TxtItalicAttribute() 00874 00875 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00876 Created: 13/03/95 00877 Purpose: Default Constuctor for TxtItalicAttribute 00878 The default Italic state is FALSE 00879 00880 SeeAlso: 00881 00882 ********************************************************************************************/ 00883 00884 TxtItalicAttribute::TxtItalicAttribute() 00885 { 00886 ItalicOn = FALSE; 00887 } 00888 00889 00890 /******************************************************************************************** 00891 00892 > TxtItalicAttribute::TxtItalicAttribute(BOOL italicOn) 00893 00894 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00895 Created: 13/3/95 00896 Inputs: italicOn: TRUE = Italic on, FALSE = Italic off 00897 Outputs: - 00898 Returns: - 00899 Purpose: TextFontTypefaceAttribute constructor 00900 Errors: - 00901 SeeAlso: - 00902 00903 ********************************************************************************************/ 00904 00905 TxtItalicAttribute::TxtItalicAttribute(BOOL italicOn) 00906 { 00907 ItalicOn = italicOn; 00908 } 00909 00910 00911 00912 /******************************************************************************************** 00913 00914 > void TxtItalicAttribute::Render(RenderRegion *pRegion) 00915 00916 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00917 Created: 13/03/95 00918 Inputs: pRegion - the render region to render this attribute into. 00919 Purpose: Sets the TxtFontTypeface attribute for the given render region. 00920 SeeAlso: - 00921 00922 ********************************************************************************************/ 00923 00924 void TxtItalicAttribute::Render(RenderRegion *pRegion, BOOL Temp) 00925 { 00926 pRegion->SetTxtItalic(this, Temp); 00927 } 00928 00929 /******************************************************************************************** 00930 00931 > void TxtItalicAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 00932 00933 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00934 Created: 13/03/95 00935 Inputs: pRegion - the render region to restore the attribute into. 00936 Temp - TRUE if this is a temporary attribute, FALSE if it is 00937 permanent (e.g. it's in a document tree). 00938 Purpose: Restores the TxtItalicAttribute attribute for the given render region. 00939 SeeAlso: - 00940 00941 ********************************************************************************************/ 00942 00943 void TxtItalicAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 00944 { 00945 pRegion->RestoreTxtItalic(this, Temp); 00946 } 00947 00948 /******************************************************************************************** 00949 00950 > TxtItalicAttribute& TxtItalicAttribute::operator=(TxtItalicAttribute& Attrib) 00951 00952 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00953 Created: 13/03/95 00954 Inputs: Attrib - the attribute to copy 00955 00956 Returns: Usual semantics for equality. 00957 Purpose: Make the Attribute the same as the other. 00958 00959 ********************************************************************************************/ 00960 00961 TxtItalicAttribute& TxtItalicAttribute::operator=(TxtItalicAttribute& Attrib) 00962 { 00963 ItalicOn = Attrib.ItalicOn; 00964 return *this; 00965 } 00966 00967 /******************************************************************************************** 00968 00969 > INT32 TxtItalicAttribute::operator==(const TxtItalicAttribute& Attrib) 00970 00971 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 00972 Created: 23/8/94 00973 Inputs: Attrib - the attribute to compare this attribute with 00974 Returns: Usual semantics for equality. 00975 Purpose: Comparison operator. See NodeAttribute::operator== for 00976 a description of why it's required. 00977 SeeAlso: NodeAttribute::operator== 00978 00979 ********************************************************************************************/ 00980 00981 INT32 TxtItalicAttribute::operator==(const TxtItalicAttribute& Attrib) 00982 { 00983 return (Attrib.ItalicOn == ItalicOn); 00984 } 00985 00986 /******************************************************************************************** 00987 00988 > void TxtItalicAttribute ::SimpleCopy(AttributeValue *pValue) 00989 00990 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00991 Created: 13/03/95 00992 Inputs: pAttr - pointer to the AttributeValue to copy. 00993 Purpose: See AttributeValue::SimpleCopy 00994 00995 ********************************************************************************************/ 00996 00997 void TxtItalicAttribute::SimpleCopy(AttributeValue *pValue) 00998 { 00999 ERROR3IF(!IS_A(pValue, TxtItalicAttribute), 01000 "Invalid Attribute value passed to TxtItalicAttribute::SimpleCopy"); 01001 // We may as well just use our assignment operator. 01002 *this = *((TxtItalicAttribute*)pValue); 01003 } 01004 01005 01006 /******************************************************************************************** 01007 01008 > BOOL TxtItalicAttribute::IsDifferent(AttributeValue *pAttr) 01009 01010 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01011 Created: 13/03/95 01012 Purpose: See base class version. 01013 Errors: The two attributes are not of the same type. 01014 SeeAlso: AttributeValue::IsDifferent 01015 01016 ********************************************************************************************/ 01017 01018 BOOL TxtItalicAttribute::IsDifferent(AttributeValue *pAttr) 01019 { 01020 // This must be at least a FillGeometryAttribute... 01021 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtItalicAttribute)), 01022 "Different attribute types in TxtItalicAttribute::IsDifferent()"); 01023 01024 // Check they are NOT the same. 01025 return ( !(*((TxtItalicAttribute *)pAttr) == *this) ); 01026 } 01027 01028 /******************************************************************************************** 01029 01030 > BOOL TxtItalicAttribute::Init() 01031 01032 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01033 Created: 13/03/95 01034 Returns: TRUE - initialised ok; FALSE if not. 01035 Purpose: Registers default attribute 01036 Errors: Out of memory. 01037 SeeAlso: AttributeManager 01038 01039 ********************************************************************************************/ 01040 01041 BOOL TxtItalicAttribute::Init() 01042 { 01043 TxtItalicAttribute *pAttr = new TxtItalicAttribute; 01044 if (pAttr==NULL) 01045 // error message has already been set by new 01046 return FALSE; 01047 01048 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 01049 pAttr); 01050 01051 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtItalicAttribute"); 01052 01053 return TRUE; 01054 } 01055 01056 /******************************************************************************************** 01057 01058 > NodeAttribute *TxtItalicAttribute::MakeNode() 01059 01060 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01061 Created: 13/03/95 01062 Returns: Pointer to the new node, or NULL if out of memory. 01063 Purpose: Make a AttrTxtItalic node, see base class 01064 Errors: Out of memory 01065 SeeAlso: AttributeValue::MakeNode 01066 01067 ********************************************************************************************/ 01068 01069 NodeAttribute *TxtItalicAttribute::MakeNode() 01070 { 01071 // Create new attribute node 01072 AttrTxtItalic* pAttr = new AttrTxtItalic(); 01073 if (pAttr==NULL) 01074 // error message has already been set by new 01075 return NULL; 01076 01077 // Copy attribute value into the new node. 01078 pAttr->Value.SimpleCopy(this); 01079 01080 // Return the new node 01081 return pAttr; 01082 } 01083 01084 01085 // ----------------------------------------------------------------------------------------- 01086 // TxtUnderlineAttribute methods 01087 01088 /******************************************************************************************** 01089 01090 > TxtUnderlineAttribute::TxtUnderlineAttribute() 01091 01092 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01093 Created: 13/03/95 01094 Purpose: Default Constuctor for TxtUnderlineAttribute 01095 The default Underline state is FALSE 01096 01097 SeeAlso: 01098 01099 ********************************************************************************************/ 01100 01101 TxtUnderlineAttribute::TxtUnderlineAttribute() 01102 { 01103 Underlined = FALSE; 01104 } 01105 01106 01107 /******************************************************************************************** 01108 01109 > TxtUnderlineAttribute::TxtUnderlineAttribute(BOOL underlined) 01110 01111 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01112 Created: 13/3/95 01113 Inputs: underlined: The underlined state 01114 Outputs: - 01115 Returns: - 01116 Purpose: TxtUnderlineAttribute constructor 01117 Errors: - 01118 SeeAlso: - 01119 01120 ********************************************************************************************/ 01121 01122 TxtUnderlineAttribute::TxtUnderlineAttribute(BOOL underlined) 01123 { 01124 Underlined = underlined; 01125 } 01126 01127 01128 01129 /******************************************************************************************** 01130 01131 > void TxtUnderlineAttribute::Render(RenderRegion *pRegion) 01132 01133 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01134 Created: 13/03/95 01135 Inputs: pRegion - the render region to render this attribute into. 01136 Purpose: Sets the TxtUnderlineAttribute attribute for the given render region. 01137 SeeAlso: - 01138 01139 ********************************************************************************************/ 01140 01141 void TxtUnderlineAttribute::Render(RenderRegion *pRegion, BOOL Temp) 01142 { 01143 pRegion->SetTxtUnderline(this, Temp); 01144 } 01145 01146 /******************************************************************************************** 01147 01148 > void TxtUnderlineAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 01149 01150 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01151 Created: 13/03/95 01152 Inputs: pRegion - the render region to restore the attribute into. 01153 Temp - TRUE if this is a temporary attribute, FALSE if it is 01154 permanent (e.g. it's in a document tree). 01155 Purpose: Restores the TxtUnderlineAttribute attribute for the given render region. 01156 SeeAlso: - 01157 01158 ********************************************************************************************/ 01159 01160 void TxtUnderlineAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 01161 { 01162 pRegion->RestoreTxtUnderline(this, Temp); 01163 } 01164 01165 /******************************************************************************************** 01166 01167 > TxtUnderlineAttribute& TxtUnderlineAttribute::operator=(TxtUnderlineAttribute& Attrib) 01168 01169 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01170 Created: 13/03/95 01171 Inputs: Attrib - the attribute to copy 01172 01173 Returns: Usual semantics for equality. 01174 Purpose: Make the Attribute the same as the other. 01175 01176 ********************************************************************************************/ 01177 01178 TxtUnderlineAttribute& TxtUnderlineAttribute::operator=(TxtUnderlineAttribute& Attrib) 01179 { 01180 Underlined = Attrib.Underlined; 01181 return *this; 01182 } 01183 01184 /******************************************************************************************** 01185 01186 > INT32 TxtUnderlineAttribute::operator==(const TxtUnderlineAttribute& Attrib) 01187 01188 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01189 Created: 15/03/95 01190 Inputs: Attrib - the attribute to compare this attribute with 01191 Returns: Usual semantics for equality. 01192 Purpose: Comparison operator. See NodeAttribute::operator== for 01193 a description of why it's required. 01194 SeeAlso: NodeAttribute::operator== 01195 01196 ********************************************************************************************/ 01197 01198 INT32 TxtUnderlineAttribute::operator==(const TxtUnderlineAttribute& Attrib) 01199 { 01200 return (Attrib.Underlined == Underlined); 01201 } 01202 01203 /******************************************************************************************** 01204 01205 > void TxtUnderlineAttribute ::SimpleCopy(AttributeValue *pValue) 01206 01207 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01208 Created: 13/03/95 01209 Inputs: pAttr - pointer to the AttributeValue to copy. 01210 Purpose: See AttributeValue::SimpleCopy 01211 01212 ********************************************************************************************/ 01213 01214 void TxtUnderlineAttribute::SimpleCopy(AttributeValue *pValue) 01215 { 01216 ERROR3IF(!IS_A(pValue, TxtUnderlineAttribute), 01217 "Invalid Attribute value passed to TxtUnderlineAttribute::SimpleCopy"); 01218 // We may as well just use our assignment operator. 01219 *this = *((TxtUnderlineAttribute*)pValue); 01220 } 01221 01222 01223 /******************************************************************************************** 01224 01225 > BOOL TxtUnderlineAttribute::IsDifferent(AttributeValue *pAttr) 01226 01227 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01228 Created: 13/03/95 01229 Purpose: See base class version. 01230 Errors: The two attributes are not of the same type. 01231 SeeAlso: AttributeValue::IsDifferent 01232 01233 ********************************************************************************************/ 01234 01235 BOOL TxtUnderlineAttribute::IsDifferent(AttributeValue *pAttr) 01236 { 01237 // This must be at least a FillGeometryAttribute... 01238 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtUnderlineAttribute)), 01239 "Different attribute types in TxtUnderlineAttribute::IsDifferent()"); 01240 01241 // Check they are NOT the same. 01242 return ( !(*((TxtUnderlineAttribute *)pAttr) == *this) ); 01243 } 01244 01245 /******************************************************************************************** 01246 01247 > BOOL TxtUnderlineAttribute::Init() 01248 01249 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01250 Created: 13/03/95 01251 Returns: TRUE - initialised ok; FALSE if not. 01252 Purpose: Registers default attribute 01253 Errors: Out of memory. 01254 SeeAlso: AttributeManager 01255 01256 ********************************************************************************************/ 01257 01258 BOOL TxtUnderlineAttribute::Init() 01259 { 01260 TxtUnderlineAttribute *pAttr = new TxtUnderlineAttribute; 01261 if (pAttr==NULL) 01262 // error message has already been set by new 01263 return FALSE; 01264 01265 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 01266 pAttr); 01267 01268 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtUnderlineAttribute"); 01269 01270 return TRUE; 01271 } 01272 01273 /******************************************************************************************** 01274 01275 > NodeAttribute *TxtUnderlineAttribute::MakeNode() 01276 01277 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01278 Created: 13/03/95 01279 Returns: Pointer to the new node, or NULL if out of memory. 01280 Purpose: Make a AttrTxtUnderline node, see base class 01281 Errors: Out of memory 01282 SeeAlso: AttributeValue::MakeNode 01283 01284 ********************************************************************************************/ 01285 01286 NodeAttribute *TxtUnderlineAttribute::MakeNode() 01287 { 01288 // Create new attribute node 01289 AttrTxtUnderline* pAttr = new AttrTxtUnderline(); 01290 if (pAttr==NULL) 01291 // error message has already been set by new 01292 return NULL; 01293 01294 // Copy attribute value into the new node. 01295 pAttr->Value.SimpleCopy(this); 01296 01297 // Return the new node 01298 return pAttr; 01299 } 01300 01301 01302 01303 01304 // ----------------------------------------------------------------------------------------- 01305 // TxtAspectRatioAttribute methods 01306 01307 /******************************************************************************************** 01308 01309 > TxtAspectRatioAttribute::TxtAspectRatioAttribute() 01310 01311 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01312 Created: 13/03/95 01313 Purpose: Default Constuctor for TxtAspectRatioAttribute 01314 A zero aspect ratio is set 01315 01316 ********************************************************************************************/ 01317 01318 TxtAspectRatioAttribute::TxtAspectRatioAttribute() 01319 { 01320 AspectRatio = 1; 01321 } 01322 01323 01324 /******************************************************************************************** 01325 01326 > TxtAspectRatioAttribute::TxtAspectRatioAttribute(FIXED16 aspectRatio) 01327 01328 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01329 Created: 13/3/95 01330 Inputs: aspectRatio: The aspectRatio value 01331 Purpose: TxtAspectRatioAttribute constructor 01332 01333 ********************************************************************************************/ 01334 01335 TxtAspectRatioAttribute::TxtAspectRatioAttribute(FIXED16 aspect) 01336 { 01337 AspectRatio = aspect; 01338 } 01339 01340 01341 /******************************************************************************************** 01342 01343 > void TxtAspectRatioAttribute::Render(RenderRegion *pRegion) 01344 01345 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01346 Created: 13/03/95 01347 Inputs: pRegion - the render region to render this attribute into. 01348 Purpose: Sets the TxtFontTypeface attribute for the given render region. 01349 01350 ********************************************************************************************/ 01351 01352 void TxtAspectRatioAttribute::Render(RenderRegion *pRegion, BOOL Temp) 01353 { 01354 pRegion->SetTxtAspectRatio(this, Temp); 01355 } 01356 01357 01358 /******************************************************************************************** 01359 01360 > void TxtAspectRatioAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 01361 01362 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01363 Created: 13/03/95 01364 Inputs: pRegion - the render region to restore the attribute into. 01365 Temp - TRUE if this is a temporary attribute, FALSE if it is 01366 permanent (e.g. it's in a document tree). 01367 Purpose: Restores the TxtAspectRatioAttribute attribute for the given render region. 01368 01369 ********************************************************************************************/ 01370 01371 void TxtAspectRatioAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 01372 { 01373 pRegion->RestoreTxtAspectRatio(this, Temp); 01374 } 01375 01376 /******************************************************************************************** 01377 01378 > TxtAspectRatioAttribute& TxtAspectRatioAttribute::operator=(TxtAspectRatioAttribute& Attrib) 01379 01380 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01381 Created: 13/03/95 01382 Inputs: Attrib - the attribute to copy 01383 01384 Returns: Usual semantics for equality. 01385 Purpose: Make the Attribute the same as the other. 01386 01387 ********************************************************************************************/ 01388 01389 TxtAspectRatioAttribute& TxtAspectRatioAttribute::operator=(TxtAspectRatioAttribute& Attrib) 01390 { 01391 AspectRatio = Attrib.AspectRatio; 01392 return *this; 01393 } 01394 01395 01396 /******************************************************************************************** 01397 01398 > INT32 TxtAspectRatioAttribute::operator==(const TxtAspectRatioAttribute& Attrib) 01399 01400 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 01401 Created: 23/8/94 01402 Inputs: Attrib - the attribute to compare this attribute with 01403 Returns: Usual semantics for equality. 01404 Purpose: Comparison operator. See NodeAttribute::operator== for 01405 a description of why it's required. 01406 SeeAlso: NodeAttribute::operator== 01407 01408 ********************************************************************************************/ 01409 01410 INT32 TxtAspectRatioAttribute::operator==(const TxtAspectRatioAttribute& Attrib) 01411 { 01412 return (Attrib.AspectRatio == AspectRatio); 01413 } 01414 01415 01416 /******************************************************************************************** 01417 01418 > void TxtAspectRatioAttribute ::SimpleCopy(AttributeValue *pValue) 01419 01420 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01421 Created: 13/03/95 01422 Inputs: pAttr - pointer to the AttributeValue to copy. 01423 Purpose: See AttributeValue::SimpleCopy 01424 01425 ********************************************************************************************/ 01426 01427 void TxtAspectRatioAttribute::SimpleCopy(AttributeValue *pValue) 01428 { 01429 ERROR3IF(!IS_A(pValue, TxtAspectRatioAttribute), 01430 "Invalid Attribute value passed to TxtAspectRatioAttribute::SimpleCopy"); 01431 // We may as well just use our assignment operator. 01432 *this = *((TxtAspectRatioAttribute*)pValue); 01433 } 01434 01435 01436 /******************************************************************************************** 01437 01438 > BOOL TxtAspectRatioAttribute::IsDifferent(AttributeValue *pAttr) 01439 01440 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01441 Created: 13/03/95 01442 Purpose: See base class version. 01443 Errors: The two attributes are not of the same type. 01444 SeeAlso: AttributeValue::IsDifferent 01445 01446 ********************************************************************************************/ 01447 01448 BOOL TxtAspectRatioAttribute::IsDifferent(AttributeValue *pAttr) 01449 { 01450 // This must be at least a FillGeometryAttribute... 01451 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtAspectRatioAttribute)), 01452 "Different attribute types in TxtAspectRatioAttribute::IsDifferent()"); 01453 01454 // Check they are NOT the same. 01455 return ( !(*((TxtAspectRatioAttribute *)pAttr) == *this) ); 01456 } 01457 01458 /******************************************************************************************** 01459 01460 > BOOL TxtAspectRatioAttribute::Init() 01461 01462 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01463 Created: 13/03/95 01464 Returns: TRUE - initialised ok; FALSE if not. 01465 Purpose: Registers default attribute 01466 Errors: Out of memory. 01467 SeeAlso: AttributeManager 01468 01469 ********************************************************************************************/ 01470 01471 BOOL TxtAspectRatioAttribute::Init() 01472 { 01473 TxtAspectRatioAttribute *pAttr = new TxtAspectRatioAttribute; 01474 if (pAttr==NULL) 01475 // error message has already been set by new 01476 return FALSE; 01477 01478 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 01479 pAttr); 01480 01481 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtAspectRatioAttribute"); 01482 01483 return TRUE; 01484 } 01485 01486 /******************************************************************************************** 01487 01488 > NodeAttribute *TxtAspectRatioAttribute::MakeNode() 01489 01490 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01491 Created: 13/03/95 01492 Returns: Pointer to the new node, or NULL if out of memory. 01493 Purpose: Make a AttrTextFontTypeface node, see base class 01494 Errors: Out of memory 01495 SeeAlso: AttributeValue::MakeNode 01496 01497 ********************************************************************************************/ 01498 01499 NodeAttribute *TxtAspectRatioAttribute::MakeNode() 01500 { 01501 // Create new attribute node 01502 AttrTxtAspectRatio* pAttr = new AttrTxtAspectRatio(); 01503 if (pAttr==NULL) 01504 // error message has already been set by new 01505 return NULL; 01506 01507 // Copy attribute value into the new node. 01508 pAttr->Value.SimpleCopy(this); 01509 01510 // Return the new node 01511 return pAttr; 01512 } 01513 01514 01515 01516 01517 01518 // ----------------------------------------------------------------------------------------- 01519 // TxtJustificationAttribute methods 01520 01521 /******************************************************************************************** 01522 01523 > TxtJustificationAttribute::TxtJustificationAttribute() 01524 01525 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01526 Created: 13/03/95 01527 Purpose: Default Constuctor for TxtJustificationAttribute 01528 It defaults to LEFT justify 01529 01530 SeeAlso: 01531 01532 ********************************************************************************************/ 01533 01534 TxtJustificationAttribute::TxtJustificationAttribute() 01535 { 01536 justification = JLEFT; 01537 } 01538 01539 01540 /******************************************************************************************** 01541 01542 > TxtJustificationAttribute::TxtJustificationAttribute(Justification Justify) 01543 01544 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01545 Created: 13/3/95 01546 Inputs: Justify:The type of justification (JLEFT, JRIGHT, JCENTRE, or JFULL) 01547 Outputs: - 01548 Returns: - 01549 Purpose: TxtJustificationAttribute constructor 01550 Errors: - 01551 SeeAlso: - 01552 01553 ********************************************************************************************/ 01554 01555 TxtJustificationAttribute::TxtJustificationAttribute(Justification Justify) 01556 { 01557 justification = Justify; 01558 } 01559 01560 01561 01562 /******************************************************************************************** 01563 01564 > void TxtJustificationAttribute::Render(RenderRegion *pRegion) 01565 01566 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01567 Created: 13/03/95 01568 Inputs: pRegion - the render region to render this attribute into. 01569 Purpose: Sets the TxtJustificationAttribute attribute for the given render region. 01570 SeeAlso: - 01571 01572 ********************************************************************************************/ 01573 01574 void TxtJustificationAttribute::Render(RenderRegion *pRegion, BOOL Temp) 01575 { 01576 pRegion->SetTxtJustification(this, Temp); 01577 } 01578 01579 /******************************************************************************************** 01580 01581 > void TxtJustificationAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 01582 01583 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01584 Created: 13/03/95 01585 Inputs: pRegion - the render region to restore the attribute into. 01586 Temp - TRUE if this is a temporary attribute, FALSE if it is 01587 permanent (e.g. it's in a document tree). 01588 Purpose: Restores the TxtJustificationAttribute attribute for the given render region. 01589 SeeAlso: - 01590 01591 ********************************************************************************************/ 01592 01593 void TxtJustificationAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 01594 { 01595 pRegion->RestoreTxtJustification(this, Temp); 01596 } 01597 01598 /******************************************************************************************** 01599 01600 > TxtJustificationAttribute& TxtJustificationAttribute::operator=(TxtJustificationAttribute& Attrib) 01601 01602 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01603 Created: 13/03/95 01604 Inputs: Attrib - the attribute to copy 01605 01606 Returns: Usual semantics for equality. 01607 Purpose: Make the Attribute the same as the other. 01608 01609 ********************************************************************************************/ 01610 01611 TxtJustificationAttribute& TxtJustificationAttribute::operator=(TxtJustificationAttribute& Attrib) 01612 { 01613 justification = Attrib.justification; 01614 return *this; 01615 } 01616 01617 /******************************************************************************************** 01618 01619 > INT32 TxtJustificationAttribute::operator==(const TxtJustificationAttribute& Attrib) 01620 01621 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 01622 Created: 23/8/94 01623 Inputs: Attrib - the attribute to compare this attribute with 01624 Returns: Usual semantics for equality. 01625 Purpose: Comparison operator. See NodeAttribute::operator== for 01626 a description of why it's required. 01627 SeeAlso: NodeAttribute::operator== 01628 01629 ********************************************************************************************/ 01630 01631 INT32 TxtJustificationAttribute::operator==(const TxtJustificationAttribute& Attrib) 01632 { 01633 return (Attrib.justification == justification); 01634 } 01635 01636 /******************************************************************************************** 01637 01638 > void TxtJustificationAttribute ::SimpleCopy(AttributeValue *pValue) 01639 01640 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01641 Created: 13/03/95 01642 Inputs: pAttr - pointer to the AttributeValue to copy. 01643 Purpose: See AttributeValue::SimpleCopy 01644 01645 ********************************************************************************************/ 01646 01647 void TxtJustificationAttribute::SimpleCopy(AttributeValue *pValue) 01648 { 01649 ERROR3IF(!IS_A(pValue, TxtJustificationAttribute), 01650 "Invalid Attribute value passed to TxtJustificationAttribute::SimpleCopy"); 01651 // We may as well just use our assignment operator. 01652 *this = *((TxtJustificationAttribute*)pValue); 01653 } 01654 01655 01656 /******************************************************************************************** 01657 01658 > BOOL TxtJustificationAttribute::IsDifferent(AttributeValue *pAttr) 01659 01660 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01661 Created: 13/03/95 01662 Purpose: See base class version. 01663 Errors: The two attributes are not of the same type. 01664 SeeAlso: AttributeValue::IsDifferent 01665 01666 ********************************************************************************************/ 01667 01668 BOOL TxtJustificationAttribute::IsDifferent(AttributeValue *pAttr) 01669 { 01670 // This must be at least a FillGeometryAttribute... 01671 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtJustificationAttribute)), 01672 "Different attribute types in TxtJustificationAttribute::IsDifferent()"); 01673 01674 // Check they are NOT the same. 01675 return ( !(*((TxtJustificationAttribute *)pAttr) == *this) ); 01676 } 01677 01678 /******************************************************************************************** 01679 01680 > BOOL TxtJustificationAttribute::Init() 01681 01682 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01683 Created: 13/03/95 01684 Returns: TRUE - initialised ok; FALSE if not. 01685 Purpose: Registers default attribute 01686 Errors: Out of memory. 01687 SeeAlso: AttributeManager 01688 01689 ********************************************************************************************/ 01690 01691 BOOL TxtJustificationAttribute::Init() 01692 { 01693 TxtJustificationAttribute *pAttr = new TxtJustificationAttribute; 01694 if (pAttr==NULL) 01695 // error message has already been set by new 01696 return FALSE; 01697 01698 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 01699 pAttr); 01700 01701 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtJustificationAttribute"); 01702 01703 return TRUE; 01704 } 01705 01706 /******************************************************************************************** 01707 01708 > NodeAttribute *TxtJustificationAttribute::MakeNode() 01709 01710 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01711 Created: 13/03/95 01712 Returns: Pointer to the new node, or NULL if out of memory. 01713 Purpose: Make a AttrTxtJustification node, see base class 01714 Errors: Out of memory 01715 SeeAlso: AttributeValue::MakeNode 01716 01717 ********************************************************************************************/ 01718 01719 NodeAttribute *TxtJustificationAttribute::MakeNode() 01720 { 01721 // Create new attribute node 01722 AttrTxtJustification* pAttr = new AttrTxtJustification(); 01723 if (pAttr==NULL) 01724 // error message has already been set by new 01725 return NULL; 01726 01727 // Copy attribute value into the new node. 01728 pAttr->Value.SimpleCopy(this); 01729 01730 // Return the new node 01731 return pAttr; 01732 } 01733 01734 01735 01736 01737 01738 // ----------------------------------------------------------------------------------------- 01739 // TxtTrackingAttribute methods 01740 01741 /******************************************************************************************** 01742 01743 > TxtTrackingAttribute::TxtTrackingAttribute() 01744 01745 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01746 Created: 13/03/95 01747 Purpose: Default Constuctor for TxtTrackingAttribute 01748 The function sets the Tracking value to 0 01749 01750 SeeAlso: 01751 01752 ********************************************************************************************/ 01753 01754 TxtTrackingAttribute::TxtTrackingAttribute() 01755 { 01756 Tracking = 0; 01757 } 01758 01759 01760 /******************************************************************************************** 01761 01762 > TxtTrackingAttribute::TxtTrackingAttribute(MILLIPOINT Tracking) 01763 01764 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01765 Created: 13/3/95 01766 Inputs: Tracking: The tracking value 01767 Outputs: - 01768 Returns: - 01769 Purpose: TxtTrackingAttribute constructor 01770 Errors: - 01771 SeeAlso: - 01772 01773 ********************************************************************************************/ 01774 01775 TxtTrackingAttribute::TxtTrackingAttribute(MILLIPOINT tracking) 01776 { 01777 Tracking = tracking; 01778 } 01779 01780 01781 01782 /******************************************************************************************** 01783 01784 > void TxtTrackingAttribute::Render(RenderRegion *pRegion) 01785 01786 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01787 Created: 13/03/95 01788 Inputs: pRegion - the render region to render this attribute into. 01789 Purpose: Sets the TxtTrackingAttribute attribute for the given render region. 01790 SeeAlso: - 01791 01792 ********************************************************************************************/ 01793 01794 void TxtTrackingAttribute::Render(RenderRegion *pRegion, BOOL Temp) 01795 { 01796 pRegion->SetTxtTracking(this, Temp); 01797 } 01798 01799 /******************************************************************************************** 01800 01801 > void TxtTrackingAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 01802 01803 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01804 Created: 13/03/95 01805 Inputs: pRegion - the render region to restore the attribute into. 01806 Temp - TRUE if this is a temporary attribute, FALSE if it is 01807 permanent (e.g. it's in a document tree). 01808 Purpose: Restores the TxtTrackingAttribute attribute for the given render region. 01809 SeeAlso: - 01810 01811 ********************************************************************************************/ 01812 01813 void TxtTrackingAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 01814 { 01815 pRegion->RestoreTxtTracking(this, Temp); 01816 } 01817 01818 /******************************************************************************************** 01819 01820 > TxtTrackingAttribute& TxtTrackingAttribute::operator=(TxtTrackingAttribute& Attrib) 01821 01822 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01823 Created: 13/03/95 01824 Inputs: Attrib - the attribute to copy 01825 01826 Returns: Usual semantics for equality. 01827 Purpose: Make the Attribute the same as the other. 01828 01829 ********************************************************************************************/ 01830 01831 TxtTrackingAttribute& TxtTrackingAttribute::operator=(TxtTrackingAttribute& Attrib) 01832 { 01833 Tracking = Attrib.Tracking; 01834 return *this; 01835 } 01836 01837 /******************************************************************************************** 01838 01839 > INT32 TxtTrackingAttribute::operator==(const TxtTrackingAttribute& Attrib) 01840 01841 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 01842 Created: 23/8/94 01843 Inputs: Attrib - the attribute to compare this attribute with 01844 Returns: Usual semantics for equality. 01845 Purpose: Comparison operator. See NodeAttribute::operator== for 01846 a description of why it's required. 01847 SeeAlso: NodeAttribute::operator== 01848 01849 ********************************************************************************************/ 01850 01851 INT32 TxtTrackingAttribute::operator==(const TxtTrackingAttribute& Attrib) 01852 { 01853 return (Attrib.Tracking == Tracking); 01854 } 01855 01856 /******************************************************************************************** 01857 01858 > void TxtTrackingAttribute ::SimpleCopy(AttributeValue *pValue) 01859 01860 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01861 Created: 13/03/95 01862 Inputs: pAttr - pointer to the AttributeValue to copy. 01863 Purpose: See AttributeValue::SimpleCopy 01864 01865 ********************************************************************************************/ 01866 01867 void TxtTrackingAttribute::SimpleCopy(AttributeValue *pValue) 01868 { 01869 ERROR3IF(!IS_A(pValue, TxtTrackingAttribute), 01870 "Invalid Attribute value passed to TxtTrackingAttribute::SimpleCopy"); 01871 // We may as well just use our assignment operator. 01872 *this = *((TxtTrackingAttribute*)pValue); 01873 } 01874 01875 01876 /******************************************************************************************** 01877 01878 > BOOL TxtTrackingAttribute::IsDifferent(AttributeValue *pAttr) 01879 01880 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01881 Created: 13/03/95 01882 Purpose: See base class version. 01883 Errors: The two attributes are not of the same type. 01884 SeeAlso: AttributeValue::IsDifferent 01885 01886 ********************************************************************************************/ 01887 01888 BOOL TxtTrackingAttribute::IsDifferent(AttributeValue *pAttr) 01889 { 01890 // This must be at least a FillGeometryAttribute... 01891 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtTrackingAttribute)), 01892 "Different attribute types in TxtTrackingAttribute::IsDifferent()"); 01893 01894 // Check they are NOT the same. 01895 return ( !(*((TxtTrackingAttribute *)pAttr) == *this) ); 01896 } 01897 01898 /******************************************************************************************** 01899 01900 > BOOL TxtTrackingAttribute::Init() 01901 01902 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01903 Created: 13/03/95 01904 Returns: TRUE - initialised ok; FALSE if not. 01905 Purpose: Registers default attribute 01906 Errors: Out of memory. 01907 SeeAlso: AttributeManager 01908 01909 ********************************************************************************************/ 01910 01911 BOOL TxtTrackingAttribute::Init() 01912 { 01913 TxtTrackingAttribute *pAttr = new TxtTrackingAttribute; 01914 if (pAttr==NULL) 01915 // error message has already been set by new 01916 return FALSE; 01917 01918 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 01919 pAttr); 01920 01921 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtTrackingAttribute"); 01922 01923 return TRUE; 01924 } 01925 01926 /******************************************************************************************** 01927 01928 > NodeAttribute *TxtTrackingAttribute::MakeNode() 01929 01930 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01931 Created: 13/03/95 01932 Returns: Pointer to the new node, or NULL if out of memory. 01933 Purpose: Make a AttrTxtTracking node, see base class 01934 Errors: Out of memory 01935 SeeAlso: AttributeValue::MakeNode 01936 01937 ********************************************************************************************/ 01938 01939 NodeAttribute *TxtTrackingAttribute::MakeNode() 01940 { 01941 // Create new attribute node 01942 AttrTxtTracking* pAttr = new AttrTxtTracking(); 01943 if (pAttr==NULL) 01944 // error message has already been set by new 01945 return NULL; 01946 01947 // Copy attribute value into the new node. 01948 pAttr->Value.SimpleCopy(this); 01949 01950 // Return the new node 01951 return pAttr; 01952 } 01953 01954 01955 01956 // ----------------------------------------------------------------------------------------- 01957 // TxtScriptAttribute methods 01958 01959 /******************************************************************************************** 01960 01961 > TxtScriptAttribute::TxtScriptAttribute() 01962 01963 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01964 Created: 13/03/95 01965 Purpose: Default Constuctor for TxtScriptAttribute 01966 The function sets the Offset to 0, and the Size to 1 01967 01968 SeeAlso: 01969 01970 ********************************************************************************************/ 01971 01972 TxtScriptAttribute::TxtScriptAttribute() 01973 { 01974 Offset = 0; 01975 Size = 1; 01976 01977 } 01978 01979 01980 /******************************************************************************************** 01981 01982 > TxtScriptAttribute::TxtScriptAttribute(FIXED16 Offset, FIXED16 Size) 01983 01984 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 01985 Created: 13/3/95 01986 Inputs: Tracking: The tracking value 01987 Outputs: - 01988 Returns: - 01989 Purpose: TxtScriptAttribute constructor 01990 Errors: - 01991 SeeAlso: - 01992 01993 ********************************************************************************************/ 01994 01995 TxtScriptAttribute::TxtScriptAttribute(FIXED16 offset, FIXED16 size) 01996 { 01997 Offset = offset; 01998 Size = size; 01999 } 02000 02001 02002 02003 /******************************************************************************************** 02004 02005 > void TxtScriptAttribute::Render(RenderRegion *pRegion) 02006 02007 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02008 Created: 13/03/95 02009 Inputs: pRegion - the render region to render this attribute into. 02010 Purpose: Sets the TxtScriptAttribute attribute for the given render region. 02011 SeeAlso: - 02012 02013 ********************************************************************************************/ 02014 02015 void TxtScriptAttribute::Render(RenderRegion *pRegion, BOOL Temp) 02016 { 02017 pRegion->SetTxtScript(this, Temp); 02018 } 02019 02020 /******************************************************************************************** 02021 02022 > void TxtScriptAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 02023 02024 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02025 Created: 13/03/95 02026 Inputs: pRegion - the render region to restore the attribute into. 02027 Temp - TRUE if this is a temporary attribute, FALSE if it is 02028 permanent (e.g. it's in a document tree). 02029 Purpose: Restores the TxtScriptAttribute attribute for the given render region. 02030 SeeAlso: - 02031 02032 ********************************************************************************************/ 02033 02034 void TxtScriptAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 02035 { 02036 pRegion->RestoreTxtScript(this, Temp); 02037 } 02038 02039 /******************************************************************************************** 02040 02041 > TxtScriptAttribute& TxtScriptAttribute::operator=(TxtScriptAttribute& Attrib) 02042 02043 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02044 Created: 13/03/95 02045 Inputs: Attrib - the attribute to copy 02046 02047 Returns: Usual semantics for equality. 02048 Purpose: Make the Attribute the same as the other. 02049 02050 ********************************************************************************************/ 02051 02052 TxtScriptAttribute& TxtScriptAttribute::operator=(TxtScriptAttribute& Attrib) 02053 { 02054 Offset = Attrib.Offset; 02055 Size = Attrib.Size; 02056 return *this; 02057 } 02058 02059 /******************************************************************************************** 02060 02061 > INT32 TxtScriptAttribute::operator==(const TxtScriptAttribute& Attrib) 02062 02063 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 02064 Created: 23/8/94 02065 Inputs: Attrib - the attribute to compare this attribute with 02066 Returns: Usual semantics for equality. 02067 Purpose: Comparison operator. See NodeAttribute::operator== for 02068 a description of why it's required. 02069 SeeAlso: NodeAttribute::operator== 02070 02071 ********************************************************************************************/ 02072 02073 INT32 TxtScriptAttribute::operator==(const TxtScriptAttribute& Attrib) 02074 { 02075 return ((Attrib.Offset == Offset) && (Attrib.Size == Size)); 02076 } 02077 02078 /******************************************************************************************** 02079 02080 > void TxtScriptAttribute ::SimpleCopy(AttributeValue *pValue) 02081 02082 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02083 Created: 13/03/95 02084 Inputs: pAttr - pointer to the AttributeValue to copy. 02085 Purpose: See AttributeValue::SimpleCopy 02086 02087 ********************************************************************************************/ 02088 02089 void TxtScriptAttribute::SimpleCopy(AttributeValue *pValue) 02090 { 02091 ERROR3IF(!IS_A(pValue, TxtScriptAttribute), 02092 "Invalid Attribute value passed to TxtScriptAttribute::SimpleCopy"); 02093 // We may as well just use our assignment operator. 02094 *this = *((TxtScriptAttribute*)pValue); 02095 } 02096 02097 02098 /******************************************************************************************** 02099 02100 > BOOL TxtScriptAttribute::IsDifferent(AttributeValue *pAttr) 02101 02102 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02103 Created: 13/03/95 02104 Purpose: See base class version. 02105 Errors: The two attributes are not of the same type. 02106 SeeAlso: AttributeValue::IsDifferent 02107 02108 ********************************************************************************************/ 02109 02110 BOOL TxtScriptAttribute::IsDifferent(AttributeValue *pAttr) 02111 { 02112 // This must be at least a FillGeometryAttribute... 02113 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtScriptAttribute)), 02114 "Different attribute types in TxtScriptAttribute::IsDifferent()"); 02115 02116 // Check they are NOT the same. 02117 return ( !(*((TxtScriptAttribute *)pAttr) == *this) ); 02118 } 02119 02120 /******************************************************************************************** 02121 02122 > BOOL TxtScriptAttribute::Init() 02123 02124 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02125 Created: 13/03/95 02126 Returns: TRUE - initialised ok; FALSE if not. 02127 Purpose: Registers default attribute 02128 Errors: Out of memory. 02129 SeeAlso: AttributeManager 02130 02131 ********************************************************************************************/ 02132 02133 BOOL TxtScriptAttribute::Init() 02134 { 02135 TxtScriptAttribute *pAttr = new TxtScriptAttribute; 02136 if (pAttr==NULL) 02137 // error message has already been set by new 02138 return FALSE; 02139 02140 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 02141 pAttr); 02142 02143 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtScriptAttribute"); 02144 02145 return TRUE; 02146 } 02147 02148 /******************************************************************************************** 02149 02150 > NodeAttribute *TxtScriptAttribute::MakeNode() 02151 02152 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02153 Created: 13/03/95 02154 Returns: Pointer to the new node, or NULL if out of memory. 02155 Purpose: Make a AttrTxtTracking node, see base class 02156 Errors: Out of memory 02157 SeeAlso: AttributeValue::MakeNode 02158 02159 ********************************************************************************************/ 02160 02161 NodeAttribute *TxtScriptAttribute::MakeNode() 02162 { 02163 // Create new attribute node 02164 AttrTxtScript* pAttr = new AttrTxtScript(); 02165 if (pAttr==NULL) 02166 // error message has already been set by new 02167 return NULL; 02168 02169 // Copy attribute value into the new node. 02170 pAttr->Value.SimpleCopy(this); 02171 02172 // Return the new node 02173 return pAttr; 02174 } 02175 02176 02177 // ----------------------------------------------------------------------------------------- 02178 // TxtBaseLineAttribute methods 02179 02180 /******************************************************************************************** 02181 02182 > TxtBaseLineAttribute::TxtBaseLineAttribute() 02183 02184 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02185 Created: 13/03/95 02186 Purpose: Default Constuctor for TxtBaseLineAttribute 02187 The function sets the Tracking value to 0 02188 02189 SeeAlso: 02190 02191 ********************************************************************************************/ 02192 02193 TxtBaseLineAttribute::TxtBaseLineAttribute() 02194 { 02195 Value = 0; 02196 } 02197 02198 02199 /******************************************************************************************** 02200 02201 > TxtBaseLineAttribute::TxtBaseLineAttribute(MILLIPOINT Value) 02202 02203 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02204 Created: 13/3/95 02205 Inputs: Value: The absolute offset from base line 02206 Outputs: - 02207 Returns: - 02208 Purpose: TxtBaseLineAttribute constructor 02209 Errors: - 02210 SeeAlso: - 02211 02212 ********************************************************************************************/ 02213 02214 TxtBaseLineAttribute::TxtBaseLineAttribute(MILLIPOINT value) 02215 { 02216 Value = value; 02217 } 02218 02219 02220 02221 /******************************************************************************************** 02222 02223 > void TxtBaseLineAttribute::Render(RenderRegion *pRegion) 02224 02225 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02226 Created: 13/03/95 02227 Inputs: pRegion - the render region to render this attribute into. 02228 Purpose: Sets the TxtBaseLineAttribute attribute for the given render region. 02229 SeeAlso: - 02230 02231 ********************************************************************************************/ 02232 02233 void TxtBaseLineAttribute::Render(RenderRegion *pRegion, BOOL Temp) 02234 { 02235 pRegion->SetTxtBaseLine(this, Temp); 02236 } 02237 02238 /******************************************************************************************** 02239 02240 > void TxtBaseLineAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 02241 02242 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02243 Created: 13/03/95 02244 Inputs: pRegion - the render region to restore the attribute into. 02245 Temp - TRUE if this is a temporary attribute, FALSE if it is 02246 permanent (e.g. it's in a document tree). 02247 Purpose: Restores the TxtBaseLineAttribute attribute for the given render region. 02248 SeeAlso: - 02249 02250 ********************************************************************************************/ 02251 02252 void TxtBaseLineAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 02253 { 02254 pRegion->RestoreTxtBaseLine(this, Temp); 02255 } 02256 02257 /******************************************************************************************** 02258 02259 > TxtBaseLineAttribute& TxtBaseLineAttribute::operator=(TxtBaseLineAttribute& Attrib) 02260 02261 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02262 Created: 13/03/95 02263 Inputs: Attrib - the attribute to copy 02264 02265 Returns: Usual semantics for equality. 02266 Purpose: Make the Attribute the same as the other. 02267 02268 ********************************************************************************************/ 02269 02270 TxtBaseLineAttribute& TxtBaseLineAttribute::operator=(TxtBaseLineAttribute& Attrib) 02271 { 02272 Value = Attrib.Value; 02273 return *this; 02274 } 02275 02276 /******************************************************************************************** 02277 02278 > INT32 TxtBaseLineAttribute::operator==(const TxtBaseLineAttribute& Attrib) 02279 02280 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 02281 Created: 23/8/94 02282 Inputs: Attrib - the attribute to compare this attribute with 02283 Returns: Usual semantics for equality. 02284 Purpose: Comparison operator. See NodeAttribute::operator== for 02285 a description of why it's required. 02286 SeeAlso: NodeAttribute::operator== 02287 02288 ********************************************************************************************/ 02289 02290 INT32 TxtBaseLineAttribute::operator==(const TxtBaseLineAttribute& Attrib) 02291 { 02292 return (Attrib.Value == Value); 02293 } 02294 02295 /******************************************************************************************** 02296 02297 > void TxtBaseLineAttribute ::SimpleCopy(AttributeValue *pValue) 02298 02299 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02300 Created: 13/03/95 02301 Inputs: pAttr - pointer to the AttributeValue to copy. 02302 Purpose: See AttributeValue::SimpleCopy 02303 02304 ********************************************************************************************/ 02305 02306 void TxtBaseLineAttribute::SimpleCopy(AttributeValue *pValue) 02307 { 02308 ERROR3IF(!IS_A(pValue, TxtBaseLineAttribute), 02309 "Invalid Attribute value passed to TxtBaseLineAttribute::SimpleCopy"); 02310 // We may as well just use our assignment operator. 02311 *this = *((TxtBaseLineAttribute*)pValue); 02312 } 02313 02314 02315 /******************************************************************************************** 02316 02317 > BOOL TxtBaseLineAttribute::IsDifferent(AttributeValue *pAttr) 02318 02319 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02320 Created: 13/03/95 02321 Purpose: See base class version. 02322 Errors: The two attributes are not of the same type. 02323 SeeAlso: AttributeValue::IsDifferent 02324 02325 ********************************************************************************************/ 02326 02327 BOOL TxtBaseLineAttribute::IsDifferent(AttributeValue *pAttr) 02328 { 02329 // This must be at least a FillGeometryAttribute... 02330 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtBaseLineAttribute)), 02331 "Different attribute types in TxtBaseLineAttribute::IsDifferent()"); 02332 02333 // Check they are NOT the same. 02334 return ( !(*((TxtBaseLineAttribute *)pAttr) == *this) ); 02335 } 02336 02337 /******************************************************************************************** 02338 02339 > BOOL TxtBaseLineAttribute::Init() 02340 02341 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02342 Created: 13/03/95 02343 Returns: TRUE - initialised ok; FALSE if not. 02344 Purpose: Registers default attribute 02345 Errors: Out of memory. 02346 SeeAlso: AttributeManager 02347 02348 ********************************************************************************************/ 02349 02350 BOOL TxtBaseLineAttribute::Init() 02351 { 02352 TxtBaseLineAttribute *pAttr = new TxtBaseLineAttribute; 02353 if (pAttr==NULL) 02354 // error message has already been set by new 02355 return FALSE; 02356 02357 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 02358 pAttr); 02359 02360 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtBaseLineAttribute"); 02361 02362 return TRUE; 02363 } 02364 02365 /******************************************************************************************** 02366 02367 > NodeAttribute *TxtBaseLineAttribute::MakeNode() 02368 02369 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02370 Created: 13/03/95 02371 Returns: Pointer to the new node, or NULL if out of memory. 02372 Purpose: Make a AttrTxtTracking node, see base class 02373 Errors: Out of memory 02374 SeeAlso: AttributeValue::MakeNode 02375 02376 ********************************************************************************************/ 02377 02378 NodeAttribute *TxtBaseLineAttribute::MakeNode() 02379 { 02380 // Create new attribute node 02381 AttrTxtBaseLine* pAttr = new AttrTxtBaseLine(); 02382 if (pAttr==NULL) 02383 // error message has already been set by new 02384 return NULL; 02385 02386 // Copy attribute value into the new node. 02387 pAttr->Value.SimpleCopy(this); 02388 02389 // Return the new node 02390 return pAttr; 02391 } 02392 02393 // Tabbing, ruler and margin/indent support 02394 // 02395 // The new LeftMargin, RightMargin, FirstIndent and Ruler attributes follow the 02396 // (rather dubious) pattern of all the other text attributes. 02397 // 02398 // Apart from substituting other class names in the dynamic type tests, the margin 02399 // and indent implementations are just code clones of the BaseLine attribute code. 02400 // 02401 // MW 19-06-2006 02402 02403 // ----------------------------------------------------------------------------------------- 02404 // TxtLeftMarginAttribute methods 02405 02406 /******************************************************************************************** 02407 02408 > TxtLeftMarginAttribute::TxtLeftMarginAttribute() 02409 02410 Author: Martin Wuerthner <xara@mw-software.com> 02411 Created: 19/06/06 02412 Purpose: Default Constuctor for TxtLeftMarginAttribute 02413 02414 ********************************************************************************************/ 02415 02416 TxtLeftMarginAttribute::TxtLeftMarginAttribute() 02417 { 02418 Value = 0; 02419 } 02420 02421 02422 /******************************************************************************************** 02423 02424 > TxtLeftMarginAttribute::TxtLeftMarginAttribute(MILLIPOINT Value) 02425 02426 Author: Martin Wuerthner <xara@mw-software.com> 02427 Created: 19/06/06 02428 Inputs: Value: The left margin in millipoints 02429 Purpose: TxtLeftMarginAttribute constructor 02430 02431 ********************************************************************************************/ 02432 02433 TxtLeftMarginAttribute::TxtLeftMarginAttribute(MILLIPOINT value) 02434 { 02435 Value = value; 02436 } 02437 02438 /******************************************************************************************** 02439 02440 > void TxtLeftMarginAttribute::Render(RenderRegion *pRegion) 02441 02442 Author: Martin Wuerthner <xara@mw-software.com> 02443 Created: 19/06/06 02444 Inputs: pRegion - the render region to render this attribute into. 02445 Purpose: Sets the TxtLeftMarginAttribute attribute for the given render region. 02446 02447 ********************************************************************************************/ 02448 02449 void TxtLeftMarginAttribute::Render(RenderRegion *pRegion, BOOL Temp) 02450 { 02451 pRegion->SetTxtLeftMargin(this, Temp); 02452 } 02453 02454 /******************************************************************************************** 02455 02456 > void TxtLeftMarginAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 02457 02458 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02459 Created: 13/03/95 02460 Inputs: pRegion - the render region to restore the attribute into. 02461 Temp - TRUE if this is a temporary attribute, FALSE if it is 02462 permanent (e.g. it's in a document tree). 02463 Purpose: Restores the TxtLeftMarginAttribute attribute for the given render region. 02464 SeeAlso: - 02465 02466 ********************************************************************************************/ 02467 02468 void TxtLeftMarginAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 02469 { 02470 pRegion->RestoreTxtLeftMargin(this, Temp); 02471 } 02472 02473 /******************************************************************************************** 02474 02475 > TxtLeftMarginAttribute& TxtLeftMarginAttribute::operator=(TxtLeftMarginAttribute& Attrib) 02476 02477 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02478 Created: 13/03/95 02479 Inputs: Attrib - the attribute to copy 02480 02481 Returns: Usual semantics for equality. 02482 Purpose: Make the Attribute the same as the other. 02483 02484 ********************************************************************************************/ 02485 02486 TxtLeftMarginAttribute& TxtLeftMarginAttribute::operator=(TxtLeftMarginAttribute& Attrib) 02487 { 02488 Value = Attrib.Value; 02489 return *this; 02490 } 02491 02492 /******************************************************************************************** 02493 02494 > INT32 TxtLeftMarginAttribute::operator==(const TxtLeftMarginAttribute& Attrib) 02495 02496 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 02497 Created: 23/8/94 02498 Inputs: Attrib - the attribute to compare this attribute with 02499 Returns: Usual semantics for equality. 02500 Purpose: Comparison operator. See NodeAttribute::operator== for 02501 a description of why it's required. 02502 SeeAlso: NodeAttribute::operator== 02503 02504 ********************************************************************************************/ 02505 02506 INT32 TxtLeftMarginAttribute::operator==(const TxtLeftMarginAttribute& Attrib) 02507 { 02508 return (Attrib.Value == Value); 02509 } 02510 02511 /******************************************************************************************** 02512 02513 > void TxtLeftMarginAttribute ::SimpleCopy(AttributeValue *pValue) 02514 02515 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02516 Created: 13/03/95 02517 Inputs: pAttr - pointer to the AttributeValue to copy. 02518 Purpose: See AttributeValue::SimpleCopy 02519 02520 ********************************************************************************************/ 02521 02522 void TxtLeftMarginAttribute::SimpleCopy(AttributeValue *pValue) 02523 { 02524 ERROR3IF(!IS_A(pValue, TxtLeftMarginAttribute), 02525 "Invalid Attribute value passed to TxtLeftMarginAttribute::SimpleCopy"); 02526 // We may as well just use our assignment operator. 02527 *this = *((TxtLeftMarginAttribute*)pValue); 02528 } 02529 02530 02531 /******************************************************************************************** 02532 02533 > BOOL TxtLeftMarginAttribute::IsDifferent(AttributeValue *pAttr) 02534 02535 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02536 Created: 13/03/95 02537 Purpose: See base class version. 02538 Errors: The two attributes are not of the same type. 02539 SeeAlso: AttributeValue::IsDifferent 02540 02541 ********************************************************************************************/ 02542 02543 BOOL TxtLeftMarginAttribute::IsDifferent(AttributeValue *pAttr) 02544 { 02545 // This must be at least a FillGeometryAttribute... 02546 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtLeftMarginAttribute)), 02547 "Different attribute types in TxtLeftMarginAttribute::IsDifferent()"); 02548 02549 // Check they are NOT the same. 02550 return ( !(*((TxtLeftMarginAttribute *)pAttr) == *this) ); 02551 } 02552 02553 /******************************************************************************************** 02554 02555 > BOOL TxtLeftMarginAttribute::Init() 02556 02557 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02558 Created: 13/03/95 02559 Returns: TRUE - initialised ok; FALSE if not. 02560 Purpose: Registers default attribute 02561 Errors: Out of memory. 02562 SeeAlso: AttributeManager 02563 02564 ********************************************************************************************/ 02565 02566 BOOL TxtLeftMarginAttribute::Init() 02567 { 02568 TxtLeftMarginAttribute *pAttr = new TxtLeftMarginAttribute; 02569 if (pAttr==NULL) 02570 // error message has already been set by new 02571 return FALSE; 02572 02573 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 02574 pAttr); 02575 02576 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtLeftMarginAttribute"); 02577 02578 return TRUE; 02579 } 02580 02581 /******************************************************************************************** 02582 02583 > NodeAttribute *TxtLeftMarginAttribute::MakeNode() 02584 02585 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02586 Created: 13/03/95 02587 Returns: Pointer to the new node, or NULL if out of memory. 02588 Purpose: Make a AttrTxtTracking node, see base class 02589 Errors: Out of memory 02590 SeeAlso: AttributeValue::MakeNode 02591 02592 ********************************************************************************************/ 02593 02594 NodeAttribute *TxtLeftMarginAttribute::MakeNode() 02595 { 02596 // Create new attribute node 02597 AttrTxtLeftMargin* pAttr = new AttrTxtLeftMargin(); 02598 if (pAttr==NULL) 02599 // error message has already been set by new 02600 return NULL; 02601 02602 // Copy attribute value into the new node. 02603 pAttr->Value.SimpleCopy(this); 02604 02605 // Return the new node 02606 return pAttr; 02607 } 02608 02609 // ----------------------------------------------------------------------------------------- 02610 // TxtRightMarginAttribute methods 02611 02612 /******************************************************************************************** 02613 02614 > TxtRightMarginAttribute::TxtRightMarginAttribute() 02615 02616 Author: Martin Wuerthner <xara@mw-software.com> 02617 Created: 19/06/06 02618 Purpose: Default Constuctor for TxtLeftMarginAttribute 02619 02620 ********************************************************************************************/ 02621 02622 TxtRightMarginAttribute::TxtRightMarginAttribute() 02623 { 02624 Value = 0; 02625 } 02626 02627 02628 /******************************************************************************************** 02629 02630 > TxtRightMarginAttribute::TxtRightMarginAttribute(MILLIPOINT Value) 02631 02632 Author: Martin Wuerthner <xara@mw-software.com> 02633 Created: 19/06/06 02634 Inputs: Value: The right margin in millipoints 02635 Purpose: TxtRightMarginAttribute constructor 02636 02637 ********************************************************************************************/ 02638 02639 TxtRightMarginAttribute::TxtRightMarginAttribute(MILLIPOINT value) 02640 { 02641 Value = value; 02642 } 02643 02644 /******************************************************************************************** 02645 02646 > void TxtRightMarginAttribute::Render(RenderRegion *pRegion) 02647 02648 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02649 Created: 13/03/95 02650 Inputs: pRegion - the render region to render this attribute into. 02651 Purpose: Sets the TxtRightMarginAttribute attribute for the given render region. 02652 SeeAlso: - 02653 02654 ********************************************************************************************/ 02655 02656 void TxtRightMarginAttribute::Render(RenderRegion *pRegion, BOOL Temp) 02657 { 02658 pRegion->SetTxtRightMargin(this, Temp); 02659 } 02660 02661 /******************************************************************************************** 02662 02663 > void TxtRightMarginAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 02664 02665 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02666 Created: 13/03/95 02667 Inputs: pRegion - the render region to restore the attribute into. 02668 Temp - TRUE if this is a temporary attribute, FALSE if it is 02669 permanent (e.g. it's in a document tree). 02670 Purpose: Restores the TxtRightMarginAttribute attribute for the given render region. 02671 SeeAlso: - 02672 02673 ********************************************************************************************/ 02674 02675 void TxtRightMarginAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 02676 { 02677 pRegion->RestoreTxtRightMargin(this, Temp); 02678 } 02679 02680 /******************************************************************************************** 02681 02682 > TxtRightMarginAttribute& TxtRightMarginAttribute::operator=(TxtRightMarginAttribute& Attrib) 02683 02684 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02685 Created: 13/03/95 02686 Inputs: Attrib - the attribute to copy 02687 02688 Returns: Usual semantics for equality. 02689 Purpose: Make the Attribute the same as the other. 02690 02691 ********************************************************************************************/ 02692 02693 TxtRightMarginAttribute& TxtRightMarginAttribute::operator=(TxtRightMarginAttribute& Attrib) 02694 { 02695 Value = Attrib.Value; 02696 return *this; 02697 } 02698 02699 /******************************************************************************************** 02700 02701 > INT32 TxtRightMarginAttribute::operator==(const TxtRightMarginAttribute& Attrib) 02702 02703 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 02704 Created: 23/8/94 02705 Inputs: Attrib - the attribute to compare this attribute with 02706 Returns: Usual semantics for equality. 02707 Purpose: Comparison operator. See NodeAttribute::operator== for 02708 a description of why it's required. 02709 SeeAlso: NodeAttribute::operator== 02710 02711 ********************************************************************************************/ 02712 02713 INT32 TxtRightMarginAttribute::operator==(const TxtRightMarginAttribute& Attrib) 02714 { 02715 return (Attrib.Value == Value); 02716 } 02717 02718 /******************************************************************************************** 02719 02720 > void TxtRightMarginAttribute ::SimpleCopy(AttributeValue *pValue) 02721 02722 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02723 Created: 13/03/95 02724 Inputs: pAttr - pointer to the AttributeValue to copy. 02725 Purpose: See AttributeValue::SimpleCopy 02726 02727 ********************************************************************************************/ 02728 02729 void TxtRightMarginAttribute::SimpleCopy(AttributeValue *pValue) 02730 { 02731 ERROR3IF(!IS_A(pValue, TxtRightMarginAttribute), 02732 "Invalid Attribute value passed to TxtRightMarginAttribute::SimpleCopy"); 02733 // We may as well just use our assignment operator. 02734 *this = *((TxtRightMarginAttribute*)pValue); 02735 } 02736 02737 02738 /******************************************************************************************** 02739 02740 > BOOL TxtRightMarginAttribute::IsDifferent(AttributeValue *pAttr) 02741 02742 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02743 Created: 13/03/95 02744 Purpose: See base class version. 02745 Errors: The two attributes are not of the same type. 02746 SeeAlso: AttributeValue::IsDifferent 02747 02748 ********************************************************************************************/ 02749 02750 BOOL TxtRightMarginAttribute::IsDifferent(AttributeValue *pAttr) 02751 { 02752 // This must be at least a FillGeometryAttribute... 02753 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtRightMarginAttribute)), 02754 "Different attribute types in TxtRightMarginAttribute::IsDifferent()"); 02755 02756 // Check they are NOT the same. 02757 return ( !(*((TxtRightMarginAttribute *)pAttr) == *this) ); 02758 } 02759 02760 /******************************************************************************************** 02761 02762 > BOOL TxtRightMarginAttribute::Init() 02763 02764 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02765 Created: 13/03/95 02766 Returns: TRUE - initialised ok; FALSE if not. 02767 Purpose: Registers default attribute 02768 Errors: Out of memory. 02769 SeeAlso: AttributeManager 02770 02771 ********************************************************************************************/ 02772 02773 BOOL TxtRightMarginAttribute::Init() 02774 { 02775 TxtRightMarginAttribute *pAttr = new TxtRightMarginAttribute; 02776 if (pAttr==NULL) 02777 // error message has already been set by new 02778 return FALSE; 02779 02780 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 02781 pAttr); 02782 02783 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtRightMarginAttribute"); 02784 02785 return TRUE; 02786 } 02787 02788 /******************************************************************************************** 02789 02790 > NodeAttribute *TxtRightMarginAttribute::MakeNode() 02791 02792 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02793 Created: 13/03/95 02794 Returns: Pointer to the new node, or NULL if out of memory. 02795 Purpose: Make a AttrTxtTracking node, see base class 02796 Errors: Out of memory 02797 SeeAlso: AttributeValue::MakeNode 02798 02799 ********************************************************************************************/ 02800 02801 NodeAttribute *TxtRightMarginAttribute::MakeNode() 02802 { 02803 // Create new attribute node 02804 AttrTxtRightMargin* pAttr = new AttrTxtRightMargin(); 02805 if (pAttr==NULL) 02806 // error message has already been set by new 02807 return NULL; 02808 02809 // Copy attribute value into the new node. 02810 pAttr->Value.SimpleCopy(this); 02811 02812 // Return the new node 02813 return pAttr; 02814 } 02815 02816 // ----------------------------------------------------------------------------------------- 02817 // TxtFirstIndentAttribute methods 02818 02819 /******************************************************************************************** 02820 02821 > TxtFirstIndentAttribute::TxtFirstIndentAttribute() 02822 02823 Author: Martin Wuerthner <xara@mw-software.com> 02824 Created: 19/06/06 02825 Purpose: Default Constuctor for TxtLeftMarginAttribute 02826 02827 ********************************************************************************************/ 02828 02829 TxtFirstIndentAttribute::TxtFirstIndentAttribute() 02830 { 02831 Value = 0; 02832 } 02833 02834 02835 /******************************************************************************************** 02836 02837 > TxtFirstIndentAttribute::TxtFirstIndentAttribute(MILLIPOINT Value) 02838 02839 Author: Martin Wuerthner <xara@mw-software.com> 02840 Created: 19/06/06 02841 Inputs: Value: The first line indent in millipoints 02842 Purpose: TxtFirstIndentAttribute constructor 02843 02844 ********************************************************************************************/ 02845 02846 TxtFirstIndentAttribute::TxtFirstIndentAttribute(MILLIPOINT value) 02847 { 02848 Value = value; 02849 } 02850 02851 /******************************************************************************************** 02852 02853 > void TxtFirstIndentAttribute::Render(RenderRegion *pRegion) 02854 02855 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02856 Created: 13/03/95 02857 Inputs: pRegion - the render region to render this attribute into. 02858 Purpose: Sets the TxtFirstIndentAttribute attribute for the given render region. 02859 SeeAlso: - 02860 02861 ********************************************************************************************/ 02862 02863 void TxtFirstIndentAttribute::Render(RenderRegion *pRegion, BOOL Temp) 02864 { 02865 pRegion->SetTxtFirstIndent(this, Temp); 02866 } 02867 02868 /******************************************************************************************** 02869 02870 > void TxtFirstIndentAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 02871 02872 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02873 Created: 13/03/95 02874 Inputs: pRegion - the render region to restore the attribute into. 02875 Temp - TRUE if this is a temporary attribute, FALSE if it is 02876 permanent (e.g. it's in a document tree). 02877 Purpose: Restores the TxtFirstIndentAttribute attribute for the given render region. 02878 SeeAlso: - 02879 02880 ********************************************************************************************/ 02881 02882 void TxtFirstIndentAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 02883 { 02884 pRegion->RestoreTxtFirstIndent(this, Temp); 02885 } 02886 02887 /******************************************************************************************** 02888 02889 > TxtFirstIndentAttribute& TxtFirstIndentAttribute::operator=(TxtFirstIndentAttribute& Attrib) 02890 02891 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02892 Created: 13/03/95 02893 Inputs: Attrib - the attribute to copy 02894 02895 Returns: Usual semantics for equality. 02896 Purpose: Make the Attribute the same as the other. 02897 02898 ********************************************************************************************/ 02899 02900 TxtFirstIndentAttribute& TxtFirstIndentAttribute::operator=(TxtFirstIndentAttribute& Attrib) 02901 { 02902 Value = Attrib.Value; 02903 return *this; 02904 } 02905 02906 /******************************************************************************************** 02907 02908 > INT32 TxtFirstIndentAttribute::operator==(const TxtFirstIndentAttribute& Attrib) 02909 02910 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 02911 Created: 23/8/94 02912 Inputs: Attrib - the attribute to compare this attribute with 02913 Returns: Usual semantics for equality. 02914 Purpose: Comparison operator. See NodeAttribute::operator== for 02915 a description of why it's required. 02916 SeeAlso: NodeAttribute::operator== 02917 02918 ********************************************************************************************/ 02919 02920 INT32 TxtFirstIndentAttribute::operator==(const TxtFirstIndentAttribute& Attrib) 02921 { 02922 return (Attrib.Value == Value); 02923 } 02924 02925 /******************************************************************************************** 02926 02927 > void TxtFirstIndentAttribute ::SimpleCopy(AttributeValue *pValue) 02928 02929 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02930 Created: 13/03/95 02931 Inputs: pAttr - pointer to the AttributeValue to copy. 02932 Purpose: See AttributeValue::SimpleCopy 02933 02934 ********************************************************************************************/ 02935 02936 void TxtFirstIndentAttribute::SimpleCopy(AttributeValue *pValue) 02937 { 02938 ERROR3IF(!IS_A(pValue, TxtFirstIndentAttribute), 02939 "Invalid Attribute value passed to TxtFirstIndentAttribute::SimpleCopy"); 02940 // We may as well just use our assignment operator. 02941 *this = *((TxtFirstIndentAttribute*)pValue); 02942 } 02943 02944 02945 /******************************************************************************************** 02946 02947 > BOOL TxtFirstIndentAttribute::IsDifferent(AttributeValue *pAttr) 02948 02949 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02950 Created: 13/03/95 02951 Purpose: See base class version. 02952 Errors: The two attributes are not of the same type. 02953 SeeAlso: AttributeValue::IsDifferent 02954 02955 ********************************************************************************************/ 02956 02957 BOOL TxtFirstIndentAttribute::IsDifferent(AttributeValue *pAttr) 02958 { 02959 // This must be at least a FillGeometryAttribute... 02960 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtFirstIndentAttribute)), 02961 "Different attribute types in TxtFirstIndentAttribute::IsDifferent()"); 02962 02963 // Check they are NOT the same. 02964 return ( !(*((TxtFirstIndentAttribute *)pAttr) == *this) ); 02965 } 02966 02967 /******************************************************************************************** 02968 02969 > BOOL TxtFirstIndentAttribute::Init() 02970 02971 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 02972 Created: 13/03/95 02973 Returns: TRUE - initialised ok; FALSE if not. 02974 Purpose: Registers default attribute 02975 Errors: Out of memory. 02976 SeeAlso: AttributeManager 02977 02978 ********************************************************************************************/ 02979 02980 BOOL TxtFirstIndentAttribute::Init() 02981 { 02982 TxtFirstIndentAttribute *pAttr = new TxtFirstIndentAttribute; 02983 if (pAttr==NULL) 02984 // error message has already been set by new 02985 return FALSE; 02986 02987 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 02988 pAttr); 02989 02990 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtFirstIndentAttribute"); 02991 02992 return TRUE; 02993 } 02994 02995 /******************************************************************************************** 02996 02997 > NodeAttribute *TxtFirstIndentAttribute::MakeNode() 02998 02999 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03000 Created: 13/03/95 03001 Returns: Pointer to the new node, or NULL if out of memory. 03002 Purpose: Make a AttrTxtTracking node, see base class 03003 Errors: Out of memory 03004 SeeAlso: AttributeValue::MakeNode 03005 03006 ********************************************************************************************/ 03007 03008 NodeAttribute *TxtFirstIndentAttribute::MakeNode() 03009 { 03010 // Create new attribute node 03011 AttrTxtFirstIndent* pAttr = new AttrTxtFirstIndent(); 03012 if (pAttr==NULL) 03013 // error message has already been set by new 03014 return NULL; 03015 03016 // Copy attribute value into the new node. 03017 pAttr->Value.SimpleCopy(this); 03018 03019 // Return the new node 03020 return pAttr; 03021 } 03022 03023 // ----------------------------------------------------------------------------------------- 03024 // TxtRulerAttribute methods 03025 03026 /******************************************************************************************** 03027 03028 > TxtRulerAttribute::TxtRulerAttribute() 03029 03030 Author: Martin Wuerthner <xara@mw-software.com> 03031 Created: 13/06/06 03032 Purpose: Default Constructor for TxtRulerAttribute 03033 Creates an empty tab stops list. 03034 03035 ********************************************************************************************/ 03036 03037 TxtRulerAttribute::TxtRulerAttribute() 03038 { 03039 Value = new TxtRuler; 03040 } 03041 /******************************************************************************************** 03042 03043 > TxtRulerAttribute::~TxtRulerAttribute() 03044 03045 Author: Martin Wuerthner <xara@mw-software.com> 03046 Created: 13/06/06 03047 Purpose: Destructor 03048 03049 ********************************************************************************************/ 03050 03051 TxtRulerAttribute::~TxtRulerAttribute() 03052 { 03053 delete Value; 03054 } 03055 03056 /******************************************************************************************** 03057 03058 > BOOL TxtRulerAttribute::AddTabStop(TxtTabStop TabStop) 03059 03060 Author: Martin Wuerthner <xara@mw-software.com> 03061 Created: 14/6/06 03062 Inputs: TabStop - a tab stop to be added 03063 Purpose: Adds a new tab stop at the given position to the sorted list, 03064 removing any other tab stop already present at this position. 03065 03066 ********************************************************************************************/ 03067 03068 void TxtRulerAttribute::AddTabStop(TxtTabStop TabStop) 03069 { 03070 MILLIPOINT Position = TabStop.GetPosition(); 03071 TxtTabStopIterator It = begin(); 03072 TxtTabStopIterator End = end(); 03073 while(It != End) 03074 { 03075 if ((*It).GetPosition() > Position) break; 03076 else if ((*It).GetPosition() == Position) 03077 { 03078 // modify this tab directly 03079 (*It) = TabStop; 03080 return; 03081 } 03082 ++It; 03083 } 03084 Value->insert(It, TabStop); 03085 } 03086 03087 03088 /******************************************************************************************** 03089 03090 > BOOL TxtRulerAttribute::AddTabStop(TxtTabType Type, MILLIPOINT Position) 03091 03092 Author: Martin Wuerthner <xara@mw-software.com> 03093 Created: 14/6/06 03094 Inputs: Type, Position - the parameters for the tab stop 03095 Purpose: Adds a new tab stop at the given position to the sorted list, 03096 removing any other tab stop already present at this position. 03097 03098 ********************************************************************************************/ 03099 03100 void TxtRulerAttribute::AddTabStop(TxtTabType Type, MILLIPOINT Position) 03101 { 03102 TxtTabStopIterator It = begin(); 03103 TxtTabStopIterator End = end(); 03104 while(It != End) 03105 { 03106 if ((*It).GetPosition() > Position) break; 03107 else if ((*It).GetPosition() == Position) 03108 { 03109 // modify this tab directly 03110 (*It).SetType(Type); 03111 return; 03112 } 03113 ++It; 03114 } 03115 Value->insert(It, TxtTabStop(Type, Position)); 03116 } 03117 03118 /******************************************************************************************** 03119 03120 > void TxtRulerAttribute::AddTabStop(TxtTabType Type, MILLIPOINT Position, WCHAR DecimalPointChar, WCHAR TabFillerChar) 03121 03122 Author: Martin Wuerthner <xara@mw-software.com> 03123 Created: 14/6/06 03124 Inputs: Type, Position, DecimalPointChar, TabFillerChar - the parameters for the tab stop 03125 Purpose: Adds a new tab stop at the given position to the sorted list, 03126 removing any other tab stop already present at this position. 03127 03128 ********************************************************************************************/ 03129 03130 void TxtRulerAttribute::AddTabStop(TxtTabType Type, MILLIPOINT Position, WCHAR DecimalPointChar, WCHAR TabFillerChar) 03131 { 03132 TxtTabStopIterator It = begin(); 03133 TxtTabStopIterator End = end(); 03134 while(It != End) 03135 { 03136 if ((*It).GetPosition() > Position) break; 03137 else if ((*It).GetPosition() == Position) 03138 { 03139 // modify this tab directly 03140 *It = TxtTabStop(Type, Position, DecimalPointChar, TabFillerChar); 03141 return; 03142 } 03143 ++It; 03144 } 03145 Value->insert(It, TxtTabStop(Type, Position, DecimalPointChar, TabFillerChar)); 03146 } 03147 03148 /******************************************************************************************** 03149 03150 > void TxtRulerAttribute::FindTabStop(MILLIPOINT MinPos, TxtTabType* pType, MILLIPOINT* pPos, 03151 WCHAR* pDecimalPointChar) const 03152 03153 Author: Martin Wuerthner <xara@mw-software.com> 03154 Created: 21/6/06 03155 Inputs: MinPos - minimum position of the tab stop 03156 Outputs: stores the tab stop's type in pType, its position in pPos and its decimal point 03157 character in pDecimalPointChar (if applicable, else undefined) 03158 Purpose: Finds a tab stop at the given position or higher 03159 03160 ********************************************************************************************/ 03161 void TxtRulerAttribute::FindTabStop(MILLIPOINT MinPos, TxtTabType* pType, MILLIPOINT* pPos, 03162 WCHAR* pDecimalPointChar) const 03163 { 03164 FindTabStopInRuler(Value, MinPos, pType, pPos, pDecimalPointChar); 03165 } 03166 03167 /******************************************************************************************** 03168 03169 > void TxtRulerAttribute::FindTabStopInRuler(const TxtRuler* pRuler, MILLIPOINT width, TxtTabType* pType, 03170 MILLIPOINT* pPos, WCHAR *pDecimalPointChar) 03171 03172 Author: Martin Wuerthner <xara@mw-software.com> 03173 Created: 21/6/06 03174 Inputs: pRuler - the ruler list or NULL 03175 MinPos - minimum position of the tab stop 03176 Outputs: stores the tab stop's type in pType, its position in pPos and its decimal point 03177 character in pDecimalPointChar (if applicable, else undefined) 03178 Purpose: Finds a tab stop at the given position or higher 03179 03180 ********************************************************************************************/ 03181 void TxtRulerAttribute::FindTabStopInRuler(const TxtRuler* pRuler, MILLIPOINT MinPos, TxtTabType* pType, 03182 MILLIPOINT* pPos, WCHAR *pDecimalPointChar) 03183 { 03184 // we cope with pRuler being NULL, in which case we simply treat it as empty 03185 if (pRuler) 03186 { 03187 for(const_TxtTabStopIterator It = pRuler->begin() ; It != pRuler->end(); ++It) 03188 { 03189 // NB - we must find a tab stop *beyond* our current position, we cannot 03190 // take the one exactly at our position - otherwise, having a tab 03191 // directly after a tab would not advance to the next tab stop 03192 if ((*It).GetPosition() > MinPos) { 03193 *pType = (*It).GetType(); 03194 *pPos = (*It).GetPosition(); 03195 if ((*It).GetType() == DecimalTab) 03196 *pDecimalPointChar = (*It).GetDecimalPointChar(); 03197 return; 03198 } 03199 } 03200 } 03201 // we did not find any tab stop beyond our position, so assume equidistant left tabs 03202 // at each multiple of 0.5in (this is what OpenOffice does) 03203 *pType = LeftTab; 03204 *pPos = MinPos + 36000 - (MinPos % 36000); 03205 } 03206 03207 /******************************************************************************************** 03208 03209 > void TxtRulerAttribute::Render(RenderRegion *pRegion) 03210 03211 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03212 Created: 13/03/95 03213 Inputs: pRegion - the render region to render this attribute into. 03214 Purpose: Sets the TxtRulerAttribute attribute for the given render region. 03215 03216 ********************************************************************************************/ 03217 03218 void TxtRulerAttribute::Render(RenderRegion *pRegion, BOOL Temp) 03219 { 03220 pRegion->SetTxtRuler(this, Temp); 03221 } 03222 03223 /******************************************************************************************** 03224 03225 > void TxtRulerAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 03226 03227 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03228 Created: 13/03/95 03229 Inputs: pRegion - the render region to restore the attribute into. 03230 Temp - TRUE if this is a temporary attribute, FALSE if it is 03231 permanent (e.g. it's in a document tree). 03232 Purpose: Restores the TxtRulerAttribute attribute for the given render region. 03233 SeeAlso: - 03234 03235 ********************************************************************************************/ 03236 03237 void TxtRulerAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 03238 { 03239 pRegion->RestoreTxtRuler(this, Temp); 03240 } 03241 03242 /******************************************************************************************** 03243 03244 > TxtRulerAttribute& TxtRulerAttribute::operator=(TxtRulerAttribute& Attrib) 03245 03246 Author: Martin Wuerthner <xara@mw-software.com> 03247 Created: 19/06/06 03248 Inputs: Attrib - the attribute to copy 03249 Purpose: Assignment operator 03250 03251 ********************************************************************************************/ 03252 03253 TxtRulerAttribute& TxtRulerAttribute::operator=(TxtRulerAttribute& Attrib) 03254 { 03255 *Value = *Attrib.Value; // use TxtRuler's assignment operator (list template class) 03256 return *this; 03257 } 03258 03259 03260 /******************************************************************************************** 03261 03262 > TxtTabStop::TxtTabStop(TxtTabType TheType, MILLIPOINT ThePosition) 03263 03264 Author: Martin Wuerthner <xara@mw-software.com> 03265 Created: 27/06/06 03266 Inputs: TheType - the type of the tab stop (left, right, centre, decimal) 03267 Position - its position 03268 Purpose: Constructor 03269 03270 ********************************************************************************************/ 03271 03272 TxtTabStop::TxtTabStop(TxtTabType TheType, MILLIPOINT ThePosition): 03273 mType(TheType), mPosition(ThePosition), mTabFillerChar((WCHAR)0) 03274 { 03275 // The decimal point character is initialised by reading the character used in the conversion class 03276 if (TheType == DecimalTab) 03277 mDecimalPointChar = Convert::GetDecimalPointChar(); 03278 else 03279 // not a decimal tab, so set to a well-defined value (to make equality comparisons easier) 03280 mDecimalPointChar = (WCHAR)0; 03281 } 03282 03283 /******************************************************************************************** 03284 03285 > TxtTabStop::TxtTabStop(TxtTabType TheType, MILLIPOINT ThePosition) 03286 03287 Author: Martin Wuerthner <xara@mw-software.com> 03288 Created: 27/06/06 03289 Inputs: Type - the type of the tab stop 03290 Position - its position 03291 DecimalPointChar - the character to align to (in case of a decimal tab) 03292 TabFillerChar - the tab filler character (always 0 at the moment) 03293 Purpose: Alternative constructor (mainly for use by loader code) 03294 03295 ********************************************************************************************/ 03296 03297 TxtTabStop::TxtTabStop(TxtTabType Type, MILLIPOINT ThePosition, WCHAR DecimalPointChar, WCHAR TabFillerChar) 03298 :mType(Type), mPosition(ThePosition), mDecimalPointChar(DecimalPointChar), mTabFillerChar(TabFillerChar) 03299 { 03300 } 03301 03302 /******************************************************************************************** 03303 03304 > void TxtTabStop::SetType(TxtTabType TheType) 03305 03306 Author: Martin Wuerthner <xara@mw-software.com> 03307 Created: 27/06/06 03308 Inputs: TheType - the type of the tab stop (left, right, centre, decimal) 03309 Position - its position 03310 Purpose: Constructor 03311 03312 ********************************************************************************************/ 03313 03314 void TxtTabStop::SetType(TxtTabType TheType) 03315 { 03316 // in addition to setting the type we also update the decimal point char to the 03317 // one valid in the current locale if the type is changed to decimal tab 03318 mType = TheType; 03319 if (TheType == DecimalTab) 03320 mDecimalPointChar = Convert::GetDecimalPointChar(); 03321 else 03322 mDecimalPointChar = (WCHAR)0; 03323 } 03324 03325 /******************************************************************************************** 03326 03327 > BOOL operator==(const TxtTabStop& t1, const TxtTabStop& t2) 03328 03329 Author: Martin Wuerthner <xara@mw-software.com> 03330 Created: 14/6/06 03331 Inputs: t1, t2 - the two tab stops to be compared 03332 Returns: Usual semantics for equality. 03333 Purpose: Comparison operator 03334 03335 ********************************************************************************************/ 03336 03337 BOOL operator==(const TxtTabStop& t1, const TxtTabStop& t2) 03338 { 03339 return t1.GetType() == t2.GetType() && t1.GetPosition() == t2.GetPosition() 03340 && t1.GetDecimalPointChar() == t2.GetDecimalPointChar() 03341 && t1.GetTabFillerChar() == t2.GetTabFillerChar(); 03342 } 03343 03344 /******************************************************************************************** 03345 03346 > BOOL operator!=(const TxtTabStop& t1, const TxtTabStop& t2) 03347 03348 Author: Martin Wuerthner <xara@mw-software.com> 03349 Created: 14/6/06 03350 Inputs: t1, t2 - the two tab stops to be compared 03351 Returns: Usual semantics for inequality. 03352 Purpose: Comparison operator 03353 03354 ********************************************************************************************/ 03355 03356 BOOL operator!=(const TxtTabStop& t1, const TxtTabStop& t2) 03357 { 03358 return !(t1 == t2); 03359 } 03360 03361 /******************************************************************************************** 03362 03363 > INT32 TxtRulerAttribute::operator==(const TxtRulerAttribute& Attrib) 03364 03365 Author: Martin Wuerthner <xara@mw-software.com> 03366 Created: 14/6/06 03367 Inputs: Attrib - the attribute to compare this attribute with 03368 Returns: Usual semantics for equality. 03369 Purpose: Comparison operator. See NodeAttribute::operator== for 03370 a description of why it's required. 03371 SeeAlso: NodeAttribute::operator== 03372 03373 ********************************************************************************************/ 03374 03375 INT32 TxtRulerAttribute::operator==(const TxtRulerAttribute& Attrib) 03376 { 03377 // we simply step through both rulers and return FALSE if we find any mismatches 03378 const_TxtTabStopIterator ThisEnd = end(); 03379 const_TxtTabStopIterator ThatEnd = Attrib.end(); 03380 const_TxtTabStopIterator ThisIt = begin(); 03381 const_TxtTabStopIterator ThatIt = Attrib.begin(); 03382 for (; ThisIt != ThisEnd || ThatIt != ThatEnd; ++ThisIt, ++ThatIt) 03383 { 03384 // at least one of the iterators still points to a valid tab stop 03385 // so, if either is past the end the rulers are different 03386 if (ThisIt == ThisEnd || ThatIt == ThatEnd) return FALSE; 03387 TxtTabStop ThisStop = *ThisIt; 03388 TxtTabStop ThatStop = *ThatIt; 03389 // both iterators valid, so compare the tab stops 03390 if (ThisStop != ThatStop) return FALSE; 03391 } 03392 return TRUE; 03393 } 03394 03395 /******************************************************************************************** 03396 03397 > void TxtRulerAttribute ::SimpleCopy(AttributeValue *pValue) 03398 03399 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03400 Created: 13/03/95 03401 Inputs: pAttr - pointer to the AttributeValue to copy. 03402 Purpose: See AttributeValue::SimpleCopy 03403 03404 ********************************************************************************************/ 03405 03406 void TxtRulerAttribute::SimpleCopy(AttributeValue *pValue) 03407 { 03408 ERROR3IF(!IS_A(pValue, TxtRulerAttribute), 03409 "Invalid Attribute value passed to TxtRulerAttribute::SimpleCopy"); 03410 // We may as well just use our assignment operator. 03411 *this = *((TxtRulerAttribute*)pValue); 03412 } 03413 03414 03415 /******************************************************************************************** 03416 03417 > BOOL TxtRulerAttribute::IsDifferent(AttributeValue *pAttr) 03418 03419 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03420 Created: 13/03/95 03421 Purpose: See base class version. 03422 Errors: The two attributes are not of the same type. 03423 SeeAlso: AttributeValue::IsDifferent 03424 03425 ********************************************************************************************/ 03426 03427 BOOL TxtRulerAttribute::IsDifferent(AttributeValue *pAttr) 03428 { 03429 // This must be at least a FillGeometryAttribute... 03430 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtRulerAttribute)), 03431 "Different attribute types in TxtRulerAttribute::IsDifferent()"); 03432 03433 // Check they are NOT the same. 03434 return ( !(*((TxtRulerAttribute *)pAttr) == *this) ); 03435 } 03436 03437 /******************************************************************************************** 03438 03439 > BOOL TxtRulerAttribute::Init() 03440 03441 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03442 Created: 13/03/95 03443 Returns: TRUE - initialised ok; FALSE if not. 03444 Purpose: Registers default attribute 03445 Errors: Out of memory. 03446 SeeAlso: AttributeManager 03447 03448 ********************************************************************************************/ 03449 03450 BOOL TxtRulerAttribute::Init() 03451 { 03452 TxtRulerAttribute *pAttr = new TxtRulerAttribute; 03453 if (pAttr==NULL) 03454 // error message has already been set by new 03455 return FALSE; 03456 03457 // The default ruler attribute is an empty ruler, so we need not do anything 03458 // here. There are implicit left align tab stops at multiples of 0.5in beyond 03459 // the last user-defined tab stop, so tabs always have an effect. 03460 #if 0 03461 PORTNOTE("text","Just for testing, add a tab stop of each type") 03462 // To test the various tab stop types without requiring a user interface for 03463 // setting tab stops, simply enable this code section 03464 pAttr->AddTabStop(LeftTab, 80000); 03465 pAttr->AddTabStop(CentreTab, 160000); 03466 pAttr->AddTabStop(RightTab, 280000); 03467 pAttr->AddTabStop(DecimalTab, 300000); 03468 #endif 03469 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 03470 pAttr); 03471 03472 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtRulerAttribute"); 03473 03474 return TRUE; 03475 } 03476 03477 /******************************************************************************************** 03478 03479 > NodeAttribute *TxtRulerAttribute::MakeNode() 03480 03481 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03482 Created: 13/03/95 03483 Returns: Pointer to the new node, or NULL if out of memory. 03484 Purpose: Make a AttrTxtTracking node, see base class 03485 Errors: Out of memory 03486 SeeAlso: AttributeValue::MakeNode 03487 03488 ********************************************************************************************/ 03489 03490 NodeAttribute *TxtRulerAttribute::MakeNode() 03491 { 03492 // Create new attribute node 03493 AttrTxtRuler* pAttr = new AttrTxtRuler(); 03494 if (pAttr==NULL) 03495 // error message has already been set by new 03496 return NULL; 03497 03498 // Copy attribute value into the new node. 03499 pAttr->Value.SimpleCopy(this); 03500 03501 // Return the new node 03502 return pAttr; 03503 } 03504 03505 // ----------------------------------------------------------------------------------------- 03506 // TxtLineSpaceAttribute methods 03507 03508 /******************************************************************************************** 03509 03510 > TxtLineSpaceAttribute::TxtLineSpaceAttribute() 03511 03512 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03513 Created: 13/03/95 03514 Purpose: Default Constuctor for TxtLineSpaceAttribute 03515 The function sets the Value to 19.2pt - 120% of 16pt 03516 03517 SeeAlso: 03518 03519 ********************************************************************************************/ 03520 03521 TxtLineSpaceAttribute::TxtLineSpaceAttribute() 03522 { 03523 IsRatio = TRUE; 03524 Value = 0; 03525 Ratio = FIXED16(1.0); 03526 } 03527 03528 03529 /******************************************************************************************** 03530 03531 > TxtLineSpaceAttribute::TxtLineSpaceAttribute(MILLIPOINT Value) 03532 03533 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03534 Created: 13/3/95 03535 Inputs: Value: The tracking value 03536 Outputs: - 03537 Returns: - 03538 Purpose: TxtLineSpaceAttribute constructor 03539 Errors: - 03540 SeeAlso: - 03541 03542 ********************************************************************************************/ 03543 03544 TxtLineSpaceAttribute::TxtLineSpaceAttribute(MILLIPOINT value) 03545 { 03546 IsRatio = FALSE; 03547 Value = value; 03548 Ratio = FIXED16(0); 03549 } 03550 03551 /******************************************************************************************** 03552 03553 > TxtLineSpaceAttribute::TxtLineSpaceAttribute(FIXED16 Ratio) 03554 03555 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03556 Created: 13/3/95 03557 Inputs: Ratio: The line space ratio 03558 Outputs: - 03559 Returns: - 03560 Purpose: TxtLineSpaceAttribute constructor 03561 Errors: - 03562 SeeAlso: - 03563 03564 ********************************************************************************************/ 03565 03566 TxtLineSpaceAttribute::TxtLineSpaceAttribute(FIXED16 ratio) 03567 { 03568 IsRatio = TRUE; 03569 Ratio = ratio; 03570 Value = 0; 03571 } 03572 03573 /******************************************************************************************** 03574 03575 > TxtLineSpaceAttribute::IsARatio() 03576 03577 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03578 Created: 13/3/95 03579 Inputs: Ratio: The line space ratio 03580 Outputs: - 03581 Returns: TRUE if the line space is a ratio value 03582 Purpose: TxtLineSpaceAttribute constructor 03583 Errors: - 03584 SeeAlso: - 03585 03586 ********************************************************************************************/ 03587 03588 BOOL TxtLineSpaceAttribute::IsARatio()const 03589 { 03590 return (IsRatio); 03591 } 03592 03593 03594 03595 /******************************************************************************************** 03596 03597 > void TxtLineSpaceAttribute::Render(RenderRegion *pRegion) 03598 03599 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03600 Created: 13/03/95 03601 Inputs: pRegion - the render region to render this attribute into. 03602 Purpose: Sets the TxtLineSpaceAttribute attribute for the given render region. 03603 SeeAlso: - 03604 03605 ********************************************************************************************/ 03606 03607 void TxtLineSpaceAttribute::Render(RenderRegion *pRegion, BOOL Temp) 03608 { 03609 pRegion->SetTxtLineSpace(this, Temp); 03610 } 03611 03612 /******************************************************************************************** 03613 03614 > void TxtLineSpaceAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 03615 03616 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03617 Created: 13/03/95 03618 Inputs: pRegion - the render region to restore the attribute into. 03619 Temp - TRUE if this is a temporary attribute, FALSE if it is 03620 permanent (e.g. it's in a document tree). 03621 Purpose: Restores the TxtLineSpaceAttribute attribute for the given render region. 03622 SeeAlso: - 03623 03624 ********************************************************************************************/ 03625 03626 void TxtLineSpaceAttribute::Restore(RenderRegion *pRegion, BOOL Temp) 03627 { 03628 pRegion->RestoreTxtLineSpace(this, Temp); 03629 } 03630 03631 /******************************************************************************************** 03632 03633 > TxtLineSpaceAttribute& TxtLineSpaceAttribute::operator=(TxtLineSpaceAttribute& Attrib) 03634 03635 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03636 Created: 13/03/95 03637 Inputs: Attrib - the attribute to copy 03638 03639 Returns: Usual semantics for equality. 03640 Purpose: Make the Attribute the same as the other. 03641 03642 ********************************************************************************************/ 03643 03644 TxtLineSpaceAttribute& TxtLineSpaceAttribute::operator=(TxtLineSpaceAttribute& Attrib) 03645 { 03646 Value = Attrib.Value; 03647 Ratio = Attrib.Ratio; 03648 IsRatio = Attrib.IsARatio(); 03649 return *this; 03650 } 03651 03652 /******************************************************************************************** 03653 03654 > INT32 TxtLineSpaceAttribute::operator==(const TxtLineSpaceAttribute& Attrib) 03655 03656 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 03657 Created: 23/8/94 03658 Inputs: Attrib - the attribute to compare this attribute with 03659 Returns: Usual semantics for equality. 03660 Purpose: Comparison operator. See NodeAttribute::operator== for 03661 a description of why it's required. 03662 SeeAlso: NodeAttribute::operator== 03663 03664 ********************************************************************************************/ 03665 03666 INT32 TxtLineSpaceAttribute::operator==(const TxtLineSpaceAttribute& Attrib) 03667 { 03668 if (Attrib.IsARatio() == IsARatio()) 03669 { 03670 if (IsRatio) 03671 { 03672 return (Attrib.Ratio == Ratio); 03673 } 03674 else 03675 { 03676 return (Attrib.Value == Value); 03677 } 03678 } 03679 else return FALSE; 03680 } 03681 03682 /******************************************************************************************** 03683 03684 > void TxtLineSpaceAttribute ::SimpleCopy(AttributeValue *pValue) 03685 03686 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03687 Created: 13/03/95 03688 Inputs: pAttr - pointer to the AttributeValue to copy. 03689 Purpose: See AttributeValue::SimpleCopy 03690 03691 ********************************************************************************************/ 03692 03693 void TxtLineSpaceAttribute::SimpleCopy(AttributeValue *pValue) 03694 { 03695 ERROR3IF(!IS_A(pValue, TxtLineSpaceAttribute), 03696 "Invalid Attribute value passed to TxtLineSpaceAttribute::SimpleCopy"); 03697 // We may as well just use our assignment operator. 03698 *this = *((TxtLineSpaceAttribute*)pValue); 03699 } 03700 03701 03702 /******************************************************************************************** 03703 03704 > BOOL TxtLineSpaceAttribute::IsDifferent(AttributeValue *pAttr) 03705 03706 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03707 Created: 13/03/95 03708 Purpose: See base class version. 03709 Errors: The two attributes are not of the same type. 03710 SeeAlso: AttributeValue::IsDifferent 03711 03712 ********************************************************************************************/ 03713 03714 BOOL TxtLineSpaceAttribute::IsDifferent(AttributeValue *pAttr) 03715 { 03716 // This must be at least a FillGeometryAttribute... 03717 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(TxtLineSpaceAttribute)), 03718 "Different attribute types in TxtLineSpaceAttribute::IsDifferent()"); 03719 03720 // Check they are NOT the same. 03721 return ( !(*((TxtLineSpaceAttribute *)pAttr) == *this) ); 03722 } 03723 03724 /******************************************************************************************** 03725 03726 > BOOL TxtLineSpaceAttribute::Init() 03727 03728 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03729 Created: 13/03/95 03730 Returns: TRUE - initialised ok; FALSE if not. 03731 Purpose: Registers default attribute 03732 Errors: Out of memory. 03733 SeeAlso: AttributeManager 03734 03735 ********************************************************************************************/ 03736 03737 BOOL TxtLineSpaceAttribute::Init() 03738 { 03739 TxtLineSpaceAttribute *pAttr = new TxtLineSpaceAttribute; 03740 if (pAttr==NULL) 03741 // error message has already been set by new 03742 return FALSE; 03743 03744 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(BaseTextClass), 03745 pAttr); 03746 03747 ERROR2IF(ID == ATTR_BAD_ID, FALSE, "Bad ID when Initialising TxtLineSpaceAttribute"); 03748 03749 return TRUE; 03750 } 03751 03752 /******************************************************************************************** 03753 03754 > NodeAttribute *TxtLineSpaceAttribute::MakeNode() 03755 03756 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03757 Created: 13/03/95 03758 Returns: Pointer to the new node, or NULL if out of memory. 03759 Purpose: Make a AttrTxtTracking node, see base class 03760 Errors: Out of memory 03761 SeeAlso: AttributeValue::MakeNode 03762 03763 ********************************************************************************************/ 03764 03765 NodeAttribute *TxtLineSpaceAttribute::MakeNode() 03766 { 03767 // Create new attribute node 03768 AttrTxtLineSpace* pAttr = new AttrTxtLineSpace(); 03769 if (pAttr==NULL) 03770 // error message has already been set by new 03771 return NULL; 03772 03773 // Copy attribute value into the new node. 03774 pAttr->Value.SimpleCopy(this); 03775 03776 // Return the new node 03777 return pAttr; 03778 } 03779 03780 03781 03782 // ----------------------------------------------------------------------------------------- 03783 // Node Attributes 03784 // ----------------------------------------------------------------------------------------- 03785 03786 // ----------------------------------------------------------------------------------------- 03787 // AttrTxtFontTypeface methods 03788 03789 /******************************************************************************************** 03790 03791 > AttrTxtFontTypeface::AttrTxtFontTypeface(Node* ContextNode, 03792 AttachNodeDirection Direction, 03793 BOOL Locked, 03794 BOOL Mangled, 03795 BOOL Marked, 03796 BOOL Selected 03797 ): AttrTxtBase(ContextNode, Direction, Locked, 03798 Mangled, Marked, Selected, TRUE) 03799 03800 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03801 Created: 13/03/95 03802 Inputs: - 03803 Outputs: - 03804 Returns: - 03805 Purpose: Creates a AttrTxtFontTypeface Attribute 03806 Errors: - 03807 SeeAlso: - 03808 03809 ********************************************************************************************/ 03810 03811 AttrTxtFontTypeface::AttrTxtFontTypeface(Node* ContextNode, 03812 AttachNodeDirection Direction, 03813 BOOL Locked, 03814 BOOL Mangled, 03815 BOOL Marked, 03816 BOOL Selected 03817 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 03818 { 03819 } 03820 03821 /******************************************************************************************** 03822 03823 > AttrTxtFontTypeface::AttrTxtFontTypeface() 03824 03825 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03826 Created: 13/03/95 03827 Inputs: - 03828 Outputs: - 03829 Returns: - 03830 Purpose: Default constructor for AttrTxtFontTypeface class 03831 Errors: - 03832 SeeAlso: - 03833 03834 ********************************************************************************************/ 03835 03836 AttrTxtFontTypeface::AttrTxtFontTypeface() 03837 { 03838 } 03839 03840 03841 /******************************************************************************************** 03842 03843 > void AttrTxtFontTypeface::Render( RenderRegion* pRender) 03844 03845 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03846 Created: 13/03/95 03847 Inputs: - 03848 Outputs: - 03849 Returns: - 03850 Purpose: 'Renders' a Line Width attribute. 03851 Errors: - 03852 SeeAlso: - 03853 03854 ********************************************************************************************/ 03855 03856 void AttrTxtFontTypeface::Render( RenderRegion* pRegion) 03857 { 03858 pRegion->SetTxtFontTypeface(&Value, FALSE); 03859 } 03860 03861 03862 03863 /*********************************************************************************************** 03864 > Node* AttrTxtFontTypeface::SimpleCopy() 03865 03866 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03867 Created: 13/03/95 03868 03869 Inputs: - 03870 Outputs: 03871 Returns: A copy of the node, or NULL if memory runs out 03872 03873 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 03874 The function is virtual, and must be defined for all derived classes. 03875 03876 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 03877 error and the function returns NULL. 03878 03879 Scope: protected 03880 ***********************************************************************************************/ 03881 03882 Node* AttrTxtFontTypeface::SimpleCopy() 03883 { 03884 AttrTxtFontTypeface* NodeCopy = new AttrTxtFontTypeface(); 03885 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 03886 CopyNodeContents(NodeCopy); 03887 return NodeCopy; 03888 } 03889 03890 /******************************************************************************************** 03891 03892 > INT32 AttrTxtFontTypeface::operator==(const NodeAttribute& Attrib) 03893 03894 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03895 Created: 13/03/95 03896 Inputs: Atrib: The attribute to compare, which must be an AttrTxtFontTypeface 03897 Outputs: - 03898 Returns: - 03899 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 03900 a description of why it's required. 03901 03902 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtFontTypeface 03903 runtime class. 03904 03905 SeeAlso: NodeAttribute::operator== 03906 03907 ********************************************************************************************/ 03908 03909 INT32 AttrTxtFontTypeface::operator==(const NodeAttribute& Attrib) 03910 { 03911 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtFontTypeface)), 03912 "Trying to compare two objects with different types"); 03913 AttrTxtFontTypeface* Attr = (AttrTxtFontTypeface*) &Attrib; 03914 return (Attr->Value.HTypeface == Value.HTypeface && 03915 Attr->Value.IsBold == Value.IsBold && 03916 Attr->Value.IsItalic == Value.IsItalic ); 03917 } 03918 03919 03920 /******************************************************************************************** 03921 03922 > virtual UINT32 AttrTxtFontTypeface::GetAttrNameID(void) 03923 03924 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03925 Created: 22/2/94 03926 Inputs: - 03927 Outputs: - 03928 Returns: Attribute description ID 03929 Purpose: Returns back a string resource ID describing the attribute 03930 03931 Errors: - 03932 SeeAlso: - 03933 03934 ********************************************************************************************/ 03935 03936 UINT32 AttrTxtFontTypeface::GetAttrNameID(void) 03937 { 03938 return (_R(IDS_FONTTYPEFACE)); 03939 } 03940 03941 03942 /*********************************************************************************************** 03943 > ` void AttrTxtFontTypeface::CopyNodeContents( AttrTxtFontTypeface* NodeCopy) 03944 03945 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 03946 Created: 28/4/93 03947 03948 Inputs: 03949 Outputs: A copy of this node 03950 Returns: - 03951 03952 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 03953 03954 Errors: An assertion failure will occur if NodeCopy is NULL 03955 03956 Scope: protected 03957 03958 ***********************************************************************************************/ 03959 03960 void AttrTxtFontTypeface::CopyNodeContents( AttrTxtFontTypeface* NodeCopy) 03961 { 03962 // Let the base class do its bit 03963 AttrTxtBase::CopyNodeContents( NodeCopy ); 03964 03965 //Copy contents specific to derived class here 03966 NodeCopy->Value.HTypeface = Value.HTypeface; 03967 NodeCopy->Value.IsBold = Value.IsBold; 03968 NodeCopy->Value.IsItalic = Value.IsItalic; 03969 } 03970 03971 03972 /*********************************************************************************************** 03973 > void AttrTxtFontTypeface::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 03974 03975 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 03976 Created: 18/12/2003 03977 Outputs: - 03978 Purpose: Polymorphically copies the contents of this node to another 03979 Errors: An assertion failure will occur if NodeCopy is NULL 03980 Scope: protected 03981 03982 ***********************************************************************************************/ 03983 03984 void AttrTxtFontTypeface::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 03985 { 03986 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 03987 ENSURE(IS_A(pNodeCopy, AttrTxtFontTypeface), "PolyCopyNodeContents given wrong dest node type"); 03988 03989 if (IS_A(pNodeCopy, AttrTxtFontTypeface)) 03990 CopyNodeContents((AttrTxtFontTypeface*)pNodeCopy); 03991 } 03992 03993 03994 03995 /******************************************************************************************** 03996 03997 > virtual UINT32 AttrTxtFontTypeface::GetNodeSize() const 03998 03999 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04000 Created: 6/10/93 04001 Inputs: - 04002 Outputs: - 04003 Returns: The size of the node in bytes 04004 Purpose: For finding the size of the node 04005 04006 SeeAlso: Node::GetSubtreeSize 04007 04008 ********************************************************************************************/ 04009 04010 UINT32 AttrTxtFontTypeface::GetNodeSize() const 04011 { 04012 return (sizeof(AttrTxtFontTypeface)); 04013 } 04014 04015 04016 /******************************************************************************************** 04017 04018 > virtual void AttrTxtFontTypeface::GetDebugDetails() 04019 04020 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 04021 Created: 24/04/94 04022 Inputs: - 04023 Purpose: Used for debugging purposes during developement. Override in your own class 04024 and output suitable debugging details. 04025 04026 ********************************************************************************************/ 04027 04028 void AttrTxtFontTypeface::GetDebugDetails(StringBase* Str) 04029 { 04030 NodeAttribute::GetDebugDetails( Str ); 04031 String_64 FontName; 04032 if (FONTMANAGER->GetFontName(Value.HTypeface, FontName)) 04033 { 04034 FontClass Class = FONTMANAGER->GetFontClass(Value.HTypeface); 04035 04036 TCHAR buf[255]; 04037 04038 camSnprintf( buf, 255, _T("\r\nFontName = %s\r\n"), (TCHAR*)(FontName) ); 04039 (*Str) += buf; 04040 04041 camSnprintf( buf, 256, _T("\r\nFont Handle = %ld\r\n"), Value.HTypeface ); 04042 (*Str) += buf; 04043 04044 switch (Class) 04045 { 04046 case FC_ATM: 04047 camSnprintf( buf, 255, _T("Type = ATM Type1\r\n") ); 04048 break; 04049 case FC_TRUETYPE: 04050 camSnprintf( buf, 255, _T("Type = TrueType\r\n") ); 04051 break; 04052 default: 04053 camSnprintf( buf, 255, _T("Type = Unknown\r\n") ); 04054 break; 04055 } 04056 04057 (*Str) += buf; 04058 camSnprintf( buf, 255, _T("Bold = %s\r\n"), Value.IsBold ? _T("TRUE"):_T("FALSE")); 04059 (*Str) += buf; 04060 camSnprintf( buf, 255, _T("Italic = %s\r\n"), Value.IsItalic ? _T("TRUE"):_T("FALSE")); 04061 (*Str) += buf; 04062 camSnprintf( buf, 255, _T("Replaced = %s\r\n"), FONTMANAGER->IsFontReplaced(&FontName, Class) ? _T("TRUE"):_T("FALSE")); 04063 (*Str) += buf; 04064 } 04065 } 04066 04067 /******************************************************************************************** 04068 04069 > BOOL AttrTxtFontTypeface::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 04070 BOOL AttrTxtFontTypeface::WritePreChildrenNative(BaseCamelotFilter* pFilter); 04071 04072 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 04073 Created: 09/07/96 04074 Inputs: pFilter - new camelot filter to save to 04075 Returns: TRUE if successful, FALSE otherwise 04076 Purpose: Saves the text font typeface attribute to the new file format filter 04077 04078 ********************************************************************************************/ 04079 04080 BOOL AttrTxtFontTypeface::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 04081 { 04082 #ifdef DO_EXPORT 04083 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 04084 04085 return CXaraFileTxtFontTypeface::WritePreChildrenWeb(pFilter, this); 04086 #else 04087 return FALSE; 04088 #endif 04089 } 04090 04091 BOOL AttrTxtFontTypeface::WritePreChildrenNative(BaseCamelotFilter *pFilter) 04092 { 04093 #ifdef DO_EXPORT 04094 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 04095 04096 return CXaraFileTxtFontTypeface::WritePreChildrenNative(pFilter, this); 04097 #else 04098 return FALSE; 04099 #endif 04100 } 04101 04102 // ----------------------------------------------------------------------------------------- 04103 // AttrTxtBold methods 04104 04105 /******************************************************************************************** 04106 04107 > AttrTxtBold::AttrTxtBold(Node* ContextNode, 04108 AttachNodeDirection Direction, 04109 BOOL Locked, 04110 BOOL Mangled, 04111 BOOL Marked, 04112 BOOL Selected 04113 ): AttrTxtBase(ContextNode, Direction, Locked, 04114 Mangled, Marked, Selected, TRUE) 04115 04116 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04117 Created: 13/03/95 04118 Inputs: - 04119 Outputs: - 04120 Returns: - 04121 Purpose: Creates a AttrTxtBold Attribute 04122 Errors: - 04123 SeeAlso: - 04124 04125 ********************************************************************************************/ 04126 04127 AttrTxtBold::AttrTxtBold(Node* ContextNode, 04128 AttachNodeDirection Direction, 04129 BOOL Locked, 04130 BOOL Mangled, 04131 BOOL Marked, 04132 BOOL Selected 04133 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 04134 { 04135 } 04136 04137 /******************************************************************************************** 04138 04139 > AttrTxtBold::AttrTxtBold() 04140 04141 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04142 Created: 13/03/95 04143 Inputs: - 04144 Outputs: - 04145 Returns: - 04146 Purpose: Default constructor for AttrTxtBold class 04147 Errors: - 04148 SeeAlso: - 04149 04150 ********************************************************************************************/ 04151 04152 AttrTxtBold::AttrTxtBold() 04153 { 04154 } 04155 04156 04157 /******************************************************************************************** 04158 04159 > void AttrTxtBold::Render( RenderRegion* pRender) 04160 04161 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04162 Created: 13/03/95 04163 Inputs: - 04164 Outputs: - 04165 Returns: - 04166 Purpose: 'Renders' a Line Width attribute. 04167 Errors: - 04168 SeeAlso: - 04169 04170 ********************************************************************************************/ 04171 04172 void AttrTxtBold::Render( RenderRegion* pRegion) 04173 { 04174 pRegion->SetTxtBold(&Value, FALSE); 04175 } 04176 04177 04178 04179 /*********************************************************************************************** 04180 > Node* AttrTxtBold::SimpleCopy() 04181 04182 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04183 Created: 13/03/95 04184 04185 Inputs: - 04186 Outputs: 04187 Returns: A copy of the node, or NULL if memory runs out 04188 04189 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 04190 The function is virtual, and must be defined for all derived classes. 04191 04192 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 04193 error and the function returns NULL. 04194 04195 Scope: protected 04196 ***********************************************************************************************/ 04197 04198 Node* AttrTxtBold::SimpleCopy() 04199 { 04200 AttrTxtBold* NodeCopy = new AttrTxtBold(); 04201 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 04202 CopyNodeContents(NodeCopy); 04203 return NodeCopy; 04204 } 04205 04206 /******************************************************************************************** 04207 04208 > INT32 AttrTxtBold::operator==(const NodeAttribute& Attrib) 04209 04210 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04211 Created: 13/03/95 04212 Inputs: Atrib: The attribute to compare, which must be an AttrTxtBold 04213 Outputs: - 04214 Returns: - 04215 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 04216 a description of why it's required. 04217 04218 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtBold 04219 runtime class. 04220 04221 SeeAlso: NodeAttribute::operator== 04222 04223 ********************************************************************************************/ 04224 04225 INT32 AttrTxtBold::operator==(const NodeAttribute& Attrib) 04226 { 04227 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtBold)), 04228 "Trying to compare two objects with different types"); 04229 AttrTxtBold* Attr = (AttrTxtBold*) &Attrib; 04230 return (Attr->Value.BoldOn == Value.BoldOn); 04231 } 04232 04233 04234 /******************************************************************************************** 04235 04236 > virtual UINT32 AttrTxtBold::GetAttrNameID(void) 04237 04238 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04239 Created: 22/2/94 04240 Inputs: - 04241 Outputs: - 04242 Returns: Attribute description ID 04243 Purpose: Returns back a string resource ID describing the attribute 04244 04245 Errors: - 04246 SeeAlso: - 04247 04248 ********************************************************************************************/ 04249 04250 UINT32 AttrTxtBold::GetAttrNameID(void) 04251 { 04252 return (_R(IDS_BOLD)); 04253 } 04254 04255 04256 /*********************************************************************************************** 04257 > ` void AttrTxtBold::CopyNodeContents( AttrTxtBold* NodeCopy) 04258 04259 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04260 Created: 28/4/93 04261 04262 Inputs: 04263 Outputs: A copy of this node 04264 Returns: - 04265 04266 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 04267 04268 Errors: An assertion failure will occur if NodeCopy is NULL 04269 04270 Scope: protected 04271 04272 ***********************************************************************************************/ 04273 04274 void AttrTxtBold::CopyNodeContents( AttrTxtBold* NodeCopy) 04275 { 04276 // Let the base class do its bit 04277 NodeAttribute::CopyNodeContents( NodeCopy ); 04278 04279 //Copy contents specific to derived class here 04280 NodeCopy->Value.BoldOn = Value.BoldOn; 04281 } 04282 04283 04284 /*********************************************************************************************** 04285 > void AttrTxtBold::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 04286 04287 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 04288 Created: 18/12/2003 04289 Outputs: - 04290 Purpose: Polymorphically copies the contents of this node to another 04291 Errors: An assertion failure will occur if NodeCopy is NULL 04292 Scope: protected 04293 04294 ***********************************************************************************************/ 04295 04296 void AttrTxtBold::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 04297 { 04298 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 04299 ENSURE(IS_A(pNodeCopy, AttrTxtBold), "PolyCopyNodeContents given wrong dest node type"); 04300 04301 if (IS_A(pNodeCopy, AttrTxtBold)) 04302 CopyNodeContents((AttrTxtBold*)pNodeCopy); 04303 } 04304 04305 04306 04307 /******************************************************************************************** 04308 04309 > virtual UINT32 AttrTxtBold::GetNodeSize() const 04310 04311 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04312 Created: 6/10/93 04313 Inputs: - 04314 Outputs: - 04315 Returns: The size of the node in bytes 04316 Purpose: For finding the size of the node 04317 04318 SeeAlso: Node::GetSubtreeSize 04319 04320 ********************************************************************************************/ 04321 04322 UINT32 AttrTxtBold::GetNodeSize() const 04323 { 04324 return (sizeof(AttrTxtBold)); 04325 } 04326 04327 04328 /******************************************************************************************** 04329 04330 > virtual void AttrTxtBold::GetDebugDetails() 04331 04332 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 04333 Created: 24/04/94 04334 Inputs: - 04335 Purpose: Used for debugging purposes during developement. Override in your own class 04336 and output suitable debugging details. 04337 04338 ********************************************************************************************/ 04339 04340 void AttrTxtBold::GetDebugDetails(StringBase* Str) 04341 { 04342 NodeAttribute::GetDebugDetails( Str ); 04343 04344 String_256 TempStr; 04345 TCHAR* p; 04346 04347 (Value.BoldOn) ? (p = _T("TRUE")) : (p = _T("FALSE")); 04348 TempStr._MakeMsg( TEXT("\r\nBold=#1%s\r\n"), p); 04349 (*Str) += TempStr; 04350 } 04351 04352 /******************************************************************************************** 04353 04354 > BOOL AttrTxtBold::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 04355 BOOL AttrTxtBold::WritePreChildrenNative(BaseCamelotFilter* pFilter); 04356 04357 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 04358 Created: 09/07/96 04359 Inputs: pFilter - new camelot filter to save to 04360 Returns: TRUE if successful, FALSE otherwise 04361 Purpose: Saves the text bold attribute to the new file format filter 04362 04363 ********************************************************************************************/ 04364 04365 BOOL AttrTxtBold::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 04366 { 04367 #ifdef DO_EXPORT 04368 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 04369 04370 return CXaraFileTxtBold::WritePreChildrenWeb(pFilter, this); 04371 #else 04372 return FALSE; 04373 #endif 04374 } 04375 04376 BOOL AttrTxtBold::WritePreChildrenNative(BaseCamelotFilter *pFilter) 04377 { 04378 #ifdef DO_EXPORT 04379 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 04380 04381 return CXaraFileTxtBold::WritePreChildrenNative(pFilter, this); 04382 #else 04383 return FALSE; 04384 #endif 04385 } 04386 04387 // ----------------------------------------------------------------------------------------- 04388 // AttrTxtItalic methods 04389 04390 /******************************************************************************************** 04391 04392 > AttrTxtItalic::AttrTxtItalic(Node* ContextNode, 04393 AttachNodeDirection Direction, 04394 BOOL Locked, 04395 BOOL Mangled, 04396 BOOL Marked, 04397 BOOL Selected 04398 ): AttrTxtBase(ContextNode, Direction, Locked, 04399 Mangled, Marked, Selected, TRUE) 04400 04401 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04402 Created: 13/03/95 04403 Inputs: - 04404 Outputs: - 04405 Returns: - 04406 Purpose: Creates a AttrTxtItalic Attribute 04407 Errors: - 04408 SeeAlso: - 04409 04410 ********************************************************************************************/ 04411 04412 AttrTxtItalic::AttrTxtItalic(Node* ContextNode, 04413 AttachNodeDirection Direction, 04414 BOOL Locked, 04415 BOOL Mangled, 04416 BOOL Marked, 04417 BOOL Selected 04418 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 04419 { 04420 } 04421 04422 /******************************************************************************************** 04423 04424 > AttrTxtItalic::AttrTxtItalic() 04425 04426 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04427 Created: 13/03/95 04428 Inputs: - 04429 Outputs: - 04430 Returns: - 04431 Purpose: Default constructor for AttrTxtItalic class 04432 Errors: - 04433 SeeAlso: - 04434 04435 ********************************************************************************************/ 04436 04437 AttrTxtItalic::AttrTxtItalic() 04438 { 04439 } 04440 04441 04442 /******************************************************************************************** 04443 04444 > void AttrTxtItalic::Render( RenderRegion* pRender) 04445 04446 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04447 Created: 13/03/95 04448 Inputs: - 04449 Outputs: - 04450 Returns: - 04451 Purpose: 'Renders' a Line Width attribute. 04452 Errors: - 04453 SeeAlso: - 04454 04455 ********************************************************************************************/ 04456 04457 void AttrTxtItalic::Render( RenderRegion* pRegion) 04458 { 04459 pRegion->SetTxtItalic(&Value, FALSE); 04460 } 04461 04462 04463 04464 /*********************************************************************************************** 04465 > Node* AttrTxtItalic::SimpleCopy() 04466 04467 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04468 Created: 13/03/95 04469 04470 Inputs: - 04471 Outputs: 04472 Returns: A copy of the node, or NULL if memory runs out 04473 04474 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 04475 The function is virtual, and must be defined for all derived classes. 04476 04477 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 04478 error and the function returns NULL. 04479 04480 Scope: protected 04481 ***********************************************************************************************/ 04482 04483 Node* AttrTxtItalic::SimpleCopy() 04484 { 04485 AttrTxtItalic* NodeCopy = new AttrTxtItalic(); 04486 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 04487 CopyNodeContents(NodeCopy); 04488 return NodeCopy; 04489 } 04490 04491 /******************************************************************************************** 04492 04493 > INT32 AttrTxtItalic::operator==(const NodeAttribute& Attrib) 04494 04495 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04496 Created: 13/03/95 04497 Inputs: Atrib: The attribute to compare, which must be an AttrLineWidth 04498 Outputs: - 04499 Returns: - 04500 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 04501 a description of why it's required. 04502 04503 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtItalic 04504 runtime class. 04505 04506 SeeAlso: NodeAttribute::operator== 04507 04508 ********************************************************************************************/ 04509 04510 INT32 AttrTxtItalic::operator==(const NodeAttribute& Attrib) 04511 { 04512 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtItalic)), 04513 "Trying to compare two objects with different types"); 04514 AttrTxtItalic* Attr = (AttrTxtItalic*) &Attrib; 04515 return (Attr->Value.ItalicOn == Value.ItalicOn); 04516 } 04517 04518 04519 /******************************************************************************************** 04520 04521 > virtual UINT32 AttrTxtItalic::GetAttrNameID(void) 04522 04523 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04524 Created: 22/2/94 04525 Inputs: - 04526 Outputs: - 04527 Returns: Attribute description ID 04528 Purpose: Returns back a string resource ID describing the attribute 04529 04530 Errors: - 04531 SeeAlso: - 04532 04533 ********************************************************************************************/ 04534 04535 UINT32 AttrTxtItalic::GetAttrNameID(void) 04536 { 04537 return (_R(IDS_ITALIC)); 04538 } 04539 04540 04541 /*********************************************************************************************** 04542 > ` void AttrTxtItalic::CopyNodeContents( AttrTxtItalic* NodeCopy) 04543 04544 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04545 Created: 28/4/93 04546 04547 Inputs: 04548 Outputs: A copy of this node 04549 Returns: - 04550 04551 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 04552 04553 Errors: An assertion failure will occur if NodeCopy is NULL 04554 04555 Scope: protected 04556 04557 ***********************************************************************************************/ 04558 04559 void AttrTxtItalic::CopyNodeContents( AttrTxtItalic* NodeCopy) 04560 { 04561 // Let the base class do its bit 04562 AttrTxtBase::CopyNodeContents( NodeCopy ); 04563 04564 //Copy contents specific to derived class here 04565 NodeCopy->Value.ItalicOn = Value.ItalicOn; 04566 } 04567 04568 04569 /*********************************************************************************************** 04570 > void AttrTxtItalic::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 04571 04572 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 04573 Created: 18/12/2003 04574 Outputs: - 04575 Purpose: Polymorphically copies the contents of this node to another 04576 Errors: An assertion failure will occur if NodeCopy is NULL 04577 Scope: protected 04578 04579 ***********************************************************************************************/ 04580 04581 void AttrTxtItalic::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 04582 { 04583 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 04584 ENSURE(IS_A(pNodeCopy, AttrTxtItalic), "PolyCopyNodeContents given wrong dest node type"); 04585 04586 if (IS_A(pNodeCopy, AttrTxtItalic)) 04587 CopyNodeContents((AttrTxtItalic*)pNodeCopy); 04588 } 04589 04590 04591 04592 /******************************************************************************************** 04593 04594 > virtual UINT32 AttrTxtItalic::GetNodeSize() const 04595 04596 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04597 Created: 6/10/93 04598 Inputs: - 04599 Outputs: - 04600 Returns: The size of the node in bytes 04601 Purpose: For finding the size of the node 04602 04603 SeeAlso: Node::GetSubtreeSize 04604 04605 ********************************************************************************************/ 04606 04607 UINT32 AttrTxtItalic::GetNodeSize() const 04608 { 04609 return (sizeof(AttrTxtItalic)); 04610 } 04611 04612 04613 /******************************************************************************************** 04614 04615 > virtual void AttrTxtItalic::GetDebugDetails() 04616 04617 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 04618 Created: 24/04/94 04619 Inputs: - 04620 Purpose: Used for debugging purposes during developement. Override in your own class 04621 and output suitable debugging details. 04622 04623 ********************************************************************************************/ 04624 04625 void AttrTxtItalic::GetDebugDetails(StringBase* Str) 04626 { 04627 NodeAttribute::GetDebugDetails( Str ); 04628 04629 String_256 TempStr; 04630 TCHAR* p; 04631 04632 (Value.ItalicOn) ? (p = _T("TRUE")) : (p = _T("FALSE")); 04633 TempStr._MakeMsg( TEXT("\r\nItalic=#1%s\r\n"), p); 04634 (*Str) += TempStr; 04635 } 04636 04637 /******************************************************************************************** 04638 04639 > BOOL AttrTxtItalic::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 04640 BOOL AttrTxtItalic::WritePreChildrenNative(BaseCamelotFilter* pFilter); 04641 04642 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 04643 Created: 09/07/96 04644 Inputs: pFilter - new camelot filter to save to 04645 Returns: TRUE if successful, FALSE otherwise 04646 Purpose: Saves the text font italic attribute to the new file format filter 04647 04648 ********************************************************************************************/ 04649 04650 BOOL AttrTxtItalic::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 04651 { 04652 #ifdef DO_EXPORT 04653 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 04654 04655 return CXaraFileTxtItalic::WritePreChildrenWeb(pFilter, this); 04656 #else 04657 return FALSE; 04658 #endif 04659 } 04660 04661 BOOL AttrTxtItalic::WritePreChildrenNative(BaseCamelotFilter *pFilter) 04662 { 04663 #ifdef DO_EXPORT 04664 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 04665 04666 return CXaraFileTxtItalic::WritePreChildrenNative(pFilter, this); 04667 #else 04668 return FALSE; 04669 #endif 04670 } 04671 04672 // ----------------------------------------------------------------------------------------- 04673 // AttrTxtFontSize methods 04674 04675 04676 /******************************************************************************************** 04677 04678 > AttrTxtFontSize::AttrTxtFontSize(Node* ContextNode, 04679 AttachNodeDirection Direction, 04680 BOOL Locked, 04681 BOOL Mangled, 04682 BOOL Marked, 04683 BOOL Selected 04684 ): AttrTxtBase(ContextNode, Direction, Locked, 04685 Mangled, Marked, Selected, TRUE) 04686 04687 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04688 Created: 13/03/95 04689 Inputs: - 04690 Outputs: - 04691 Returns: - 04692 Purpose: Creates a AttrTxtFontSize Attribute 04693 Errors: - 04694 SeeAlso: - 04695 04696 ********************************************************************************************/ 04697 04698 AttrTxtFontSize::AttrTxtFontSize(Node* ContextNode, 04699 AttachNodeDirection Direction, 04700 BOOL Locked, 04701 BOOL Mangled, 04702 BOOL Marked, 04703 BOOL Selected 04704 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 04705 { 04706 } 04707 04708 /******************************************************************************************** 04709 04710 > AttrTxtFontSize::AttrTxtFontSize() 04711 04712 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04713 Created: 13/03/95 04714 Inputs: - 04715 Outputs: - 04716 Returns: - 04717 Purpose: Default constructor for AttrTxtFontSize class 04718 Errors: - 04719 SeeAlso: - 04720 04721 ********************************************************************************************/ 04722 04723 AttrTxtFontSize::AttrTxtFontSize() 04724 { 04725 } 04726 04727 04728 /******************************************************************************************** 04729 04730 > void AttrTxtFontSize::Render( RenderRegion* pRender) 04731 04732 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04733 Created: 13/03/95 04734 Inputs: - 04735 Outputs: - 04736 Returns: - 04737 Purpose: 'Renders' a Line Width attribute. 04738 Errors: - 04739 SeeAlso: - 04740 04741 ********************************************************************************************/ 04742 04743 void AttrTxtFontSize::Render( RenderRegion* pRegion) 04744 { 04745 pRegion->SetTxtFontSize(&Value, FALSE); 04746 } 04747 04748 04749 04750 /*********************************************************************************************** 04751 > Node* AttrTxtFontSize::SimpleCopy() 04752 04753 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04754 Created: 13/03/95 04755 04756 Inputs: - 04757 Outputs: 04758 Returns: A copy of the node, or NULL if memory runs out 04759 04760 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 04761 The function is virtual, and must be defined for all derived classes. 04762 04763 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 04764 error and the function returns NULL. 04765 04766 Scope: protected 04767 ***********************************************************************************************/ 04768 04769 Node* AttrTxtFontSize::SimpleCopy() 04770 { 04771 AttrTxtFontSize* NodeCopy = new AttrTxtFontSize(); 04772 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 04773 CopyNodeContents(NodeCopy); 04774 return NodeCopy; 04775 } 04776 04777 /******************************************************************************************** 04778 04779 > INT32 AttrTxtFontSize::operator==(const NodeAttribute& Attrib) 04780 04781 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04782 Created: 13/03/95 04783 Inputs: Atrib: The attribute to compare, which must be an AttrTxtFontSize 04784 Outputs: - 04785 Returns: - 04786 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 04787 a description of why it's required. 04788 04789 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtFontSize 04790 runtime class. 04791 04792 SeeAlso: NodeAttribute::operator== 04793 04794 ********************************************************************************************/ 04795 04796 INT32 AttrTxtFontSize::operator==(const NodeAttribute& Attrib) 04797 { 04798 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtFontSize)), 04799 "Trying to compare two objects with different types"); 04800 AttrTxtFontSize* Attr = (AttrTxtFontSize*) &Attrib; 04801 return (Attr->Value.FontSize == Value.FontSize); 04802 } 04803 04804 04805 /******************************************************************************************** 04806 04807 > virtual UINT32 AttrTxtFontSize::GetAttrNameID(void) 04808 04809 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04810 Created: 22/2/94 04811 Inputs: - 04812 Outputs: - 04813 Returns: Attribute description ID 04814 Purpose: Returns back a string resource ID describing the attribute 04815 04816 Errors: - 04817 SeeAlso: - 04818 04819 ********************************************************************************************/ 04820 04821 UINT32 AttrTxtFontSize::GetAttrNameID(void) 04822 { 04823 return (_R(IDS_FONTSIZE)); 04824 } 04825 04826 04827 /*********************************************************************************************** 04828 > ` void AttrTxtFontSize::CopyNodeContents( AttrTxtFontSize* NodeCopy) 04829 04830 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04831 Created: 28/4/93 04832 04833 Inputs: 04834 Outputs: A copy of this node 04835 Returns: - 04836 04837 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 04838 04839 Errors: An assertion failure will occur if NodeCopy is NULL 04840 04841 Scope: protected 04842 04843 ***********************************************************************************************/ 04844 04845 void AttrTxtFontSize::CopyNodeContents( AttrTxtFontSize* NodeCopy) 04846 { 04847 // Let the base class do its bit 04848 AttrTxtBase::CopyNodeContents( NodeCopy ); 04849 04850 //Copy contents specific to derived class here 04851 NodeCopy->Value.FontSize = Value.FontSize; 04852 } 04853 04854 04855 /*********************************************************************************************** 04856 > void AttrTxtFontSize::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 04857 04858 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 04859 Created: 18/12/2003 04860 Outputs: - 04861 Purpose: Polymorphically copies the contents of this node to another 04862 Errors: An assertion failure will occur if NodeCopy is NULL 04863 Scope: protected 04864 04865 ***********************************************************************************************/ 04866 04867 void AttrTxtFontSize::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 04868 { 04869 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 04870 ENSURE(IS_A(pNodeCopy, AttrTxtFontSize), "PolyCopyNodeContents given wrong dest node type"); 04871 04872 if (IS_A(pNodeCopy, AttrTxtFontSize)) 04873 CopyNodeContents((AttrTxtFontSize*)pNodeCopy); 04874 } 04875 04876 04877 04878 /******************************************************************************************** 04879 04880 > virtual UINT32 AttrTxtFontSize::GetNodeSize() const 04881 04882 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04883 Created: 6/10/93 04884 Inputs: - 04885 Outputs: - 04886 Returns: The size of the node in bytes 04887 Purpose: For finding the size of the node 04888 04889 SeeAlso: Node::GetSubtreeSize 04890 04891 ********************************************************************************************/ 04892 04893 UINT32 AttrTxtFontSize::GetNodeSize() const 04894 { 04895 return (sizeof(AttrTxtFontSize)); 04896 } 04897 04898 04899 /******************************************************************************************** 04900 04901 > virtual void AttrTxtFontSize::GetDebugDetails() 04902 04903 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 04904 Created: 24/04/94 04905 Inputs: - 04906 Purpose: Used for debugging purposes during developement. Override in your own class 04907 and output suitable debugging details. 04908 04909 ********************************************************************************************/ 04910 04911 void AttrTxtFontSize::GetDebugDetails(StringBase* Str) 04912 { 04913 NodeAttribute::GetDebugDetails( Str ); 04914 04915 String_256 TempStr; 04916 TempStr._MakeMsg( TEXT("\r\nFontSize=#1%ld\r\n"), Value.FontSize); 04917 (*Str) += TempStr; 04918 } 04919 04920 04921 /******************************************************************************************** 04922 > void AttrTxtFontSize::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 04923 04924 Author: Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com> 04925 Created: 4/6/95 04926 Inputs: Scale - 04927 Aspect - 04928 Purpose: Transform the attribute using the baseline relative scale and aspect 04929 ********************************************************************************************/ 04930 04931 void AttrTxtFontSize::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 04932 { 04933 TxtFontSizeAttribute* pFontSizeAttrVal=(TxtFontSizeAttribute*)GetAttributeValue(); 04934 pFontSizeAttrVal->FontSize = XLONG(pFontSizeAttrVal->FontSize) * Scale; 04935 } 04936 04937 /******************************************************************************************** 04938 04939 > BOOL AttrTxtFontSize::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 04940 BOOL AttrTxtFontSize::WritePreChildrenNative(BaseCamelotFilter* pFilter); 04941 04942 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 04943 Created: 09/07/96 04944 Inputs: pFilter - new camelot filter to save to 04945 Returns: TRUE if successful, FALSE otherwise 04946 Purpose: Saves the text font size attribute to the new file format filter 04947 04948 ********************************************************************************************/ 04949 04950 BOOL AttrTxtFontSize::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 04951 { 04952 #ifdef DO_EXPORT 04953 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 04954 04955 return CXaraFileTxtFontSize::WritePreChildrenWeb(pFilter, this); 04956 #else 04957 return FALSE; 04958 #endif 04959 } 04960 04961 BOOL AttrTxtFontSize::WritePreChildrenNative(BaseCamelotFilter *pFilter) 04962 { 04963 #ifdef DO_EXPORT 04964 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 04965 04966 return CXaraFileTxtFontSize::WritePreChildrenNative(pFilter, this); 04967 #else 04968 return FALSE; 04969 #endif 04970 } 04971 04972 // AttrTxtUnderline methods 04973 // ----------------------------------------------------------------------------------------- 04974 04975 /******************************************************************************************** 04976 04977 > AttrTxtUnderline::AttrTxtUnderline(Node* ContextNode, 04978 AttachNodeDirection Direction, 04979 BOOL Locked, 04980 BOOL Mangled, 04981 BOOL Marked, 04982 BOOL Selected 04983 ): AttrTxtBase(ContextNode, Direction, Locked, 04984 Mangled, Marked, Selected, TRUE) 04985 04986 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 04987 Created: 13/03/95 04988 Inputs: - 04989 Outputs: - 04990 Returns: - 04991 Purpose: Creates a AttrTxtUnderline Attribute 04992 Errors: - 04993 SeeAlso: - 04994 04995 ********************************************************************************************/ 04996 04997 AttrTxtUnderline::AttrTxtUnderline(Node* ContextNode, 04998 AttachNodeDirection Direction, 04999 BOOL Locked, 05000 BOOL Mangled, 05001 BOOL Marked, 05002 BOOL Selected 05003 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 05004 { 05005 } 05006 05007 /******************************************************************************************** 05008 05009 > AttrTxtUnderline::AttrTxtUnderline() 05010 05011 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05012 Created: 13/03/95 05013 Inputs: - 05014 Outputs: - 05015 Returns: - 05016 Purpose: Default constructor for AttrTxtUnderline class 05017 Errors: - 05018 SeeAlso: - 05019 05020 ********************************************************************************************/ 05021 05022 AttrTxtUnderline::AttrTxtUnderline() 05023 { 05024 } 05025 05026 05027 /******************************************************************************************** 05028 05029 > void AttrTxtUnderline::Render( RenderRegion* pRender) 05030 05031 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05032 Created: 13/03/95 05033 Inputs: - 05034 Outputs: - 05035 Returns: - 05036 Purpose: 'Renders' a Line Width attribute. 05037 Errors: - 05038 SeeAlso: - 05039 05040 ********************************************************************************************/ 05041 05042 void AttrTxtUnderline::Render( RenderRegion* pRegion) 05043 { 05044 pRegion->SetTxtUnderline(&Value, FALSE); 05045 } 05046 05047 05048 05049 /*********************************************************************************************** 05050 > Node* AttrTxtUnderline::SimpleCopy() 05051 05052 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05053 Created: 13/03/95 05054 05055 Inputs: - 05056 Outputs: 05057 Returns: A copy of the node, or NULL if memory runs out 05058 05059 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 05060 The function is virtual, and must be defined for all derived classes. 05061 05062 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 05063 error and the function returns NULL. 05064 05065 Scope: protected 05066 ***********************************************************************************************/ 05067 05068 Node* AttrTxtUnderline::SimpleCopy() 05069 { 05070 AttrTxtUnderline* NodeCopy = new AttrTxtUnderline(); 05071 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 05072 CopyNodeContents(NodeCopy); 05073 return NodeCopy; 05074 } 05075 05076 /******************************************************************************************** 05077 05078 > INT32 AttrTxtUnderline::operator==(const NodeAttribute& Attrib) 05079 05080 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05081 Created: 13/03/95 05082 Inputs: Atrib: The attribute to compare, which must be an AttrLineWidth 05083 Outputs: - 05084 Returns: - 05085 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 05086 a description of why it's required. 05087 05088 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtUnderline 05089 runtime class. 05090 05091 SeeAlso: NodeAttribute::operator== 05092 05093 ********************************************************************************************/ 05094 05095 INT32 AttrTxtUnderline::operator==(const NodeAttribute& Attrib) 05096 { 05097 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtUnderline)), 05098 "Trying to compare two objects with different types"); 05099 AttrTxtUnderline* Attr = (AttrTxtUnderline*) &Attrib; 05100 return (Attr->Value.Underlined == Value.Underlined); 05101 } 05102 05103 05104 /******************************************************************************************** 05105 05106 > virtual UINT32 AttrTxtUnderline::GetAttrNameID(void) 05107 05108 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05109 Created: 22/2/94 05110 Inputs: - 05111 Outputs: - 05112 Returns: Attribute description ID 05113 Purpose: Returns back a string resource ID describing the attribute 05114 05115 Errors: - 05116 SeeAlso: - 05117 05118 ********************************************************************************************/ 05119 05120 UINT32 AttrTxtUnderline::GetAttrNameID(void) 05121 { 05122 return (_R(IDS_UNDERLINE)); 05123 } 05124 05125 05126 /*********************************************************************************************** 05127 > ` void AttrTxtUnderline::CopyNodeContents( AttrTxtUnderline* NodeCopy) 05128 05129 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05130 Created: 28/4/93 05131 05132 Inputs: 05133 Outputs: A copy of this node 05134 Returns: - 05135 05136 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 05137 05138 Errors: An assertion failure will occur if NodeCopy is NULL 05139 05140 Scope: protected 05141 05142 ***********************************************************************************************/ 05143 05144 void AttrTxtUnderline::CopyNodeContents( AttrTxtUnderline* NodeCopy) 05145 { 05146 // Let the base class do its bit 05147 AttrTxtBase::CopyNodeContents( NodeCopy ); 05148 05149 //Copy contents specific to derived class here 05150 NodeCopy->Value.Underlined = Value.Underlined; 05151 } 05152 05153 05154 /*********************************************************************************************** 05155 > void AttrTxtUnderline::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 05156 05157 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 05158 Created: 18/12/2003 05159 Outputs: - 05160 Purpose: Polymorphically copies the contents of this node to another 05161 Errors: An assertion failure will occur if NodeCopy is NULL 05162 Scope: protected 05163 05164 ***********************************************************************************************/ 05165 05166 void AttrTxtUnderline::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 05167 { 05168 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 05169 ENSURE(IS_A(pNodeCopy, AttrTxtUnderline), "PolyCopyNodeContents given wrong dest node type"); 05170 05171 if (IS_A(pNodeCopy, AttrTxtUnderline)) 05172 CopyNodeContents((AttrTxtUnderline*)pNodeCopy); 05173 } 05174 05175 05176 05177 /******************************************************************************************** 05178 05179 > virtual UINT32 AttrTxtUnderline::GetNodeSize() const 05180 05181 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05182 Created: 6/10/93 05183 Inputs: - 05184 Outputs: - 05185 Returns: The size of the node in bytes 05186 Purpose: For finding the size of the node 05187 05188 SeeAlso: Node::GetSubtreeSize 05189 05190 ********************************************************************************************/ 05191 05192 UINT32 AttrTxtUnderline::GetNodeSize() const 05193 { 05194 return (sizeof(AttrTxtUnderline)); 05195 } 05196 05197 /******************************************************************************************** 05198 05199 > virtual void AttrTxtUnderline::GetDebugDetails() 05200 05201 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 05202 Created: 24/04/94 05203 Inputs: - 05204 Purpose: Used for debugging purposes during developement. Override in your own class 05205 and output suitable debugging details. 05206 05207 ********************************************************************************************/ 05208 05209 void AttrTxtUnderline::GetDebugDetails(StringBase* Str) 05210 { 05211 NodeAttribute::GetDebugDetails( Str ); 05212 05213 String_256 TempStr; 05214 TCHAR* p; 05215 (Value.Underlined) ? (p=_T("TRUE")) : (p=_T("FALSE")); 05216 TempStr._MakeMsg( TEXT("\r\nUnderline=#1%s\r\n"), p); 05217 (*Str) += TempStr; 05218 } 05219 05220 /******************************************************************************************** 05221 05222 > BOOL AttrTxtUnderline::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 05223 BOOL AttrTxtUnderline::WritePreChildrenNative(BaseCamelotFilter* pFilter); 05224 05225 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 05226 Created: 09/07/96 05227 Inputs: pFilter - new camelot filter to save to 05228 Returns: TRUE if successful, FALSE otherwise 05229 Purpose: Saves the text underline attribute to the new file format filter 05230 05231 ********************************************************************************************/ 05232 05233 BOOL AttrTxtUnderline::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 05234 { 05235 #ifdef DO_EXPORT 05236 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 05237 05238 return CXaraFileTxtUnderline::WritePreChildrenWeb(pFilter, this); 05239 #else 05240 return FALSE; 05241 #endif 05242 } 05243 05244 BOOL AttrTxtUnderline::WritePreChildrenNative(BaseCamelotFilter *pFilter) 05245 { 05246 #ifdef DO_EXPORT 05247 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 05248 05249 return CXaraFileTxtUnderline::WritePreChildrenNative(pFilter, this); 05250 #else 05251 return FALSE; 05252 #endif 05253 } 05254 05255 // ------------------------------------------------------------------------------------------ 05256 // AttrTxtAspectRatio methods 05257 05258 /******************************************************************************************** 05259 05260 > AttrTxtAspectRatio::AttrTxtAspectRatio(Node* ContextNode, 05261 AttachNodeDirection Direction, 05262 BOOL Locked, 05263 BOOL Mangled, 05264 BOOL Marked, 05265 BOOL Selected 05266 ): AttrTxtBase(ContextNode, Direction, Locked, 05267 Mangled, Marked, Selected, TRUE) 05268 05269 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05270 Created: 13/03/95 05271 Purpose: Creates a AttrTxtAspectRatio Attribute 05272 05273 ********************************************************************************************/ 05274 05275 AttrTxtAspectRatio::AttrTxtAspectRatio(Node* ContextNode, 05276 AttachNodeDirection Direction, 05277 BOOL Locked, 05278 BOOL Mangled, 05279 BOOL Marked, 05280 BOOL Selected 05281 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 05282 { 05283 } 05284 05285 /******************************************************************************************** 05286 05287 > AttrTxtAspectRatio::AttrTxtAspectRatio() 05288 05289 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05290 Created: 13/03/95 05291 Purpose: Default constructor for AttrTxtAspectRatio class 05292 05293 ********************************************************************************************/ 05294 05295 AttrTxtAspectRatio::AttrTxtAspectRatio() 05296 { 05297 } 05298 05299 05300 /******************************************************************************************** 05301 05302 > void AttrTxtAspectRatio::Render( RenderRegion* pRender) 05303 05304 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05305 Created: 13/03/95 05306 Purpose: 'Renders' a Line Width attribute. 05307 05308 ********************************************************************************************/ 05309 05310 void AttrTxtAspectRatio::Render( RenderRegion* pRegion) 05311 { 05312 pRegion->SetTxtAspectRatio(&Value, FALSE); 05313 } 05314 05315 05316 05317 /*********************************************************************************************** 05318 > Node* AttrTxtAspectRatio::SimpleCopy() 05319 05320 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05321 Created: 13/03/95 05322 05323 Returns: A copy of the node, or NULL if memory runs out 05324 05325 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 05326 The function is virtual, and must be defined for all derived classes. 05327 05328 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 05329 error and the function returns NULL. 05330 05331 Scope: protected 05332 ***********************************************************************************************/ 05333 05334 Node* AttrTxtAspectRatio::SimpleCopy() 05335 { 05336 AttrTxtAspectRatio* NodeCopy = new AttrTxtAspectRatio(); 05337 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 05338 CopyNodeContents(NodeCopy); 05339 return NodeCopy; 05340 } 05341 05342 /******************************************************************************************** 05343 05344 > INT32 AttrTxtAspectRatio::operator==(const NodeAttribute& Attrib) 05345 05346 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05347 Created: 13/03/95 05348 Inputs: Atrib: The attribute to compare, which must be an AttrLineWidth 05349 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 05350 a description of why it's required. 05351 05352 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtAspectRatio 05353 runtime class. 05354 05355 SeeAlso: NodeAttribute::operator== 05356 05357 ********************************************************************************************/ 05358 05359 INT32 AttrTxtAspectRatio::operator==(const NodeAttribute& Attrib) 05360 { 05361 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtAspectRatio)), 05362 "Trying to compare two objects with different types"); 05363 AttrTxtAspectRatio* Attr = (AttrTxtAspectRatio*) &Attrib; 05364 return (Attr->Value.AspectRatio == Value.AspectRatio); 05365 } 05366 05367 05368 /******************************************************************************************** 05369 05370 > virtual UINT32 AttrTxtAspectRatio::GetAttrNameID(void) 05371 05372 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05373 Created: 22/2/94 05374 Returns: Attribute description ID 05375 Purpose: Returns back a string resource ID describing the attribute 05376 05377 ********************************************************************************************/ 05378 05379 UINT32 AttrTxtAspectRatio::GetAttrNameID(void) 05380 { 05381 return (_R(IDS_ASPECTRATIO)); 05382 } 05383 05384 05385 /*********************************************************************************************** 05386 > ` void AttrTxtAspectRatio::CopyNodeContents( AttrTxtAspectRatio* NodeCopy) 05387 05388 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05389 Created: 28/4/93 05390 05391 Inputs: 05392 Outputs: A copy of this node 05393 05394 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 05395 05396 Errors: An assertion failure will occur if NodeCopy is NULL 05397 05398 Scope: protected 05399 05400 ***********************************************************************************************/ 05401 05402 void AttrTxtAspectRatio::CopyNodeContents( AttrTxtAspectRatio* NodeCopy) 05403 { 05404 // Let the base class do its bit 05405 AttrTxtBase::CopyNodeContents( NodeCopy ); 05406 05407 //Copy contents specific to derived class here 05408 NodeCopy->Value.AspectRatio = Value.AspectRatio; 05409 } 05410 05411 05412 /*********************************************************************************************** 05413 > void AttrTxtAspectRatio::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 05414 05415 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 05416 Created: 18/12/2003 05417 Outputs: - 05418 Purpose: Polymorphically copies the contents of this node to another 05419 Errors: An assertion failure will occur if NodeCopy is NULL 05420 Scope: protected 05421 05422 ***********************************************************************************************/ 05423 05424 void AttrTxtAspectRatio::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 05425 { 05426 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 05427 ENSURE(IS_A(pNodeCopy, AttrTxtAspectRatio), "PolyCopyNodeContents given wrong dest node type"); 05428 05429 if (IS_A(pNodeCopy, AttrTxtAspectRatio)) 05430 CopyNodeContents((AttrTxtAspectRatio*)pNodeCopy); 05431 } 05432 05433 05434 05435 /******************************************************************************************** 05436 05437 > virtual UINT32 AttrTxtAspectRatio::GetNodeSize() const 05438 05439 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05440 Created: 6/10/93 05441 Inputs: - 05442 Outputs: - 05443 Returns: The size of the node in bytes 05444 Purpose: For finding the size of the node 05445 05446 SeeAlso: Node::GetSubtreeSize 05447 05448 ********************************************************************************************/ 05449 05450 UINT32 AttrTxtAspectRatio::GetNodeSize() const 05451 { 05452 return (sizeof(AttrTxtAspectRatio)); 05453 } 05454 05455 05456 /******************************************************************************************** 05457 05458 > virtual void AttrTxtAspectRatio::GetDebugDetails() 05459 05460 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 05461 Created: 24/04/94 05462 Inputs: - 05463 Purpose: Used for debugging purposes during developement. Override in your own class 05464 and output suitable debugging details. 05465 05466 ********************************************************************************************/ 05467 05468 void AttrTxtAspectRatio::GetDebugDetails(StringBase* Str) 05469 { 05470 #if DEBUG_TREE 05471 NodeAttribute::GetDebugDetails( Str ); 05472 05473 String_256 TempStr; 05474 TCHAR floatStr[20]; 05475 camSnprintf( floatStr, 20, _T("%f"), Value.AspectRatio.MakeDouble() ); 05476 TempStr._MakeMsg( TEXT("\r\nAspect ratio :\t#1%s\r\n"), floatStr); 05477 (*Str) += TempStr; 05478 #endif 05479 } 05480 05481 05482 /******************************************************************************************** 05483 > void AttrTxtAspectRatio::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 05484 05485 Author: Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com> 05486 Created: 4/6/95 05487 Inputs: Scale - 05488 Aspect - 05489 Purpose: Transform the attribute using the baseline relative scale and aspect 05490 ********************************************************************************************/ 05491 05492 void AttrTxtAspectRatio::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 05493 { 05494 TxtAspectRatioAttribute* pAspectRatioAttrVal=(TxtAspectRatioAttribute*)GetAttributeValue(); 05495 pAspectRatioAttrVal->AspectRatio = pAspectRatioAttrVal->AspectRatio * Aspect; 05496 } 05497 05498 /******************************************************************************************** 05499 05500 > BOOL AttrTxtAspectRatio::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 05501 BOOL AttrTxtAspectRatio::WritePreChildrenNative(BaseCamelotFilter* pFilter); 05502 05503 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 05504 Created: 09/07/96 05505 Inputs: pFilter - new camelot filter to save to 05506 Returns: TRUE if successful, FALSE otherwise 05507 Purpose: Saves the text aspect ratio attribute to the new file format filter 05508 05509 ********************************************************************************************/ 05510 05511 BOOL AttrTxtAspectRatio::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 05512 { 05513 #ifdef DO_EXPORT 05514 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 05515 05516 return CXaraFileTxtAspectRatio::WritePreChildrenWeb(pFilter, this); 05517 #else 05518 return FALSE; 05519 #endif 05520 } 05521 05522 BOOL AttrTxtAspectRatio::WritePreChildrenNative(BaseCamelotFilter *pFilter) 05523 { 05524 #ifdef DO_EXPORT 05525 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 05526 05527 return CXaraFileTxtAspectRatio::WritePreChildrenNative(pFilter, this); 05528 #else 05529 return FALSE; 05530 #endif 05531 } 05532 05533 // AttrTxtJustification methods 05534 // ----------------------------------------------------------------------------------------- 05535 05536 /******************************************************************************************** 05537 05538 > AttrTxtJustification::AttrTxtJustification(Node* ContextNode, 05539 AttachNodeDirection Direction, 05540 BOOL Locked, 05541 BOOL Mangled, 05542 BOOL Marked, 05543 BOOL Selected 05544 ): AttrTxtBase(ContextNode, Direction, Locked, 05545 Mangled, Marked, Selected, TRUE) 05546 05547 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05548 Created: 13/03/95 05549 Inputs: - 05550 Outputs: - 05551 Returns: - 05552 Purpose: Creates a AttrTxtJustification Attribute 05553 Errors: - 05554 SeeAlso: - 05555 05556 ********************************************************************************************/ 05557 05558 AttrTxtJustification::AttrTxtJustification(Node* ContextNode, 05559 AttachNodeDirection Direction, 05560 BOOL Locked, 05561 BOOL Mangled, 05562 BOOL Marked, 05563 BOOL Selected 05564 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 05565 { 05566 } 05567 05568 /******************************************************************************************** 05569 05570 > AttrTxtJustification::AttrTxtJustification() 05571 05572 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05573 Created: 13/03/95 05574 Inputs: - 05575 Outputs: - 05576 Returns: - 05577 Purpose: Default constructor for AttrTxtJustification class 05578 Errors: - 05579 SeeAlso: - 05580 05581 ********************************************************************************************/ 05582 05583 AttrTxtJustification::AttrTxtJustification() 05584 { 05585 } 05586 05587 05588 /******************************************************************************************** 05589 05590 > void AttrTxtJustification::Render( RenderRegion* pRender) 05591 05592 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05593 Created: 13/03/95 05594 Inputs: - 05595 Outputs: - 05596 Returns: - 05597 Purpose: 'Renders' a Line Width attribute. 05598 Errors: - 05599 SeeAlso: - 05600 05601 ********************************************************************************************/ 05602 05603 void AttrTxtJustification::Render( RenderRegion* pRegion) 05604 { 05605 pRegion->SetTxtJustification(&Value, FALSE); 05606 } 05607 05608 05609 05610 /*********************************************************************************************** 05611 > Node* AttrTxtJustification::SimpleCopy() 05612 05613 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05614 Created: 13/03/95 05615 05616 Inputs: - 05617 Outputs: 05618 Returns: A copy of the node, or NULL if memory runs out 05619 05620 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 05621 The function is virtual, and must be defined for all derived classes. 05622 05623 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 05624 error and the function returns NULL. 05625 05626 Scope: protected 05627 ***********************************************************************************************/ 05628 05629 Node* AttrTxtJustification::SimpleCopy() 05630 { 05631 AttrTxtJustification* NodeCopy = new AttrTxtJustification(); 05632 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 05633 CopyNodeContents(NodeCopy); 05634 return NodeCopy; 05635 } 05636 05637 /******************************************************************************************** 05638 05639 > INT32 AttrTxtJustification::operator==(const NodeAttribute& Attrib) 05640 05641 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05642 Created: 13/03/95 05643 Inputs: Atrib: The attribute to compare, which must be an AttrLineWidth 05644 Outputs: - 05645 Returns: - 05646 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 05647 a description of why it's required. 05648 05649 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtJustification 05650 runtime class. 05651 05652 SeeAlso: NodeAttribute::operator== 05653 05654 ********************************************************************************************/ 05655 05656 INT32 AttrTxtJustification::operator==(const NodeAttribute& Attrib) 05657 { 05658 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtJustification)), 05659 "Trying to compare two objects with different types"); 05660 AttrTxtJustification* Attr = (AttrTxtJustification*) &Attrib; 05661 return (Attr->Value.justification == Value.justification); 05662 } 05663 05664 05665 /******************************************************************************************** 05666 05667 > virtual UINT32 AttrTxtJustification::GetAttrNameID(void) 05668 05669 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05670 Created: 22/2/94 05671 Inputs: - 05672 Outputs: - 05673 Returns: Attribute description ID 05674 Purpose: Returns back a string resource ID describing the attribute 05675 05676 Errors: - 05677 SeeAlso: - 05678 05679 ********************************************************************************************/ 05680 05681 UINT32 AttrTxtJustification::GetAttrNameID(void) 05682 { 05683 return (_R(IDS_JUSTIFICATION)); 05684 } 05685 05686 05687 /*********************************************************************************************** 05688 > ` void AttrTxtJustification::CopyNodeContents( AttrTxtJustification* NodeCopy) 05689 05690 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05691 Created: 28/4/93 05692 05693 Inputs: 05694 Outputs: A copy of this node 05695 Returns: - 05696 05697 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 05698 05699 Errors: An assertion failure will occur if NodeCopy is NULL 05700 05701 Scope: protected 05702 05703 ***********************************************************************************************/ 05704 05705 void AttrTxtJustification::CopyNodeContents( AttrTxtJustification* NodeCopy) 05706 { 05707 // Let the base class do its bit 05708 AttrTxtBase::CopyNodeContents( NodeCopy ); 05709 05710 //Copy contents specific to derived class here 05711 NodeCopy->Value.justification = Value.justification; 05712 } 05713 05714 05715 /*********************************************************************************************** 05716 > void AttrTxtJustification::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 05717 05718 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 05719 Created: 18/12/2003 05720 Outputs: - 05721 Purpose: Polymorphically copies the contents of this node to another 05722 Errors: An assertion failure will occur if NodeCopy is NULL 05723 Scope: protected 05724 05725 ***********************************************************************************************/ 05726 05727 void AttrTxtJustification::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 05728 { 05729 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 05730 ENSURE(IS_A(pNodeCopy, AttrTxtJustification), "PolyCopyNodeContents given wrong dest node type"); 05731 05732 if (IS_A(pNodeCopy, AttrTxtJustification)) 05733 CopyNodeContents((AttrTxtJustification*)pNodeCopy); 05734 } 05735 05736 05737 05738 /******************************************************************************************** 05739 05740 > virtual UINT32 AttrTxtJustification::GetNodeSize() const 05741 05742 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05743 Created: 6/10/93 05744 Inputs: - 05745 Outputs: - 05746 Returns: The size of the node in bytes 05747 Purpose: For finding the size of the node 05748 05749 SeeAlso: Node::GetSubtreeSize 05750 05751 ********************************************************************************************/ 05752 05753 UINT32 AttrTxtJustification::GetNodeSize() const 05754 { 05755 return (sizeof(AttrTxtJustification)); 05756 } 05757 05758 05759 /******************************************************************************************** 05760 05761 > virtual void AttrTxtJustification::GetDebugDetails() 05762 05763 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 05764 Created: 24/04/94 05765 Inputs: - 05766 Purpose: Used for debugging purposes during developement. Override in your own class 05767 and output suitable debugging details. 05768 05769 ********************************************************************************************/ 05770 05771 void AttrTxtJustification::GetDebugDetails(StringBase* Str) 05772 { 05773 NodeAttribute::GetDebugDetails( Str ); 05774 05775 String_256 TempStr; 05776 char* p; 05777 05778 switch (Value.justification) 05779 { 05780 case JLEFT: 05781 p="Left"; 05782 break; 05783 case JRIGHT: 05784 p="Right"; 05785 break; 05786 case JCENTRE: 05787 p="Centre"; 05788 break; 05789 case JFULL: 05790 p="Fully"; 05791 break; 05792 default: 05793 p="(Unknown)"; 05794 break; 05795 } 05796 05797 TempStr._MakeMsg(TEXT("\r\nJustification=#1%s"), p); 05798 (*Str) += TempStr; 05799 TempStr._MakeMsg(TEXT(" justified\r\n")); 05800 (*Str) += TempStr; 05801 } 05802 05803 /******************************************************************************************** 05804 05805 > BOOL AttrTxtJustification::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 05806 BOOL AttrTxtJustification::WritePreChildrenNative(BaseCamelotFilter* pFilter); 05807 05808 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 05809 Created: 09/07/96 05810 Inputs: pFilter - new camelot filter to save to 05811 Returns: TRUE if successful, FALSE otherwise 05812 Purpose: Saves the text justification attribute to the new file format filter 05813 05814 ********************************************************************************************/ 05815 05816 BOOL AttrTxtJustification::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 05817 { 05818 #ifdef DO_EXPORT 05819 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 05820 05821 return CXaraFileTxtJustification::WritePreChildrenWeb(pFilter, this); 05822 #else 05823 return FALSE; 05824 #endif 05825 } 05826 05827 BOOL AttrTxtJustification::WritePreChildrenNative(BaseCamelotFilter *pFilter) 05828 { 05829 #ifdef DO_EXPORT 05830 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 05831 05832 return CXaraFileTxtJustification::WritePreChildrenNative(pFilter, this); 05833 #else 05834 return FALSE; 05835 #endif 05836 } 05837 05838 // AttrTxtTracking methods 05839 // ----------------------------------------------------------------------------------------- 05840 05841 /******************************************************************************************** 05842 05843 > AttrTxtTracking::AttrTxtTracking(Node* ContextNode, 05844 AttachNodeDirection Direction, 05845 BOOL Locked, 05846 BOOL Mangled, 05847 BOOL Marked, 05848 BOOL Selected 05849 ): AttrTxtBase(ContextNode, Direction, Locked, 05850 Mangled, Marked, Selected, TRUE) 05851 05852 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05853 Created: 13/03/95 05854 Inputs: - 05855 Outputs: - 05856 Returns: - 05857 Purpose: Creates a AttrTxtTracking Attribute 05858 Errors: - 05859 SeeAlso: - 05860 05861 ********************************************************************************************/ 05862 05863 AttrTxtTracking::AttrTxtTracking(Node* ContextNode, 05864 AttachNodeDirection Direction, 05865 BOOL Locked, 05866 BOOL Mangled, 05867 BOOL Marked, 05868 BOOL Selected 05869 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 05870 { 05871 } 05872 05873 /******************************************************************************************** 05874 05875 > AttrTxtTracking::AttrTxtTracking() 05876 05877 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05878 Created: 13/03/95 05879 Inputs: - 05880 Outputs: - 05881 Returns: - 05882 Purpose: Default constructor for AttrTxtTracking class 05883 Errors: - 05884 SeeAlso: - 05885 05886 ********************************************************************************************/ 05887 05888 AttrTxtTracking::AttrTxtTracking() 05889 { 05890 } 05891 05892 05893 /******************************************************************************************** 05894 05895 > void AttrTxtTracking::Render( RenderRegion* pRender) 05896 05897 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05898 Created: 13/03/95 05899 Inputs: - 05900 Outputs: - 05901 Returns: - 05902 Purpose: 'Renders' a Line Width attribute. 05903 Errors: - 05904 SeeAlso: - 05905 05906 ********************************************************************************************/ 05907 05908 void AttrTxtTracking::Render( RenderRegion* pRegion) 05909 { 05910 pRegion->SetTxtTracking(&Value, FALSE); 05911 } 05912 05913 05914 05915 /*********************************************************************************************** 05916 > Node* AttrTxtTracking::SimpleCopy() 05917 05918 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05919 Created: 13/03/95 05920 05921 Inputs: - 05922 Outputs: 05923 Returns: A copy of the node, or NULL if memory runs out 05924 05925 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 05926 The function is virtual, and must be defined for all derived classes. 05927 05928 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 05929 error and the function returns NULL. 05930 05931 Scope: protected 05932 ***********************************************************************************************/ 05933 05934 Node* AttrTxtTracking::SimpleCopy() 05935 { 05936 AttrTxtTracking* NodeCopy = new AttrTxtTracking(); 05937 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 05938 CopyNodeContents(NodeCopy); 05939 return NodeCopy; 05940 } 05941 05942 /******************************************************************************************** 05943 05944 > INT32 AttrTxtTracking::operator==(const NodeAttribute& Attrib) 05945 05946 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05947 Created: 13/03/95 05948 Inputs: Atrib: The attribute to compare, which must be an AttrLineWidth 05949 Outputs: - 05950 Returns: - 05951 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 05952 a description of why it's required. 05953 05954 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtTracking 05955 runtime class. 05956 05957 SeeAlso: NodeAttribute::operator== 05958 05959 ********************************************************************************************/ 05960 05961 INT32 AttrTxtTracking::operator==(const NodeAttribute& Attrib) 05962 { 05963 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtTracking)), 05964 "Trying to compare two objects with different types"); 05965 AttrTxtTracking* Attr = (AttrTxtTracking*) &Attrib; 05966 return (Attr->Value.Tracking == Value.Tracking); 05967 } 05968 05969 05970 /******************************************************************************************** 05971 05972 > virtual UINT32 AttrTxtTracking::GetAttrNameID(void) 05973 05974 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05975 Created: 22/2/94 05976 Inputs: - 05977 Outputs: - 05978 Returns: Attribute description ID 05979 Purpose: Returns back a string resource ID describing the attribute 05980 05981 Errors: - 05982 SeeAlso: - 05983 05984 ********************************************************************************************/ 05985 05986 UINT32 AttrTxtTracking::GetAttrNameID(void) 05987 { 05988 return (_R(IDS_TRACKING)); 05989 } 05990 05991 05992 /*********************************************************************************************** 05993 > ` void AttrTxtTracking::CopyNodeContents( AttrTxtTracking* NodeCopy) 05994 05995 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 05996 Created: 28/4/93 05997 05998 Inputs: 05999 Outputs: A copy of this node 06000 Returns: - 06001 06002 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 06003 06004 Errors: An assertion failure will occur if NodeCopy is NULL 06005 06006 Scope: protected 06007 06008 ***********************************************************************************************/ 06009 06010 void AttrTxtTracking::CopyNodeContents( AttrTxtTracking* NodeCopy) 06011 { 06012 // Let the base class do its bit 06013 NodeAttribute::CopyNodeContents( NodeCopy ); 06014 06015 //Copy contents specific to derived class here 06016 NodeCopy->Value.Tracking = Value.Tracking; 06017 } 06018 06019 06020 /*********************************************************************************************** 06021 > void AttrTxtTracking::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 06022 06023 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 06024 Created: 18/12/2003 06025 Outputs: - 06026 Purpose: Polymorphically copies the contents of this node to another 06027 Errors: An assertion failure will occur if NodeCopy is NULL 06028 Scope: protected 06029 06030 ***********************************************************************************************/ 06031 06032 void AttrTxtTracking::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 06033 { 06034 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 06035 ENSURE(IS_A(pNodeCopy, AttrTxtTracking), "PolyCopyNodeContents given wrong dest node type"); 06036 06037 if (IS_A(pNodeCopy, AttrTxtTracking)) 06038 CopyNodeContents((AttrTxtTracking*)pNodeCopy); 06039 } 06040 06041 06042 06043 /******************************************************************************************** 06044 06045 > virtual UINT32 AttrTxtTracking::GetNodeSize() const 06046 06047 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06048 Created: 6/10/93 06049 Inputs: - 06050 Outputs: - 06051 Returns: The size of the node in bytes 06052 Purpose: For finding the size of the node 06053 06054 SeeAlso: Node::GetSubtreeSize 06055 06056 ********************************************************************************************/ 06057 06058 UINT32 AttrTxtTracking::GetNodeSize() const 06059 { 06060 return (sizeof(AttrTxtTracking)); 06061 } 06062 06063 06064 /******************************************************************************************** 06065 06066 > virtual void AttrTxtTracking::GetDebugDetails() 06067 06068 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 06069 Created: 24/04/94 06070 Inputs: - 06071 Purpose: Used for debugging purposes during developement. Override in your own class 06072 and output suitable debugging details. 06073 06074 ********************************************************************************************/ 06075 06076 void AttrTxtTracking::GetDebugDetails(StringBase* Str) 06077 { 06078 NodeAttribute::GetDebugDetails( Str ); 06079 06080 String_256 TempStr; 06081 TempStr._MakeMsg( TEXT("\r\nTracking=#1%ld\r\n"), Value.Tracking); 06082 (*Str) += TempStr; 06083 } 06084 06085 /******************************************************************************************** 06086 06087 > BOOL AttrTxtTracking::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 06088 BOOL AttrTxtTracking::WritePreChildrenNative(BaseCamelotFilter* pFilter); 06089 06090 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 06091 Created: 09/07/96 06092 Inputs: pFilter - new camelot filter to save to 06093 Returns: TRUE if successful, FALSE otherwise 06094 Purpose: Saves the text tracking attribute to the new file format filter 06095 06096 ********************************************************************************************/ 06097 06098 BOOL AttrTxtTracking::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 06099 { 06100 #ifdef DO_EXPORT 06101 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 06102 06103 return CXaraFileTxtTracking::WritePreChildrenWeb(pFilter, this); 06104 #else 06105 return FALSE; 06106 #endif 06107 } 06108 06109 BOOL AttrTxtTracking::WritePreChildrenNative(BaseCamelotFilter *pFilter) 06110 { 06111 #ifdef DO_EXPORT 06112 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 06113 06114 return CXaraFileTxtTracking::WritePreChildrenNative(pFilter, this); 06115 #else 06116 return FALSE; 06117 #endif 06118 } 06119 06120 // AttrTxtScript methods 06121 // ----------------------------------------------------------------------------------------- 06122 06123 06124 /******************************************************************************************** 06125 06126 > AttrTxtScript::AttrTxtScript(Node* ContextNode, 06127 AttachNodeDirection Direction, 06128 BOOL Locked, 06129 BOOL Mangled, 06130 BOOL Marked, 06131 BOOL Selected 06132 ): AttrTxtBase(ContextNode, Direction, Locked, 06133 Mangled, Marked, Selected, TRUE) 06134 06135 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06136 Created: 13/03/95 06137 Inputs: - 06138 Outputs: - 06139 Returns: - 06140 Purpose: Creates a AttrTxtScript Attribute 06141 Errors: - 06142 SeeAlso: - 06143 06144 ********************************************************************************************/ 06145 06146 AttrTxtScript::AttrTxtScript(Node* ContextNode, 06147 AttachNodeDirection Direction, 06148 BOOL Locked, 06149 BOOL Mangled, 06150 BOOL Marked, 06151 BOOL Selected 06152 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 06153 { 06154 } 06155 06156 /******************************************************************************************** 06157 06158 > AttrTxtScript::AttrTxtScript() 06159 06160 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06161 Created: 13/03/95 06162 Inputs: - 06163 Outputs: - 06164 Returns: - 06165 Purpose: Default constructor for AttrTxtScript class 06166 Errors: - 06167 SeeAlso: - 06168 06169 ********************************************************************************************/ 06170 06171 AttrTxtScript::AttrTxtScript() 06172 { 06173 } 06174 06175 06176 /******************************************************************************************** 06177 06178 > void AttrTxtScript::Render( RenderRegion* pRender) 06179 06180 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06181 Created: 13/03/95 06182 Inputs: - 06183 Outputs: - 06184 Returns: - 06185 Purpose: 'Renders' a Line Width attribute. 06186 Errors: - 06187 SeeAlso: - 06188 06189 ********************************************************************************************/ 06190 06191 void AttrTxtScript::Render( RenderRegion* pRegion) 06192 { 06193 pRegion->SetTxtScript(&Value, FALSE); 06194 } 06195 06196 06197 06198 /*********************************************************************************************** 06199 > Node* AttrTxtScript::SimpleCopy() 06200 06201 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06202 Created: 13/03/95 06203 06204 Inputs: - 06205 Outputs: 06206 Returns: A copy of the node, or NULL if memory runs out 06207 06208 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 06209 The function is virtual, and must be defined for all derived classes. 06210 06211 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 06212 error and the function returns NULL. 06213 06214 Scope: protected 06215 ***********************************************************************************************/ 06216 06217 Node* AttrTxtScript::SimpleCopy() 06218 { 06219 AttrTxtScript* NodeCopy = new AttrTxtScript(); 06220 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 06221 CopyNodeContents(NodeCopy); 06222 return NodeCopy; 06223 } 06224 06225 /******************************************************************************************** 06226 06227 > INT32 AttrTxtScript::operator==(const NodeAttribute& Attrib) 06228 06229 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06230 Created: 13/03/95 06231 Inputs: Atrib: The attribute to compare, which must be an AttrTxtScript 06232 Outputs: - 06233 Returns: - 06234 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 06235 a description of why it's required. 06236 06237 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtScript 06238 runtime class. 06239 06240 SeeAlso: NodeAttribute::operator== 06241 06242 ********************************************************************************************/ 06243 06244 INT32 AttrTxtScript::operator==(const NodeAttribute& Attrib) 06245 { 06246 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtScript)), 06247 "Trying to compare two objects with different types"); 06248 AttrTxtScript* Attr = (AttrTxtScript*) &Attrib; 06249 return ((Attr->Value.Size == Value.Size) && (Attr->Value.Offset == Value.Offset)); 06250 } 06251 06252 06253 /******************************************************************************************** 06254 06255 > virtual UINT32 AttrTxtScript::GetAttrNameID(void) 06256 06257 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06258 Created: 22/2/94 06259 Inputs: - 06260 Outputs: - 06261 Returns: Attribute description ID 06262 Purpose: Returns back a string resource ID describing the attribute 06263 06264 Errors: - 06265 SeeAlso: - 06266 06267 ********************************************************************************************/ 06268 06269 UINT32 AttrTxtScript::GetAttrNameID(void) 06270 { 06271 return (_R(IDS_SCRIPT)); 06272 } 06273 06274 06275 /*********************************************************************************************** 06276 > ` void AttrTxtScript::CopyNodeContents( AttrTxtScript* NodeCopy) 06277 06278 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06279 Created: 28/4/93 06280 06281 Inputs: 06282 Outputs: A copy of this node 06283 Returns: - 06284 06285 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 06286 06287 Errors: An assertion failure will occur if NodeCopy is NULL 06288 06289 Scope: protected 06290 06291 ***********************************************************************************************/ 06292 06293 void AttrTxtScript::CopyNodeContents( AttrTxtScript* NodeCopy) 06294 { 06295 // Let the base class do its bit 06296 NodeAttribute::CopyNodeContents( NodeCopy ); 06297 06298 //Copy contents specific to derived class here 06299 NodeCopy->Value.Size = Value.Size; 06300 NodeCopy->Value.Offset = Value.Offset; 06301 } 06302 06303 06304 /*********************************************************************************************** 06305 > void AttrTxtScript::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 06306 06307 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 06308 Created: 18/12/2003 06309 Outputs: - 06310 Purpose: Polymorphically copies the contents of this node to another 06311 Errors: An assertion failure will occur if NodeCopy is NULL 06312 Scope: protected 06313 06314 ***********************************************************************************************/ 06315 06316 void AttrTxtScript::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 06317 { 06318 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 06319 ENSURE(IS_A(pNodeCopy, AttrTxtScript), "PolyCopyNodeContents given wrong dest node type"); 06320 06321 if (IS_A(pNodeCopy, AttrTxtScript)) 06322 CopyNodeContents((AttrTxtScript*)pNodeCopy); 06323 } 06324 06325 06326 06327 /******************************************************************************************** 06328 06329 > virtual UINT32 AttrTxtScript::GetNodeSize() const 06330 06331 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06332 Created: 6/10/93 06333 Inputs: - 06334 Outputs: - 06335 Returns: The size of the node in bytes 06336 Purpose: For finding the size of the node 06337 06338 SeeAlso: Node::GetSubtreeSize 06339 06340 ********************************************************************************************/ 06341 06342 UINT32 AttrTxtScript::GetNodeSize() const 06343 { 06344 return (sizeof(AttrTxtScript)); 06345 } 06346 06347 06348 /******************************************************************************************** 06349 06350 > virtual void AttrTxtScript::GetDebugDetails() 06351 06352 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 06353 Created: 24/04/94 06354 Inputs: - 06355 Purpose: Used for debugging purposes during developement. Override in your own class 06356 and output suitable debugging details. 06357 06358 ********************************************************************************************/ 06359 06360 void AttrTxtScript::GetDebugDetails(StringBase* Str) 06361 { 06362 NodeAttribute::GetDebugDetails( Str ); 06363 06364 String_256 TempStr; 06365 TempStr._MakeMsg( TEXT("\r\nSize=#1%ld\r\n"), Value.Size.GetRawLong() ); 06366 (*Str) += TempStr; 06367 TempStr._MakeMsg( TEXT("Offset=#1%ld\r\n"), Value.Offset.GetRawLong() ); 06368 (*Str) += TempStr; 06369 } 06370 06371 /******************************************************************************************** 06372 06373 > BOOL AttrTxtScript::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 06374 BOOL AttrTxtScript::WritePreChildrenNative(BaseCamelotFilter* pFilter); 06375 06376 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 06377 Created: 09/07/96 06378 Inputs: pFilter - new camelot filter to save to 06379 Returns: TRUE if successful, FALSE otherwise 06380 Purpose: Saves the text script attribute to the new file format filter 06381 06382 ********************************************************************************************/ 06383 06384 BOOL AttrTxtScript::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 06385 { 06386 #ifdef DO_EXPORT 06387 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 06388 06389 return CXaraFileTxtScript::WritePreChildrenWeb(pFilter, this); 06390 #else 06391 return FALSE; 06392 #endif 06393 } 06394 06395 BOOL AttrTxtScript::WritePreChildrenNative(BaseCamelotFilter *pFilter) 06396 { 06397 #ifdef DO_EXPORT 06398 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 06399 06400 return CXaraFileTxtScript::WritePreChildrenNative(pFilter, this); 06401 #else 06402 return FALSE; 06403 #endif 06404 } 06405 06406 // AttrTxtBaseLine methods 06407 // ----------------------------------------------------------------------------------------- 06408 06409 /******************************************************************************************** 06410 06411 > AttrTxtBaseLine::AttrTxtBaseLine(Node* ContextNode, 06412 AttachNodeDirection Direction, 06413 BOOL Locked, 06414 BOOL Mangled, 06415 BOOL Marked, 06416 BOOL Selected 06417 ): AttrTxtBase(ContextNode, Direction, Locked, 06418 Mangled, Marked, Selected, TRUE) 06419 06420 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06421 Created: 13/03/95 06422 Inputs: - 06423 Outputs: - 06424 Returns: - 06425 Purpose: Creates a AttrTxtBaseLine Attribute 06426 Errors: - 06427 SeeAlso: - 06428 06429 ********************************************************************************************/ 06430 06431 AttrTxtBaseLine::AttrTxtBaseLine(Node* ContextNode, 06432 AttachNodeDirection Direction, 06433 BOOL Locked, 06434 BOOL Mangled, 06435 BOOL Marked, 06436 BOOL Selected 06437 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 06438 { 06439 } 06440 06441 /******************************************************************************************** 06442 06443 > AttrTxtBaseLine::AttrTxtBaseLine() 06444 06445 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06446 Created: 13/03/95 06447 Inputs: - 06448 Outputs: - 06449 Returns: - 06450 Purpose: Default constructor for AttrTxtBaseLine class 06451 Errors: - 06452 SeeAlso: - 06453 06454 ********************************************************************************************/ 06455 06456 AttrTxtBaseLine::AttrTxtBaseLine() 06457 { 06458 } 06459 06460 06461 /******************************************************************************************** 06462 06463 > void AttrTxtBaseLine::Render( RenderRegion* pRender) 06464 06465 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06466 Created: 13/03/95 06467 Inputs: - 06468 Outputs: - 06469 Returns: - 06470 Purpose: 'Renders' a Line Width attribute. 06471 Errors: - 06472 SeeAlso: - 06473 06474 ********************************************************************************************/ 06475 06476 void AttrTxtBaseLine::Render( RenderRegion* pRegion) 06477 { 06478 pRegion->SetTxtBaseLine(&Value, FALSE); 06479 } 06480 06481 06482 06483 /*********************************************************************************************** 06484 > Node* AttrTxtBaseLine::SimpleCopy() 06485 06486 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06487 Created: 13/03/95 06488 06489 Inputs: - 06490 Outputs: 06491 Returns: A copy of the node, or NULL if memory runs out 06492 06493 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 06494 The function is virtual, and must be defined for all derived classes. 06495 06496 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 06497 error and the function returns NULL. 06498 06499 Scope: protected 06500 ***********************************************************************************************/ 06501 06502 Node* AttrTxtBaseLine::SimpleCopy() 06503 { 06504 AttrTxtBaseLine* NodeCopy = new AttrTxtBaseLine(); 06505 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 06506 CopyNodeContents(NodeCopy); 06507 return NodeCopy; 06508 } 06509 06510 /******************************************************************************************** 06511 06512 > INT32 AttrTxtBaseLine::operator==(const NodeAttribute& Attrib) 06513 06514 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06515 Created: 13/03/95 06516 Inputs: Atrib: The attribute to compare, which must be an AttrTxtBaseLine 06517 Outputs: - 06518 Returns: - 06519 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 06520 a description of why it's required. 06521 06522 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtBaseLine 06523 runtime class. 06524 06525 SeeAlso: NodeAttribute::operator== 06526 06527 ********************************************************************************************/ 06528 06529 INT32 AttrTxtBaseLine::operator==(const NodeAttribute& Attrib) 06530 { 06531 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtBaseLine)), 06532 "Trying to compare two objects with different types"); 06533 AttrTxtBaseLine* Attr = (AttrTxtBaseLine*) &Attrib; 06534 return (Attr->Value.Value == Value.Value); 06535 } 06536 06537 06538 /******************************************************************************************** 06539 06540 > virtual UINT32 AttrTxtBaseLine::GetAttrNameID(void) 06541 06542 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06543 Created: 22/2/94 06544 Inputs: - 06545 Outputs: - 06546 Returns: Attribute description ID 06547 Purpose: Returns back a string resource ID describing the attribute 06548 06549 Errors: - 06550 SeeAlso: - 06551 06552 ********************************************************************************************/ 06553 06554 UINT32 AttrTxtBaseLine::GetAttrNameID(void) 06555 { 06556 return (_R(IDS_BASELINE)); 06557 } 06558 06559 06560 /*********************************************************************************************** 06561 > ` void AttrTxtBaseLine::CopyNodeContents( AttrTxtBaseLine* NodeCopy) 06562 06563 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06564 Created: 28/4/93 06565 06566 Inputs: 06567 Outputs: A copy of this node 06568 Returns: - 06569 06570 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 06571 06572 Errors: An assertion failure will occur if NodeCopy is NULL 06573 06574 Scope: protected 06575 06576 ***********************************************************************************************/ 06577 06578 void AttrTxtBaseLine::CopyNodeContents( AttrTxtBaseLine* NodeCopy) 06579 { 06580 // Let the base class do its bit 06581 NodeAttribute::CopyNodeContents( NodeCopy ); 06582 06583 //Copy contents specific to derived class here 06584 NodeCopy->Value.Value = Value.Value; 06585 } 06586 06587 06588 /*********************************************************************************************** 06589 > void AttrTxtBaseLine::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 06590 06591 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 06592 Created: 18/12/2003 06593 Outputs: - 06594 Purpose: Polymorphically copies the contents of this node to another 06595 Errors: An assertion failure will occur if NodeCopy is NULL 06596 Scope: protected 06597 06598 ***********************************************************************************************/ 06599 06600 void AttrTxtBaseLine::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 06601 { 06602 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 06603 ENSURE(IS_A(pNodeCopy, AttrTxtBaseLine), "PolyCopyNodeContents given wrong dest node type"); 06604 06605 if (IS_A(pNodeCopy, AttrTxtBaseLine)) 06606 CopyNodeContents((AttrTxtBaseLine*)pNodeCopy); 06607 } 06608 06609 06610 06611 /******************************************************************************************** 06612 06613 > virtual UINT32 AttrTxtBaseLine::GetNodeSize() const 06614 06615 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06616 Created: 6/10/93 06617 Inputs: - 06618 Outputs: - 06619 Returns: The size of the node in bytes 06620 Purpose: For finding the size of the node 06621 06622 SeeAlso: Node::GetSubtreeSize 06623 06624 ********************************************************************************************/ 06625 06626 UINT32 AttrTxtBaseLine::GetNodeSize() const 06627 { 06628 return (sizeof(AttrTxtBaseLine)); 06629 } 06630 06631 06632 /******************************************************************************************** 06633 06634 > virtual void AttrTxtBaseLine::GetDebugDetails() 06635 06636 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 06637 Created: 24/04/94 06638 Inputs: - 06639 Purpose: Used for debugging purposes during developement. Override in your own class 06640 and output suitable debugging details. 06641 06642 ********************************************************************************************/ 06643 06644 void AttrTxtBaseLine::GetDebugDetails(StringBase* Str) 06645 { 06646 NodeAttribute::GetDebugDetails( Str ); 06647 06648 String_256 TempStr; 06649 TempStr._MakeMsg( TEXT("\r\nRise=#1%ld\r\n"), Value.Value); 06650 (*Str) += TempStr; 06651 } 06652 06653 06654 /******************************************************************************************** 06655 > void AttrTxtBaseLine::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 06656 06657 Author: Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com> 06658 Created: 4/6/95 06659 Inputs: Scale - 06660 Aspect - 06661 Purpose: Transform the attribute using the baseline relative scale and aspect 06662 ********************************************************************************************/ 06663 06664 void AttrTxtBaseLine::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 06665 { 06666 TxtBaseLineAttribute* pBaseLineAttrVal=(TxtBaseLineAttribute*)GetAttributeValue(); 06667 pBaseLineAttrVal->Value = XLONG(pBaseLineAttrVal->Value) * Scale; 06668 } 06669 06670 06671 /******************************************************************************************** 06672 06673 > BOOL AttrTxtBaseLine::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 06674 BOOL AttrTxtBaseLine::WritePreChildrenNative(BaseCamelotFilter* pFilter); 06675 06676 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 06677 Created: 09/07/96 06678 Inputs: pFilter - new camelot filter to save to 06679 Returns: TRUE if successful, FALSE otherwise 06680 Purpose: Saves the text baseline attribute to the new file format filter 06681 06682 ********************************************************************************************/ 06683 06684 BOOL AttrTxtBaseLine::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 06685 { 06686 #ifdef DO_EXPORT 06687 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 06688 06689 return CXaraFileTxtBaseLine::WritePreChildrenWeb(pFilter, this); 06690 #else 06691 return FALSE; 06692 #endif 06693 } 06694 06695 BOOL AttrTxtBaseLine::WritePreChildrenNative(BaseCamelotFilter *pFilter) 06696 { 06697 #ifdef DO_EXPORT 06698 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 06699 06700 return CXaraFileTxtBaseLine::WritePreChildrenNative(pFilter, this); 06701 #else 06702 return FALSE; 06703 #endif 06704 } 06705 06706 // AttrTxtLeftMargin methods 06707 // ----------------------------------------------------------------------------------------- 06708 06709 /******************************************************************************************** 06710 06711 > AttrTxtLeftMargin::AttrTxtLeftMargin(Node* ContextNode, 06712 AttachNodeDirection Direction, 06713 BOOL Locked, 06714 BOOL Mangled, 06715 BOOL Marked, 06716 BOOL Selected 06717 ): AttrTxtBase(ContextNode, Direction, Locked, 06718 Mangled, Marked, Selected, TRUE) 06719 06720 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06721 Created: 13/03/95 06722 Purpose: Creates a AttrTxtLeftMargin Attribute 06723 06724 ********************************************************************************************/ 06725 06726 AttrTxtLeftMargin::AttrTxtLeftMargin(Node* ContextNode, 06727 AttachNodeDirection Direction, 06728 BOOL Locked, 06729 BOOL Mangled, 06730 BOOL Marked, 06731 BOOL Selected 06732 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 06733 { 06734 } 06735 06736 /******************************************************************************************** 06737 06738 > void AttrTxtLeftMargin::Render( RenderRegion* pRender) 06739 06740 Author: Martin Wuerthner <xara@mw-software.com> 06741 Created: 19/06/06 06742 Inputs: pRenderRegion = the render region to which the attribute should be rendered 06743 Purpose: 'Renders' a left margin attribute 06744 06745 ********************************************************************************************/ 06746 06747 void AttrTxtLeftMargin::Render( RenderRegion* pRegion) 06748 { 06749 pRegion->SetTxtLeftMargin(&Value, FALSE); 06750 } 06751 06752 /*********************************************************************************************** 06753 > Node* AttrTxtLeftMargin::SimpleCopy() 06754 06755 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06756 Created: 13/03/95 06757 06758 Returns: A copy of the node, or NULL if memory runs out 06759 06760 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 06761 The function is virtual, and must be defined for all derived classes. 06762 06763 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 06764 error and the function returns NULL. 06765 06766 ***********************************************************************************************/ 06767 06768 Node* AttrTxtLeftMargin::SimpleCopy() 06769 { 06770 AttrTxtLeftMargin* NodeCopy = new AttrTxtLeftMargin(); 06771 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 06772 CopyNodeContents(NodeCopy); 06773 return NodeCopy; 06774 } 06775 06776 /******************************************************************************************** 06777 06778 > INT32 AttrTxtLeftMargin::operator==(const NodeAttribute& Attrib) 06779 06780 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06781 Created: 13/03/95 06782 Inputs: Atrib: The attribute to compare, which must be an AttrTxtLeftMargin 06783 Outputs: - 06784 Returns: - 06785 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 06786 a description of why it's required. 06787 06788 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtLeftMargin 06789 runtime class. 06790 06791 SeeAlso: NodeAttribute::operator== 06792 06793 ********************************************************************************************/ 06794 06795 INT32 AttrTxtLeftMargin::operator==(const NodeAttribute& Attrib) 06796 { 06797 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtLeftMargin)), 06798 "Trying to compare two objects with different types"); 06799 AttrTxtLeftMargin* Attr = (AttrTxtLeftMargin*) &Attrib; 06800 return (Attr->Value.Value == Value.Value); 06801 } 06802 06803 06804 /******************************************************************************************** 06805 06806 > virtual UINT32 AttrTxtLeftMargin::GetAttrNameID(void) 06807 06808 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06809 Created: 22/2/94 06810 Inputs: - 06811 Outputs: - 06812 Returns: Attribute description ID 06813 Purpose: Returns back a string resource ID describing the attribute 06814 06815 Errors: - 06816 SeeAlso: - 06817 06818 ********************************************************************************************/ 06819 06820 UINT32 AttrTxtLeftMargin::GetAttrNameID(void) 06821 { 06822 return (_R(IDS_LEFTMARGIN)); 06823 } 06824 06825 06826 /*********************************************************************************************** 06827 > ` void AttrTxtLeftMargin::CopyNodeContents( AttrTxtLeftMargin* NodeCopy) 06828 06829 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06830 Created: 28/4/93 06831 06832 Inputs: 06833 Outputs: A copy of this node 06834 Returns: - 06835 06836 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 06837 06838 Errors: An assertion failure will occur if NodeCopy is NULL 06839 06840 Scope: protected 06841 06842 ***********************************************************************************************/ 06843 06844 void AttrTxtLeftMargin::CopyNodeContents( AttrTxtLeftMargin* NodeCopy) 06845 { 06846 // Let the base class do its bit 06847 NodeAttribute::CopyNodeContents( NodeCopy ); 06848 06849 //Copy contents specific to derived class here 06850 NodeCopy->Value.Value = Value.Value; 06851 } 06852 06853 06854 /*********************************************************************************************** 06855 > void AttrTxtLeftMargin::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 06856 06857 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 06858 Created: 18/12/2003 06859 Outputs: - 06860 Purpose: Polymorphically copies the contents of this node to another 06861 Errors: An assertion failure will occur if NodeCopy is NULL 06862 Scope: protected 06863 06864 ***********************************************************************************************/ 06865 06866 void AttrTxtLeftMargin::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 06867 { 06868 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 06869 ENSURE(IS_A(pNodeCopy, AttrTxtLeftMargin), "PolyCopyNodeContents given wrong dest node type"); 06870 06871 if (IS_A(pNodeCopy, AttrTxtLeftMargin)) 06872 CopyNodeContents((AttrTxtLeftMargin*)pNodeCopy); 06873 } 06874 06875 /******************************************************************************************** 06876 06877 > virtual UINT32 AttrTxtLeftMargin::GetNodeSize() const 06878 06879 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06880 Created: 6/10/93 06881 Inputs: - 06882 Outputs: - 06883 Returns: The size of the node in bytes 06884 Purpose: For finding the size of the node 06885 06886 SeeAlso: Node::GetSubtreeSize 06887 06888 ********************************************************************************************/ 06889 06890 UINT32 AttrTxtLeftMargin::GetNodeSize() const 06891 { 06892 return (sizeof(AttrTxtLeftMargin)); 06893 } 06894 06895 06896 /******************************************************************************************** 06897 06898 > virtual void AttrTxtLeftMargin::GetDebugDetails() 06899 06900 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 06901 Created: 24/04/94 06902 Inputs: - 06903 Purpose: Used for debugging purposes during developement. Override in your own class 06904 and output suitable debugging details. 06905 06906 ********************************************************************************************/ 06907 06908 void AttrTxtLeftMargin::GetDebugDetails(StringBase* Str) 06909 { 06910 NodeAttribute::GetDebugDetails( Str ); 06911 06912 String_256 TempStr; 06913 TempStr._MakeMsg( TEXT("\r\nLeft margin=#1%ld\r\n"), Value.Value); 06914 (*Str) += TempStr; 06915 } 06916 06917 06918 /******************************************************************************************** 06919 > void AttrTxtLeftMargin::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 06920 06921 Author: Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com> 06922 Created: 4/6/95 06923 Inputs: Scale - 06924 Aspect - 06925 Purpose: Transform the attribute using the baseline relative scale and aspect 06926 ********************************************************************************************/ 06927 06928 void AttrTxtLeftMargin::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 06929 { 06930 TxtLeftMarginAttribute* pLeftMarginAttrVal=(TxtLeftMarginAttribute*)GetAttributeValue(); 06931 pLeftMarginAttrVal->Value = XLONG(pLeftMarginAttrVal->Value) * Scale; 06932 } 06933 06934 06935 /******************************************************************************************** 06936 06937 > BOOL AttrTxtLeftMargin::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 06938 BOOL AttrTxtLeftMargin::WritePreChildrenNative(BaseCamelotFilter* pFilter); 06939 06940 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 06941 Created: 09/07/96 06942 Inputs: pFilter - new camelot filter to save to 06943 Returns: TRUE if successful, FALSE otherwise 06944 Purpose: Saves the text baseline attribute to the new file format filter 06945 06946 ********************************************************************************************/ 06947 06948 BOOL AttrTxtLeftMargin::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 06949 { 06950 #ifdef DO_EXPORT 06951 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 06952 06953 return CXaraFileTxtLeftMargin::WritePreChildrenWeb(pFilter, this); 06954 #else 06955 return FALSE; 06956 #endif 06957 } 06958 06959 BOOL AttrTxtLeftMargin::WritePreChildrenNative(BaseCamelotFilter *pFilter) 06960 { 06961 #ifdef DO_EXPORT 06962 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 06963 06964 return CXaraFileTxtLeftMargin::WritePreChildrenNative(pFilter, this); 06965 #else 06966 return FALSE; 06967 #endif 06968 } 06969 06970 // AttrTxtRightMargin methods 06971 // ----------------------------------------------------------------------------------------- 06972 06973 /******************************************************************************************** 06974 06975 > AttrTxtRightMargin::AttrTxtRightMargin(Node* ContextNode, 06976 AttachNodeDirection Direction, 06977 BOOL Locked, 06978 BOOL Mangled, 06979 BOOL Marked, 06980 BOOL Selected 06981 ): AttrTxtBase(ContextNode, Direction, Locked, 06982 Mangled, Marked, Selected, TRUE) 06983 06984 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 06985 Created: 13/03/95 06986 Inputs: - 06987 Outputs: - 06988 Returns: - 06989 Purpose: Creates a AttrTxtRightMargin Attribute 06990 Errors: - 06991 SeeAlso: - 06992 06993 ********************************************************************************************/ 06994 06995 AttrTxtRightMargin::AttrTxtRightMargin(Node* ContextNode, 06996 AttachNodeDirection Direction, 06997 BOOL Locked, 06998 BOOL Mangled, 06999 BOOL Marked, 07000 BOOL Selected 07001 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 07002 { 07003 } 07004 07005 /******************************************************************************************** 07006 07007 > void AttrTxtRightMargin::Render( RenderRegion* pRender) 07008 07009 Author: Martin Wuerthner <xara@mw-software.com> 07010 Created: 19/06/06 07011 Inputs: pRenderRegion = the render region to which the attribute should be rendered 07012 Purpose: 'Renders' a right margin attribute 07013 07014 ********************************************************************************************/ 07015 07016 void AttrTxtRightMargin::Render( RenderRegion* pRegion) 07017 { 07018 pRegion->SetTxtRightMargin(&Value, FALSE); 07019 } 07020 07021 /*********************************************************************************************** 07022 > Node* AttrTxtRightMargin::SimpleCopy() 07023 07024 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07025 Created: 13/03/95 07026 07027 Inputs: - 07028 Outputs: 07029 Returns: A copy of the node, or NULL if memory runs out 07030 07031 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 07032 The function is virtual, and must be defined for all derived classes. 07033 07034 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 07035 error and the function returns NULL. 07036 07037 Scope: protected 07038 ***********************************************************************************************/ 07039 07040 Node* AttrTxtRightMargin::SimpleCopy() 07041 { 07042 AttrTxtRightMargin* NodeCopy = new AttrTxtRightMargin(); 07043 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 07044 CopyNodeContents(NodeCopy); 07045 return NodeCopy; 07046 } 07047 07048 /******************************************************************************************** 07049 07050 > INT32 AttrTxtRightMargin::operator==(const NodeAttribute& Attrib) 07051 07052 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07053 Created: 13/03/95 07054 Inputs: Atrib: The attribute to compare, which must be an AttrTxtRightMargin 07055 Outputs: - 07056 Returns: - 07057 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 07058 a description of why it's required. 07059 07060 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtRightMargin 07061 runtime class. 07062 07063 SeeAlso: NodeAttribute::operator== 07064 07065 ********************************************************************************************/ 07066 07067 INT32 AttrTxtRightMargin::operator==(const NodeAttribute& Attrib) 07068 { 07069 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtRightMargin)), 07070 "Trying to compare two objects with different types"); 07071 AttrTxtRightMargin* Attr = (AttrTxtRightMargin*) &Attrib; 07072 return (Attr->Value.Value == Value.Value); 07073 } 07074 07075 07076 /******************************************************************************************** 07077 07078 > virtual UINT32 AttrTxtRightMargin::GetAttrNameID(void) 07079 07080 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07081 Created: 22/2/94 07082 Inputs: - 07083 Outputs: - 07084 Returns: Attribute description ID 07085 Purpose: Returns back a string resource ID describing the attribute 07086 07087 Errors: - 07088 SeeAlso: - 07089 07090 ********************************************************************************************/ 07091 07092 UINT32 AttrTxtRightMargin::GetAttrNameID(void) 07093 { 07094 return (_R(IDS_RIGHTMARGIN)); 07095 } 07096 07097 07098 /*********************************************************************************************** 07099 > ` void AttrTxtRightMargin::CopyNodeContents( AttrTxtRightMargin* NodeCopy) 07100 07101 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07102 Created: 28/4/93 07103 07104 Inputs: 07105 Outputs: A copy of this node 07106 Returns: - 07107 07108 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 07109 07110 Errors: An assertion failure will occur if NodeCopy is NULL 07111 07112 Scope: protected 07113 07114 ***********************************************************************************************/ 07115 07116 void AttrTxtRightMargin::CopyNodeContents( AttrTxtRightMargin* NodeCopy) 07117 { 07118 // Let the base class do its bit 07119 NodeAttribute::CopyNodeContents( NodeCopy ); 07120 07121 //Copy contents specific to derived class here 07122 NodeCopy->Value.Value = Value.Value; 07123 } 07124 07125 07126 /*********************************************************************************************** 07127 > void AttrTxtRightMargin::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 07128 07129 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 07130 Created: 18/12/2003 07131 Outputs: - 07132 Purpose: Polymorphically copies the contents of this node to another 07133 Errors: An assertion failure will occur if NodeCopy is NULL 07134 Scope: protected 07135 07136 ***********************************************************************************************/ 07137 07138 void AttrTxtRightMargin::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 07139 { 07140 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 07141 ENSURE(IS_A(pNodeCopy, AttrTxtRightMargin), "PolyCopyNodeContents given wrong dest node type"); 07142 07143 if (IS_A(pNodeCopy, AttrTxtRightMargin)) 07144 CopyNodeContents((AttrTxtRightMargin*)pNodeCopy); 07145 } 07146 07147 /******************************************************************************************** 07148 07149 > virtual UINT32 AttrTxtRightMargin::GetNodeSize() const 07150 07151 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07152 Created: 6/10/93 07153 Inputs: - 07154 Outputs: - 07155 Returns: The size of the node in bytes 07156 Purpose: For finding the size of the node 07157 07158 SeeAlso: Node::GetSubtreeSize 07159 07160 ********************************************************************************************/ 07161 07162 UINT32 AttrTxtRightMargin::GetNodeSize() const 07163 { 07164 return (sizeof(AttrTxtRightMargin)); 07165 } 07166 07167 07168 /******************************************************************************************** 07169 07170 > virtual void AttrTxtRightMargin::GetDebugDetails() 07171 07172 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 07173 Created: 24/04/94 07174 Inputs: - 07175 Purpose: Used for debugging purposes during developement. Override in your own class 07176 and output suitable debugging details. 07177 07178 ********************************************************************************************/ 07179 07180 void AttrTxtRightMargin::GetDebugDetails(StringBase* Str) 07181 { 07182 NodeAttribute::GetDebugDetails( Str ); 07183 07184 String_256 TempStr; 07185 TempStr._MakeMsg( TEXT("\r\nRight margin=#1%ld\r\n"), Value.Value); 07186 (*Str) += TempStr; 07187 } 07188 07189 07190 /******************************************************************************************** 07191 > void AttrTxtRightMargin::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 07192 07193 Author: Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com> 07194 Created: 4/6/95 07195 Inputs: Scale - 07196 Aspect - 07197 Purpose: Transform the attribute using the baseline relative scale and aspect 07198 ********************************************************************************************/ 07199 07200 void AttrTxtRightMargin::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 07201 { 07202 TxtRightMarginAttribute* pRightMarginAttrVal=(TxtRightMarginAttribute*)GetAttributeValue(); 07203 pRightMarginAttrVal->Value = XLONG(pRightMarginAttrVal->Value) * Scale; 07204 } 07205 07206 07207 /******************************************************************************************** 07208 07209 > BOOL AttrTxtRightMargin::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 07210 BOOL AttrTxtRightMargin::WritePreChildrenNative(BaseCamelotFilter* pFilter); 07211 07212 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 07213 Created: 09/07/96 07214 Inputs: pFilter - new camelot filter to save to 07215 Returns: TRUE if successful, FALSE otherwise 07216 Purpose: Saves the text baseline attribute to the new file format filter 07217 07218 ********************************************************************************************/ 07219 07220 BOOL AttrTxtRightMargin::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 07221 { 07222 #ifdef DO_EXPORT 07223 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 07224 07225 return CXaraFileTxtRightMargin::WritePreChildrenWeb(pFilter, this); 07226 #else 07227 return FALSE; 07228 #endif 07229 } 07230 07231 BOOL AttrTxtRightMargin::WritePreChildrenNative(BaseCamelotFilter *pFilter) 07232 { 07233 #ifdef DO_EXPORT 07234 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 07235 07236 return CXaraFileTxtRightMargin::WritePreChildrenNative(pFilter, this); 07237 #else 07238 return FALSE; 07239 #endif 07240 } 07241 07242 07243 // AttrTxtFirstIndent methods 07244 // ----------------------------------------------------------------------------------------- 07245 07246 /******************************************************************************************** 07247 07248 > AttrTxtFirstIndent::AttrTxtFirstIndent(Node* ContextNode, 07249 AttachNodeDirection Direction, 07250 BOOL Locked, 07251 BOOL Mangled, 07252 BOOL Marked, 07253 BOOL Selected 07254 ): AttrTxtBase(ContextNode, Direction, Locked, 07255 Mangled, Marked, Selected, TRUE) 07256 07257 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07258 Created: 13/03/95 07259 Inputs: - 07260 Outputs: - 07261 Returns: - 07262 Purpose: Creates a AttrTxtFirstIndent Attribute 07263 Errors: - 07264 SeeAlso: - 07265 07266 ********************************************************************************************/ 07267 07268 AttrTxtFirstIndent::AttrTxtFirstIndent(Node* ContextNode, 07269 AttachNodeDirection Direction, 07270 BOOL Locked, 07271 BOOL Mangled, 07272 BOOL Marked, 07273 BOOL Selected 07274 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 07275 { 07276 } 07277 07278 /******************************************************************************************** 07279 07280 > void AttrTxtFirstIndent::Render( RenderRegion* pRender) 07281 07282 Author: Martin Wuerthner <xara@mw-software.com> 07283 Created: 19/06/06 07284 Inputs: pRenderRegion = the render region to which the attribute should be rendered 07285 Purpose: 'Renders' a left indent attribute 07286 07287 ********************************************************************************************/ 07288 07289 void AttrTxtFirstIndent::Render( RenderRegion* pRegion) 07290 { 07291 pRegion->SetTxtFirstIndent(&Value, FALSE); 07292 } 07293 07294 /*********************************************************************************************** 07295 > Node* AttrTxtFirstIndent::SimpleCopy() 07296 07297 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07298 Created: 13/03/95 07299 07300 Inputs: - 07301 Outputs: 07302 Returns: A copy of the node, or NULL if memory runs out 07303 07304 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 07305 The function is virtual, and must be defined for all derived classes. 07306 07307 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 07308 error and the function returns NULL. 07309 07310 Scope: protected 07311 ***********************************************************************************************/ 07312 07313 Node* AttrTxtFirstIndent::SimpleCopy() 07314 { 07315 AttrTxtFirstIndent* NodeCopy = new AttrTxtFirstIndent(); 07316 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 07317 CopyNodeContents(NodeCopy); 07318 return NodeCopy; 07319 } 07320 07321 /******************************************************************************************** 07322 07323 > INT32 AttrTxtFirstIndent::operator==(const NodeAttribute& Attrib) 07324 07325 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07326 Created: 13/03/95 07327 Inputs: Atrib: The attribute to compare, which must be an AttrTxtFirstIndent 07328 Outputs: - 07329 Returns: - 07330 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 07331 a description of why it's required. 07332 07333 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtFirstIndent 07334 runtime class. 07335 07336 SeeAlso: NodeAttribute::operator== 07337 07338 ********************************************************************************************/ 07339 07340 INT32 AttrTxtFirstIndent::operator==(const NodeAttribute& Attrib) 07341 { 07342 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtFirstIndent)), 07343 "Trying to compare two objects with different types"); 07344 AttrTxtFirstIndent* Attr = (AttrTxtFirstIndent*) &Attrib; 07345 return (Attr->Value.Value == Value.Value); 07346 } 07347 07348 07349 /******************************************************************************************** 07350 07351 > virtual UINT32 AttrTxtFirstIndent::GetAttrNameID(void) 07352 07353 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07354 Created: 22/2/94 07355 Inputs: - 07356 Outputs: - 07357 Returns: Attribute description ID 07358 Purpose: Returns back a string resource ID describing the attribute 07359 07360 Errors: - 07361 SeeAlso: - 07362 07363 ********************************************************************************************/ 07364 07365 UINT32 AttrTxtFirstIndent::GetAttrNameID(void) 07366 { 07367 return (_R(IDS_FIRSTINDENT)); 07368 } 07369 07370 07371 /*********************************************************************************************** 07372 > ` void AttrTxtFirstIndent::CopyNodeContents( AttrTxtFirstIndent* NodeCopy) 07373 07374 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07375 Created: 28/4/93 07376 07377 Inputs: 07378 Outputs: A copy of this node 07379 Returns: - 07380 07381 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 07382 07383 Errors: An assertion failure will occur if NodeCopy is NULL 07384 07385 Scope: protected 07386 07387 ***********************************************************************************************/ 07388 07389 void AttrTxtFirstIndent::CopyNodeContents( AttrTxtFirstIndent* NodeCopy) 07390 { 07391 // Let the base class do its bit 07392 NodeAttribute::CopyNodeContents( NodeCopy ); 07393 07394 //Copy contents specific to derived class here 07395 NodeCopy->Value.Value = Value.Value; 07396 } 07397 07398 07399 /*********************************************************************************************** 07400 > void AttrTxtFirstIndent::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 07401 07402 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 07403 Created: 18/12/2003 07404 Outputs: - 07405 Purpose: Polymorphically copies the contents of this node to another 07406 Errors: An assertion failure will occur if NodeCopy is NULL 07407 Scope: protected 07408 07409 ***********************************************************************************************/ 07410 07411 void AttrTxtFirstIndent::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 07412 { 07413 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 07414 ENSURE(IS_A(pNodeCopy, AttrTxtFirstIndent), "PolyCopyNodeContents given wrong dest node type"); 07415 07416 if (IS_A(pNodeCopy, AttrTxtFirstIndent)) 07417 CopyNodeContents((AttrTxtFirstIndent*)pNodeCopy); 07418 } 07419 07420 /******************************************************************************************** 07421 07422 > virtual UINT32 AttrTxtFirstIndent::GetNodeSize() const 07423 07424 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07425 Created: 6/10/93 07426 Inputs: - 07427 Outputs: - 07428 Returns: The size of the node in bytes 07429 Purpose: For finding the size of the node 07430 07431 SeeAlso: Node::GetSubtreeSize 07432 07433 ********************************************************************************************/ 07434 07435 UINT32 AttrTxtFirstIndent::GetNodeSize() const 07436 { 07437 return (sizeof(AttrTxtFirstIndent)); 07438 } 07439 07440 07441 /******************************************************************************************** 07442 07443 > virtual void AttrTxtFirstIndent::GetDebugDetails() 07444 07445 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 07446 Created: 24/04/94 07447 Inputs: - 07448 Purpose: Used for debugging purposes during developement. Override in your own class 07449 and output suitable debugging details. 07450 07451 ********************************************************************************************/ 07452 07453 void AttrTxtFirstIndent::GetDebugDetails(StringBase* Str) 07454 { 07455 NodeAttribute::GetDebugDetails( Str ); 07456 07457 String_256 TempStr; 07458 TempStr._MakeMsg( TEXT("\r\nLeft margin=#1%ld\r\n"), Value.Value); 07459 (*Str) += TempStr; 07460 } 07461 07462 07463 /******************************************************************************************** 07464 > void AttrTxtFirstIndent::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 07465 07466 Author: Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com> 07467 Created: 4/6/95 07468 Inputs: Scale - 07469 Aspect - 07470 Purpose: Transform the attribute using the baseline relative scale and aspect 07471 ********************************************************************************************/ 07472 07473 void AttrTxtFirstIndent::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 07474 { 07475 TxtFirstIndentAttribute* pFirstIndentAttrVal=(TxtFirstIndentAttribute*)GetAttributeValue(); 07476 pFirstIndentAttrVal->Value = XLONG(pFirstIndentAttrVal->Value) * Scale; 07477 } 07478 07479 07480 /******************************************************************************************** 07481 07482 > BOOL AttrTxtFirstIndent::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 07483 BOOL AttrTxtFirstIndent::WritePreChildrenNative(BaseCamelotFilter* pFilter); 07484 07485 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 07486 Created: 09/07/96 07487 Inputs: pFilter - new camelot filter to save to 07488 Returns: TRUE if successful, FALSE otherwise 07489 Purpose: Saves the text baseline attribute to the new file format filter 07490 07491 ********************************************************************************************/ 07492 07493 BOOL AttrTxtFirstIndent::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 07494 { 07495 #ifdef DO_EXPORT 07496 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 07497 07498 return CXaraFileTxtFirstIndent::WritePreChildrenWeb(pFilter, this); 07499 #else 07500 return FALSE; 07501 #endif 07502 } 07503 07504 BOOL AttrTxtFirstIndent::WritePreChildrenNative(BaseCamelotFilter *pFilter) 07505 { 07506 #ifdef DO_EXPORT 07507 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 07508 07509 return CXaraFileTxtFirstIndent::WritePreChildrenNative(pFilter, this); 07510 #else 07511 return FALSE; 07512 #endif 07513 } 07514 07515 07516 // AttrTxtRuler methods 07517 // ----------------------------------------------------------------------------------------- 07518 07519 /******************************************************************************************** 07520 07521 > AttrTxtRuler::AttrTxtRuler(Node* ContextNode, 07522 AttachNodeDirection Direction, 07523 BOOL Locked, 07524 BOOL Mangled, 07525 BOOL Marked, 07526 BOOL Selected 07527 ): AttrTxtBase(ContextNode, Direction, Locked, 07528 Mangled, Marked, Selected, TRUE) 07529 07530 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07531 Created: 13/03/95 07532 Inputs: - 07533 Outputs: - 07534 Returns: - 07535 Purpose: Creates a AttrTxtRuler Attribute 07536 Errors: - 07537 SeeAlso: - 07538 07539 ********************************************************************************************/ 07540 07541 AttrTxtRuler::AttrTxtRuler(Node* ContextNode, 07542 AttachNodeDirection Direction, 07543 BOOL Locked, 07544 BOOL Mangled, 07545 BOOL Marked, 07546 BOOL Selected 07547 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 07548 { 07549 } 07550 07551 /******************************************************************************************** 07552 07553 > void AttrTxtRuler::Render( RenderRegion* pRender) 07554 07555 Author: Martin Wuerthner <xara@mw-software.com> 07556 Created: 19/06/06 07557 Inputs: pRenderRegion = the render region to which the attribute should be rendered 07558 Purpose: 'Renders' a ruler attribute 07559 07560 ********************************************************************************************/ 07561 07562 void AttrTxtRuler::Render( RenderRegion* pRegion) 07563 { 07564 pRegion->SetTxtRuler(&Value, FALSE); 07565 } 07566 07567 /*********************************************************************************************** 07568 > Node* AttrTxtRuler::SimpleCopy() 07569 07570 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07571 Created: 13/03/95 07572 07573 Inputs: - 07574 Outputs: 07575 Returns: A copy of the node, or NULL if memory runs out 07576 07577 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 07578 The function is virtual, and must be defined for all derived classes. 07579 07580 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 07581 error and the function returns NULL. 07582 07583 Scope: protected 07584 ***********************************************************************************************/ 07585 07586 Node* AttrTxtRuler::SimpleCopy() 07587 { 07588 AttrTxtRuler* NodeCopy = new AttrTxtRuler(); 07589 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 07590 CopyNodeContents(NodeCopy); 07591 return NodeCopy; 07592 } 07593 07594 /******************************************************************************************** 07595 07596 > INT32 AttrTxtRuler::operator==(const NodeAttribute& Attrib) 07597 07598 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07599 Created: 13/03/95 07600 Inputs: Atrib: The attribute to compare, which must be an AttrTxtRuler 07601 Outputs: - 07602 Returns: - 07603 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 07604 a description of why it's required. 07605 07606 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtRuler 07607 runtime class. 07608 07609 SeeAlso: NodeAttribute::operator== 07610 07611 ********************************************************************************************/ 07612 07613 INT32 AttrTxtRuler::operator==(const NodeAttribute& Attrib) 07614 { 07615 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtRuler)), 07616 "Trying to compare two objects with different types"); 07617 AttrTxtRuler* Attr = (AttrTxtRuler*) &Attrib; 07618 07619 return (Attr->Value == Value); 07620 } 07621 07622 07623 /******************************************************************************************** 07624 07625 > virtual UINT32 AttrTxtRuler::GetAttrNameID(void) 07626 07627 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07628 Created: 22/2/94 07629 Inputs: - 07630 Outputs: - 07631 Returns: Attribute description ID 07632 Purpose: Returns back a string resource ID describing the attribute 07633 07634 Errors: - 07635 SeeAlso: - 07636 07637 ********************************************************************************************/ 07638 07639 UINT32 AttrTxtRuler::GetAttrNameID(void) 07640 { 07641 return (_R(IDS_RULER)); 07642 } 07643 07644 07645 /*********************************************************************************************** 07646 > ` void AttrTxtRuler::CopyNodeContents( AttrTxtRuler* NodeCopy) 07647 07648 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07649 Created: 28/4/93 07650 07651 Inputs: 07652 Outputs: A copy of this node 07653 Returns: - 07654 07655 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 07656 07657 Errors: An assertion failure will occur if NodeCopy is NULL 07658 07659 Scope: protected 07660 07661 ***********************************************************************************************/ 07662 07663 void AttrTxtRuler::CopyNodeContents( AttrTxtRuler* NodeCopy) 07664 { 07665 // Let the base class do its bit 07666 NodeAttribute::CopyNodeContents( NodeCopy ); 07667 07668 //Copy contents specific to derived class here 07669 NodeCopy->Value = Value; 07670 } 07671 07672 07673 /*********************************************************************************************** 07674 > void AttrTxtRuler::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 07675 07676 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 07677 Created: 18/12/2003 07678 Outputs: - 07679 Purpose: Polymorphically copies the contents of this node to another 07680 Errors: An assertion failure will occur if NodeCopy is NULL 07681 Scope: protected 07682 07683 ***********************************************************************************************/ 07684 07685 void AttrTxtRuler::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 07686 { 07687 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 07688 ENSURE(IS_A(pNodeCopy, AttrTxtRuler), "PolyCopyNodeContents given wrong dest node type"); 07689 07690 if (IS_A(pNodeCopy, AttrTxtRuler)) 07691 CopyNodeContents((AttrTxtRuler*)pNodeCopy); 07692 } 07693 07694 /******************************************************************************************** 07695 07696 > virtual UINT32 AttrTxtRuler::GetNodeSize() const 07697 07698 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07699 Created: 6/10/93 07700 Inputs: - 07701 Outputs: - 07702 Returns: The size of the node in bytes 07703 Purpose: For finding the size of the node 07704 07705 SeeAlso: Node::GetSubtreeSize 07706 07707 ********************************************************************************************/ 07708 07709 UINT32 AttrTxtRuler::GetNodeSize() const 07710 { 07711 return (sizeof(AttrTxtRuler)); 07712 } 07713 07714 07715 /******************************************************************************************** 07716 07717 > virtual void AttrTxtRuler::GetDebugDetails() 07718 07719 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 07720 Created: 24/04/94 07721 Inputs: - 07722 Purpose: Used for debugging purposes during developement. Override in your own class 07723 and output suitable debugging details. 07724 07725 ********************************************************************************************/ 07726 07727 void AttrTxtRuler::GetDebugDetails(StringBase* Str) 07728 { 07729 NodeAttribute::GetDebugDetails( Str ); 07730 07731 String_256 TempStr; 07732 TempStr._MakeMsg( TEXT("\r\nRuler(#1%08x)="), Value.Value); 07733 (*Str) += TempStr; 07734 for (TxtTabStopIterator It = Value.begin(); It != Value.end(); ++It) 07735 { 07736 switch((*It).GetType()) 07737 { 07738 case LeftTab: 07739 TempStr._MakeMsg( TEXT("L(#1%ld)"), (*It).GetPosition()); 07740 break; 07741 case RightTab: 07742 TempStr._MakeMsg( TEXT("R(#1%ld)"), (*It).GetPosition()); 07743 break; 07744 case CentreTab: 07745 TempStr._MakeMsg( TEXT("C(#1%ld)"), (*It).GetPosition()); 07746 break; 07747 case DecimalTab: 07748 TempStr._MakeMsg( TEXT("D(#1%ld)"), (*It).GetPosition()); 07749 break; 07750 } 07751 (*Str) += TempStr; 07752 } 07753 (*Str) += _T("\r\n"); 07754 } 07755 07756 07757 /******************************************************************************************** 07758 > void AttrTxtRuler::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 07759 07760 Author: Martin Wuerthner <xara@mw-software.com> 07761 Created: 04/07/06 07762 Inputs: Scale - 07763 Aspect - 07764 Purpose: Transform the attribute using the baseline relative scale and aspect 07765 ********************************************************************************************/ 07766 07767 void AttrTxtRuler::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 07768 { 07769 TxtRulerAttribute* pRulerAttrVal=(TxtRulerAttribute*)GetAttributeValue(); 07770 TxtRuler* pRuler = pRulerAttrVal->Value; 07771 07772 for (TxtTabStopIterator it = pRuler->begin(); it != pRuler->end(); ++it) 07773 { 07774 MILLIPOINT pos = (*it).GetPosition(); 07775 (*it).SetPosition(XLONG(pos) * Scale); 07776 } 07777 } 07778 07779 07780 /******************************************************************************************** 07781 07782 > BOOL AttrTxtRuler::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 07783 BOOL AttrTxtRuler::WritePreChildrenNative(BaseCamelotFilter* pFilter); 07784 07785 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 07786 Created: 09/07/96 07787 Inputs: pFilter - new camelot filter to save to 07788 Returns: TRUE if successful, FALSE otherwise 07789 Purpose: Saves the text baseline attribute to the new file format filter 07790 07791 ********************************************************************************************/ 07792 07793 BOOL AttrTxtRuler::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 07794 { 07795 #ifdef DO_EXPORT 07796 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 07797 07798 return CXaraFileTxtRuler::WritePreChildrenWeb(pFilter, this); 07799 #else 07800 return FALSE; 07801 #endif 07802 } 07803 07804 BOOL AttrTxtRuler::WritePreChildrenNative(BaseCamelotFilter *pFilter) 07805 { 07806 #ifdef DO_EXPORT 07807 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 07808 07809 return CXaraFileTxtRuler::WritePreChildrenNative(pFilter, this); 07810 #else 07811 return FALSE; 07812 #endif 07813 } 07814 07815 // AttrTxtLineSpace methods 07816 // ----------------------------------------------------------------------------------------- 07817 07818 /******************************************************************************************** 07819 07820 > AttrTxtLineSpace::AttrTxtLineSpace(Node* ContextNode, 07821 AttachNodeDirection Direction, 07822 BOOL Locked, 07823 BOOL Mangled, 07824 BOOL Marked, 07825 BOOL Selected 07826 ): AttrTxtBase(ContextNode, Direction, Locked, 07827 Mangled, Marked, Selected, TRUE) 07828 07829 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07830 Created: 13/03/95 07831 Inputs: - 07832 Outputs: - 07833 Returns: - 07834 Purpose: Creates a AttrTxtLineSpace Attribute 07835 Errors: - 07836 SeeAlso: - 07837 07838 ********************************************************************************************/ 07839 07840 AttrTxtLineSpace::AttrTxtLineSpace(Node* ContextNode, 07841 AttachNodeDirection Direction, 07842 BOOL Locked, 07843 BOOL Mangled, 07844 BOOL Marked, 07845 BOOL Selected 07846 ): AttrTxtBase(ContextNode, Direction, Locked, Mangled, Marked, Selected) 07847 { 07848 } 07849 07850 /******************************************************************************************** 07851 07852 > AttrTxtLineSpace::AttrTxtLineSpace() 07853 07854 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07855 Created: 13/03/95 07856 Inputs: - 07857 Outputs: - 07858 Returns: - 07859 Purpose: Default constructor for AttrTxtLineSpace class 07860 Errors: - 07861 SeeAlso: - 07862 07863 ********************************************************************************************/ 07864 07865 AttrTxtLineSpace::AttrTxtLineSpace() 07866 { 07867 } 07868 07869 07870 /******************************************************************************************** 07871 07872 > AttrTxtLineSpace::AttrTxtLineSpace(MILLIPOINT Value) 07873 07874 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07875 Created: 13/03/95 07876 Inputs: - 07877 Outputs: - 07878 Returns: - 07879 Purpose: Default constructor for AttrTxtLineSpace class 07880 Errors: - 07881 SeeAlso: - 07882 07883 ********************************************************************************************/ 07884 07885 AttrTxtLineSpace::AttrTxtLineSpace(MILLIPOINT value) 07886 { 07887 Value.Value = value; 07888 Value.Ratio = 0; 07889 Value.IsRatio = FALSE; 07890 } 07891 07892 07893 /******************************************************************************************** 07894 07895 > AttrTxtLineSpace::AttrTxtLineSpace(FIXED16 Ratio) 07896 07897 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07898 Created: 13/03/95 07899 Inputs: - 07900 Outputs: - 07901 Returns: - 07902 Purpose: Default constructor for AttrTxtLineSpace class 07903 Errors: - 07904 SeeAlso: - 07905 07906 ********************************************************************************************/ 07907 07908 AttrTxtLineSpace::AttrTxtLineSpace(FIXED16 ratio) 07909 { 07910 Value.Ratio = ratio; 07911 Value.Value = 0; 07912 Value.IsRatio = TRUE; 07913 07914 } 07915 07916 07917 /******************************************************************************************** 07918 07919 > void AttrTxtLineSpace::Render( RenderRegion* pRender) 07920 07921 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07922 Created: 13/03/95 07923 Inputs: - 07924 Outputs: - 07925 Returns: - 07926 Purpose: 'Renders' a Line Width attribute. 07927 Errors: - 07928 SeeAlso: - 07929 07930 ********************************************************************************************/ 07931 07932 void AttrTxtLineSpace::Render( RenderRegion* pRegion) 07933 { 07934 pRegion->SetTxtLineSpace(&Value, FALSE); 07935 } 07936 07937 07938 07939 /*********************************************************************************************** 07940 > Node* AttrTxtLineSpace::SimpleCopy() 07941 07942 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07943 Created: 13/03/95 07944 07945 Inputs: - 07946 Outputs: 07947 Returns: A copy of the node, or NULL if memory runs out 07948 07949 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 07950 The function is virtual, and must be defined for all derived classes. 07951 07952 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 07953 error and the function returns NULL. 07954 07955 Scope: protected 07956 ***********************************************************************************************/ 07957 07958 Node* AttrTxtLineSpace::SimpleCopy() 07959 { 07960 AttrTxtLineSpace* NodeCopy = new AttrTxtLineSpace(); 07961 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 07962 CopyNodeContents(NodeCopy); 07963 return NodeCopy; 07964 } 07965 07966 /******************************************************************************************** 07967 07968 > INT32 AttrTxtLineSpace::operator==(const NodeAttribute& Attrib) 07969 07970 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07971 Created: 13/03/95 07972 Inputs: Atrib: The attribute to compare, which must be an AttrLineWidth 07973 Outputs: - 07974 Returns: - 07975 Purpose: A virtual comparison operator. See NodeAttribute::operator== for 07976 a description of why it's required. 07977 07978 Errors: An ENSURE failure will occur if Attrib does not have a AttrTxtLineSpace 07979 runtime class. 07980 07981 SeeAlso: NodeAttribute::operator== 07982 07983 ********************************************************************************************/ 07984 07985 INT32 AttrTxtLineSpace::operator==(const NodeAttribute& Attrib) 07986 { 07987 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTxtLineSpace)), 07988 "Trying to compare two objects with different types"); 07989 AttrTxtLineSpace* Attr = (AttrTxtLineSpace*) &Attrib; 07990 return (Attr->Value == Value); 07991 } 07992 07993 07994 /******************************************************************************************** 07995 07996 > virtual UINT32 AttrTxtLineSpace::GetAttrNameID(void) 07997 07998 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 07999 Created: 22/2/94 08000 Inputs: - 08001 Outputs: - 08002 Returns: Attribute description ID 08003 Purpose: Returns back a string resource ID describing the attribute 08004 08005 Errors: - 08006 SeeAlso: - 08007 08008 ********************************************************************************************/ 08009 08010 UINT32 AttrTxtLineSpace::GetAttrNameID(void) 08011 { 08012 return (_R(IDS_LINESPACE)); 08013 } 08014 08015 08016 /*********************************************************************************************** 08017 > ` void AttrTxtLineSpace::CopyNodeContents( AttrTxtLineSpace* NodeCopy) 08018 08019 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 08020 Created: 28/4/93 08021 08022 Inputs: 08023 Outputs: A copy of this node 08024 Returns: - 08025 08026 Purpose: This method copies the node's contents to the node pointed to by NodeCopy. 08027 08028 Errors: An assertion failure will occur if NodeCopy is NULL 08029 08030 Scope: protected 08031 08032 ***********************************************************************************************/ 08033 08034 void AttrTxtLineSpace::CopyNodeContents( AttrTxtLineSpace* NodeCopy) 08035 { 08036 // Let the base class do its bit 08037 NodeAttribute::CopyNodeContents( NodeCopy ); 08038 NodeCopy->Value = Value; 08039 08040 } 08041 08042 08043 /*********************************************************************************************** 08044 > void AttrTxtLineSpace::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 08045 08046 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 08047 Created: 18/12/2003 08048 Outputs: - 08049 Purpose: Polymorphically copies the contents of this node to another 08050 Errors: An assertion failure will occur if NodeCopy is NULL 08051 Scope: protected 08052 08053 ***********************************************************************************************/ 08054 08055 void AttrTxtLineSpace::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 08056 { 08057 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 08058 ENSURE(IS_A(pNodeCopy, AttrTxtLineSpace), "PolyCopyNodeContents given wrong dest node type"); 08059 08060 if (IS_A(pNodeCopy, AttrTxtLineSpace)) 08061 CopyNodeContents((AttrTxtLineSpace*)pNodeCopy); 08062 } 08063 08064 08065 08066 /******************************************************************************************** 08067 08068 > virtual UINT32 AttrTxtLineSpace::GetNodeSize() const 08069 08070 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 08071 Created: 6/10/93 08072 Inputs: - 08073 Outputs: - 08074 Returns: The size of the node in bytes 08075 Purpose: For finding the size of the node 08076 08077 SeeAlso: Node::GetSubtreeSize 08078 08079 ********************************************************************************************/ 08080 08081 UINT32 AttrTxtLineSpace::GetNodeSize() const 08082 { 08083 return (sizeof(AttrTxtLineSpace)); 08084 } 08085 08086 08087 /******************************************************************************************** 08088 08089 > virtual void AttrTxtLineSpace::GetDebugDetails() 08090 08091 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 08092 Created: 24/04/94 08093 Inputs: - 08094 Purpose: Used for debugging purposes during developement. Override in your own class 08095 and output suitable debugging details. 08096 08097 ********************************************************************************************/ 08098 08099 void AttrTxtLineSpace::GetDebugDetails(StringBase* Str) 08100 { 08101 NodeAttribute::GetDebugDetails( Str ); 08102 08103 08104 TCHAR buf[64]; 08105 camSnprintf( buf, 64, _T("\r\nLineSpace = %ld\r\nRatio = %.2f"), Value.Value, Value.Ratio.MakeDouble() ); 08106 //TempStr._MakeMsg( TEXT("\r\nLine space=#1%ld\r\n Ratio=#2%f\r\n"), Value.Value,Value.Ratio.MakeDouble()); 08107 (*Str) += buf; 08108 } 08109 08110 08111 /******************************************************************************************** 08112 > void AttrTxtLineSpace::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 08113 08114 Author: Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com> 08115 Created: 4/6/95 08116 Inputs: Scale - 08117 Aspect - 08118 Purpose: Transform the attribute using the baseline relative scale and aspect 08119 ********************************************************************************************/ 08120 08121 void AttrTxtLineSpace::BaseLineRelativeTransform(FIXED16 Scale, FIXED16 Aspect) 08122 { 08123 // absolute line spacing only - which is 0 if line spacing is relative so has no effect in that case 08124 TxtLineSpaceAttribute* pLineSpaceAttrVal=(TxtLineSpaceAttribute*)GetAttributeValue(); 08125 pLineSpaceAttrVal->Value = XLONG(pLineSpaceAttrVal->Value) * Scale; 08126 } 08127 08128 /******************************************************************************************** 08129 08130 > BOOL AttrTxtLineSpace::WritePreChildrenWeb(BaseCamelotFilter* pFilter); 08131 BOOL AttrTxtLineSpace::WritePreChildrenNative(BaseCamelotFilter* pFilter); 08132 08133 Author: Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com> 08134 Created: 09/07/96 08135 Inputs: pFilter - new camelot filter to save to 08136 Returns: TRUE if successful, FALSE otherwise 08137 Purpose: Saves the text line spacing attribute to the new file format filter 08138 08139 ********************************************************************************************/ 08140 08141 BOOL AttrTxtLineSpace::WritePreChildrenWeb(BaseCamelotFilter *pFilter) 08142 { 08143 #ifdef DO_EXPORT 08144 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 08145 08146 return CXaraFileTxtLineSpace::WritePreChildrenWeb(pFilter, this); 08147 #else 08148 return FALSE; 08149 #endif 08150 } 08151 08152 BOOL AttrTxtLineSpace::WritePreChildrenNative(BaseCamelotFilter *pFilter) 08153 { 08154 #ifdef DO_EXPORT 08155 ERROR2IF(pFilter==NULL, FALSE, "Parameter pFilter == NULL."); 08156 08157 return CXaraFileTxtLineSpace::WritePreChildrenNative(pFilter, this); 08158 #else 08159 return FALSE; 08160 #endif 08161 } 08162 08164 // CharDescription methods 08165 08166 /******************************************************************************************** 08167 > CharDescription::CharDescription(WCHAR CharCode, WORD TypefaceHandle, BOOL Bold, BOOL Italic) 08168 08169 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 08170 Created: 20/3/95 08171 Inputs: CharCode : Unicode character, LO-BYTE identical to ASCII 08172 TypefaceHandle: This must be in the range 0..16384(2 power 14) 08173 Bold : Bold or not 08174 Italic : Italic or not 08175 Purpose: CharDescription constructor 08176 ********************************************************************************************/ 08177 08178 CharDescription::CharDescription(WCHAR CharCode, WORD TypefaceHandle, BOOL Bold, BOOL Italic) 08179 { 08180 charHandle = CharCode <<16; // CharCode occupies HI-WORD 08181 charHandle+=(Bold ? 1<<15 : 0); // Top bit of LOW-WORD 08182 charHandle+=(Italic ? 1<<14 : 0); // Next bit 08183 charHandle+= TypefaceHandle; // Lowest 14 bits of LOW-WORD 08184 08185 ERROR3IF (CharCode!=GetCharCode() || TypefaceHandle!=GetTypefaceHandle() || 08186 Bold!=GetBold() || Italic!=GetItalic(), "Invalid CharHandle generated"); 08187 } 08188 08189 08190 08191 /******************************************************************************************** 08192 > CharDescription::CharDescription(CharDescription& that) 08193 08194 Author: Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com> 08195 Created: 24/4/95 08196 Inputs: Reference to a CharDescriptor 08197 Purpose: CharDescription constructor from another CharDescriptor 08198 ********************************************************************************************/ 08199 08200 CharDescription::CharDescription(CharDescription& that) 08201 { 08202 charHandle = that.charHandle; 08203 }