nodeattr.h

Go to the documentation of this file.
00001 // $Id: nodeattr.h 1445 2006-07-14 20:15:02Z phil $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 
00099 // The Node Attribute Class
00100 
00101 #ifndef INC_NODEATTR
00102 #define INC_NODEATTR
00103 
00104 #include "node.h"
00105 
00106 class DocColour;
00107 class AttributeValue;
00108 class BlendAttrParam;
00109 class NodeRenderableInk;
00110 class UndoableOperation;
00111 
00112 // Graeme (21/3/00) - This list of attributes was originally in attrmgr.h. I've moved them
00113 // here so that they can be used to identify attribute nodes directly.
00114 typedef enum
00115 {
00116     ATTR_BAD_ID     = (UINT32)~1,
00117     ATTR_STROKECOLOUR = 0,
00118     ATTR_STROKETRANSP,
00119     ATTR_FILLGEOMETRY,
00120     ATTR_TRANSPFILLGEOMETRY,
00121     ATTR_FILLMAPPING,
00122     ATTR_TRANSPFILLMAPPING,
00123     ATTR_FILLEFFECT,
00124     ATTR_LINEWIDTH,
00125     ATTR_WINDINGRULE,
00126     ATTR_JOINTYPE,
00127     ATTR_QUALITY,
00128     ATTR_DASHPATTERN,
00129     ATTR_STARTCAP,
00130     ATTR_STARTARROW,
00131     ATTR_ENDARROW,
00132     ATTR_MITRELIMIT,
00133     ATTR_USERATTRIBUTE,
00134     ATTR_WEBADDRESS,
00135     ATTR_TXTFONTTYPEFACE,
00136     ATTR_TXTBOLD,
00137     ATTR_TXTITALIC,
00138     ATTR_TXTASPECTRATIO,
00139     ATTR_TXTJUSTIFICATION,
00140     ATTR_TXTTRACKING,
00141     ATTR_TXTUNDERLINE,
00142     ATTR_TXTFONTSIZE,
00143     ATTR_TXTSCRIPT,
00144     ATTR_TXTBASELINE,
00145     ATTR_TXTLINESPACE,
00146     ATTR_TXTLEFTMARGIN,
00147     ATTR_TXTRIGHTMARGIN,
00148     ATTR_TXTFIRSTINDENT,
00149     ATTR_TXTRULER,
00150     ATTR_OVERPRINTLINE,
00151     ATTR_OVERPRINTFILL,
00152     ATTR_PRINTONALLPLATES,
00153     ATTR_STROKETYPE,
00154     ATTR_VARWIDTH,
00155     ATTR_BEVELINDENT,
00156     ATTR_BEVELTYPE,
00157     ATTR_BEVELCONTRAST,
00158     ATTR_BEVELLIGHTANGLE,
00159     ATTR_BEVELLIGHTTILT,
00160     //ATTR_PAINTINGMODE,    // Bye bye painting mode!
00161     ATTR_BRUSHTYPE,
00162     ATTR_FEATHER,
00163     ATTR_CLIPREGION,
00164     ATTR_CLIPVIEW,
00165 
00166     ATTR_FIRST_FREE_ID,     // Put all new attributes above this line!
00167 
00168     ATTR_MOULD = 0,
00169     ATTR_ENDCAP = 0
00170 } AttrIndex;
00171 
00172 typedef const StringBase&   AttributeIdentifier;
00173 class VisibleAttribute;
00174 extern const String_8 NullString;
00175 /***********************************************************************************************
00176 
00177 >   class NodeAttribute : public NodeRenderable
00178 
00179     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00180     Created:    21/6/93
00181     Purpose:    Abstract class from which various Attribute nodes are derived.
00182 
00183 ***********************************************************************************************/
00184 
00185 class NodeAttribute : public NodeRenderable
00186 {
00187     CC_DECLARE_DYNAMIC( NodeAttribute );   
00188 
00189 public:
00190     NodeAttribute(); 
00191     NodeAttribute(Node* ContextNode,  
00192                       AttachNodeDirection Direction,    
00193                       BOOL Locked=FALSE, 
00194                       BOOL Mangled=FALSE,  
00195                       BOOL Marked=FALSE, 
00196                       BOOL Selected=FALSE);
00197 
00198     virtual void Render(RenderRegion* pRender) {};
00199     virtual SubtreeRenderState RenderSubtree(RenderRegion* pRender, Node** ppNextNode = NULL, BOOL bClip = TRUE);
00200     virtual BOOL NeedsToExport( RenderRegion* pRender, BOOL VisibleLayersOnly = FALSE,
00201                                 BOOL CheckSelected = FALSE );
00202     virtual Node* SimpleCopy();                         // Copies a node
00203     virtual INT32 operator==(const NodeAttribute& NodeAttrib); 
00204     virtual BOOL IsDifferent(Node *pOther);
00205     virtual UINT32 GetAttrNameID(void); 
00206     virtual DocColour *EnumerateColourFields(UINT32 Context);
00207 
00208     virtual CCRuntimeClass* GetAttributeType() { return GetRuntimeClass(); }
00209     virtual AttributeValue* GetAttributeValue() { return NULL; }
00210     virtual AttributeIdentifier GetAttributeClassID() const     {   return NullString;  }
00211     virtual AttrIndex GetAttributeIndex () { return ATTR_BAD_ID; }
00212     virtual VisibleAttribute* CreateVisibleAttribute() const    {   return NULL;    }
00213     virtual BOOL CopyComponentData(BaseDocument* SrcDoc, BaseDocument* NodesDoc); 
00214     virtual BOOL Blend(BlendAttrParam* pBlendParam);
00215     virtual BOOL HasEquivalentDefaultValue(BOOL bAppearance = FALSE);
00216 
00217     // This routine returns any secondary attribute that needs to be changed,
00218     // when this attribute is changed.
00219     virtual NodeAttribute* GetOtherAttrToApply(BOOL* IsMutate) { return NULL; }
00220 
00221     // This vfn denotes whether the other attribute above will be applied selectively,
00222     // which prevents OpApplyAttribToSelected::ApplyToSelection() from blanket-applying
00223     // the other attribute to the selection.
00224     virtual BOOL OtherAttrIsAppliedSelectively() const { return FALSE; }
00225 
00226     virtual void OnMakeCurrent() {}
00227 
00228     // Routines to scan the tree in reverse render order returning attributes which are
00229     // "in scope" for a given node.
00230     static NodeAttribute* FindFirstAppliedAttr(Node* pContextNode, Node* pRoot = NULL);
00231     static NodeAttribute* FindPrevAppliedAttr(Node* pContextNode, Node* pRoot = NULL);
00232 
00233     virtual BOOL IsAnAttribute() const; 
00234     virtual BOOL IsOrHidesAnAttribute() const;
00235     virtual BOOL IsRenderedAsInk() const {return TRUE;}
00236 
00237     virtual BOOL IsAValueChange() const; 
00238     virtual BOOL IsAColourFill() const; 
00239     virtual BOOL IsATranspFill() const; 
00240     virtual BOOL IsAStrokeColour() const; 
00241     virtual BOOL IsAStrokeTransp() const; 
00242 
00243     virtual BOOL IsAFlatFill() const; 
00244     virtual BOOL IsAGradFill() const; 
00245     virtual BOOL IsABitmapFill() const; 
00246     virtual BOOL IsAFractalFill() const;
00247     virtual BOOL IsALineLevelAttrib() { return FALSE; }; // Is the attribute a text line level attribute
00248     virtual BOOL IsALineWidthAttr() const;
00249     virtual BOOL NeedsToRenderAtEachBrushStroke() const;
00250 
00251     // This virtual was added because attributes like the NodeAttrQuality can never be directly
00252     // applied to an object. 
00253     virtual BOOL CanBeAppliedToObject() { return TRUE; };
00254 
00255     // This virtual was primarily added to support triggers. If the attribute has exactly the same
00256     // value then it's not multiply applied. It might be bad if you select the attributes into 
00257     // render regions since they don't have the notion of multiple attrs of the same type.
00258     virtual BOOL CanBeMultiplyApplied() { return FALSE; }
00259     // Template/WizOp attributes need to remain with the objects they were attached to.
00260     // Hence they are not optimized, whereas the base class is.
00261     virtual BOOL ShouldBeOptimized()    { return !IsEffectAttribute(); }
00262 
00263     // Effect Attributes live at different positions in the tree and so don't have
00264     // the same scope as normal attributes
00265     virtual BOOL IsEffectAttribute() const;
00266 
00267     BOOL IsADefaultAttr(); 
00268         // Simple but useful fn to determine if the attribute (which must be in the tree) is a default
00269         // attribute
00270 
00271     virtual BOOL EffectsParentBounds();
00272     virtual DocRect GetAttrBoundingRect(NodeRenderableInk* pParent = NULL, CCAttrMap* pAttribMap = NULL);
00273 
00274     // virtual Transform fn which does nothing in the base class.
00275     virtual void TransformToNewBounds(DocRect& NewBounds) { return; } 
00276 
00277     virtual BOOL ShouldBecomeCurrent();
00278 
00279 #ifdef _DEBUG
00280     virtual void ShowDebugTreeDetails() const;
00281 #endif
00282 
00283 protected:
00284     virtual void CopyNodeContents( NodeAttribute* NodeCopy );
00285 
00286 public:
00287     // Starting from this attribute, returns the next attribute of the given type
00288     // that applies to the Node on which Node::FindFirstAttr was called, or null
00289     // if there isn't one.
00290     NodeAttribute* FindNextAttr(Node::TypeFunc pfnTest) const;
00291 
00292     // Ilan 27/4/00
00293     // New extensions to the attribute system - initially created to support feathering attribute
00294 
00295     // Determines whether dynamically created copies of the attribute need special post-copying update
00296     // Also means that it needs to receive object change messages from any child nodes within its scope
00297     virtual BOOL IsLinkedToNodeGeometry();
00298     virtual BOOL IsLinkedToThisNode(Node* pNode);
00299 
00300     // Attributes which are linked to node geometry, require the following additional
00301     // initialisation functions
00302     virtual BOOL PostDynCreateInit(CCAttrMap* pMap, Path* InkPath, CCRuntimeClass* pCreatorClass);
00303     virtual BOOL PostDynCreateInit(CCAttrMap* pMap, Node* pNode, CCRuntimeClass* pCreatorClass);
00304     virtual void PostDynCreateDeInit();
00305 
00306     // Lets the attribute know that the child objects have changed (nb see notes in definition)
00307     virtual BOOL LinkedNodeGeometryHasChanged(UndoableOperation* pOp);
00308 
00309     // When compound nodes are dynamically created inside blends to form one of the BlendRefs
00310     // it is necessary to supply 
00311     virtual BOOL LinkToGeometry(Node* pContext);
00312     // Called after a default attribute is created and attached to a NodeDocument
00313     // (ie when a new document is created)
00314     virtual void NewlyCreatedDefaultAttr(NodeDocument* pNode);
00315 
00316     // To determine if the NodeAttribute is the container (ie node in the tree) for the supplied AttributeValue
00317     virtual BOOL ContainsAttributeValue(AttributeValue* pVal);
00318 
00319     // Karim 15/11/2000
00320     // ID function for an attribute which diverts rendering offscreen, ie its AttributeValue is derived
00321     // from OffscreenAttrValue, eg AttrFeather.
00322     virtual BOOL IsAnOffscreenAttribute() { return FALSE; }
00323 
00324     // Allow attributes to supply additional paths into the BecomeA system
00325     // (E.g. special outline strokes)
00326 //  virtual BOOL DoBecomeAdditionalPath(BecomeA* pBecomeA, NodePath* pNode, NodeRenderableInk* pCreatedByNode, CCAttrMap* pAttrMap) {return FALSE;}
00327 
00328 // Karim 13/09/2000
00329 // Virtual override of NodeRenderable::IsSeeThrough() - see base declaration for details.
00330 public:
00331     virtual BOOL IsSeeThrough(BOOL CheckIndirectAttrs) { return FALSE; }
00332 };
00333 
00334 #endif

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