lineattr.cpp

Go to the documentation of this file.
00001 // $Id: lineattr.cpp 1688 2006-08-10 12:05:20Z gerry $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 
00099 /*
00100 */
00101     
00102 #include "camtypes.h"                          
00103 #include "lineattr.h"
00104 //#include "errors.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00105 //#include "mario.h"
00106 //#include "simon.h"
00107 //#include "tim.h"
00108 //#include "will.h"
00109 //#include "attrmgr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00110 //#include "tranform.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00111 #include "blobs.h"
00112 //#include "app.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00113 //#include "fixed16.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00114 #include "blendatt.h"
00115 #include "nodepath.h"
00116 //#include "ink.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00117 #include "attrmap.h"
00118 //#include "camfiltr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00119 #include "cxftags.h"
00120 //#include "cxfdefs.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00121 #include "rechattr.h"   // Record handling classes for attributes
00122 //#include "cxfrec.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00123 #include "cxfdash.h"    // Default dash pattern references
00124 #include "cxfarrow.h"   // Default arrow head/tail references
00125 #include "cxfcols.h"    // REF_DEFAULTCOLOUR_TRANSPARENT ...
00126 
00127 DECLARE_SOURCE("$Revision: 1688 $");
00128 
00129 CC_IMPLEMENT_DYNCREATE(AttrStrokeColour,    AttrFillGeometry)
00130 CC_IMPLEMENT_DYNCREATE(AttrStrokeTransp,    AttrFillGeometry)
00131 CC_IMPLEMENT_DYNCREATE(AttrLineWidth,       NodeAttribute)
00132 CC_IMPLEMENT_DYNCREATE(AttrStartArrow,      NodeAttribute)
00133 CC_IMPLEMENT_DYNCREATE(AttrEndArrow,        NodeAttribute)
00134 CC_IMPLEMENT_DYNCREATE(AttrStartCap,        NodeAttribute)
00135 CC_IMPLEMENT_DYNCREATE(AttrJoinType,        NodeAttribute)
00136 CC_IMPLEMENT_DYNCREATE(AttrMitreLimit,      NodeAttribute)
00137 CC_IMPLEMENT_DYNCREATE(AttrWindingRule,     NodeAttribute)
00138 CC_IMPLEMENT_DYNCREATE(AttrDashPattern,     NodeAttribute)
00139 
00140 //#ifdef NEW_NATIVE_FILTER
00141 CC_IMPLEMENT_DYNAMIC(LineAttrRecordHandler, CamelotRecordHandler)
00142 //#endif //NEW_NATIVE_FILTER
00143 
00144 // Declare smart memory handling in Debug builds
00145 // Give this file in memory dumps
00146 #define new CAM_DEBUG_NEW
00147     
00148 /********************************************************************************************
00149 
00150 >   AttrLineWidth::AttrLineWidth(Node* ContextNode,  
00151                     AttachNodeDirection Direction,  
00152                     BOOL Locked, 
00153                     BOOL Mangled,  
00154                     BOOL Marked, 
00155                     BOOL Selected    
00156             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected, TRUE)  
00157 
00158     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00159     Created:    21/6/93
00160     Inputs:     -
00161     Outputs:    -
00162     Returns:    -
00163     Purpose:    Creates a LineWidth Attribute
00164     Errors:     -
00165     SeeAlso:    -
00166 
00167 ********************************************************************************************/
00168 
00169 AttrLineWidth::AttrLineWidth(Node* ContextNode,  
00170                     AttachNodeDirection Direction,  
00171                     BOOL Locked, 
00172                     BOOL Mangled,  
00173                     BOOL Marked, 
00174                     BOOL Selected    
00175             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected)  
00176 {                         
00177 } 
00178 
00179 /********************************************************************************************
00180 
00181 >   AttrLineWidth::AttrLineWidth()
00182 
00183     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00184     Created:    21/6/93
00185     Inputs:     -
00186     Outputs:    -
00187     Returns:    -
00188     Purpose:    Default constructor for Line Width Attribute class
00189     Errors:     -
00190     SeeAlso:    -
00191 
00192 ********************************************************************************************/
00193 
00194 AttrLineWidth::AttrLineWidth()
00195 {
00196 }
00197 
00198 /********************************************************************************************
00199 
00200 >   void AttrLineWidth::Render( RenderRegion* pRender)
00201 
00202     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00203     Created:    21/6/93
00204     Inputs:     -
00205     Outputs:    -
00206     Returns:    -
00207     Purpose:    'Renders' a Line Width attribute.
00208     Errors:     -
00209     SeeAlso:    -
00210 
00211 ********************************************************************************************/
00212 
00213 void AttrLineWidth::Render( RenderRegion* pRender)
00214 {
00215     pRender->SetLineWidth(&Value, FALSE);
00216 }
00217 
00218 /********************************************************************************************
00219 
00220 >   void AttrLineWidth::Transform( TransformBase& Trans )
00221 
00222     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00223     Created:    1/8/94
00224     Inputs:     Trans - the transform object to apply to this attribute.
00225     Purpose:    Scale the Line Width.
00226     SeeAlso:    NodeRenderable::Transform
00227 
00228 ********************************************************************************************/
00229 
00230 void AttrLineWidth::Transform( TransformBase& Trans )
00231 {
00232     if ( Trans.TransLines )
00233     {
00234         // Find out the equivalent scale factor
00235         FIXED16 ScaleFactor = Trans.GetScalar();
00236 
00237         // And scale the line width
00238         Value.LineWidth = labs( INT32(ScaleFactor.MakeDouble() * Value.LineWidth) );
00239         //TRACEUSER( "Diccon", _T("Transforming line width %d\n"), Value.LineWidth);
00240     }
00241 }
00242 
00243 /***********************************************************************************************
00244 > Node* AttrLineWidth::SimpleCopy() 
00245 
00246     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00247     Created:    21/6/93
00248     
00249     Inputs:         - 
00250     Outputs:     
00251     Returns:    A copy of the node, or NULL if memory runs out 
00252          
00253     Purpose:    This method returns a shallow copy of the node with all Node pointers NULL. 
00254                 The function is virtual, and must be defined for all derived classes.  
00255 
00256     Errors:     If memory runs out when trying to copy, then ERROR is called with an out of memory
00257                 error and the function returns NULL. 
00258     
00259     Scope:      protected       
00260 ***********************************************************************************************/
00261      
00262 Node* AttrLineWidth::SimpleCopy()
00263 {
00264     AttrLineWidth* NodeCopy = new AttrLineWidth();
00265     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
00266     CopyNodeContents(NodeCopy);
00267     return NodeCopy;
00268 } 
00269 
00270 /********************************************************************************************
00271 
00272 >   INT32 AttrLineWidth::operator==(const NodeAttribute& Attrib)
00273 
00274     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00275     Created:    9/2/94
00276     Inputs:     Atrib:  The attribute to compare, which must be an AttrLineWidth 
00277     Outputs:    -
00278     Returns:    -
00279     Purpose:    A virtual comparison operator. See NodeAttribute::operator== for 
00280                 a description of why it's required. 
00281  
00282     Errors:     An ENSURE failure will occur if Attrib does not have a AttrLineWidth 
00283                 runtime class.
00284                  
00285     SeeAlso:    NodeAttribute::operator==
00286 
00287 ********************************************************************************************/
00288 
00289 INT32 AttrLineWidth::operator==(const NodeAttribute& Attrib)
00290 {
00291     ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrLineWidth)), 
00292         "Trying to compare two objects with different types"); 
00293     AttrLineWidth* Attr = (AttrLineWidth*) &Attrib;
00294     return (Attr->Value.LineWidth == Value.LineWidth); 
00295 } 
00296 
00297 
00298 /********************************************************************************************
00299 
00300 >   virtual UINT32 AttrLineWidth::GetAttrNameID(void)  
00301 
00302     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00303     Created:    22/2/94
00304     Inputs:     -
00305     Outputs:    -
00306     Returns:    Attribute description ID
00307     Purpose:    Returns back a string resource ID describing the attribute
00308 
00309     Errors:     -
00310     SeeAlso:    -
00311 
00312 ********************************************************************************************/
00313 
00314 UINT32 AttrLineWidth::GetAttrNameID(void)  
00315 {
00316     return (_R(IDS_LINE_WIDTH)); 
00317 }               
00318                  
00319 
00320 /***********************************************************************************************
00321 > ` void AttrLineWidth::CopyNodeContents( AttrLineWidth* NodeCopy)
00322 
00323     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00324     Created:    28/4/93
00325     
00326     Inputs:           
00327     Outputs:    A copy of this node
00328     Returns:    -
00329          
00330     Purpose:    This method copies the node's contents to the node pointed to by NodeCopy.
00331               
00332     Errors:     An assertion failure will occur if NodeCopy is NULL
00333     
00334     Scope:      protected
00335                                      
00336 ***********************************************************************************************/
00337 
00338 void AttrLineWidth::CopyNodeContents( AttrLineWidth* NodeCopy)
00339 {
00340     NodeAttribute::CopyNodeContents( NodeCopy );
00341     
00342     //Copy contents specific to derived class here
00343     NodeCopy->Value.LineWidth = Value.LineWidth;
00344 } 
00345 
00346 
00347 
00348 /***********************************************************************************************
00349 >   void AttrLineWidth::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
00350 
00351     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00352     Created:    18/12/2003
00353     Outputs:    -
00354     Purpose:    Polymorphically copies the contents of this node to another
00355     Errors:     An assertion failure will occur if NodeCopy is NULL
00356     Scope:      protected
00357                                      
00358 ***********************************************************************************************/
00359 
00360 void AttrLineWidth::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
00361 {
00362     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00363     ENSURE(IS_A(pNodeCopy, AttrLineWidth), "PolyCopyNodeContents given wrong dest node type");
00364 
00365     if (IS_A(pNodeCopy, AttrLineWidth))
00366         CopyNodeContents((AttrLineWidth*)pNodeCopy);
00367 }
00368 
00369 
00370 
00371 #ifdef _DEBUG
00372 /***********************************************************************************************
00373 
00374 >   void AttrLineWidth::ShowDebugTreeDetails() const
00375 
00376     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00377     Created:    21/6/93
00378     Purpose:    Displays debugging info of the tree
00379 
00380 ***********************************************************************************************/
00381 
00382 void AttrLineWidth::ShowDebugTreeDetails() const
00383 {
00384     // Display a bit of debugging info
00385     // For now, we will just call the base class version
00386     NodeAttribute::ShowDebugTreeDetails();  
00387 }
00388 #endif
00389 
00390 
00391 void AttrLineWidth::GetDebugDetails(StringBase* Str)
00392 {
00393 #ifdef _DEBUG
00394     NodeAttribute::GetDebugDetails( Str );
00395 
00396     String_256 TempStr;
00397     TempStr._MakeMsg( TEXT("\r\nLine width=#1%ld\r\n"), Value.LineWidth );
00398     (*Str) += TempStr;
00399 #endif
00400 }
00401 
00402 
00403 /********************************************************************************************
00404 
00405 >   virtual UINT32 AttrLineWidth::GetNodeSize() const
00406 
00407     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00408     Created:    6/10/93
00409     Inputs:     -
00410     Outputs:    -
00411     Returns:    The size of the node in bytes
00412     Purpose:    For finding the size of the node 
00413                 
00414     SeeAlso:    Node::GetSubtreeSize
00415 
00416 ********************************************************************************************/
00417 
00418 UINT32 AttrLineWidth::GetNodeSize() const 
00419 {     
00420     return (sizeof(AttrLineWidth)); 
00421 }  
00422 
00423 /********************************************************************************************
00424 
00425 >   virtual BOOL AttrLineWidth::Blend(BlendAttrParam* pBlendParam)
00426 
00427     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00428     Created:    25/10/94
00429     Inputs:     pBlendParam = ptr to blend attribute param object holding all info needed
00430     Outputs:    -
00431     Returns:    TRUE if successful, FALSE otherwise
00432     Purpose:    Blends a line width attribute with another.
00433                 If successful, pBlendParam->GetBlendedAttr() will get a valid blended line attribute.
00434                 
00435     SeeAlso:    -
00436 
00437 ********************************************************************************************/
00438 
00439 BOOL AttrLineWidth::Blend(BlendAttrParam* pBlendParam)
00440 {
00441     // Check entry param isn't NULL
00442     ERROR3IF(pBlendParam == NULL,"NULL entry param");
00443     if (pBlendParam == NULL) return FALSE;
00444 
00445     // Get the Value member to blend to the Value member of the other NodeAttribute.
00446     // If it succeeds, ask the blended Value to make a NodeAttribute out of itself.
00447 
00448     if (Value.Blend(pBlendParam))
00449     {
00450         // Get the blended attr val. After this call, the ptr is our reponsibility
00451         // so we have to delete it if it's no longer needed
00452         AttributeValue* pBlendedAttrVal = pBlendParam->GetBlendedAttrVal();
00453 
00454         if (pBlendedAttrVal != NULL)
00455         {
00456             // We have a blended attr val, so ask it to make a NodeAttribute out of itself
00457             // and set the pBlendParam's blended NodeAttribute ptr to it
00458             NodeAttribute* pBlendedAttr = pBlendedAttrVal->MakeNode();
00459             pBlendParam->SetBlendedAttr(pBlendedAttr);
00460 
00461             if (pBlendedAttr != NULL)
00462             {
00463                 // We were able to make a blended NodeAttribute
00464                 // so delete the blended attr val, and return TRUE
00465                 delete pBlendedAttrVal;
00466                 return TRUE;
00467             }
00468             else
00469             {
00470                 // Couldn't make a blended NodeAttribute, so give the blended attr val back
00471                 // and return FALSE
00472                 pBlendParam->SetBlendedAttrVal(pBlendedAttrVal);
00473                 return FALSE;
00474             }
00475         }
00476     }
00477 
00478     return FALSE;
00479 }
00480 
00481 
00482 
00483 /*********************************************************************************************
00484 
00485 >    virtual BOOL AttrLineWidth::NeedsToRenderAtEachBrushStroke()
00486 
00487      Author:    Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00488      Created:   29/11/99
00489      Inputs:    -
00490      Outputs:   -
00491      Returns:   TRUE if this attribute should be rendered at every step of a brush stroke
00492      Purpose:   So that don't have to keep re-rendering attributes whilst drawing a brush, this
00493                 identifies whether or not the attribute need to be rendered at each step, 
00494                 e.g. radial fills.
00495      Errors:    
00496      See Also;  Brush code (ndbrshmk.cpp)
00497 
00498      Notes:     You wouldn't think that you would need to render line width at each stroke but
00499                 we want to make linewidth scale along with the brush.
00500 **********************************************************************************************/
00501        
00502 BOOL AttrLineWidth::NeedsToRenderAtEachBrushStroke() const
00503 {
00504     return TRUE;
00505 }
00506 
00507 /*********************************************************************************************
00508 
00509 >    BOOL NodeAttribute::IsALineWidthAttr() const
00510      Author:    Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00511      Created:   13/2/95
00512      Inputs:    -
00513      Outputs:   -
00514      Returns:   TRUE if the node is a line width attribute, will return TRUE
00515      Purpose:   Virtual function for determining if the node is a line width attribute
00516      Errors:    
00517 
00518 *************************************************************************************************/
00519 
00520 BOOL AttrLineWidth::IsALineWidthAttr() const
00521 {
00522     return TRUE;
00523 }
00524 
00525 
00526 /********************************************************************************************
00527 
00528   > virtual BOOL AttrLineWidth::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
00529 
00530     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00531     Created:    30/5/96
00532     Inputs:     pFilter = ptr to the filter
00533     Returns:    TRUE if record is written, FALSE if not
00534     Purpose:    Writes the line width record to the filter
00535     SeeAlso:    -
00536 
00537 ********************************************************************************************/
00538 
00539 BOOL AttrLineWidth::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
00540 {
00541 #ifdef DO_EXPORT
00542     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
00543 
00544     CamelotFileRecord Rec(pFilter,TAG_LINEWIDTH,TAG_LINEWIDTH_SIZE);
00545 
00546     BOOL ok = Rec.Init();
00547 
00548     if (ok) ok = Rec.WriteINT32(Value.LineWidth);
00549     if (ok) ok = pFilter->Write(&Rec);
00550 
00551     return ok;
00552 #else
00553     return FALSE;
00554 #endif
00555 }
00556 
00557 //--------------------------------------------------------------
00558 // See AttrLineWidth::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
00559 //
00560 BOOL AttrLineWidth::WritePreChildrenNative(BaseCamelotFilter* pFilter)
00561 {
00562 #ifdef DO_EXPORT
00563     return WritePreChildrenWeb(pFilter);
00564 #else
00565     return FALSE;
00566 #endif
00567 }
00568 
00569 
00570 
00571 /********************************************************************************************
00572 
00573 >   NodeAttribute* AttrLineWidth::GetOtherAttrToApply(BOOL* IsMutate)
00574 
00575     Author:     Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
00576     Created:    26/06/2000
00577     Inputs:     IsMutate    **don't know(!)**
00578 
00579     Returns:    The secondary attribute to apply, or NULL if none to apply.
00580     Purpose:    Some attributes require a secondary attribute to be changed when they are
00581                 changed. This routine obtains a pointer to the secondary attribute to apply.
00582 
00583                 In the case of AttrLineWidth, the other attribute is AttrStrokeColour.
00584 
00585     See also:   OpApplyAttribToSelected::ApplyToSelection().
00586 
00587 ********************************************************************************************/
00588 NodeAttribute* AttrLineWidth::GetOtherAttrToApply(BOOL* IsMutate)
00589 {
00590     ERROR3IF(IsMutate == NULL, "NULL flag pointer passed to GetOtherAttrToApply");
00591 
00592     // LineWidth attributes sometimes require a stroke colour attribute as well.
00593     AttrStrokeColour* pStrokeColour = NULL;
00594     pStrokeColour = new AttrStrokeColour;
00595     if (pStrokeColour == NULL)
00596         return NULL;
00597 
00598     *IsMutate = FALSE;
00599 
00600     return pStrokeColour;
00601 }
00602 
00603 
00604 
00605 //-------------------------------------------------------------------------------------------
00606 //-------------------------------------------------------------------------------------------
00607 //-------------------------------------------------------------------------------------------
00608 //-------------------------------------------------------------------------------------------
00609 
00610 
00611 
00612 /********************************************************************************************
00613 
00614 >   AttrStrokeColour::AttrStrokeColour(Node* ContextNode,  
00615                     AttachNodeDirection Direction,  
00616                     BOOL Locked, 
00617                     BOOL Mangled,  
00618                     BOOL Marked, 
00619                     BOOL Selected    
00620             ): AttrFlatFill(ContextNode, Direction, Locked, Mangled, Marked, Selected)  
00621 
00622     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00623     Created:    21/6/93
00624     Inputs:     -
00625     Outputs:    -
00626     Returns:    -
00627     Purpose:    Creates a LineColour Attribute
00628     Errors:     -
00629     SeeAlso:    -
00630 
00631 ********************************************************************************************/
00632 
00633 AttrStrokeColour::AttrStrokeColour(Node* ContextNode,  
00634                     AttachNodeDirection Direction,  
00635                     BOOL Locked, 
00636                     BOOL Mangled,  
00637                     BOOL Marked, 
00638                     BOOL Selected    
00639             ): AttrFillGeometry(ContextNode, Direction, Locked, Mangled, Marked, Selected)   
00640 {                         
00641 } 
00642 
00643 /********************************************************************************************
00644 
00645 >   AttrStrokeColour::AttrStrokeColour()
00646 
00647     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00648     Created:    21/6/93
00649     Inputs:     -
00650     Outputs:    -
00651     Returns:    -
00652     Purpose:    Default constructor for Line Colour Attribute class
00653     Errors:     -
00654     SeeAlso:    -
00655 
00656 ********************************************************************************************/
00657 
00658 AttrStrokeColour::AttrStrokeColour()
00659 {
00660 }
00661 
00662 /********************************************************************************************
00663 
00664 >   void AttrStrokeColour::Render( RenderRegion* pRender)
00665 
00666     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00667     Created:    21/6/93
00668     Inputs:     -
00669     Outputs:    -
00670     Returns:    -
00671     Purpose:    'Renders' a Line Colour attribute.
00672     Errors:     -
00673     SeeAlso:    -
00674 
00675 ********************************************************************************************/
00676 
00677 void AttrStrokeColour::Render( RenderRegion* pRender)
00678 {
00679     pRender->SetLineColour((StrokeColourAttribute *) &Value, FALSE);
00680 }
00681 
00682 /***********************************************************************************************
00683 > Node* AttrStrokeColour::SimpleCopy() 
00684 
00685     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00686     Created:    21/6/93
00687     
00688     Inputs:         - 
00689     Outputs:     
00690     Returns:    A copy of the node, or NULL if memory runs out 
00691          
00692     Purpose:    This method returns a shallow copy of the node with all Node pointers NULL. 
00693                 The function is virtual, and must be defined for all derived classes.  
00694      
00695     Errors:     If memory runs out when trying to copy, then ERROR is called with an out of memory
00696                 error and the function returns NULL. 
00697           
00698     Scope:      protected       
00699 ***********************************************************************************************/
00700 
00701 Node* AttrStrokeColour::SimpleCopy()
00702 {
00703     AttrStrokeColour* NodeCopy = new AttrStrokeColour();
00704     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
00705     CopyNodeContents(NodeCopy);
00706     
00707     return NodeCopy;
00708 }  
00709 
00710 /********************************************************************************************
00711 
00712 >   INT32 AttrStrokeColour::operator==(const NodeAttribute& Attrib)
00713 
00714     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00715     Created:    9/2/94
00716     Inputs:     Atrib:  The attribute to compare, which must be an AttrStrokeColour 
00717     Outputs:    -
00718     Returns:    -
00719     Purpose:    A virtual comparison operator. See NodeAttribute::operator== for 
00720                 a description of why it's required. 
00721  
00722     Errors:     An ENSURE failure will occur if Attrib does not have a AttrStrokeColour 
00723                 runtime class.
00724                  
00725     SeeAlso:    NodeAttribute::operator==
00726 
00727 ********************************************************************************************/
00728 
00729 INT32 AttrStrokeColour::operator==(const NodeAttribute& Attrib)
00730 {
00731     ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrStrokeColour)), 
00732             "Trying to compare two objects with different types"); 
00733     AttrStrokeColour* Attr = (AttrStrokeColour*) &Attrib;
00734     return (Attr->Value.Colour == Value.Colour); 
00735 }
00736 
00737 /********************************************************************************************
00738 
00739 >   virtual UINT32 AttrStrokeColour::GetAttrNameID(void)  
00740 
00741     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00742     Created:    22/2/94
00743     Inputs:     -
00744     Outputs:    -
00745     Returns:    Attribute description ID
00746     Purpose:    Returns back a string resource ID describing the attribute
00747 
00748     Errors:     -
00749     SeeAlso:    -
00750 
00751 ********************************************************************************************/
00752 
00753 UINT32 AttrStrokeColour::GetAttrNameID(void)  
00754 {
00755     return (_R(IDS_LINE_COLOUR)); 
00756 }                                  
00757 
00758 /***********************************************************************************************
00759 >   void AttrStrokeColour::CopyNodeContents( AttrStrokeColour* NodeCopy)
00760 
00761 
00762     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00763     Created:    28/4/93
00764     
00765     Inputs:           
00766     Outputs:    A copy of this node
00767     Returns:    -
00768          
00769     Purpose:    This method copies the node's contents to the node pointed to by NodeCopy.
00770               
00771     Errors:     An assertion failure will occur if NodeCopy is NULL
00772     
00773     Scope:      protected
00774                                      
00775 ***********************************************************************************************/
00776 
00777 void AttrStrokeColour::CopyNodeContents( AttrStrokeColour* NodeCopy)
00778 {
00779     NodeAttribute::CopyNodeContents( NodeCopy );
00780     
00781     //Copy contents specific to derived class here 
00782     NodeCopy->Value.Colour = Value.Colour;
00783 } 
00784 
00785 
00786 
00787 /***********************************************************************************************
00788 >   void AttrStrokeColour::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
00789 
00790     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00791     Created:    18/12/2003
00792     Outputs:    -
00793     Purpose:    Polymorphically copies the contents of this node to another
00794     Errors:     An assertion failure will occur if NodeCopy is NULL
00795     Scope:      protected
00796                                      
00797 ***********************************************************************************************/
00798 
00799 void AttrStrokeColour::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
00800 {
00801     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00802     ENSURE(IS_A(pNodeCopy, AttrStrokeColour), "PolyCopyNodeContents given wrong dest node type");
00803 
00804     if (IS_A(pNodeCopy, AttrStrokeColour))
00805         CopyNodeContents((AttrStrokeColour*)pNodeCopy);
00806 }
00807 
00808 
00809 
00810 #ifdef _DEBUG
00811 /***********************************************************************************************
00812 
00813 >   void AttrStrokeColour::ShowDebugTreeDetails() const
00814 
00815     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00816     Created:    21/6/93
00817     Purpose:    Displays debugging info of the tree
00818 
00819 ***********************************************************************************************/
00820 
00821 void AttrStrokeColour::ShowDebugTreeDetails() const
00822 {
00823     // Display a bit of debugging info
00824     // For now, we will just call the base class version
00825     NodeAttribute::ShowDebugTreeDetails();  
00826 }
00827 #endif
00828 
00829 
00830 void AttrStrokeColour::GetDebugDetails(StringBase* Str)
00831 {
00832 #ifdef _DEBUG
00833     NodeAttribute::GetDebugDetails( Str );
00834 
00835     String_256 TempStr;
00836 
00837 #if FALSE
00838     if (Value.LineColour.IsTransparent())
00839         TempStr._MakeMsg( TEXT("\r\nLine colour=transparent\r\n"));
00840     else
00841     {
00842         INT32 Red, Green, Blue;
00843         Value.LineColour.GetRGBValue(&Red, &Green, &Blue);
00844 
00845         TempStr._MakeMsg( TEXT("\r\nLine colour=(#1%ld, #2%ld, #3%ld)\r\n"), 
00846                          Red, Green, Blue);
00847     }
00848 #else
00849 //  TempStr._MakeMsg( TEXT("\r\nLine"));
00850 //  Value.Colour.GetDebugDetails(&TempStr);
00851 #endif
00852 
00853     (*Str) += TempStr;
00854 #endif
00855 }
00856 
00857 
00858 /********************************************************************************************
00859 
00860 >   virtual UINT32 AttrStrokeColour::GetNodeSize() const
00861 
00862     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00863     Created:    6/10/93
00864     Inputs:     -
00865     Outputs:    -
00866     Returns:    The size of the node in bytes
00867     Purpose:    For finding the size of the node 
00868                 
00869     SeeAlso:    Node::GetSubtreeSize
00870 
00871 ********************************************************************************************/
00872 
00873 UINT32 AttrStrokeColour::GetNodeSize() const 
00874 {     
00875     return (sizeof(AttrStrokeColour)); 
00876 }  
00877 
00878 /********************************************************************************************
00879 
00880 >   virtual AttrFillGeometry* AttrStrokeColour::ChangeAttrValue(AttrValueChange* Mutator)
00881 
00882     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00883     Created:    28/11/94
00884     Inputs:     The value change attribute
00885     Returns:    A new stroke colour attr, with the appropriate changes made
00886     Purpose:    Changes the stroke colour in some way 
00887 
00888 ********************************************************************************************/
00889 
00890 AttrFillGeometry* AttrStrokeColour::ChangeAttrValue(AttrValueChange* Mutator)
00891 {
00892     AttrFillGeometry* NewFill = NULL;
00893 
00894     // Make a copy of this Fill and change the copys' control point colours
00895     NewFill = (AttrFillGeometry*)this->SimpleCopy();
00896     if (NewFill == NULL)
00897         return NULL;
00898 
00899     if (Mutator->MutateFill(NewFill))
00900         return NewFill;
00901 
00902     return NewFill;
00903 }
00904 
00905 
00906 /********************************************************************************************
00907 
00908   > virtual BOOL AttrStrokeColour::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
00909 
00910     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00911     Created:    22/5/96
00912     Inputs:     pFilter = ptr to the filter
00913     Returns:    TRUE if record is written, FALSE if not
00914     Purpose:    Writes the line colour record to the filter
00915     SeeAlso:    -
00916 
00917 ********************************************************************************************/
00918 
00919 BOOL AttrStrokeColour::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
00920 {
00921 #ifdef DO_EXPORT
00922     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
00923 
00924     INT32 ColourRef = pFilter->WriteRecord(&Value.Colour);
00925 
00926     BOOL ok = (ColourRef != 0);
00927 
00928     if (ok)
00929     {
00930         BOOL ColourRequired = TRUE;
00931         INT32 Tag = TAG_LINECOLOUR;
00932         INT32 Size = TAG_LINECOLOUR_SIZE;
00933         switch (ColourRef)
00934         {
00935             case REF_DEFAULTCOLOUR_TRANSPARENT:
00936                 Tag = TAG_LINECOLOUR_NONE;
00937                 Size = TAG_LINECOLOUR_NONE_SIZE;
00938                 ColourRequired = FALSE;
00939                 break;
00940             case REF_DEFAULTCOLOUR_BLACK:
00941                 Tag = TAG_LINECOLOUR_BLACK;
00942                 Size = TAG_LINECOLOUR_BLACK_SIZE;
00943                 ColourRequired = FALSE;
00944                 break;
00945             case REF_DEFAULTCOLOUR_WHITE:
00946                 Tag = TAG_LINECOLOUR_WHITE;
00947                 Size = TAG_LINECOLOUR_WHITE_SIZE;
00948                 ColourRequired = FALSE;
00949                 break;
00950         }
00951 
00952         CamelotFileRecord Rec(pFilter,Tag,Size);
00953 
00954         ok = Rec.Init();
00955 
00956         if (ok && ColourRequired) ok = Rec.WriteReference(ColourRef);
00957         if (ok) ok = pFilter->Write(&Rec);
00958     }
00959 
00960     if (!ok)
00961         pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
00962 
00963     return ok;
00964 
00965 /*  INT32 ColourRef = pFilter->WriteRecord(&Value.Colour);
00966 
00967     BOOL ok = (ColourRef >= 1);
00968 
00969     if (ok) ok = (pFilter->StartRecord(TAG_LINECOLOUR,TAG_LINECOLOUR_SIZE) != 0);
00970     if (ok) ok = pFilter->Write(ColourRef);
00971     if (ok) ok = pFilter->EndRecord();
00972 
00973     if (!ok)
00974         pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
00975 
00976     return ok;
00977 */
00978 #else
00979     return FALSE;
00980 #endif
00981 }
00982 
00983 //--------------------------------------------------------------
00984 // See AttrStrokeColour::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
00985 //
00986 BOOL AttrStrokeColour::WritePreChildrenNative(BaseCamelotFilter* pFilter)
00987 {
00988 #ifdef DO_EXPORT
00989     return WritePreChildrenWeb(pFilter);
00990 #else
00991     return FALSE;
00992 #endif
00993 }
00994 
00995 
00996 /********************************************************************************************
00997 
00998   > virtual BOOL AttrStrokeColour::WriteColourDefinitions (BaseCamelotFilter* pFilter)
00999 
01000     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
01001     Created:    14/9/2000
01002     Inputs:     pFilter = ptr to the filter
01003     Returns:    TRUE if record is written, FALSE if not
01004     Purpose:    Writes out colour definitions for this fill.
01005     SeeAlso:    BaseCamelotFilter::WriteRemainingAtomicTagDefinitions ()
01006                 Layer::WriteAtomicNodesColourRefs ()
01007 
01008 ********************************************************************************************/
01009 
01010 BOOL AttrStrokeColour::WriteColourDefinitions (BaseCamelotFilter* pFilter)
01011 {
01012     INT32 ColRef = pFilter->WriteRecord(&Value.Colour);
01013 
01014     // Is the colour reference ok?
01015     
01016     return (ColRef != 0);
01017 }
01018 
01019 
01020 //----------------------------------------------------------------------------
01021 //----------------------------------------------------------------------------
01022 //----------------------------------------------------------------------------
01023 
01024 /********************************************************************************************
01025 
01026 >   AttrFillGeometry* AttrStrokeColourChange::MutateFill(AttrFillGeometry* FillToMutate) 
01027 
01028     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01029     Created:    28/11/94
01030     Inputs:     The value change attribute
01031     Returns:    A new stroke colour attr, with the appropriate changes made
01032     Purpose:    Changes the stroke colour in some way 
01033 
01034 ********************************************************************************************/
01035 
01036 AttrFillGeometry* AttrStrokeColourChange::MutateFill(AttrFillGeometry* FillToMutate) 
01037 { 
01038     // Make a copy of this Fill and change the copys' control point colours
01039     AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
01040     if (NewFill == NULL)
01041         return NULL;
01042 
01043     NewFill->SetStartColour(GetStartColour());
01044 
01045     return NewFill; 
01046 }
01047 
01048 /********************************************************************************************
01049 
01050 >   virtual NodeAttribute* AttrStrokeColourChange::GetOtherAttrToApply(BOOL* IsMutate)
01051 
01052     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01053     Created:    17/8/95
01054     Returns:    The secondary attribute to apply, or NULL if none to apply
01055     Purpose:    Some attributes require a secondary atribute to be changed when they are
01056                 changed.  This routine obtains a pointer to the secondary attribute to
01057                 apply.
01058 
01059 ********************************************************************************************/
01060 
01061 NodeAttribute* AttrStrokeColourChange::GetOtherAttrToApply(BOOL* IsMutate)
01062 {
01063     return NULL;
01064 
01065 /*  ERROR3IF(IsMutate == NULL, "NULL flag pointer passed to GetOtherAttrToApply");
01066 
01067     // A stroke colour change also needs to set the Stroke Transparency
01068 
01069     NodeAttribute* OtherAttr = new AttrStrokeTranspChange;
01070     if (OtherAttr == NULL)
01071         return NULL;
01072 
01073     UINT32 Transp;
01074 
01075     DocColour Col = *GetStartColour();
01076 
01077     if (Col.IsTransparent())
01078         Transp = 255;
01079     else
01080         Transp = 0;
01081 
01082     ((AttrStrokeTranspChange *)OtherAttr)->SetStartTransp(&Transp);
01083 
01084     *IsMutate = TRUE;
01085 
01086     return OtherAttr; */
01087 }
01088 
01089 /********************************************************************************************
01090 
01091 >   virtual UINT32 AttrStrokeColourChange::GetAttrNameID(void)  
01092 
01093     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01094     Created:    29/1/95
01095     Returns:    Attribute description ID
01096     Purpose:    Returns a string resource ID describing the attribute
01097 
01098 ********************************************************************************************/
01099 
01100 UINT32 AttrStrokeColourChange::GetAttrNameID(void)  
01101 {
01102     // if it's called in the line width combo-box then we return "line width"
01103     // rather than "line colour"
01104     if (m_bLineWidth)
01105         return (_R(IDS_LINE_WIDTH));
01106 
01107     return (_R(IDS_STROKECOLOUR_CHANGE));
01108 }                                  
01109 
01110 
01111 /*********************************************************************************************
01112 
01113 >    BOOL AttrStrokeColour::EffectsParentBounds()
01114 
01115      Author:    Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01116      Created:   12/5/95
01117      Inputs:    -
01118      Outputs:   -
01119      Returns:   TRUE
01120      Purpose:   Indicates that the stroke colour can effect the bounds of the object it is
01121                 applied to (as it determines whether the path is stroked or not).
01122 
01123 **********************************************************************************************/
01124        
01125 BOOL AttrStrokeColour::EffectsParentBounds()
01126 {
01127     return TRUE;
01128 }
01129 
01130 /*********************************************************************************************
01131 
01132 >    BOOL AttrStrokeColourChange::EffectsParentBounds()
01133 
01134      Author:    Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01135      Created:   12/5/95
01136      Inputs:    -
01137      Outputs:   -
01138      Returns:   TRUE
01139      Purpose:   Indicates that the stroke colour can effect the bounds of the object it is
01140                 applied to (as it determines whether the path is stroked or not).
01141 
01142 **********************************************************************************************/
01143        
01144 BOOL AttrStrokeColourChange::EffectsParentBounds()
01145 {
01146     return TRUE;
01147 }
01148 
01149 //-----------------------------------------------------------------------------------------
01150 //-----------------------------------------------------------------------------------------
01151 //-----------------------------------------------------------------------------------------
01152 
01153 /********************************************************************************************
01154 
01155 >   AttrStrokeTransp::AttrStrokeTransp(Node* ContextNode,  
01156                     AttachNodeDirection Direction,  
01157                     BOOL Locked, 
01158                     BOOL Mangled,  
01159                     BOOL Marked, 
01160                     BOOL Selected    
01161             ): AttrFlatFill(ContextNode, Direction, Locked, Mangled, Marked, Selected)  
01162 
01163     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01164     Created:    21/6/93
01165     Inputs:     -
01166     Outputs:    -
01167     Returns:    -
01168     Purpose:    Creates a LineColour Attribute
01169     Errors:     -
01170     SeeAlso:    -
01171 
01172 ********************************************************************************************/
01173 
01174 AttrStrokeTransp::AttrStrokeTransp(Node* ContextNode,  
01175                     AttachNodeDirection Direction,  
01176                     BOOL Locked, 
01177                     BOOL Mangled,  
01178                     BOOL Marked, 
01179                     BOOL Selected    
01180             ): AttrFillGeometry(ContextNode, Direction, Locked, Mangled, Marked, Selected)   
01181 {                         
01182 } 
01183 
01184 /********************************************************************************************
01185 
01186 >   AttrStrokeTransp::AttrStrokeTransp()
01187 
01188     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01189     Created:    21/6/93
01190     Inputs:     -
01191     Outputs:    -
01192     Returns:    -
01193     Purpose:    Default constructor for Line Colour Attribute class
01194     Errors:     -
01195     SeeAlso:    -
01196 
01197 ********************************************************************************************/
01198 
01199 AttrStrokeTransp::AttrStrokeTransp()
01200 {
01201 }
01202 
01203 /********************************************************************************************
01204 
01205 >   void AttrStrokeTransp::Render( RenderRegion* pRender)
01206 
01207     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01208     Created:    21/6/93
01209     Inputs:     -
01210     Outputs:    -
01211     Returns:    -
01212     Purpose:    'Renders' a Line Colour attribute.
01213     Errors:     -
01214     SeeAlso:    -
01215 
01216 ********************************************************************************************/
01217 
01218 void AttrStrokeTransp::Render( RenderRegion* pRender)
01219 {
01220     pRender->SetLineTransp((StrokeTranspAttribute *) &Value, FALSE);
01221 }
01222 
01223 /***********************************************************************************************
01224 > Node* AttrStrokeTransp::SimpleCopy() 
01225 
01226     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01227     Created:    21/6/93
01228     
01229     Inputs:         - 
01230     Outputs:     
01231     Returns:    A copy of the node, or NULL if memory runs out 
01232          
01233     Purpose:    This method returns a shallow copy of the node with all Node pointers NULL. 
01234                 The function is virtual, and must be defined for all derived classes.  
01235      
01236     Errors:     If memory runs out when trying to copy, then ERROR is called with an out of memory
01237                 error and the function returns NULL. 
01238           
01239     Scope:      protected       
01240 ***********************************************************************************************/
01241 
01242 Node* AttrStrokeTransp::SimpleCopy()
01243 {
01244     AttrStrokeTransp* NodeCopy = new AttrStrokeTransp();
01245     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
01246     CopyNodeContents(NodeCopy);
01247     
01248     return NodeCopy;
01249 }  
01250 
01251 /********************************************************************************************
01252 
01253 >   INT32 AttrStrokeTransp::operator==(const NodeAttribute& Attrib)
01254 
01255     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01256     Created:    9/2/94
01257     Inputs:     Atrib:  The attribute to compare, which must be an AttrStrokeTransp 
01258     Outputs:    -
01259     Returns:    -
01260     Purpose:    A virtual comparison operator. See NodeAttribute::operator== for 
01261                 a description of why it's required. 
01262  
01263     Errors:     An ENSURE failure will occur if Attrib does not have a AttrStrokeTransp 
01264                 runtime class.
01265                  
01266     SeeAlso:    NodeAttribute::operator==
01267 
01268 ********************************************************************************************/
01269 
01270 INT32 AttrStrokeTransp::operator==(const NodeAttribute& Attrib)
01271 {
01272     ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrStrokeTransp)), 
01273             "Trying to compare two objects with different types"); 
01274     AttrStrokeTransp* Attr = (AttrStrokeTransp*) &Attrib;
01275     return (Attr->Value.Transp == Value.Transp &&
01276             Attr->Value.TranspType == Value.TranspType ); 
01277 }
01278 
01279 /********************************************************************************************
01280 
01281 >   virtual UINT32 AttrStrokeTransp::GetAttrNameID(void)  
01282 
01283     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01284     Created:    22/2/94
01285     Inputs:     -
01286     Outputs:    -
01287     Returns:    Attribute description ID
01288     Purpose:    Returns back a string resource ID describing the attribute
01289 
01290     Errors:     -
01291     SeeAlso:    -
01292 
01293 ********************************************************************************************/
01294 
01295 UINT32 AttrStrokeTransp::GetAttrNameID(void)  
01296 {
01297     return (_R(IDS_LINE_TRANSP)); 
01298 }                                  
01299 
01300 /***********************************************************************************************
01301 >   void AttrStrokeTransp::CopyNodeContents( AttrStrokeTransp* NodeCopy)
01302 
01303 
01304     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01305     Created:    28/4/93
01306     
01307     Inputs:           
01308     Outputs:    A copy of this node
01309     Returns:    -
01310          
01311     Purpose:    This method copies the node's contents to the node pointed to by NodeCopy.
01312               
01313     Errors:     An assertion failure will occur if NodeCopy is NULL
01314     
01315     Scope:      protected
01316                                      
01317 ***********************************************************************************************/
01318 
01319 void AttrStrokeTransp::CopyNodeContents( AttrStrokeTransp* NodeCopy)
01320 {
01321     NodeAttribute::CopyNodeContents( NodeCopy );
01322     
01323     //Copy contents specific to derived class here 
01324     NodeCopy->Value.Transp = Value.Transp;
01325     NodeCopy->Value.TranspType = Value.TranspType;
01326 } 
01327 
01328 
01329 
01330 /***********************************************************************************************
01331 >   void AttrStrokeTransp::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
01332 
01333     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
01334     Created:    18/12/2003
01335     Outputs:    -
01336     Purpose:    Polymorphically copies the contents of this node to another
01337     Errors:     An assertion failure will occur if NodeCopy is NULL
01338     Scope:      protected
01339                                      
01340 ***********************************************************************************************/
01341 
01342 void AttrStrokeTransp::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
01343 {
01344     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
01345     ENSURE(IS_A(pNodeCopy, AttrStrokeTransp), "PolyCopyNodeContents given wrong dest node type");
01346 
01347     if (IS_A(pNodeCopy, AttrStrokeTransp))
01348         CopyNodeContents((AttrStrokeTransp*)pNodeCopy);
01349 }
01350 
01351 
01352 
01353 #ifdef _DEBUG
01354 /***********************************************************************************************
01355 
01356 >   void AttrStrokeTransp::ShowDebugTreeDetails() const
01357 
01358     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01359     Created:    21/6/93
01360     Purpose:    Displays debugging info of the tree
01361 
01362 ***********************************************************************************************/
01363 
01364 void AttrStrokeTransp::ShowDebugTreeDetails() const
01365 {
01366     // Display a bit of debugging info
01367     // For now, we will just call the base class version
01368     NodeAttribute::ShowDebugTreeDetails();  
01369 }
01370 #endif
01371 
01372 
01373 void AttrStrokeTransp::GetDebugDetails(StringBase* Str)
01374 {
01375 #ifdef _DEBUG
01376     NodeAttribute::GetDebugDetails( Str );
01377 
01378     String_256 TempStr;
01379 
01380     TempStr._MakeMsg(TEXT("\r\nLine Transparency = #1%ld "), 
01381                      *GetStartTransp());
01382 
01383     (*Str) += TempStr;
01384 
01385     TempStr._MakeMsg(TEXT("\nTransparency Type = #1%ld "), 
01386                      GetTranspType());
01387 
01388     (*Str) += TempStr;
01389 #endif
01390 }
01391 
01392 
01393 /********************************************************************************************
01394 
01395 >   virtual UINT32 AttrStrokeTransp::GetNodeSize() const
01396 
01397     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01398     Created:    6/10/93
01399     Inputs:     -
01400     Outputs:    -
01401     Returns:    The size of the node in bytes
01402     Purpose:    For finding the size of the node 
01403                 
01404     SeeAlso:    Node::GetSubtreeSize
01405 
01406 ********************************************************************************************/
01407 
01408 UINT32 AttrStrokeTransp::GetNodeSize() const 
01409 {     
01410     return (sizeof(AttrStrokeTransp)); 
01411 }  
01412 
01413 /********************************************************************************************
01414 
01415 >   virtual AttrFillGeometry* AttrStrokeTransp::ChangeAttrValue(AttrValueChange* Mutator)
01416 
01417     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01418     Created:    28/11/94
01419     Inputs:     The value change attribute
01420     Returns:    A new stroke colour attr, with the appropriate changes made
01421     Purpose:    Changes the stroke colour in some way 
01422 
01423 ********************************************************************************************/
01424 
01425 AttrFillGeometry* AttrStrokeTransp::ChangeAttrValue(AttrValueChange* Mutator)
01426 {
01427     AttrFillGeometry* NewFill = NULL;
01428 
01429     // Make a copy of this Fill and change the copys' control point colours
01430     NewFill = (AttrFillGeometry*)this->SimpleCopy();
01431     if (NewFill == NULL)
01432         return NULL;
01433 
01434     if (Mutator->MutateFill(NewFill))
01435         return NewFill;
01436 
01437     return NewFill;
01438 }
01439 
01440 
01441 /********************************************************************************************
01442 
01443   > virtual BOOL AttrStrokeTransp::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
01444 
01445     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
01446     Created:    30/5/96
01447     Inputs:     pFilter = ptr to the filter
01448     Returns:    TRUE if record is written, FALSE if not
01449     Purpose:    Writes the stroke transparancy record to the filter
01450     SeeAlso:    -
01451 
01452 ********************************************************************************************/
01453 
01454 BOOL AttrStrokeTransp::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
01455 {
01456 #ifdef DO_EXPORT
01457     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
01458     ERROR3IF(Value.Transp     > 255,"Transparency level is too high to be stored as a byte");
01459     ERROR3IF(Value.TranspType > 255,"Transparency type is too high to be stored as a byte");
01460 
01461     CamelotFileRecord Rec(pFilter,TAG_LINETRANSPARENCY,TAG_LINETRANSPARENCY_SIZE);
01462 
01463     BOOL ok = Rec.Init();
01464     if (ok) ok = Rec.WriteBYTE(BYTE(Value.Transp));
01465     if (ok) ok = Rec.WriteBYTE(BYTE(Value.TranspType));
01466     if (ok) ok = pFilter->Write(&Rec);
01467 
01468     return ok;
01469 #else
01470     return FALSE;
01471 #endif
01472 }
01473 
01474 //--------------------------------------------------------------
01475 // See AttrStrokeTransp::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
01476 //
01477 BOOL AttrStrokeTransp::WritePreChildrenNative(BaseCamelotFilter* pFilter)
01478 {
01479 #ifdef DO_EXPORT
01480     return WritePreChildrenWeb(pFilter);
01481 #else
01482     return FALSE;
01483 #endif
01484 }
01485 
01486 /********************************************************************************************
01487 
01488   > virtual BOOL AttrStrokeTransp::NeedsTransparency() const
01489 
01490     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
01491     Created:    19/11/97
01492     Returns:    TRUE if this node requires transparency mode to render properly.
01493     Purpose:    Called to determine whether transparency is needed to render properly.
01494 
01495 ********************************************************************************************/
01496 
01497 BOOL AttrStrokeTransp::NeedsTransparency() const
01498 {
01499     AttrStrokeTransp* pNonConst = (AttrStrokeTransp*) this;
01500     return pNonConst->GetTranspType() != TT_Mix || *(pNonConst->GetStartTransp()) != 0;
01501 }
01502 
01503 //-----------------------------------------------------------------------------------------
01504 //-----------------------------------------------------------------------------------------
01505 //-----------------------------------------------------------------------------------------
01506 
01507 /********************************************************************************************
01508 
01509 >   AttrFillGeometry* AttrStrokeTranspChange::MutateFill(AttrFillGeometry* FillToMutate) 
01510 
01511     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01512     Created:    28/11/94
01513     Inputs:     The value change attribute
01514     Returns:    A new stroke colour attr, with the appropriate changes made
01515     Purpose:    Changes the stroke colour in some way 
01516 
01517 ********************************************************************************************/
01518 
01519 AttrFillGeometry* AttrStrokeTranspChange::MutateFill(AttrFillGeometry* FillToMutate) 
01520 { 
01521     // Make a copy of this Fill and change the copys' control point colours
01522     AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
01523     if (NewFill == NULL)
01524         return NULL;
01525 
01526     NewFill->SetStartTransp(GetStartTransp());
01527 
01528     return NewFill; 
01529 }
01530 
01531 /********************************************************************************************
01532 
01533 >   virtual UINT32 AttrStrokeTranspChange::GetAttrNameID(void)  
01534 
01535     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01536     Created:    29/1/95
01537     Returns:    Attribute description ID
01538     Purpose:    Returns a string resource ID describing the attribute
01539 
01540 ********************************************************************************************/
01541 
01542 UINT32 AttrStrokeTranspChange::GetAttrNameID(void)  
01543 {
01544     return (_R(IDS_STROKETRANSP_CHANGE));
01545 }                                  
01546 
01547 /********************************************************************************************
01548 
01549 >   AttrFillGeometry* AttrStrokeTranspTypeChange::MutateFill(AttrFillGeometry* FillToMutate) 
01550 
01551     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01552     Created:    28/11/94
01553     Inputs:     The value change attribute
01554     Returns:    A new stroke colour attr, with the appropriate changes made
01555     Purpose:    Changes the stroke colour in some way 
01556 
01557 ********************************************************************************************/
01558 
01559 AttrFillGeometry* AttrStrokeTranspTypeChange::MutateFill(AttrFillGeometry* FillToMutate) 
01560 { 
01561     // Make a copy of this Fill and change the copys' control point colours
01562     AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
01563     if (NewFill == NULL)
01564         return NULL;
01565 
01566     NewFill->SetTranspType(GetTranspType());
01567 
01568     return NewFill; 
01569 }
01570 
01571 /********************************************************************************************
01572 
01573 >   virtual UINT32 AttrStrokeTranspTypeChange::GetAttrNameID(void)  
01574 
01575     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01576     Created:    29/1/95
01577     Returns:    Attribute description ID
01578     Purpose:    Returns a string resource ID describing the attribute
01579 
01580 ********************************************************************************************/
01581 
01582 UINT32 AttrStrokeTranspTypeChange::GetAttrNameID(void)  
01583 {
01584     return (_R(IDS_STROKETRANSPTYPE_CHANGE));
01585 }                                  
01586 
01587 /********************************************************************************************
01588 
01589 >   AttrStartCap::AttrStartCap(Node* ContextNode,  
01590                     AttachNodeDirection Direction,  
01591                     BOOL Locked, 
01592                     BOOL Mangled,  
01593                     BOOL Marked, 
01594                     BOOL Selected    
01595             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected, TRUE)  
01596 
01597     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01598     Created:    9/7/93
01599     Inputs:     -
01600     Outputs:    -
01601     Returns:    -
01602     Purpose:    Creates a StartCap Attribute
01603     Errors:     -
01604     SeeAlso:    -
01605 
01606 ********************************************************************************************/
01607 
01608 AttrStartCap::AttrStartCap(Node* ContextNode,  
01609                     AttachNodeDirection Direction,  
01610                     BOOL Locked, 
01611                     BOOL Mangled,  
01612                     BOOL Marked, 
01613                     BOOL Selected    
01614             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected)  
01615 {                         
01616 } 
01617 
01618 /********************************************************************************************
01619 
01620 >   AttrStartCap::AttrStartCap()
01621 
01622     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01623     Created:    9/7/93
01624     Inputs:     -
01625     Outputs:    -
01626     Returns:    -
01627     Purpose:    Default constructor for Start Cap Attribute class
01628     Errors:     -
01629     SeeAlso:    -
01630 
01631 ********************************************************************************************/
01632 
01633 AttrStartCap::AttrStartCap() : NodeAttribute()
01634 {
01635 }
01636 
01637 
01638 /********************************************************************************************
01639 
01640 >   void AttrStartCap::Render( RenderRegion* pRender)
01641 
01642     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01643     Created:    9/7/93
01644     Inputs:     -
01645     Outputs:    -
01646     Returns:    -
01647     Purpose:    'Renders' a StartCap attribute.
01648     Errors:     -
01649     SeeAlso:    -
01650 
01651 ********************************************************************************************/
01652 
01653 void AttrStartCap::Render( RenderRegion* pRender)
01654 {
01655     pRender->SetStartCap(&Value, FALSE);
01656 }
01657 
01658 /***********************************************************************************************
01659 > Node* AttrStartCap::SimpleCopy() 
01660 
01661     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01662     Created:    9/7/93
01663     
01664     Inputs:         - 
01665     Outputs:     
01666     Returns:    A copy of the node, or NULL if memory runs out 
01667          
01668     Purpose:    This method returns a shallow copy of the node with all Node pointers NULL. 
01669                 The function is virtual, and must be defined for all derived classes.  
01670            
01671     Errors:     If memory runs out when trying to copy, then ERROR is called with an out of memory
01672                 error and the function returns NULL. 
01673    
01674     Scope:      protected       
01675 ***********************************************************************************************/
01676      
01677 Node* AttrStartCap::SimpleCopy()
01678 {
01679     AttrStartCap* NodeCopy = new AttrStartCap();
01680     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
01681     CopyNodeContents(NodeCopy);
01682     return NodeCopy;
01683 }                   
01684 
01685 /********************************************************************************************
01686 
01687 >   INT32 AttrStartCap::operator==(const NodeAttribute& Attrib)
01688 
01689     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01690     Created:    9/2/94
01691     Inputs:     Atrib:  The attribute to compare, which must be an AttrStartCap 
01692     Outputs:    -
01693     Returns:    -
01694     Purpose:    A virtual comparison operator. See NodeAttribute::operator== for 
01695                 a description of why it's required. 
01696  
01697     Errors:     An ENSURE failure will occur if Attrib does not have a AttrStartCap 
01698                 runtime class.
01699                  
01700     SeeAlso:    NodeAttribute::operator==
01701 
01702 ********************************************************************************************/
01703 
01704 INT32 AttrStartCap::operator==(const NodeAttribute& Attrib)
01705 {
01706     ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrStartCap)),
01707         "Trying to compare two objects with different types"); 
01708     AttrStartCap* Attr = (AttrStartCap*) &Attrib;
01709     return (Attr->Value.StartCap == Value.StartCap); 
01710 }
01711 
01712 /********************************************************************************************
01713 
01714 >   virtual UINT32 AttrStartCap::GetAttrNameID(void)  
01715 
01716     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01717     Created:    22/2/94
01718     Inputs:     -
01719     Outputs:    -
01720     Returns:    Attribute description ID
01721     Purpose:    Returns back a string resource ID describing the attribute
01722 
01723     Errors:     -
01724     SeeAlso:    -
01725 
01726 ********************************************************************************************/
01727 
01728 UINT32 AttrStartCap::GetAttrNameID(void)  
01729 {
01730     return (_R(IDS_START_CAP)); 
01731 }                 
01732 
01733 /***********************************************************************************************
01734 >   void AttrStartCap::CopyNodeContents( AttrStartCap* NodeCopy)
01735 
01736     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01737     Created:    28/4/93
01738     
01739     Inputs:           
01740     Outputs:    A copy of this node
01741     Returns:    -
01742          
01743     Purpose:    This method copies the node's contents to the node pointed to by NodeCopy.
01744               
01745     Errors:     An assertion failure will occur if NodeCopy is NULL
01746     
01747     Scope:      protected
01748                                      
01749 ***********************************************************************************************/
01750 
01751 void AttrStartCap::CopyNodeContents( AttrStartCap* NodeCopy)
01752 {
01753     NodeAttribute::CopyNodeContents( NodeCopy );
01754     NodeCopy->Value.StartCap = Value.StartCap; 
01755 } 
01756 
01757 
01758 
01759 /***********************************************************************************************
01760 >   void AttrStartCap::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
01761 
01762     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
01763     Created:    18/12/2003
01764     Outputs:    -
01765     Purpose:    Polymorphically copies the contents of this node to another
01766     Errors:     An assertion failure will occur if NodeCopy is NULL
01767     Scope:      protected
01768                                      
01769 ***********************************************************************************************/
01770 
01771 void AttrStartCap::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
01772 {
01773     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
01774     ENSURE(IS_A(pNodeCopy, AttrStartCap), "PolyCopyNodeContents given wrong dest node type");
01775 
01776     if (IS_A(pNodeCopy, AttrStartCap))
01777         CopyNodeContents((AttrStartCap*)pNodeCopy);
01778 }
01779 
01780 
01781 
01782 #ifdef _DEBUG
01783 /***********************************************************************************************
01784 
01785 >   void AttrStartCap::ShowDebugTreeDetails() const
01786 
01787     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01788     Created:    9/7/93
01789     Purpose:    Displays debugging info of the tree
01790 
01791 ***********************************************************************************************/
01792 
01793 void AttrStartCap::ShowDebugTreeDetails() const
01794 {
01795     // Display a bit of debugging info
01796     // For now, we will just call the base class version
01797     NodeAttribute::ShowDebugTreeDetails();  
01798 }
01799 #endif
01800 
01801 void AttrStartCap::GetDebugDetails(StringBase* Str)
01802 {
01803 #ifdef _DEBUG
01804     NodeAttribute::GetDebugDetails( Str );
01805 
01806     String_256 TempStr;
01807     char *p;
01808     switch (Value.StartCap)
01809     {
01810         case LineCapButt: p = "Butt"; break;
01811         case LineCapRound: p = "Round"; break;
01812         case LineCapSquare: p = "Square"; break;
01813         default: p = "??"; break;
01814     }
01815     TempStr._MakeMsg( TEXT("\r\nStartCap=#1%s\r\n"), p );
01816     (*Str) += TempStr;
01817 #endif
01818 }
01819 
01820 
01821 /********************************************************************************************
01822 
01823 >   virtual UINT32 AttrStartCap::GetNodeSize() const
01824 
01825     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01826     Created:    6/10/93
01827     Inputs:     -
01828     Outputs:    -
01829     Returns:    The size of the node in bytes
01830     Purpose:    For finding the size of the node 
01831                 
01832     SeeAlso:    Node::GetSubtreeSize
01833 
01834 ********************************************************************************************/
01835 
01836 UINT32 AttrStartCap::GetNodeSize() const 
01837 {     
01838     return (sizeof(AttrStartCap)); 
01839 }  
01840 
01841 
01842 
01843 /********************************************************************************************
01844 
01845   > virtual BOOL AttrStartCap::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
01846 
01847     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
01848     Created:    30/5/96
01849     Inputs:     pFilter = ptr to the filter
01850     Returns:    TRUE if record is written, FALSE if not
01851     Purpose:    Writes the start cap record to the filter
01852     SeeAlso:    -
01853 
01854 ********************************************************************************************/
01855 
01856 BOOL AttrStartCap::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
01857 {
01858 #ifdef DO_EXPORT
01859     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
01860 
01861     CamelotFileRecord Rec(pFilter,TAG_STARTCAP,TAG_STARTCAP_SIZE);
01862 
01863     BOOL ok = Rec.Init();
01864     if (ok) ok = Rec.WriteBYTE(BYTE(Value.StartCap));
01865     if (ok) ok = pFilter->Write(&Rec);
01866 
01867     // Camelot uses the start cap attr to define both the start and end caps for the effected shapes.
01868     // However, the file format supports separate records for the two states.
01869     // Both the start & end cap records are saved with the same value, just in case another
01870     // program wishes to load the file.
01871 
01872     CamelotFileRecord Rec2(pFilter,TAG_ENDCAP,TAG_ENDCAP_SIZE);
01873 
01874     if (ok) ok = Rec2.Init();
01875     if (ok) ok = Rec2.WriteBYTE(BYTE(Value.StartCap));
01876     if (ok) ok = pFilter->Write(&Rec2);
01877 
01878     return ok;
01879 #else
01880     return FALSE;
01881 #endif
01882 }
01883 
01884 //--------------------------------------------------------------
01885 // See AttrStartCap::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
01886 //
01887 BOOL AttrStartCap::WritePreChildrenNative(BaseCamelotFilter* pFilter)
01888 {
01889 #ifdef DO_EXPORT
01890     return WritePreChildrenWeb(pFilter);
01891 #else
01892     return FALSE;
01893 #endif
01894 }
01895 
01896 //----------------------------------------------------------------------------
01897 //----------------------------------------------------------------------------
01898 //----------------------------------------------------------------------------
01899 
01900 /********************************************************************************************
01901 
01902 >   AttrStartArrow::AttrStartArrow(Node* ContextNode,  
01903                     AttachNodeDirection Direction,  
01904                     BOOL Locked, 
01905                     BOOL Mangled,  
01906                     BOOL Marked, 
01907                     BOOL Selected    
01908             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected, TRUE)  
01909 
01910     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01911     Created:    9/7/93
01912     Inputs:     -
01913     Outputs:    -
01914     Returns:    -
01915     Purpose:    Creates a StartArrow Attribute
01916     Errors:     -
01917     SeeAlso:    -
01918 
01919 ********************************************************************************************/
01920 
01921 AttrStartArrow::AttrStartArrow(Node* ContextNode,  
01922                     AttachNodeDirection Direction,  
01923                     BOOL Locked, 
01924                     BOOL Mangled,  
01925                     BOOL Marked, 
01926                     BOOL Selected    
01927             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected)  
01928 {                         
01929 } 
01930 
01931 /********************************************************************************************
01932 
01933 >   AttrStartArrow::AttrStartArrow()
01934 
01935     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01936     Created:    9/7/93
01937     Inputs:     -
01938     Outputs:    -
01939     Returns:    -
01940     Purpose:    Default constructor for Start Arrow Attribute class
01941     Errors:     -
01942     SeeAlso:    -
01943 
01944 ********************************************************************************************/
01945 
01946 AttrStartArrow::AttrStartArrow() : NodeAttribute()
01947 {
01948 }
01949 
01950 /********************************************************************************************
01951 
01952 >   void AttrStartArrow::Render( RenderRegion* pRender)
01953 
01954     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01955     Created:    9/7/93
01956     Inputs:     -
01957     Outputs:    -
01958     Returns:    -
01959     Purpose:    'Renders' a StartArrow attribute.
01960     Errors:     -
01961     SeeAlso:    -
01962 
01963 ********************************************************************************************/
01964 
01965 void AttrStartArrow::Render( RenderRegion* pRender)
01966 {
01967     pRender->SetStartArrow(&Value, FALSE);
01968 }
01969 
01970 BOOL AttrStartArrow::EffectsParentBounds()
01971 {
01972     return !Value.StartArrow.IsNullArrow();
01973 }
01974 
01975 /***********************************************************************************************
01976 
01977 >   DocRect AttrStartArrow::GetAttrBoundingRect(NodeRenderableInk* pParent)
01978 
01979     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01980     Created:    4/4/95
01981     Returns:    The bounding rect of the arrowhead
01982     Purpose:    Finds the bounding rect of the arrowhead.  
01983 
01984 ***********************************************************************************************/
01985 
01986 DocRect AttrStartArrow::GetAttrBoundingRect(NodeRenderableInk* pParent, CCAttrMap* pAttribMap)
01987 {
01988     if (!pParent->IsNodePath())
01989     {
01990 //      ERROR3("Arrow is not applied to a Path !!");    
01991         return DocRect(0, 0, 0, 0);
01992     }
01993 
01994     INT32 LineWidth = 0;
01995 
01996     // Now extract the info we need from the applied attributes
01997     void* pLineWidth = NULL;
01998     pAttribMap->Lookup( CC_RUNTIME_CLASS(AttrLineWidth), pLineWidth );
01999     ENSURE(pLineWidth,"AttrStartArrow::GetAttrBoundingRect can't find LineWidth");
02000 
02001     if (pLineWidth) 
02002     {
02003         LineWidth = ((AttrLineWidth*)pLineWidth)->Value.LineWidth;
02004     }
02005 
02006     return Value.StartArrow.GetArrowBoundingRect(&((NodePath*)pParent)->InkPath, LineWidth, TRUE);
02007 }
02008 
02009 /***********************************************************************************************
02010 
02011 >   Node* AttrStartArrow::SimpleCopy() 
02012 
02013     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02014     Created:    9/7/93
02015     
02016     Inputs:         - 
02017     Outputs:     
02018     Returns:    A copy of the node, or NULL if memory runs out 
02019          
02020     Purpose:    This method returns a shallow copy of the node with all Node pointers NULL. 
02021                 The function is virtual, and must be defined for all derived classes.  
02022 
02023     Errors:     If memory runs out when trying to copy, then ERROR is called with an out of memory
02024                 error and the function returns NULL. 
02025    
02026     Scope:      protected       
02027 
02028 ***********************************************************************************************/
02029      
02030 Node* AttrStartArrow::SimpleCopy()
02031 {
02032     AttrStartArrow* NodeCopy = new AttrStartArrow();
02033     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
02034     CopyNodeContents(NodeCopy);
02035     return NodeCopy;
02036 } 
02037 
02038 /********************************************************************************************
02039 
02040 >   INT32 AttrStartArrow::operator==(const NodeAttribute& Attrib)
02041 
02042     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02043     Created:    9/2/94
02044     Inputs:     Atrib:  The attribute to compare, which must be an AttrStartArrow
02045     Outputs:    -
02046     Returns:    -
02047     Purpose:    A virtual comparison operator. See NodeAttribute::operator== for 
02048                 a description of why it's required. 
02049  
02050     Errors:     An ENSURE failure will occur if Attrib does not have a AttrStartArrow 
02051                 runtime class.
02052                  
02053     SeeAlso:    NodeAttribute::operator==
02054 
02055 ********************************************************************************************/
02056 
02057 INT32 AttrStartArrow::operator==(const NodeAttribute& Attrib)
02058 {
02059     ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrStartArrow)),
02060         "Trying to compare two objects with different types"); 
02061 
02062     AttrStartArrow* Attr = (AttrStartArrow*) &Attrib;
02063     return (Attr->Value.StartArrow == Value.StartArrow); 
02064 } 
02065 
02066 /********************************************************************************************
02067 
02068 >   virtual UINT32 AttrStartArrow::GetAttrNameID(void)  
02069 
02070     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02071     Created:    22/2/94
02072     Inputs:     -
02073     Outputs:    -
02074     Returns:    Attribute description ID
02075     Purpose:    Returns back a string resource ID describing the attribute
02076 
02077     Errors:     -
02078     SeeAlso:    -
02079 
02080 ********************************************************************************************/
02081 
02082 UINT32 AttrStartArrow::GetAttrNameID(void)  
02083 {
02084     return (_R(IDS_START_ARROW)); 
02085 }                                  
02086 
02087 /***********************************************************************************************
02088 >   void AttrStartArrow::CopyNodeContents( AttrStartArrow* NodeCopy)
02089 
02090     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02091     Created:    28/4/93
02092     
02093     Inputs:           
02094     Outputs:    A copy of this node
02095     Returns:    -
02096          
02097     Purpose:    This method copies the node's contents to the node pointed to by NodeCopy.
02098               
02099     Errors:     An assertion failure will occur if NodeCopy is NULL
02100     
02101     Scope:      protected
02102                                      
02103 ***********************************************************************************************/
02104 
02105 void AttrStartArrow::CopyNodeContents( AttrStartArrow* NodeCopy)
02106 {
02107     NodeAttribute::CopyNodeContents( NodeCopy );
02108     
02109     //Copy contents specific to derived class here
02110     NodeCopy->Value.StartArrow = Value.StartArrow;
02111 } 
02112 
02113 
02114 
02115 /***********************************************************************************************
02116 >   void AttrStartArrow::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
02117 
02118     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
02119     Created:    18/12/2003
02120     Outputs:    -
02121     Purpose:    Polymorphically copies the contents of this node to another
02122     Errors:     An assertion failure will occur if NodeCopy is NULL
02123     Scope:      protected
02124                                      
02125 ***********************************************************************************************/
02126 
02127 void AttrStartArrow::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
02128 {
02129     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
02130     ENSURE(IS_A(pNodeCopy, AttrStartArrow), "PolyCopyNodeContents given wrong dest node type");
02131 
02132     if (IS_A(pNodeCopy, AttrStartArrow))
02133         CopyNodeContents((AttrStartArrow*)pNodeCopy);
02134 }
02135 
02136 
02137 
02138 #ifdef _DEBUG
02139 /***********************************************************************************************
02140 
02141 >   void AttrStartArrow::ShowDebugTreeDetails() const
02142 
02143     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02144     Created:    9/7/93
02145     Purpose:    Displays debugging info of the tree
02146 
02147 ***********************************************************************************************/
02148 
02149 void AttrStartArrow::ShowDebugTreeDetails() const
02150 {
02151     // Display a bit of debugging info
02152     // For now, we will just call the base class version
02153     NodeAttribute::ShowDebugTreeDetails();  
02154 }
02155 #endif
02156 
02157 void AttrStartArrow::GetDebugDetails(StringBase* Str)
02158 {
02159 #ifdef _DEBUG
02160     NodeAttribute::GetDebugDetails( Str );
02161 
02162     String_256 TempStr;
02163     //TempStr._MakeMsg( TEXT(!!!"\r\nLine width=#1%ld\r\n"), Value.LineWidth );
02164     (*Str) += TempStr;
02165 #endif
02166 }
02167 
02168 /********************************************************************************************
02169 
02170 >   virtual UINT32 AttrStartArrow::GetNodeSize() const
02171 
02172     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02173     Created:    6/10/93
02174     Inputs:     -
02175     Outputs:    -
02176     Returns:    The size of the node in bytes
02177     Purpose:    For finding the size of the node 
02178                 
02179     SeeAlso:    Node::GetSubtreeSize
02180 
02181 ********************************************************************************************/
02182 
02183 UINT32 AttrStartArrow::GetNodeSize() const 
02184 {     
02185     return (sizeof(AttrStartArrow)); 
02186 }  
02187 
02188 
02189 
02190 /********************************************************************************************
02191 
02192   > virtual BOOL AttrStartArrow::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
02193 
02194     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
02195     Created:    30/5/96
02196     Inputs:     pFilter = ptr to the filter
02197     Returns:    TRUE if record is written, FALSE if not
02198     Purpose:    Writes the start arrow record to the filter
02199     SeeAlso:    -
02200 
02201 ********************************************************************************************/
02202 
02203 BOOL AttrStartArrow::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
02204 {
02205 #ifdef DO_EXPORT
02206     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
02207 
02208     CamelotFileRecord Rec(pFilter,TAG_ARROWHEAD,TAG_ARROWHEAD_SIZE);
02209 
02210     INT32       ArrowId     = 0;
02211     FIXED16     ScaleWidth  = Value.StartArrow.GetArrowWidth();
02212     FIXED16     ScaleHeight = Value.StartArrow.GetArrowHeight();
02213     ArrowRec    Arrow;
02214 
02215     INT32 ArrowType = Value.StartArrow.GetArrowID();
02216 
02217     // Convert the internal style into an arrow reference
02218     switch ((StockArrow)ArrowType)
02219     {
02220         case SA_NULLARROW       : ArrowId = REF_ARROW_NULL;             break;
02221         case SA_STRAIGHTARROW   : ArrowId = REF_ARROW_STRAIGHT;         break;
02222         case SA_ANGLEDARROW     : ArrowId = REF_ARROW_ANGLED;           break;
02223         case SA_ROUNDEDARROW    : ArrowId = REF_ARROW_ROUNDED;          break;
02224         case SA_SPOT            : ArrowId = REF_ARROW_SPOT;             break;
02225         case SA_DIAMOND         : ArrowId = REF_ARROW_DIAMOND;          break;
02226         case SA_ARROWFEATHER    : ArrowId = REF_ARROW_FEATHER;          break;
02227         case SA_ARROWFEATHER2   : ArrowId = REF_ARROW_FEATHER2;         break;
02228         case SA_HOLLOWDIAMOND   : ArrowId = REF_ARROW_HOLLOWDIAMOND;    break;
02229         default:
02230             ERROR3("Unkown arrow head type in AttrStartArrow::WritePreChildrenWeb");
02231             break;
02232     }
02233 
02234     BOOL ok = Rec.Init();
02235     if (ok) ok = Rec.WriteINT32(ArrowId);
02236     if (ok) ok = Rec.WriteFIXED16(ScaleWidth);
02237     if (ok) ok = Rec.WriteFIXED16(ScaleHeight);
02238     if (ok) ok = pFilter->Write(&Rec);
02239 
02240     return ok;
02241 #else
02242     return FALSE;
02243 #endif // DO_EXPORT
02244 }
02245 
02246 //--------------------------------------------------------------
02247 // See AttrStartArrow::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
02248 //
02249 BOOL AttrStartArrow::WritePreChildrenNative(BaseCamelotFilter* pFilter)
02250 {
02251 #ifdef DO_EXPORT
02252     return WritePreChildrenWeb(pFilter);
02253 #else
02254     return FALSE;
02255 #endif
02256 }
02257 
02258 
02259 //----------------------------------------------------------------------------
02260 //----------------------------------------------------------------------------
02261 //----------------------------------------------------------------------------
02262 
02263 /********************************************************************************************
02264 
02265 >   AttrEndArrow::AttrEndArrow(Node* ContextNode,  
02266                     AttachNodeDirection Direction,  
02267                     BOOL Locked, 
02268                     BOOL Mangled,  
02269                     BOOL Marked, 
02270                     BOOL Selected    
02271             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected, TRUE)  
02272 
02273     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02274     Created:    9/7/93
02275     Inputs:     -
02276     Outputs:    -
02277     Returns:    -
02278     Purpose:    Creates an EndArrow Attribute
02279     Errors:     -
02280     SeeAlso:    -
02281 
02282 ********************************************************************************************/
02283 
02284 AttrEndArrow::AttrEndArrow(Node* ContextNode,  
02285                     AttachNodeDirection Direction,  
02286                     BOOL Locked, 
02287                     BOOL Mangled,  
02288                     BOOL Marked, 
02289                     BOOL Selected    
02290             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected)  
02291 {                         
02292 } 
02293 
02294 /********************************************************************************************
02295 
02296 >   AttrEndArrow::AttrEndArrow()
02297 
02298     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02299     Created:    9/7/93
02300     Inputs:     -
02301     Outputs:    -
02302     Returns:    -
02303     Purpose:    Default constructor for End Arrow Attribute class
02304     Errors:     -
02305     SeeAlso:    -
02306 
02307 ********************************************************************************************/
02308 
02309 AttrEndArrow::AttrEndArrow() : NodeAttribute()
02310 {
02311 }
02312 
02313 /********************************************************************************************
02314 
02315 >   void AttrEndArrow::Render( RenderRegion* pRender)
02316 
02317     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02318     Created:    9/7/93
02319     Inputs:     -
02320     Outputs:    -
02321     Returns:    -
02322     Purpose:    'Renders' a EndArrow attribute.
02323     Errors:     -
02324     SeeAlso:    -
02325 
02326 ********************************************************************************************/
02327 
02328 void AttrEndArrow::Render( RenderRegion* pRender)
02329 {
02330     pRender->SetEndArrow(&Value, FALSE);
02331 }
02332 
02333 BOOL AttrEndArrow::EffectsParentBounds()
02334 {
02335     return !Value.EndArrow.IsNullArrow();
02336 }
02337 
02338 /***********************************************************************************************
02339 
02340 >   DocRect AttrEndArrow::GetAttrBoundingRect(NodeRenderableInk* pParent)
02341 
02342     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02343     Created:    4/4/95
02344     Returns:    The bounding rect of the arrowhead
02345     Purpose:    Finds the bounding rect of the arrowhead.  
02346 
02347 ***********************************************************************************************/
02348      
02349 DocRect AttrEndArrow::GetAttrBoundingRect(NodeRenderableInk* pParent, CCAttrMap* pAttribMap)
02350 {
02351     if (!pParent->IsNodePath())
02352     {
02353 //      ERROR3("Arrow is not applied to a Path !!");    
02354         return DocRect(0, 0, 0, 0);
02355     }
02356 
02357 
02358     INT32 LineWidth = 0;
02359 
02360     // Now extract the info we need from the applied attributes
02361     void* pLineWidth = NULL;
02362     pAttribMap->Lookup( CC_RUNTIME_CLASS(AttrLineWidth), pLineWidth );
02363     ENSURE(pLineWidth,"AttrEndArrow::GetAttrBoundingRect can't find LineWidth");
02364 
02365     if (pLineWidth) 
02366     {
02367         LineWidth = ((AttrLineWidth*)pLineWidth)->Value.LineWidth;
02368     }
02369 
02370     return Value.EndArrow.GetArrowBoundingRect(&((NodePath*)pParent)->InkPath, LineWidth, FALSE);
02371 }
02372 
02373 /***********************************************************************************************
02374 > Node* AttrEndArrow::SimpleCopy() 
02375 
02376     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02377     Created:    9/7/93
02378     
02379     Inputs:         - 
02380     Outputs:     
02381     Returns:    A copy of the node, or NULL if memory runs out 
02382          
02383     Purpose:    This method returns a shallow copy of the node with all Node pointers NULL. 
02384                 The function is virtual, and must be defined for all derived classes.  
02385     
02386     Errors:     If memory runs out when trying to copy, then ERROR is called with an out of memory
02387                 error and the function returns NULL. 
02388     
02389     Scope:      protected       
02390 ***********************************************************************************************/
02391      
02392 Node* AttrEndArrow::SimpleCopy()
02393 {
02394     AttrEndArrow* NodeCopy = new AttrEndArrow();
02395     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
02396     CopyNodeContents(NodeCopy);
02397     
02398     return NodeCopy;
02399 }  
02400 
02401 /********************************************************************************************
02402 
02403 >   INT32 AttrEndArrow::operator==(const NodeAttribute& Attrib)
02404 
02405     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02406     Created:    9/2/94
02407     Inputs:     Atrib:  The attribute to compare, which must be an AttrEndArrow
02408     Outputs:    -
02409     Returns:    -
02410     Purpose:    A virtual comparison operator. See NodeAttribute::operator== for 
02411                 a description of why it's required. 
02412  
02413     Errors:     An ENSURE failure will occur if Attrib does not have a AttrEndArrow
02414                 runtime class.
02415                  
02416     SeeAlso:    NodeAttribute::operator==
02417 
02418 ********************************************************************************************/
02419 
02420 INT32 AttrEndArrow::operator==(const NodeAttribute& Attrib)
02421 {
02422     ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrEndArrow)),
02423         "Trying to compare two objects with different types"); 
02424 
02425     AttrEndArrow* Attr = (AttrEndArrow*) &Attrib;
02426     return (Attr->Value.EndArrow == Value.EndArrow); 
02427 }
02428 
02429 /********************************************************************************************
02430 
02431 >   virtual UINT32 AttrEndArrow::GetAttrNameID(void)  
02432 
02433     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02434     Created:    22/2/94
02435     Inputs:     -
02436     Outputs:    -
02437     Returns:    Attribute description ID
02438     Purpose:    Returns back a string resource ID describing the attribute
02439 
02440     Errors:     -
02441     SeeAlso:    -
02442 
02443 ********************************************************************************************/
02444 
02445 UINT32 AttrEndArrow::GetAttrNameID(void)  
02446 {
02447     return (_R(IDS_END_ARROW)); 
02448 }                                  
02449 
02450 /***********************************************************************************************
02451 >   void AttrEndArrow::CopyNodeContents( AttrEndArrow* NodeCopy)
02452 
02453     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02454     Created:    28/4/93
02455     
02456     Inputs:           
02457     Outputs:    A copy of this node
02458     Returns:    -
02459          
02460     Purpose:    This method copies the node's contents to the node pointed to by NodeCopy.
02461               
02462     Errors:     An assertion failure will occur if NodeCopy is NULL
02463     
02464     Scope:      protected
02465                                      
02466 ***********************************************************************************************/
02467 
02468 void AttrEndArrow::CopyNodeContents( AttrEndArrow* NodeCopy)
02469 {
02470     NodeAttribute::CopyNodeContents( NodeCopy );
02471     
02472     //Copy contents specific to derived class here
02473     NodeCopy->Value.EndArrow = Value.EndArrow;
02474 } 
02475 
02476 
02477 
02478 /***********************************************************************************************
02479 >   void AttrEndArrow::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
02480 
02481     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
02482     Created:    18/12/2003
02483     Outputs:    -
02484     Purpose:    Polymorphically copies the contents of this node to another
02485     Errors:     An assertion failure will occur if NodeCopy is NULL
02486     Scope:      protected
02487                                      
02488 ***********************************************************************************************/
02489 
02490 void AttrEndArrow::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
02491 {
02492     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
02493     ENSURE(IS_A(pNodeCopy, AttrEndArrow), "PolyCopyNodeContents given wrong dest node type");
02494 
02495     if (IS_A(pNodeCopy, AttrEndArrow))
02496         CopyNodeContents((AttrEndArrow*)pNodeCopy);
02497 }
02498 
02499 
02500 
02501 #ifdef _DEBUG
02502 /***********************************************************************************************
02503 
02504 >   void AttrEndArrow::ShowDebugTreeDetails() const
02505 
02506     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02507     Created:    9/7/93
02508     Purpose:    Displays debugging info of the tree
02509 
02510 ***********************************************************************************************/
02511 
02512 void AttrEndArrow::ShowDebugTreeDetails() const
02513 {
02514     // Display a bit of debugging info
02515     // For now, we will just call the base class version
02516     NodeAttribute::ShowDebugTreeDetails();  
02517 }
02518 #endif
02519 
02520 void AttrEndArrow::GetDebugDetails(StringBase* Str)
02521 {
02522 #ifdef _DEBUG
02523     NodeAttribute::GetDebugDetails( Str );
02524 
02525     String_256 TempStr;
02526     //TempStr._MakeMsg( TEXT(!!!"\r\nLine width=#1%ld\r\n"), Value.LineWidth );
02527     (*Str) += TempStr;
02528 #endif
02529 }
02530 
02531 /********************************************************************************************
02532 
02533 >   virtual UINT32 AttrEndArrow::GetNodeSize() const
02534 
02535     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02536     Created:    6/10/93
02537     Inputs:     -
02538     Outputs:    -
02539     Returns:    The size of the node in bytes
02540     Purpose:    For finding the size of the node 
02541                 
02542     SeeAlso:    Node::GetSubtreeSize
02543 
02544 ********************************************************************************************/
02545 
02546 UINT32 AttrEndArrow::GetNodeSize() const 
02547 {     
02548     return (sizeof(AttrEndArrow)); 
02549 }  
02550 
02551 
02552 
02553 /********************************************************************************************
02554 
02555   > virtual BOOL AttrEndArrow::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
02556 
02557     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
02558     Created:    30/5/96
02559     Inputs:     pFilter = ptr to the filter
02560     Returns:    TRUE if record is written, FALSE if not
02561     Purpose:    Writes the end arrow record to the filter
02562     SeeAlso:    -
02563 
02564 ********************************************************************************************/
02565 
02566 BOOL AttrEndArrow::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
02567 {
02568 #ifdef DO_EXPORT
02569     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
02570 
02571     CamelotFileRecord Rec(pFilter,TAG_ARROWTAIL,TAG_ARROWTAIL_SIZE);
02572 
02573     INT32       ArrowId     = 0;
02574     FIXED16     ScaleWidth  = Value.EndArrow.GetArrowWidth();
02575     FIXED16     ScaleHeight = Value.EndArrow.GetArrowHeight();
02576     ArrowRec    Arrow;
02577 
02578     INT32 ArrowType = Value.EndArrow.GetArrowID();
02579 
02580     // Convert the internal style into an arrow reference
02581     switch ((StockArrow)ArrowType)
02582     {
02583         case SA_NULLARROW       : ArrowId = REF_ARROW_NULL;             break;
02584         case SA_STRAIGHTARROW   : ArrowId = REF_ARROW_STRAIGHT;         break;
02585         case SA_ANGLEDARROW     : ArrowId = REF_ARROW_ANGLED;           break;
02586         case SA_ROUNDEDARROW    : ArrowId = REF_ARROW_ROUNDED;          break;
02587         case SA_SPOT            : ArrowId = REF_ARROW_SPOT;             break;
02588         case SA_DIAMOND         : ArrowId = REF_ARROW_DIAMOND;          break;
02589         case SA_ARROWFEATHER    : ArrowId = REF_ARROW_FEATHER;          break;
02590         case SA_ARROWFEATHER2   : ArrowId = REF_ARROW_FEATHER2;         break;
02591         case SA_HOLLOWDIAMOND   : ArrowId = REF_ARROW_HOLLOWDIAMOND;    break;
02592         default:
02593             ERROR3("Unkown arrow head type in AttrEndArrow::WritePreChildrenWeb");
02594             break;
02595     }
02596 
02597     BOOL ok = Rec.Init();
02598     if (ok) ok = Rec.WriteINT32(ArrowId);
02599     if (ok) ok = Rec.WriteFIXED16(ScaleWidth);
02600     if (ok) ok = Rec.WriteFIXED16(ScaleHeight);
02601     if (ok) ok = pFilter->Write(&Rec);
02602 
02603     return ok;
02604 #else
02605     return FALSE;
02606 #endif // DO_EXPORT
02607 }
02608 
02609 //--------------------------------------------------------------
02610 // See AttrEndArrow::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
02611 //
02612 BOOL AttrEndArrow::WritePreChildrenNative(BaseCamelotFilter* pFilter)
02613 {
02614 #ifdef DO_EXPORT
02615     return WritePreChildrenWeb(pFilter);
02616 #else
02617     return FALSE;
02618 #endif
02619 }
02620 
02621 //----------------------------------------------------------------------------
02622 //----------------------------------------------------------------------------
02623 //----------------------------------------------------------------------------
02624 
02625 /********************************************************************************************
02626 
02627 >   AttrJoinType::AttrJoinType(Node* ContextNode,  
02628                     AttachNodeDirection Direction,  
02629                     BOOL Locked, 
02630                     BOOL Mangled,  
02631                     BOOL Marked, 
02632                     BOOL Selected    
02633             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected, TRUE)  
02634 
02635     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02636     Created:    9/7/93
02637     Inputs:     -
02638     Outputs:    -
02639     Returns:    -
02640     Purpose:    Creates a JoinType Attribute
02641     Errors:     -
02642     SeeAlso:    -
02643 
02644 ********************************************************************************************/
02645 
02646 AttrJoinType::AttrJoinType(Node* ContextNode,  
02647                     AttachNodeDirection Direction,  
02648                     BOOL Locked, 
02649                     BOOL Mangled,  
02650                     BOOL Marked, 
02651                     BOOL Selected    
02652             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected)  
02653 {                         
02654 } 
02655 
02656 /********************************************************************************************
02657 
02658 >   AttrJoinType::AttrJoinType()
02659 
02660     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02661     Created:    9/7/93
02662     Inputs:     -
02663     Outputs:    -
02664     Returns:    -
02665     Purpose:    Default constructor for Join Type Attribute class
02666     Errors:     -
02667     SeeAlso:    -
02668 
02669 ********************************************************************************************/
02670 
02671 AttrJoinType::AttrJoinType() : NodeAttribute()
02672 {
02673 }
02674 
02675 /********************************************************************************************
02676 
02677 >   void AttrJoinType::Render( RenderRegion* pRender)
02678 
02679     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02680     Created:    9/7/93
02681     Inputs:     -
02682     Outputs:    -
02683     Returns:    -
02684     Purpose:    'Renders' a JoinType attribute.
02685     Errors:     -
02686     SeeAlso:    -
02687 
02688 ********************************************************************************************/
02689 
02690 void AttrJoinType::Render( RenderRegion* pRender)
02691 {
02692     pRender->SetJoinType(&Value, FALSE);
02693 }
02694 
02695 /***********************************************************************************************
02696 > Node* AttrJoinType::SimpleCopy() 
02697 
02698     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02699     Created:    9/7/93
02700     
02701     Inputs:         - 
02702     Outputs:     
02703     Returns:    A copy of the node, or NULL if memory runs out 
02704          
02705     Purpose:    This method returns a shallow copy of the node with all Node pointers NULL. 
02706                 The function is virtual, and must be defined for all derived classes.  
02707            
02708     Errors:     If memory runs out when trying to copy, then ERROR is called with an out of memory
02709                 error and the function returns NULL. 
02710 
02711     Scope:      protected       
02712 ***********************************************************************************************/
02713      
02714 Node* AttrJoinType::SimpleCopy()
02715 {
02716     AttrJoinType* NodeCopy = new AttrJoinType();
02717     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
02718     CopyNodeContents(NodeCopy);
02719     
02720     return NodeCopy;
02721 }  
02722 
02723 /********************************************************************************************
02724 
02725 >   INT32 AttrJoinType::operator==(const NodeAttribute& Attrib)
02726 
02727     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02728     Created:    9/2/94
02729     Inputs:     Atrib:  The attribute to compare, which must be an AttrJoinType
02730     Outputs:    -
02731     Returns:    -
02732     Purpose:    A virtual comparison operator. See NodeAttribute::operator== for 
02733                 a description of why it's required. 
02734  
02735     Errors:     An ENSURE failure will occur if Attrib does not have a AttrJoinType
02736                 runtime class.
02737                  
02738     SeeAlso:    NodeAttribute::operator==
02739 
02740 ********************************************************************************************/
02741 
02742 INT32 AttrJoinType::operator==(const NodeAttribute& Attrib)
02743 {
02744     ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrJoinType)),
02745         "Trying to compare two objects with different types"); 
02746     AttrJoinType* Attr = (AttrJoinType*) &Attrib;
02747     return (Attr->Value.JoinType == Value.JoinType); 
02748 }
02749 
02750 /********************************************************************************************
02751 
02752 >   virtual UINT32 AttrJoinType::GetAttrNameID(void)  
02753 
02754     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02755     Created:    22/2/94
02756     Inputs:     -
02757     Outputs:    -
02758     Returns:    Attribute description ID
02759     Purpose:    Returns back a string resource ID describing the attribute
02760 
02761     Errors:     -
02762     SeeAlso:    -
02763 
02764 ********************************************************************************************/
02765 
02766 UINT32 AttrJoinType::GetAttrNameID(void)  
02767 {
02768     return (_R(IDS_JOIN_TYPE)); 
02769 }                                  
02770 
02771 /***********************************************************************************************
02772 >   void AttrJoinType::CopyNodeContents( AttrJoinType* NodeCopy)
02773 
02774     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02775     Created:    28/4/93
02776     
02777     Inputs:           
02778     Outputs:    A copy of this node
02779     Returns:    -
02780          
02781     Purpose:    This method copies the node's contents to the node pointed to by NodeCopy.
02782               
02783     Errors:     An assertion failure will occur if NodeCopy is NULL
02784     
02785     Scope:      protected
02786                                      
02787 ***********************************************************************************************/
02788 
02789 void AttrJoinType::CopyNodeContents( AttrJoinType* NodeCopy)
02790 {
02791     NodeAttribute::CopyNodeContents( NodeCopy ); 
02792     NodeCopy->Value.JoinType = Value.JoinType; 
02793     
02794 } 
02795 
02796 
02797 
02798 /***********************************************************************************************
02799 >   void AttrJoinType::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
02800 
02801     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
02802     Created:    18/12/2003
02803     Outputs:    -
02804     Purpose:    Polymorphically copies the contents of this node to another
02805     Errors:     An assertion failure will occur if NodeCopy is NULL
02806     Scope:      protected
02807                                      
02808 ***********************************************************************************************/
02809 
02810 void AttrJoinType::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
02811 {
02812     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
02813     ENSURE(IS_A(pNodeCopy, AttrJoinType), "PolyCopyNodeContents given wrong dest node type");
02814 
02815     if (IS_A(pNodeCopy, AttrJoinType))
02816         CopyNodeContents((AttrJoinType*)pNodeCopy);
02817 }
02818 
02819 
02820 
02821 #ifdef _DEBUG
02822 /***********************************************************************************************
02823 
02824 >   void AttrJoinType::ShowDebugTreeDetails() const
02825 
02826     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02827     Created:    9/7/93
02828     Purpose:    Displays debugging info of the tree
02829 
02830 ***********************************************************************************************/
02831 
02832 void AttrJoinType::ShowDebugTreeDetails() const
02833 {
02834     // Display a bit of debugging info
02835     // For now, we will just call the base class version
02836     NodeAttribute::ShowDebugTreeDetails();  
02837 }
02838 #endif
02839 
02840 void AttrJoinType::GetDebugDetails(StringBase* Str)
02841 {
02842 #ifdef _DEBUG
02843     NodeAttribute::GetDebugDetails( Str );
02844 
02845     String_256 TempStr;
02846     char *p;
02847     switch (Value.JoinType)
02848     {
02849         case MitreJoin: p = "Mitre"; break;
02850         case RoundJoin: p = "Round"; break;
02851         case BevelledJoin: p = "Bevelled"; break;
02852         default: p = "??"; break;
02853     }
02854     TempStr._MakeMsg( TEXT("\r\nJoin type=#1%s\r\n"), p );
02855     (*Str) += TempStr;
02856 #endif
02857 }
02858 
02859 
02860 /********************************************************************************************
02861 
02862 >   virtual UINT32 AttrJoinType::GetNodeSize() const
02863 
02864     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02865     Created:    6/10/93
02866     Inputs:     -
02867     Outputs:    -
02868     Returns:    The size of the node in bytes
02869     Purpose:    For finding the size of the node 
02870                 
02871     SeeAlso:    Node::GetSubtreeSize
02872 
02873 ********************************************************************************************/
02874 
02875 UINT32 AttrJoinType::GetNodeSize() const 
02876 {     
02877     return (sizeof(AttrJoinType)); 
02878 }  
02879 
02880 
02881 
02882 
02883 /********************************************************************************************
02884 
02885   > virtual BOOL AttrJoinType::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
02886 
02887     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
02888     Created:    30/5/96
02889     Inputs:     pFilter = ptr to the filter
02890     Returns:    TRUE if record is written, FALSE if not
02891     Purpose:    Writes the join type record to the filter
02892     SeeAlso:    -
02893 
02894 ********************************************************************************************/
02895 
02896 BOOL AttrJoinType::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
02897 {
02898 #ifdef DO_EXPORT
02899     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
02900 
02901     CamelotFileRecord Rec(pFilter,TAG_JOINSTYLE,TAG_JOINSTYLE_SIZE);
02902 
02903     BOOL ok = Rec.Init();
02904     if (ok) ok = Rec.WriteBYTE(BYTE(Value.JoinType));
02905     if (ok) ok = pFilter->Write(&Rec);
02906 
02907     return ok;
02908 #else
02909     return FALSE;
02910 #endif
02911 }
02912 
02913 //--------------------------------------------------------------
02914 // See AttrJoinType::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
02915 //
02916 BOOL AttrJoinType::WritePreChildrenNative(BaseCamelotFilter* pFilter)
02917 {
02918 #ifdef DO_EXPORT
02919     return WritePreChildrenWeb(pFilter);
02920 #else
02921     return FALSE;
02922 #endif
02923 }
02924 
02925 
02926 //----------------------------------------------------------------------------
02927 //----------------------------------------------------------------------------
02928 //----------------------------------------------------------------------------
02929 
02930 
02931 /********************************************************************************************
02932 
02933 >   AttrMitreLimit::AttrMitreLimit(Node* ContextNode,  
02934                     AttachNodeDirection Direction,  
02935                     BOOL Locked, 
02936                     BOOL Mangled,  
02937                     BOOL Marked, 
02938                     BOOL Selected    
02939             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected, TRUE)  
02940 
02941     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02942     Created:    9/7/93
02943     Inputs:     -
02944     Outputs:    -
02945     Returns:    -
02946     Purpose:    Creates a MitreLimit Attribute
02947     Errors:     -
02948     SeeAlso:    -
02949 
02950 ********************************************************************************************/
02951 
02952 AttrMitreLimit::AttrMitreLimit(Node* ContextNode,  
02953                     AttachNodeDirection Direction,  
02954                     BOOL Locked, 
02955                     BOOL Mangled,  
02956                     BOOL Marked, 
02957                     BOOL Selected    
02958             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected)  
02959 {                         
02960 } 
02961 
02962 /********************************************************************************************
02963 
02964 >   AttrMitreLimit::AttrMitreLimit()
02965 
02966     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02967     Created:    9/7/93
02968     Inputs:     -
02969     Outputs:    -
02970     Returns:    -
02971     Purpose:    Default constructor for Join Type Attribute class
02972     Errors:     -
02973     SeeAlso:    -
02974 
02975 ********************************************************************************************/
02976 
02977 AttrMitreLimit::AttrMitreLimit() : NodeAttribute()
02978 {
02979 }
02980 
02981 /********************************************************************************************
02982 
02983 >   void AttrMitreLimit::Render( RenderRegion* pRender)
02984 
02985     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02986     Created:    9/7/93
02987     Inputs:     -
02988     Outputs:    -
02989     Returns:    -
02990     Purpose:    'Renders' a MitreLimit attribute.
02991     Errors:     -
02992     SeeAlso:    -
02993 
02994 ********************************************************************************************/
02995 
02996 void AttrMitreLimit::Render( RenderRegion* pRender)
02997 {
02998     pRender->SetMitreLimit(&Value, FALSE);
02999 }
03000 
03001 /***********************************************************************************************
03002 > Node* AttrMitreLimit::SimpleCopy() 
03003 
03004     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
03005     Created:    9/7/93
03006     
03007     Inputs:         - 
03008     Outputs:     
03009     Returns:    A copy of the node, or NULL if memory runs out 
03010          
03011     Purpose:    This method returns a shallow copy of the node with all Node pointers NULL. 
03012                 The function is virtual, and must be defined for all derived classes.  
03013            
03014     Errors:     If memory runs out when trying to copy, then ERROR is called with an out of memory
03015                 error and the function returns NULL. 
03016    
03017     Scope:      protected       
03018 ***********************************************************************************************/
03019      
03020 Node* AttrMitreLimit::SimpleCopy()
03021 {
03022     AttrMitreLimit* NodeCopy = new AttrMitreLimit();
03023     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
03024     CopyNodeContents(NodeCopy);
03025     return NodeCopy;
03026 }    
03027 
03028 /********************************************************************************************
03029 
03030 >   INT32 AttrMitreLimit::operator==(const NodeAttribute& Attrib)
03031 
03032     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03033     Created:    9/2/94
03034     Inputs:     Atrib:  The attribute to compare, which must be an AttrMitreLimit
03035     Outputs:    -
03036     Returns:    -
03037     Purpose:    A virtual comparison operator. See NodeAttribute::operator== for 
03038                 a description of why it's required. 
03039  
03040     Errors:     An ENSURE failure will occur if Attrib does not have a AttrMitreLimit
03041                 runtime class.
03042                  
03043     SeeAlso:    NodeAttribute::operator==
03044 
03045 ********************************************************************************************/
03046 
03047 INT32 AttrMitreLimit::operator==(const NodeAttribute& Attrib)
03048 {
03049     ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrMitreLimit)),
03050         "Trying to compare two objects with different types"); 
03051     AttrMitreLimit* Attr = (AttrMitreLimit*) &Attrib;
03052     return (Attr->Value.MitreLimit == Value.MitreLimit); 
03053 } 
03054 
03055 /********************************************************************************************
03056 
03057 >   virtual UINT32 AttrMitreLimit::GetAttrNameID(void)  
03058 
03059     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03060     Created:    22/2/94
03061     Inputs:     -
03062     Outputs:    -
03063     Returns:    Attribute description ID
03064     Purpose:    Returns back a string resource ID describing the attribute
03065 
03066     Errors:     -
03067     SeeAlso:    -
03068 
03069 ********************************************************************************************/
03070 
03071 UINT32 AttrMitreLimit::GetAttrNameID(void)  
03072 {
03073     return (_R(IDS_MITRE_LIMIT)); 
03074 }                               
03075 
03076 /***********************************************************************************************
03077 >   void AttrMitreLimit::CopyNodeContents( AttrMitreLimit* NodeCopy)
03078 
03079     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03080     Created:    28/4/93
03081     
03082     Inputs:           
03083     Outputs:    A copy of this node
03084     Returns:    -
03085          
03086     Purpose:    This method copies the node's contents to the node pointed to by NodeCopy.
03087               
03088     Errors:     An assertion failure will occur if NodeCopy is NULL
03089     
03090     Scope:      protected
03091                                      
03092 ***********************************************************************************************/
03093 
03094 void AttrMitreLimit::CopyNodeContents( AttrMitreLimit* NodeCopy)
03095 {
03096     NodeAttribute::CopyNodeContents( NodeCopy );
03097     NodeCopy->Value.MitreLimit = Value.MitreLimit; 
03098 } 
03099 
03100 
03101 
03102 /***********************************************************************************************
03103 >   void AttrMitreLimit::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
03104 
03105     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
03106     Created:    18/12/2003
03107     Outputs:    -
03108     Purpose:    Polymorphically copies the contents of this node to another
03109     Errors:     An assertion failure will occur if NodeCopy is NULL
03110     Scope:      protected
03111                                      
03112 ***********************************************************************************************/
03113 
03114 void AttrMitreLimit::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
03115 {
03116     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
03117     ENSURE(IS_A(pNodeCopy, AttrMitreLimit), "PolyCopyNodeContents given wrong dest node type");
03118 
03119     if (IS_A(pNodeCopy, AttrMitreLimit))
03120         CopyNodeContents((AttrMitreLimit*)pNodeCopy);
03121 }
03122 
03123 
03124 
03125 #ifdef _DEBUG
03126 /***********************************************************************************************
03127 
03128 >   void AttrMitreLimit::ShowDebugTreeDetails() const
03129 
03130     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
03131     Created:    9/7/93
03132     Purpose:    Displays debugging info of the tree
03133 
03134 ***********************************************************************************************/
03135 
03136 void AttrMitreLimit::ShowDebugTreeDetails() const
03137 {
03138     // Display a bit of debugging info
03139     // For now, we will just call the base class version
03140     NodeAttribute::ShowDebugTreeDetails();  
03141 }
03142 #endif
03143 
03144 void AttrMitreLimit::GetDebugDetails(StringBase* Str)
03145 {
03146 #ifdef _DEBUG
03147     NodeAttribute::GetDebugDetails( Str );
03148 
03149     String_256 TempStr;
03150     TempStr._MakeMsg( TEXT("\r\nMitre limit=#1%ld\r\n"), Value.MitreLimit );
03151     (*Str) += TempStr;
03152 #endif
03153 }
03154 
03155 /********************************************************************************************
03156 
03157 >   virtual UINT32 AttrMitreLimit::GetNodeSize() const
03158 
03159     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03160     Created:    6/10/93
03161     Inputs:     -
03162     Outputs:    -
03163     Returns:    The size of the node in bytes
03164     Purpose:    For finding the size of the node 
03165                 
03166     SeeAlso:    Node::GetSubtreeSize
03167 
03168 ********************************************************************************************/
03169 
03170 UINT32 AttrMitreLimit::GetNodeSize() const 
03171 {     
03172     return (sizeof(AttrMitreLimit)); 
03173 }  
03174 
03175 
03176 
03177 
03178 /********************************************************************************************
03179 
03180   > virtual BOOL AttrMitreLimit::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
03181 
03182     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
03183     Created:    30/5/96
03184     Inputs:     pFilter = ptr to the filter
03185     Returns:    TRUE if record is written, FALSE if not
03186     Purpose:    Writes the mitre limit record to the filter
03187     SeeAlso:    -
03188 
03189 ********************************************************************************************/
03190 
03191 BOOL AttrMitreLimit::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
03192 {
03193 #ifdef DO_EXPORT
03194     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
03195 
03196     CamelotFileRecord Rec(pFilter,TAG_MITRELIMIT,TAG_MITRELIMIT_SIZE);
03197 
03198     BOOL ok = Rec.Init();
03199     if (ok) ok = Rec.WriteINT32(Value.MitreLimit);
03200     if (ok) ok = pFilter->Write(&Rec);
03201 
03202     return ok;
03203 #else
03204     return FALSE;
03205 #endif
03206 }
03207 
03208 //--------------------------------------------------------------
03209 // See AttrMitreLimit::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
03210 //
03211 BOOL AttrMitreLimit::WritePreChildrenNative(BaseCamelotFilter* pFilter)
03212 {
03213 #ifdef DO_EXPORT
03214     return WritePreChildrenWeb(pFilter);
03215 #else
03216     return FALSE;
03217 #endif
03218 }
03219 
03220 
03221 //----------------------------------------------------------------------------
03222 //----------------------------------------------------------------------------
03223 //----------------------------------------------------------------------------
03224 
03225 
03226 /********************************************************************************************
03227 
03228 >   AttrWindingRule::AttrWindingRule(Node* ContextNode,  
03229                     AttachNodeDirection Direction,  
03230                     BOOL Locked, 
03231                     BOOL Mangled,  
03232                     BOOL Marked, 
03233                     BOOL Selected    
03234             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected, TRUE)  
03235 
03236     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
03237     Created:    9/7/93
03238     Inputs:     -
03239     Outputs:    -
03240     Returns:    -
03241     Purpose:    Creates a WindingRule Attribute
03242     Errors:     -
03243     SeeAlso:    -
03244 
03245 ********************************************************************************************/
03246 
03247 AttrWindingRule::AttrWindingRule(Node* ContextNode,  
03248                     AttachNodeDirection Direction,  
03249                     BOOL Locked, 
03250                     BOOL Mangled,  
03251                     BOOL Marked, 
03252                     BOOL Selected    
03253             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected)  
03254 {                         
03255 } 
03256 
03257 /********************************************************************************************
03258 
03259 >   AttrWindingRule::AttrWindingRule()
03260 
03261     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
03262     Created:    9/7/93
03263     Inputs:     -
03264     Outputs:    -
03265     Returns:    -
03266     Purpose:    Default constructor for Join Type Attribute class
03267     Errors:     -
03268     SeeAlso:    -
03269 
03270 ********************************************************************************************/
03271 
03272 AttrWindingRule::AttrWindingRule() : NodeAttribute()
03273 {
03274     Value.WindingRule = EvenOddWinding;
03275 }
03276 
03277 /********************************************************************************************
03278 
03279 >   void AttrWindingRule::Render( RenderRegion* pRender)
03280 
03281     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
03282     Created:    9/7/93
03283     Inputs:     -
03284     Outputs:    -
03285     Returns:    -
03286     Purpose:    'Renders' a WindingRule attribute.
03287     Errors:     -
03288     SeeAlso:    -
03289 
03290 ********************************************************************************************/
03291 
03292 void AttrWindingRule::Render( RenderRegion* pRender )
03293 {
03294     pRender->SetWindingRule(&Value, FALSE);
03295 }
03296 
03297 /***********************************************************************************************
03298 > Node* AttrWindingRule::SimpleCopy() 
03299 
03300     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
03301     Created:    9/7/93
03302     
03303     Inputs:         - 
03304     Outputs:     
03305     Returns:    A copy of the node, or NULL if memory runs out 
03306          
03307     Purpose:    This method returns a shallow copy of the node with all Node pointers NULL. 
03308                 The function is virtual, and must be defined for all derived classes.  
03309     
03310     Errors:     If memory runs out when trying to copy, then ERROR is called with an out of memory
03311                 error and the function returns NULL. 
03312    
03313     Scope:      protected       
03314 ***********************************************************************************************/
03315      
03316 Node* AttrWindingRule::SimpleCopy()
03317 {
03318     AttrWindingRule* NodeCopy = new AttrWindingRule();
03319     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
03320     CopyNodeContents(NodeCopy);
03321     return NodeCopy;
03322 }  
03323 
03324 /********************************************************************************************
03325 
03326 >   INT32 AttrWindingRule::operator==(const NodeAttribute& Attrib)
03327 
03328     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03329     Created:    9/2/94
03330     Inputs:     Atrib:  The attribute to compare, which must be an AttrWindingRule
03331     Outputs:    -
03332     Returns:    -
03333     Purpose:    A virtual comparison operator. See NodeAttribute::operator== for 
03334                 a description of why it's required. 
03335  
03336     Errors:     An ENSURE failure will occur if Attrib does not have a AttrWindingRule
03337                 runtime class.
03338                  
03339     SeeAlso:    NodeAttribute::operator==
03340 
03341 ********************************************************************************************/
03342 
03343 INT32 AttrWindingRule::operator==(const NodeAttribute& Attrib)
03344 {
03345     ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrWindingRule)),
03346         "Trying to compare two objects with different types"); 
03347     AttrWindingRule* Attr = (AttrWindingRule*) &Attrib;
03348     return (Attr->Value.WindingRule == Value.WindingRule); 
03349 } 
03350 
03351 /********************************************************************************************
03352 
03353 >   virtual UINT32 AttrWindingRule::GetAttrNameID(void)  
03354 
03355     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03356     Created:    22/2/94
03357     Inputs:     -
03358     Outputs:    -
03359     Returns:    Attribute description ID
03360     Purpose:    Returns back a string resource ID describing the attribute
03361 
03362     Errors:     -
03363     SeeAlso:    -
03364 
03365 ********************************************************************************************/
03366 
03367 UINT32 AttrWindingRule::GetAttrNameID(void)  
03368 {
03369     return (_R(IDS_WINDING_RULE)); 
03370 }                                 
03371 
03372 
03373 /***********************************************************************************************
03374 >   void AttrWindingRule::CopyNodeContents( AttrWindingRule* NodeCopy)
03375 
03376     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03377     Created:    28/4/93
03378     
03379     Inputs:           
03380     Outputs:    A copy of this node
03381     Returns:    -
03382          
03383     Purpose:    This method copies the node's contents to the node pointed to by NodeCopy.
03384               
03385     Errors:     An assertion failure will occur if NodeCopy is NULL
03386     
03387     Scope:      protected
03388                                      
03389 ***********************************************************************************************/
03390 
03391 void AttrWindingRule::CopyNodeContents( AttrWindingRule* NodeCopy)
03392 {
03393     NodeAttribute::CopyNodeContents( NodeCopy );
03394     NodeCopy->Value.WindingRule = Value.WindingRule; 
03395 } 
03396 
03397 
03398 
03399 /***********************************************************************************************
03400 >   void AttrWindingRule::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
03401 
03402     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
03403     Created:    18/12/2003
03404     Outputs:    -
03405     Purpose:    Polymorphically copies the contents of this node to another
03406     Errors:     An assertion failure will occur if NodeCopy is NULL
03407     Scope:      protected
03408                                      
03409 ***********************************************************************************************/
03410 
03411 void AttrWindingRule::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
03412 {
03413     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
03414     ENSURE(IS_A(pNodeCopy, AttrWindingRule), "PolyCopyNodeContents given wrong dest node type");
03415 
03416     if (IS_A(pNodeCopy, AttrWindingRule))
03417         CopyNodeContents((AttrWindingRule*)pNodeCopy);
03418 }
03419 
03420 
03421 
03422 #ifdef _DEBUG
03423 /***********************************************************************************************
03424 
03425 >   void AttrWindingRule::ShowDebugTreeDetails() const
03426 
03427     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
03428     Created:    9/7/93
03429     Purpose:    Displays debugging info of the tree
03430 
03431 ***********************************************************************************************/
03432 
03433 void AttrWindingRule::ShowDebugTreeDetails() const
03434 {
03435     // Display a bit of debugging info
03436     // For now, we will just call the base class version
03437     NodeAttribute::ShowDebugTreeDetails();  
03438 }
03439 #endif
03440 
03441 void AttrWindingRule::GetDebugDetails(StringBase* Str)
03442 {
03443 #ifdef _DEBUG
03444     NodeAttribute::GetDebugDetails( Str );
03445 
03446     String_256 TempStr;
03447     char *p;
03448     switch (Value.WindingRule)
03449     {
03450         case NonZeroWinding: p = "Non-zero"; break;
03451         case NegativeWinding: p = "Negative"; break;
03452         case EvenOddWinding: p = "Even-odd"; break;
03453         case PositiveWinding: p = "Positive"; break;
03454         default: p = "??"; break;
03455     }
03456     TempStr._MakeMsg( TEXT("\r\nWinding=#1%s\r\n"), p );
03457     (*Str) += TempStr;
03458 #endif
03459 }
03460 
03461 
03462 /********************************************************************************************
03463 
03464 >   virtual UINT32 AttrWindingRule::GetNodeSize() const
03465 
03466     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03467     Created:    6/10/93
03468     Inputs:     -
03469     Outputs:    -
03470     Returns:    The size of the node in bytes
03471     Purpose:    For finding the size of the node 
03472                 
03473     SeeAlso:    Node::GetSubtreeSize
03474 
03475 ********************************************************************************************/
03476 
03477 UINT32 AttrWindingRule::GetNodeSize() const 
03478 {     
03479     return (sizeof(AttrWindingRule)); 
03480 }  
03481 
03482 
03483 
03484 
03485 /********************************************************************************************
03486 
03487   > virtual BOOL AttrWindingRule::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
03488 
03489     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
03490     Created:    30/5/96
03491     Inputs:     pFilter = ptr to the filter
03492     Returns:    TRUE if record is written, FALSE if not
03493     Purpose:    Writes the winding rule record to the filter
03494     SeeAlso:    -
03495 
03496 ********************************************************************************************/
03497 
03498 BOOL AttrWindingRule::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
03499 {
03500 #ifdef DO_EXPORT
03501     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
03502 
03503     CamelotFileRecord Rec(pFilter,TAG_WINDINGRULE,TAG_WINDINGRULE_SIZE);
03504 
03505     BOOL ok = Rec.Init();
03506     if (ok) ok = Rec.WriteBYTE(BYTE(Value.WindingRule));
03507     if (ok) ok = pFilter->Write(&Rec);
03508 
03509     return ok;
03510 #else
03511     return FALSE;
03512 #endif
03513 }
03514 
03515 //--------------------------------------------------------------
03516 // See AttrWindingRule::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
03517 //
03518 BOOL AttrWindingRule::WritePreChildrenNative(BaseCamelotFilter* pFilter)
03519 {
03520 #ifdef DO_EXPORT
03521     return WritePreChildrenWeb(pFilter);
03522 #else
03523     return FALSE;
03524 #endif
03525 }
03526 
03527 
03528 //----------------------------------------------------------------------------
03529 //----------------------------------------------------------------------------
03530 //----------------------------------------------------------------------------
03531 
03532 
03533 /********************************************************************************************
03534 
03535 >   AttrDashPattern::AttrDashPattern(Node* ContextNode,  
03536                     AttachNodeDirection Direction,  
03537                     BOOL Locked, 
03538                     BOOL Mangled,  
03539                     BOOL Marked, 
03540                     BOOL Selected    
03541             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected, TRUE)  
03542 
03543     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
03544     Created:    9/7/93
03545     Inputs:     -
03546     Outputs:    -
03547     Returns:    -
03548     Purpose:    Creates a DashPattern Attribute
03549     Errors:     -
03550     SeeAlso:    -
03551 
03552 ********************************************************************************************/
03553 
03554 AttrDashPattern::AttrDashPattern(Node* ContextNode,  
03555                     AttachNodeDirection Direction,  
03556                     BOOL Locked, 
03557                     BOOL Mangled,  
03558                     BOOL Marked, 
03559                     BOOL Selected    
03560             ): NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected)  
03561 {                         
03562 } 
03563 
03564 /********************************************************************************************
03565 
03566 >   AttrDashPattern::AttrDashPattern()
03567 
03568     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
03569     Created:    9/7/93
03570     Inputs:     -
03571     Outputs:    -
03572     Returns:    -
03573     Purpose:    Default constructor for Join Type Attribute class
03574     Errors:     -
03575     SeeAlso:    -
03576 
03577 ********************************************************************************************/
03578 
03579 AttrDashPattern::AttrDashPattern() : NodeAttribute()
03580 {
03581 }
03582 
03583 /********************************************************************************************
03584 
03585 >   void AttrDashPattern::Render( RenderRegion* pRender)
03586 
03587     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
03588     Created:    9/7/93
03589     Inputs:     -
03590     Outputs:    -
03591     Returns:    -
03592     Purpose:    'Renders' a DashPattern attribute.
03593     Errors:     -
03594     SeeAlso:    -
03595 
03596 ********************************************************************************************/
03597 
03598 void AttrDashPattern::Render( RenderRegion* pRender)
03599 {
03600     pRender->SetDashPattern(&Value, FALSE);
03601 }
03602 
03603 /***********************************************************************************************
03604 > Node* AttrDashPattern::SimpleCopy() 
03605 
03606     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
03607     Created:    9/7/93
03608     
03609     Inputs:         - 
03610     Outputs:     
03611     Returns:    A copy of the node, or NULL if memory runs out 
03612          
03613     Purpose:    This method returns a shallow copy of the node with all Node pointers NULL. 
03614                 The function is virtual, and must be defined for all derived classes.  
03615            
03616     Errors:     If memory runs out when trying to copy, then ERROR is called with an out of memory
03617                 error and the function returns NULL. 
03618 
03619     Scope:      protected       
03620 ***********************************************************************************************/
03621      
03622 Node* AttrDashPattern::SimpleCopy()
03623 {
03624     AttrDashPattern* NodeCopy = new AttrDashPattern();
03625     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
03626     CopyNodeContents(NodeCopy);
03627     return NodeCopy;
03628 }    
03629 
03630 /********************************************************************************************
03631 
03632 >   INT32 AttrDashPattern::operator==(const NodeAttribute& Attrib)
03633 
03634     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03635     Created:    9/2/94
03636     Inputs:     Atrib:  The attribute to compare, which must be an AttrDashPattern
03637     Outputs:    -
03638     Returns:    -
03639     Purpose:    A virtual comparison operator. See NodeAttribute::operator== for 
03640                 a description of why it's required. 
03641  
03642     Errors:     An ENSURE failure will occur if Attrib does not have a AttrDashPattern
03643                 runtime class.
03644                  
03645     SeeAlso:    NodeAttribute::operator==
03646 
03647 ********************************************************************************************/
03648 
03649 INT32 AttrDashPattern::operator==(const NodeAttribute& Attrib)
03650 {
03651     ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrDashPattern)),
03652         "Trying to compare two objects with different types"); 
03653 
03654     AttrDashPattern* Attr = (AttrDashPattern*) &Attrib;
03655     return (Attr->Value.DashPattern == Value.DashPattern); 
03656 }
03657 
03658 /********************************************************************************************
03659 
03660 >   virtual UINT32 AttrDashPattern::GetAttrNameID(void)  
03661 
03662     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03663     Created:    22/2/94
03664     Inputs:     -
03665     Outputs:    -
03666     Returns:    Attribute description ID
03667     Purpose:    Returns back a string resource ID describing the attribute
03668 
03669     Errors:     -
03670     SeeAlso:    -
03671 
03672 ********************************************************************************************/
03673 
03674 UINT32 AttrDashPattern::GetAttrNameID(void)  
03675 {
03676     return (_R(IDS_DASH_PATTERN)); 
03677 }                                
03678 
03679 
03680 /***********************************************************************************************
03681 >   void AttrDashPattern::CopyNodeContents( AttrDashPattern* NodeCopy)
03682 
03683     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03684     Created:    28/4/93
03685     
03686     Inputs:           
03687     Outputs:    A copy of this node
03688     Returns:    -
03689          
03690     Purpose:    This method copies the node's contents to the node pointed to by NodeCopy.
03691               
03692     Errors:     An assertion failure will occur if NodeCopy is NULL
03693     
03694     Scope:      protected
03695                                      
03696 ***********************************************************************************************/
03697 
03698 void AttrDashPattern::CopyNodeContents( AttrDashPattern* NodeCopy)
03699 {
03700     NodeAttribute::CopyNodeContents( NodeCopy );
03701     NodeCopy->Value.DashPattern = Value.DashPattern; 
03702 } 
03703 
03704 
03705 
03706 /***********************************************************************************************
03707 >   void AttrDashPattern::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
03708 
03709     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
03710     Created:    18/12/2003
03711     Outputs:    -
03712     Purpose:    Polymorphically copies the contents of this node to another
03713     Errors:     An assertion failure will occur if NodeCopy is NULL
03714     Scope:      protected
03715                                      
03716 ***********************************************************************************************/
03717 
03718 void AttrDashPattern::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
03719 {
03720     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
03721     ENSURE(IS_A(pNodeCopy, AttrDashPattern), "PolyCopyNodeContents given wrong dest node type");
03722 
03723     if (IS_A(pNodeCopy, AttrDashPattern))
03724         CopyNodeContents((AttrDashPattern*)pNodeCopy);
03725 }
03726 
03727 
03728 
03729 #ifdef _DEBUG
03730 /***********************************************************************************************
03731 
03732 >   void AttrDashPattern::ShowDebugTreeDetails() const
03733 
03734     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
03735     Created:    9/7/93
03736     Purpose:    Displays debugging info of the tree
03737 
03738 ***********************************************************************************************/
03739 
03740 void AttrDashPattern::ShowDebugTreeDetails() const
03741 {
03742     // Display a bit of debugging info
03743     // For now, we will just call the base class version
03744     NodeAttribute::ShowDebugTreeDetails();  
03745 }
03746 #endif
03747 
03748 void AttrDashPattern::GetDebugDetails(StringBase* Str)
03749 {
03750 #ifdef _DEBUG
03751     NodeAttribute::GetDebugDetails( Str );
03752 
03753     String_256 TempStr;
03754 
03755     TempStr._MakeMsg( TEXT("\r\nDash ID=#1%ld\r\n"), Value.DashPattern.GetDashID() );
03756     (*Str) += TempStr;
03757     
03758     TempStr._MakeMsg( TEXT("\r\nLine width=#1%ld\r\n"), Value.DashPattern.LineWidth );
03759     (*Str) += TempStr;
03760     if (Value.DashPattern.ShouldScaleWithLineWidth())
03761         (*Str) += TEXT("Scale with line width\r\n");
03762     else
03763         (*Str) += TEXT("Don't scale with line width\r\n");
03764 
03765     TempStr._MakeMsg( TEXT("Dash start=#1%ld\r\n"), Value.DashPattern.DashStart );
03766     (*Str) += TempStr;
03767 
03768     INT32 Elements  = Value.DashPattern.Elements;
03769     TempStr._MakeMsg( TEXT("Elements=#1%ld\r\n"), Elements );
03770     (*Str) += TempStr;
03771 
03772     INT32* DashArray = Value.DashPattern.ElementData;
03773     for (INT32 el = 0; el < Elements; el++)
03774     {
03775         TempStr._MakeMsg( TEXT("\t=#1%ld\r\n"), DashArray[el]);
03776         (*Str) += TempStr;
03777     }           
03778     
03779 #endif
03780 }
03781 
03782 /********************************************************************************************
03783 
03784 >   virtual UINT32 AttrDashPattern::GetNodeSize() const
03785 
03786     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03787     Created:    6/10/93
03788     Inputs:     -
03789     Outputs:    -
03790     Returns:    The size of the node in bytes
03791     Purpose:    For finding the size of the node 
03792                 
03793     SeeAlso:    Node::GetSubtreeSize
03794 
03795 ********************************************************************************************/
03796 
03797 UINT32 AttrDashPattern::GetNodeSize() const 
03798 {     
03799     return (sizeof(AttrDashPattern)); 
03800 }  
03801 
03802 
03803 
03804 /********************************************************************************************
03805 
03806   > virtual BOOL AttrDashPattern::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
03807 
03808     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
03809     Created:    30/5/96
03810     Inputs:     pFilter = ptr to the filter
03811     Returns:    TRUE if record is written, FALSE if not
03812     Purpose:    Writes the dash pattern record to the filter
03813     SeeAlso:    -
03814 
03815 ********************************************************************************************/
03816 
03817 BOOL AttrDashPattern::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
03818 {
03819 #ifdef DO_EXPORT
03820     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
03821 
03822     INT32 DashType = 0;
03823     INT32 Pattern = Value.DashPattern.GetDashID();
03824     
03825     BOOL ok = TRUE;
03826 
03827     if (Pattern != 0)
03828     {
03829         // We can save it simply using the ID
03830         switch ((StockDash)Pattern)
03831         {
03832             case SD_SOLID  : DashType = REF_DASH_SOLID; break;
03833             case SD_DASH1  : DashType = REF_DASH_1; break;
03834             case SD_DASH2  : DashType = REF_DASH_2; break;
03835             case SD_DASH3  : DashType = REF_DASH_3; break;
03836             case SD_DASH4  : DashType = REF_DASH_4; break;
03837             case SD_DASH5  : DashType = REF_DASH_5; break;
03838             case SD_DASH6  : DashType = REF_DASH_6; break;
03839             case SD_DASH7  : DashType = REF_DASH_7; break;
03840             case SD_DASH8  : DashType = REF_DASH_8; break;
03841             case SD_DASH9  : DashType = REF_DASH_9; break;
03842             case SD_DASH10 : DashType = REF_DASH_10; break;
03843             case SD_DASH11 : DashType = REF_DASH_11; break;
03844             case SD_DASH12 : DashType = REF_DASH_12; break;
03845             case SD_DASH13 : DashType = REF_DASH_13; break;
03846             case SD_DASH14 : DashType = REF_DASH_14; break;
03847             case SD_DASH15 : DashType = REF_DASH_15; break;
03848             case SD_DASH16 : DashType = REF_DASH_16; break;
03849             case SD_DASH17 : DashType = REF_DASH_17; break;
03850             case SD_DASH18 : DashType = REF_DASH_18; break;
03851             case SD_DASH19 : DashType = REF_DASH_19; break;
03852             case SD_DASH20 : DashType = REF_DASH_20; break;
03853             case SD_DASH_GUIDELAYER : DashType = REF_DASH_GUIDELAYER; break;
03854             default:
03855                 ERROR3("Unkown dash type in AttrDashPattern::WritePreChildrenWeb");
03856         }
03857 
03858         // Save out the simple dash id details
03859         CamelotFileRecord Rec(pFilter,TAG_DASHSTYLE,TAG_DASHSTYLE_SIZE);
03860         ok = Rec.Init();
03861         if (ok) ok = Rec.WriteINT32(DashType);
03862         if (ok) ok = pFilter->Write(&Rec);
03863     }
03864     else
03865     {
03866         // Output the definition
03867         // Is it a scaled sort?
03868         BOOL DoScale    = Value.DashPattern.ShouldScaleWithLineWidth();
03869         INT32 Tag       = TAG_DEFINEDASH;
03870         if (DoScale)
03871             Tag         = TAG_DEFINEDASH_SCALED;
03872         
03873         INT32 DashStart = Value.DashPattern.DashStart;
03874         INT32 LineWidth = Value.DashPattern.LineWidth;
03875         INT32 Elements  = Value.DashPattern.Elements;
03876         INT32* DashArray = Value.DashPattern.ElementData;
03877 
03878         // Don't bother with zero width lines
03879         //if (LineWidth == 0)
03880         //  Elements = 0;
03881         
03882         //FIXED16 Scale = 1;
03883         //if (DoScale)
03884         //{
03885         //  Scale = (double(LineWidth) / double(RR_DASHPATTERN().LineWidth));
03886         //}
03887 
03888         CamelotFileRecord Rec(pFilter,Tag, CXF_UNKNOWN_SIZE);
03889         ok = Rec.Init();
03890         if (ok) ok = Rec.WriteINT32(DashStart);
03891         if (ok) ok = Rec.WriteINT32(LineWidth);
03892         if (ok) ok = Rec.WriteINT32(Elements);
03893         if (ok && Elements > 0)
03894         {
03895             for (INT32 el = 0; el < Elements; el++)
03896             {
03897                 if (ok) ok = Rec.WriteINT32(DashArray[el]);
03898             }           
03899         }
03900 
03901         if (ok) ok = pFilter->Write(&Rec);
03902     }
03903 
03904     return ok;
03905 #else
03906     return FALSE;
03907 #endif // DO_EXPORT
03908 }
03909 
03910 //--------------------------------------------------------------
03911 // See AttrDashPattern::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
03912 //
03913 BOOL AttrDashPattern::WritePreChildrenNative(BaseCamelotFilter* pFilter)
03914 {
03915 #ifdef DO_EXPORT
03916     return WritePreChildrenWeb(pFilter);
03917 #else
03918     return FALSE;
03919 #endif
03920 }
03921 
03922 
03923 //---------------------------------------------------------------------------------------
03924 //---------------------------------------------------------------------------------------
03925 //---------------------------------------------------------------------------------------
03926 
03927 /********************************************************************************************
03928 
03929 >   virtual UINT32* LineAttrRecordHandler::GetTagList()
03930 
03931     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
03932     Created:    29/5/96
03933     Inputs:     -
03934     Returns:    Ptr to a list of tag values, terminated by CXFRH_TAG_LIST_END
03935     Purpose:    Provides the record handler system with a list of records handled by this
03936                 handler
03937     SeeAlso:    -
03938 
03939 ********************************************************************************************/
03940 
03941 UINT32* LineAttrRecordHandler::GetTagList()
03942 {
03943     static UINT32 TagList[] = { TAG_LINECOLOUR,
03944                                 TAG_LINECOLOUR_NONE,
03945                                 TAG_LINECOLOUR_BLACK,
03946                                 TAG_LINECOLOUR_WHITE,
03947                                 TAG_LINEWIDTH,
03948                                 TAG_LINETRANSPARENCY,
03949                                 TAG_STARTCAP,
03950                                 TAG_ENDCAP,
03951                                 TAG_JOINSTYLE,
03952                                 TAG_MITRELIMIT,
03953                                 TAG_WINDINGRULE,
03954                                 TAG_DASHSTYLE,
03955                                 TAG_DEFINEDASH, TAG_DEFINEDASH_SCALED,
03956                                 TAG_ARROWHEAD, TAG_ARROWTAIL,
03957                                 CXFRH_TAG_LIST_END};
03958 
03959     return (UINT32*)&TagList;
03960 }
03961 
03962 /********************************************************************************************
03963 
03964 >   virtual BOOL LineAttrRecordHandler::HandleRecord(CXaraFileRecord* pCXaraFileRecord)
03965 
03966     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
03967     Created:    29/5/96
03968     Inputs:     pCXaraFileRecord = ptr to record to handle
03969     Returns:    TRUE if handled successfuly
03970                 FALSE otherwise
03971     Purpose:    Handles the given record.
03972     SeeAlso:    -
03973 
03974 ********************************************************************************************/
03975 
03976 BOOL LineAttrRecordHandler::HandleRecord(CXaraFileRecord* pCXaraFileRecord)
03977 {
03978     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
03979 
03980     BOOL ok = TRUE;
03981 
03982     switch (pCXaraFileRecord->GetTag())
03983     {
03984         case TAG_LINECOLOUR:
03985         case TAG_LINECOLOUR_NONE:
03986         case TAG_LINECOLOUR_BLACK:
03987         case TAG_LINECOLOUR_WHITE:
03988             ok = HandleLineColourRecord(pCXaraFileRecord);
03989             break;
03990         case TAG_LINEWIDTH :        ok = HandleLineWidthRecord(pCXaraFileRecord);       break;
03991         case TAG_LINETRANSPARENCY:  ok = HandleLineTransparencyRecord(pCXaraFileRecord);break;
03992         case TAG_STARTCAP:
03993         case TAG_ENDCAP:            ok = HandleCapRecord(pCXaraFileRecord);             break;
03994         case TAG_JOINSTYLE:         ok = HandleJoinStyleRecord(pCXaraFileRecord);       break;
03995         case TAG_MITRELIMIT:        ok = HandleMitreLimitRecord(pCXaraFileRecord);      break;
03996         case TAG_WINDINGRULE:       ok = HandleWindingRuleRecord(pCXaraFileRecord);     break;
03997         case TAG_DASHSTYLE:         ok = HandleDashStyleRecord(pCXaraFileRecord);       break;
03998         case TAG_DEFINEDASH:        ok = HandleDefineDashRecord(pCXaraFileRecord);      break;
03999         case TAG_DEFINEDASH_SCALED: ok = HandleDefineDashRecord(pCXaraFileRecord);      break;
04000         case TAG_ARROWHEAD:         ok = HandleArrowHeadRecord(pCXaraFileRecord);       break;
04001         case TAG_ARROWTAIL:         ok = HandleArrowTailRecord(pCXaraFileRecord);       break;
04002 
04003         default:
04004             ok = FALSE;
04005             ERROR3_PF(("I don't handle records with the tag (%d)\n",pCXaraFileRecord->GetTag()));
04006             break;
04007     }
04008 
04009     return ok;
04010 }
04011 
04012 
04013 /********************************************************************************************
04014 
04015 BOOL LineAttrRecordHandler::HandleLineColourRecord(CXaraFileRecord* pCXaraFileRecord)
04016 
04017     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
04018     Created:    30/5/96
04019     Inputs:     pCXaraFileRecord = ptr to record to handle
04020     Returns:    TRUE if handled successfuly
04021                 FALSE otherwise
04022     Purpose:    Handles the given record.
04023                 The record has to be a Line colour record
04024     SeeAlso:    -
04025 
04026 ********************************************************************************************/
04027 
04028 BOOL LineAttrRecordHandler::HandleLineColourRecord(CXaraFileRecord* pCXaraFileRecord)
04029 {
04030     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
04031     //ERROR2IF(pCXaraFileRecord->GetTag() != TAG_LINECOLOUR,FALSE,"I don't handle this tag type");
04032 
04033     INT32 ColourRef;
04034     INT32 Tag = pCXaraFileRecord->GetTag();
04035     BOOL ok = TRUE;
04036     // If it is the plain line colour record then read the colour
04037     // If it is one of the line colour default colour records then this is not required
04038     switch (Tag)
04039     {
04040         case TAG_LINECOLOUR:
04041             ok = pCXaraFileRecord->ReadINT32(&ColourRef);
04042             break;
04043         case TAG_LINECOLOUR_NONE:
04044             ColourRef = REF_DEFAULTCOLOUR_TRANSPARENT;
04045             break;
04046         case TAG_LINECOLOUR_BLACK:
04047             ColourRef = REF_DEFAULTCOLOUR_BLACK;
04048             break;
04049         case TAG_LINECOLOUR_WHITE:
04050             ColourRef = REF_DEFAULTCOLOUR_WHITE;
04051             break;
04052         default:
04053             ERROR2(FALSE,"I don't handle this tag type");
04054     }
04055     
04056     if (ok)
04057     {
04058         AttrStrokeColour* pAttr = new AttrStrokeColour;
04059         if (pAttr != NULL)
04060         {
04061             if (ok) ok = GetDocColour(ColourRef,&(pAttr->Value.Colour));
04062             if (ok) ok = InsertNode(pAttr);
04063         }
04064         else
04065             ok = FALSE;
04066     }
04067 
04068     return ok;
04069 }
04070 
04071 /********************************************************************************************
04072 
04073 BOOL LineAttrRecordHandler::HandleLineWidthRecord(CXaraFileRecord* pCXaraFileRecord)
04074 
04075     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
04076     Created:    20/6/96
04077     Inputs:     pCXaraFileRecord = ptr to record to handle
04078     Returns:    TRUE if handled successfuly
04079                 FALSE otherwise
04080     Purpose:    Handles the given record.
04081                 The record has to be a Line width record
04082     SeeAlso:    -
04083 
04084 ********************************************************************************************/
04085 
04086 BOOL LineAttrRecordHandler::HandleLineWidthRecord(CXaraFileRecord* pCXaraFileRecord)
04087 {
04088     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
04089     ERROR2IF(pCXaraFileRecord->GetTag() != TAG_LINEWIDTH,FALSE,"I don't handle this tag type");
04090 
04091     INT32 Width = 0;
04092     AttrLineWidth* pAttr = NULL;
04093 
04094     BOOL    ok = pCXaraFileRecord->ReadINT32(&Width);// Read the width from the record
04095     if (ok)      pAttr = new AttrLineWidth;         // Create a new line width attr
04096     if (ok) ok = (pAttr != NULL);                   // Check it's not NULL
04097     if (ok)      pAttr->Value.LineWidth = Width;    // Set the width to the read-in value
04098     if (ok) ok = InsertNode(pAttr);                 // Insert the node into the tree
04099 
04100     return ok;
04101 }
04102 
04103 /********************************************************************************************
04104 
04105 BOOL LineAttrRecordHandler::HandleLineTransparencyRecord(CXaraFileRecord* pCXaraFileRecord)
04106 
04107     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
04108     Created:    27/6/96
04109     Inputs:     pCXaraFileRecord = ptr to record to handle
04110     Returns:    TRUE if handled successfuly
04111                 FALSE otherwise
04112     Purpose:    Handles the given record.
04113                 The record has to be a Line transparency record
04114     SeeAlso:    -
04115 
04116 ********************************************************************************************/
04117 
04118 BOOL LineAttrRecordHandler::HandleLineTransparencyRecord(CXaraFileRecord* pCXaraFileRecord)
04119 {
04120     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
04121     ERROR2IF(pCXaraFileRecord->GetTag() != TAG_LINETRANSPARENCY,FALSE,"I don't handle this tag type");
04122 
04123     BOOL ok = TRUE;
04124 
04125     BYTE Transp, TranspType;
04126     AttrStrokeTransp* pAttr = NULL;
04127 
04128     if (ok) ok = pCXaraFileRecord->ReadBYTE(&Transp);       // Read transparency level
04129     if (ok) ok = pCXaraFileRecord->ReadBYTE(&TranspType);   // Read transparency type
04130     if (ok)      pAttr = new AttrStrokeTransp;              // Create a new attr
04131     if (ok) ok = (pAttr != NULL);                           // Check it's not NULL
04132     if (ok)      pAttr->Value.Transp     = UINT32(Transp);  // Set the transparency level
04133     if (ok)      pAttr->Value.TranspType = UINT32(TranspType);// Set the transparency type
04134     if (ok) ok = InsertNode(pAttr);                         // Insert the node into the tree
04135 
04136     return ok;
04137 }
04138 
04139 /********************************************************************************************
04140 
04141 BOOL LineAttrRecordHandler::HandleCapRecord(CXaraFileRecord* pCXaraFileRecord)
04142 
04143     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
04144     Created:    27/6/96
04145     Inputs:     pCXaraFileRecord = ptr to record to handle
04146     Returns:    TRUE if handled successfuly
04147                 FALSE otherwise
04148     Purpose:    Handles the given record.
04149                 The record has to be a start or end cap record
04150     SeeAlso:    -
04151 
04152 ********************************************************************************************/
04153 
04154 BOOL LineAttrRecordHandler::HandleCapRecord(CXaraFileRecord* pCXaraFileRecord)
04155 {
04156     UINT32 Tag = pCXaraFileRecord->GetTag();
04157 
04158     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
04159     ERROR2IF(Tag != TAG_STARTCAP && Tag != TAG_ENDCAP,FALSE,"I don't handle this tag type");
04160 
04161     // We don't have a separate end cap attribute, so just ignore it.
04162     // The cap def will come in with the start cap record
04163     if (Tag == TAG_ENDCAP)
04164         return TRUE;
04165 
04166     BOOL ok = TRUE;
04167 
04168     BYTE StartCap;
04169     AttrStartCap* pAttr = NULL;
04170 
04171     if (ok) ok = pCXaraFileRecord->ReadBYTE(&StartCap);         // Read cap type
04172     if (ok)      pAttr = new AttrStartCap;                      // Create a new attr
04173     if (ok) ok = (pAttr != NULL);                               // Check it's not NULL
04174     if (ok)      pAttr->Value.StartCap = LineCapType(StartCap); // Set the cap type
04175     if (ok) ok = InsertNode(pAttr);                             // Insert the node into the tree
04176 
04177     return ok;
04178 }
04179 
04180 /********************************************************************************************
04181 
04182 BOOL LineAttrRecordHandler::HandleJoinStyleRecord(CXaraFileRecord* pCXaraFileRecord)
04183 
04184     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
04185     Created:    27/6/96
04186     Inputs:     pCXaraFileRecord = ptr to record to handle
04187     Returns:    TRUE if handled successfuly
04188                 FALSE otherwise
04189     Purpose:    Handles the given record.
04190                 The record has to be a join style record
04191     SeeAlso:    -
04192 
04193 ********************************************************************************************/
04194 
04195 BOOL LineAttrRecordHandler::HandleJoinStyleRecord(CXaraFileRecord* pCXaraFileRecord)
04196 {
04197     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
04198     ERROR2IF(pCXaraFileRecord->GetTag() != TAG_JOINSTYLE,FALSE,"I don't handle this tag type");
04199 
04200     BOOL ok = TRUE;
04201 
04202     BYTE JoinType;
04203     AttrJoinType* pAttr = NULL;
04204 
04205     if (ok) ok = pCXaraFileRecord->ReadBYTE(&JoinType);         // Read join type
04206     if (ok)      pAttr = new AttrJoinType;                      // Create a new attr
04207     if (ok) ok = (pAttr != NULL);                               // Check it's not NULL
04208     if (ok)      pAttr->Value.JoinType = JointType(JoinType);   // Set the join type
04209     if (ok) ok = InsertNode(pAttr);                             // Insert the node into the tree
04210 
04211     return ok;
04212 }
04213 
04214 /********************************************************************************************
04215 
04216 BOOL LineAttrRecordHandler::HandleMitreLimitRecord(CXaraFileRecord* pCXaraFileRecord)
04217 
04218     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
04219     Created:    27/6/96
04220     Inputs:     pCXaraFileRecord = ptr to record to handle
04221     Returns:    TRUE if handled successfuly
04222                 FALSE otherwise
04223     Purpose:    Handles the given record.
04224                 The record has to be a mitre limit record
04225     SeeAlso:    -
04226 
04227 ********************************************************************************************/
04228 
04229 BOOL LineAttrRecordHandler::HandleMitreLimitRecord(CXaraFileRecord* pCXaraFileRecord)
04230 {
04231     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
04232     ERROR2IF(pCXaraFileRecord->GetTag() != TAG_MITRELIMIT,FALSE,"I don't handle this tag type");
04233 
04234     BOOL ok = TRUE;
04235 
04236     INT32 MitreLimit;
04237     AttrMitreLimit* pAttr = NULL;
04238 
04239     if (ok) ok = pCXaraFileRecord->ReadINT32(&MitreLimit);  // Read mitre limit
04240     if (ok)      pAttr = new AttrMitreLimit;                // Create a new attr
04241     if (ok) ok = (pAttr != NULL);                           // Check it's not NULL
04242     if (ok)      pAttr->Value.MitreLimit = MitreLimit;      // Set the mitre limit
04243     if (ok) ok = InsertNode(pAttr);                         // Insert the node into the tree
04244 
04245     return ok;
04246 }
04247 
04248 /********************************************************************************************
04249 
04250 BOOL LineAttrRecordHandler::HandleWindingRuleRecord(CXaraFileRecord* pCXaraFileRecord)
04251 
04252     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
04253     Created:    27/6/96
04254     Inputs:     pCXaraFileRecord = ptr to record to handle
04255     Returns:    TRUE if handled successfuly
04256                 FALSE otherwise
04257     Purpose:    Handles the given record.
04258                 The record has to be a winding rule record
04259     SeeAlso:    -
04260 
04261 ********************************************************************************************/
04262 
04263 BOOL LineAttrRecordHandler::HandleWindingRuleRecord(CXaraFileRecord* pCXaraFileRecord)
04264 {
04265     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
04266     ERROR2IF(pCXaraFileRecord->GetTag() != TAG_WINDINGRULE,FALSE,"I don't handle this tag type");
04267 
04268     BOOL ok = TRUE;
04269 
04270     BYTE WindingRule;
04271     AttrWindingRule* pAttr = NULL;
04272 
04273     if (ok) ok = pCXaraFileRecord->ReadBYTE(&WindingRule);              // Read mitre limit
04274     if (ok)      pAttr = new AttrWindingRule;                           // Create a new attr
04275     if (ok) ok = (pAttr != NULL);                                       // Check it's not NULL
04276     if (ok)      pAttr->Value.WindingRule = WindingType(WindingRule);   // Set the mitre limit
04277     if (ok) ok = InsertNode(pAttr);                                     // Insert the node into the tree
04278 
04279     return ok;
04280 }
04281 
04282 /********************************************************************************************
04283 
04284 BOOL LineAttrRecordHandler::HandleDashStyleRecord(CXaraFileRecord* pCXaraFileRecord)
04285 
04286     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
04287     Created:    8/7/96
04288     Inputs:     pCXaraFileRecord = ptr to record to handle
04289     Returns:    TRUE if handled successfuly
04290                 FALSE otherwise
04291     Purpose:    Handles the given record.
04292                 The record has to be a dash style record
04293     SeeAlso:    -
04294 
04295 ********************************************************************************************/
04296 
04297 BOOL LineAttrRecordHandler::HandleDashStyleRecord(CXaraFileRecord* pCXaraFileRecord)
04298 {
04299     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"HandleDashStyleRecord pCXaraFileRecord is NULL");
04300     ERROR2IF(pCXaraFileRecord->GetTag() != TAG_DASHSTYLE,FALSE,"HandleDashStyleRecord I don't handle this tag type");
04301 
04302     BOOL ok = TRUE;
04303 
04304     INT32 DashType;
04305     AttrDashPattern* pAttr = NULL;
04306 
04307     // Read dash pattern type
04308     ok = pCXaraFileRecord->ReadINT32(&DashType);                    
04309 
04310     if (ok)
04311     {
04312         // Convert this into the correct dash style
04313         StockDash Pattern = SD_SOLID;
04314         switch (DashType)
04315         {
04316             case REF_DASH_SOLID : Pattern = SD_SOLID; break;
04317             case REF_DASH_1 : Pattern = SD_DASH1; break;
04318             case REF_DASH_2 : Pattern = SD_DASH2; break;
04319             case REF_DASH_3 : Pattern = SD_DASH3; break;
04320             case REF_DASH_4 : Pattern = SD_DASH4; break;
04321             case REF_DASH_5 : Pattern = SD_DASH5; break;
04322             case REF_DASH_6 : Pattern = SD_DASH6; break;
04323             case REF_DASH_7 : Pattern = SD_DASH7; break;
04324             case REF_DASH_8 : Pattern = SD_DASH8; break;
04325             case REF_DASH_9 : Pattern = SD_DASH9; break;
04326             case REF_DASH_10 : Pattern = SD_DASH10; break;
04327             case REF_DASH_11 : Pattern = SD_DASH11; break;
04328             case REF_DASH_12 : Pattern = SD_DASH12; break;
04329             case REF_DASH_13 : Pattern = SD_DASH13; break;
04330             case REF_DASH_14 : Pattern = SD_DASH14; break;
04331             case REF_DASH_15 : Pattern = SD_DASH15; break;
04332             case REF_DASH_16 : Pattern = SD_DASH16; break;
04333             case REF_DASH_17 : Pattern = SD_DASH17; break;
04334             case REF_DASH_18 : Pattern = SD_DASH18; break;
04335             case REF_DASH_19 : Pattern = SD_DASH19; break;
04336             case REF_DASH_20 : Pattern = SD_DASH20; break;
04337             case REF_DASH_GUIDELAYER : Pattern = SD_DASH_GUIDELAYER; break;
04338             default:
04339                 ERROR3("Unkown dash type in LineAttrRecordHandler::HandleDashStyleRecord");
04340         }
04341 
04342         pAttr = new AttrDashPattern;                            // Create a new attr
04343         ok = (pAttr != NULL);                                   // Check it's not NULL
04344         if (ok)      pAttr->Value.SetStockDashPattern(Pattern); // Set the dash pattern type
04345         if (ok) ok = InsertNode(pAttr);                         // Insert the node into the tree
04346     }
04347 
04348     return ok;
04349 }
04350 
04351 /********************************************************************************************
04352 
04353 BOOL LineAttrRecordHandler::HandleDefineDashRecord(CXaraFileRecord* pCXaraFileRecord)
04354 
04355     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
04356     Created:    9/7/96
04357     Inputs:     pCXaraFileRecord = ptr to record to handle
04358     Returns:    TRUE if handled successfuly
04359                 FALSE otherwise
04360     Purpose:    Handles the given record.
04361                 The record has to be a define dash style record
04362     SeeAlso:    -
04363 
04364 ********************************************************************************************/
04365 
04366 BOOL LineAttrRecordHandler::HandleDefineDashRecord(CXaraFileRecord* pCXaraFileRecord)
04367 {
04368     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"HandleDefineDashRecord pCXaraFileRecord is NULL");
04369     
04370     INT32 Tag = pCXaraFileRecord->GetTag();
04371     
04372     ERROR2IF(Tag != TAG_DEFINEDASH && Tag != TAG_DEFINEDASH_SCALED,FALSE,"HandleDefineDashRecord I don't handle this tag type");
04373 
04374     BOOL ok = TRUE;
04375 
04376     AttrDashPattern* pAttr = NULL;
04377     BOOL Scale      = FALSE;
04378     if (Tag == TAG_DEFINEDASH_SCALED)
04379         Scale = TRUE;
04380 //  INT32 DashType  = 0;
04381     INT32 DashStart = 0;
04382     INT32 LineWidth = 0;
04383     INT32 Elements  = 0;
04384     INT32* DashArray = NULL;     
04385 
04386     // Read the information from the record
04387     ok = pCXaraFileRecord->ReadINT32(&DashStart);                   
04388     ok = pCXaraFileRecord->ReadINT32(&LineWidth);                   
04389     ok = pCXaraFileRecord->ReadINT32(&Elements);                    
04390     
04391     // Don't bother with zero width lines
04392     //if (LineWidth == 0)
04393     //  Elements = 0;
04394 
04395     if (ok && Elements > 0)
04396     {
04397         // Sanity check on the number of elements
04398         ERROR3IF(Elements > 30,"Number of elements > 30, Are you sure this is correct?");
04399 
04400         // Create ourselves an array of the correct number of elements
04401         DashArray = new INT32[Elements];
04402         if (DashArray)
04403         {
04404             for (INT32 el = 0; el < Elements; el++)
04405             {
04406                 if (ok) ok = pCXaraFileRecord->ReadINT32(&DashArray[el]);
04407             }
04408         }
04409         else
04410         {
04411             Elements = 0;
04412             ERROR3("Couldn't create the elements array");
04413         }
04414     }
04415 
04416     if (ok)
04417     {
04418         DashRec Dash;
04419         Dash.DashStart          = DashStart; 
04420         Dash.LineWidth          = LineWidth; 
04421         Dash.Elements           = Elements;
04422         Dash.ElementData        = DashArray; 
04423         Dash.ScaleWithLineWidth = Scale;
04424 
04425         pAttr      = new AttrDashPattern;                       // Create a new attr
04426                 ok = (pAttr != NULL);                           // Check it's not NULL
04427         if (ok)      pAttr->Value.SetDashPattern(Dash);         // Set the dash pattern
04428         if (ok) ok = InsertNode(pAttr);                         // Insert the node into the tree
04429     }
04430 
04431     return ok;
04432 }
04433 
04434 /********************************************************************************************
04435 
04436 BOOL LineAttrRecordHandler::HandleArrowHeadRecord(CXaraFileRecord* pCXaraFileRecord)
04437 
04438     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
04439     Created:    8/7/96
04440     Inputs:     pCXaraFileRecord = ptr to record to handle
04441     Returns:    TRUE if handled successfuly
04442                 FALSE otherwise
04443     Purpose:    Handles the given record.
04444                 The record has to be an arrow head record
04445     SeeAlso:    -
04446 
04447 ********************************************************************************************/
04448 
04449 BOOL LineAttrRecordHandler::HandleArrowHeadRecord(CXaraFileRecord* pCXaraFileRecord)
04450 {
04451     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"HandleArrowHeadRecord pCXaraFileRecord is NULL");
04452     ERROR2IF(pCXaraFileRecord->GetTag() != TAG_ARROWHEAD,FALSE,"HandleArrowHeadRecord I don't handle this tag type");
04453 
04454     BOOL ok = TRUE;
04455 
04456     AttrStartArrow* pAttr   = NULL;
04457     INT32       ArrowId     = 0;
04458     FIXED16     ScaleWidth;
04459     FIXED16     ScaleHeight;
04460     ArrowRec    Arrow;
04461     StockArrow  ArrowType = SA_NULLARROW;
04462 
04463     if (ok) ok = pCXaraFileRecord->ReadINT32(&ArrowId);                 // Read the type of arrow head
04464     if (ok) ok = pCXaraFileRecord->ReadFIXED16(&ScaleWidth);            // Read the width scaling
04465     if (ok) ok = pCXaraFileRecord->ReadFIXED16(&ScaleHeight);           // Read the height scaling
04466 
04467     // Convert the arrow id into the internal style
04468     if (ok)
04469     {
04470         switch (ArrowId)
04471         {
04472             case REF_ARROW_NULL:            ArrowType = SA_NULLARROW;       break;
04473             case REF_ARROW_STRAIGHT:        ArrowType = SA_STRAIGHTARROW;   break;
04474             case REF_ARROW_ANGLED:          ArrowType = SA_ANGLEDARROW;     break;
04475             case REF_ARROW_ROUNDED:         ArrowType = SA_ROUNDEDARROW;    break;
04476             case REF_ARROW_SPOT:            ArrowType = SA_SPOT;            break;
04477             case REF_ARROW_DIAMOND:         ArrowType = SA_DIAMOND;         break;
04478             case REF_ARROW_FEATHER:         ArrowType = SA_ARROWFEATHER;    break;
04479             case REF_ARROW_FEATHER2:        ArrowType = SA_ARROWFEATHER2;   break;
04480             case REF_ARROW_HOLLOWDIAMOND:   ArrowType = SA_HOLLOWDIAMOND;   break;
04481             default:
04482                 ERROR3("Unkown arrow head type in LineAttrRecordHandler::HandleArrowTailRecord");
04483                 break;
04484         }
04485     }
04486 
04487     if (ok) ok = Arrow.CreateStockArrow(ArrowType);
04488     if (ok)      Arrow.SetArrowSize(ScaleWidth, ScaleHeight);
04489 
04490     if (ok)      pAttr = new AttrStartArrow;                            // Create a new attr
04491     if (ok) ok = (pAttr != NULL);                                       // Check it's not NULL
04492     if (ok)      pAttr->Value.StartArrow = Arrow;                       // Set the arrow
04493     if (ok) ok = InsertNode(pAttr);                                     // Insert the node into the tree
04494 
04495     return ok;
04496 }
04497 
04498 /********************************************************************************************
04499 
04500 BOOL LineAttrRecordHandler::HandleArrowTailRecord(CXaraFileRecord* pCXaraFileRecord)
04501 
04502     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
04503     Created:    8/7/96
04504     Inputs:     pCXaraFileRecord = ptr to record to handle
04505     Returns:    TRUE if handled successfuly
04506                 FALSE otherwise
04507     Purpose:    Handles the given record.
04508                 The record has to be an arrow tail record
04509     SeeAlso:    -
04510 
04511 ********************************************************************************************/
04512 
04513 BOOL LineAttrRecordHandler::HandleArrowTailRecord(CXaraFileRecord* pCXaraFileRecord)
04514 {
04515     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"HandleArrowTailRecord pCXaraFileRecord is NULL");
04516     ERROR2IF(pCXaraFileRecord->GetTag() != TAG_ARROWTAIL,FALSE,"HandleArrowTailRecord I don't handle this tag type");
04517 
04518     BOOL ok = TRUE;
04519 
04520     AttrEndArrow* pAttr = NULL;
04521     INT32       ArrowId     = 0;
04522     FIXED16     ScaleWidth;
04523     FIXED16     ScaleHeight;
04524     ArrowRec    Arrow;
04525     StockArrow  ArrowType = SA_NULLARROW;
04526 
04527     if (ok) ok = pCXaraFileRecord->ReadINT32(&ArrowId);                 // Read the type of arrow head
04528     if (ok) ok = pCXaraFileRecord->ReadFIXED16(&ScaleWidth);            // Read the width scaling
04529     if (ok) ok = pCXaraFileRecord->ReadFIXED16(&ScaleHeight);           // Read the height scaling
04530 
04531     // Convert the arrow id into the internal style
04532     if (ok)
04533     {
04534         switch (ArrowId)
04535         {
04536             case REF_ARROW_NULL:            ArrowType = SA_NULLARROW;       break;
04537             case REF_ARROW_STRAIGHT:        ArrowType = SA_STRAIGHTARROW;   break;
04538             case REF_ARROW_ANGLED:          ArrowType = SA_ANGLEDARROW;     break;
04539             case REF_ARROW_ROUNDED:         ArrowType = SA_ROUNDEDARROW;    break;
04540             case REF_ARROW_SPOT:            ArrowType = SA_SPOT;            break;
04541             case REF_ARROW_DIAMOND:         ArrowType = SA_DIAMOND;         break;
04542             case REF_ARROW_FEATHER:         ArrowType = SA_ARROWFEATHER;    break;
04543             case REF_ARROW_FEATHER2:        ArrowType = SA_ARROWFEATHER2;   break;
04544             case REF_ARROW_HOLLOWDIAMOND:   ArrowType = SA_HOLLOWDIAMOND;   break;
04545             default:
04546                 ERROR3("Unkown arrow head type in LineAttrRecordHandler::HandleArrowTailRecord");
04547                 break;
04548         }
04549     }
04550 
04551     if (ok) ok = Arrow.CreateStockArrow(ArrowType);
04552     if (ok)      Arrow.SetArrowSize(ScaleWidth, ScaleHeight);
04553 
04554     if (ok)      pAttr = new AttrEndArrow;                              // Create a new attr
04555     if (ok) ok = (pAttr != NULL);                                       // Check it's not NULL
04556     if (ok)      pAttr->Value.EndArrow = Arrow;                         // Set the arrow
04557     if (ok) ok = InsertNode(pAttr);                                     // Insert the node into the tree
04558 
04559     return ok;
04560 }
04561 
04562 
04563 //------------------------------------------------------------------------------------------
04564 //------------------------------------------------------------------------------------------
04565 //------------------------------------------------------------------------------------------
04566 
04567 /********************************************************************************************
04568 
04569 >   virtual void LineAttrRecordHandler::GetRecordDescriptionText(CXaraFileRecord* pRecord,StringBase* pStr)
04570 
04571     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
04572     Created:    13/6/96
04573     Inputs:     pRecord = ptr to a record
04574                 pStr = ptr to string to update
04575     Returns:    -
04576     Purpose:    This provides descriptions for the fill attribute record.
04577     Errors:     -
04578     SeeAlso:    -
04579 
04580 ********************************************************************************************/
04581 
04582 #ifdef XAR_TREE_DIALOG
04583 void LineAttrRecordHandler::GetRecordDescriptionText(CXaraFileRecord* pRecord,StringBase* pStr)
04584 {
04585     if (pStr == NULL || pRecord == NULL)
04586         return;
04587 
04588     // Call base class first
04589     // This outputs the tag and size
04590     CamelotRecordHandler::GetRecordDescriptionText(pRecord,pStr);
04591 
04592     TCHAR s[256];
04593 
04594     UINT32 Tag = pRecord->GetTag();
04595     switch (Tag)
04596     {
04597         case TAG_LINECOLOUR:
04598         {
04599             // Read the colour reference number
04600             INT32 ColourRef;
04601             pRecord->ReadINT32(&ColourRef);
04602             camSprintf(s,_T("Colour reference = %d\r\n"),ColourRef);        (*pStr) += s;
04603         }
04604         break;
04605 
04606         case TAG_LINEWIDTH:
04607         {
04608             INT32 Width;
04609             pRecord->ReadINT32(&Width);
04610             camSprintf(s,_T("Width = %d\r\n"),Width);       (*pStr) += s;
04611         }
04612         break;
04613 
04614         case TAG_LINETRANSPARENCY:
04615         {
04616             BYTE Transp, TranspType;
04617             pRecord->ReadBYTE(&Transp);
04618             pRecord->ReadBYTE(&TranspType);
04619             camSprintf(s,_T("Transparency\t= %d\r\n"),INT32(Transp));           (*pStr) += s;
04620             camSprintf(s,_T("Transparency Type\t= %d\r\n"),INT32(TranspType));  (*pStr) += s;
04621         }
04622         break;
04623 
04624         case TAG_STARTCAP:
04625         case TAG_ENDCAP:
04626         {
04627             BYTE Cap;
04628             pRecord->ReadBYTE(&Cap);
04629             camSprintf(s,_T("Cap style = %d\r\n"),INT32(Cap));  (*pStr) += s;
04630         }
04631         break;
04632 
04633         case TAG_JOINSTYLE:
04634         {
04635             BYTE Join;
04636             pRecord->ReadBYTE(&Join);
04637             camSprintf(s,_T("Join style = %d\r\n"),INT32(Join)); (*pStr) += s;
04638         }
04639         break;
04640 
04641         case TAG_MITRELIMIT:
04642         {
04643             INT32 MitreLimit;
04644             pRecord->ReadINT32(&MitreLimit);
04645             camSprintf(s,_T("Mitre Limit = %d\r\n"),MitreLimit); (*pStr) += s;
04646         }
04647         break;
04648 
04649         case TAG_WINDINGRULE:
04650         {
04651             BYTE WindingRule;
04652             pRecord->ReadBYTE(&WindingRule);
04653             camSprintf(s,_T("Winding Rule = %d\r\n"),INT32(WindingRule)); (*pStr) += s;
04654         }
04655         break;
04656 
04657         case TAG_DASHSTYLE:
04658         {
04659             INT32 DashVal;
04660             pRecord->ReadINT32(&DashVal);
04661             camSprintf(s,_T("Dash Style = %d\r\n"),DashVal); (*pStr) += s;
04662         }
04663         break;
04664 
04665         case TAG_DEFINEDASH:
04666         case TAG_DEFINEDASH_SCALED:
04667         {
04668             if (Tag == TAG_DEFINEDASH_SCALED)
04669             {
04670                 camSprintf(s,_T("Define scaled dash pattern\r\n\r\n"));
04671                 (*pStr) += s;
04672             }
04673             else
04674             {               
04675                 camSprintf(s,_T("Define dash pattern\r\n\r\n"));
04676                 (*pStr) += s;
04677             }
04678 
04679             // Read the information from the record
04680             INT32 DashStart = 0;
04681             pRecord->ReadINT32(&DashStart);
04682             camSprintf(s,_T("Dash Start = %d\r\n"),DashStart); (*pStr) += s;
04683 
04684             INT32 LineWidth = 0;
04685             pRecord->ReadINT32(&LineWidth);
04686             camSprintf(s,_T("Line width = %d\r\n"),LineWidth); (*pStr) += s;
04687 
04688             INT32 Elements  = 0;
04689             pRecord->ReadINT32(&Elements);
04690             camSprintf(s,_T("Elements = %d\r\n"),Elements); (*pStr) += s;
04691 
04692             // Don't bother with zero width lines
04693             //if (LineWidth == 0)
04694             //  Elements = 0;
04695 
04696             if (Elements > 0)
04697             {
04698                 // Show the elements in all their glory
04699                 INT32 Data = 0L;
04700                 for (INT32 el = 0; el < Elements; el++)
04701                 {
04702                     if (!pRecord->ReadINT32(&Data))
04703                         break;
04704                     camSprintf(s,_T("\t%d\r\n"),Data); (*pStr) += s;
04705                 }
04706             }
04707         }
04708         break;
04709 
04710         case TAG_ARROWHEAD:
04711         {
04712             INT32 ArrowId;
04713             pRecord->ReadINT32(&ArrowId);
04714             camSprintf(s,_T("Arrow head Id = %d\r\n"),ArrowId); (*pStr) += s;
04715             FIXED16 ScaleWidth;
04716             pRecord->ReadFIXED16(&ScaleWidth);
04717             camSprintf(s,_T("Scale width = %f\r\n"),ScaleWidth.MakeDouble()); (*pStr) += s;
04718             FIXED16 ScaleHeight;
04719             pRecord->ReadFIXED16(&ScaleHeight);
04720             camSprintf(s,_T("Scale height = %f\r\n"),ScaleHeight.MakeDouble()); (*pStr) += s;
04721         }
04722         break;
04723 
04724         case TAG_ARROWTAIL:
04725         {
04726             INT32 ArrowId;
04727             pRecord->ReadINT32(&ArrowId);
04728             camSprintf(s,_T("Arrow tail Id = %d\r\n"),ArrowId); (*pStr) += s;
04729             FIXED16 ScaleWidth;
04730             pRecord->ReadFIXED16(&ScaleWidth);
04731             camSprintf(s,_T("Scale width = %f\r\n"),ScaleWidth.MakeDouble()); (*pStr) += s;
04732             FIXED16 ScaleHeight;
04733             pRecord->ReadFIXED16(&ScaleHeight);
04734             camSprintf(s,_T("Scale height = %f\r\n"),ScaleHeight.MakeDouble()); (*pStr) += s;
04735         }
04736         break;
04737     }
04738 }
04739 #endif

Generated on Sat Nov 10 03:45:38 2007 for Camelot by  doxygen 1.4.4