ngsentry.h

Go to the documentation of this file.
00001 // $Id: ngsentry.h 1282 2006-06-09 09:46:49Z alex $
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     $Header: /Camelot/kernel/ngsentry.h 13    7/01/04 16:47 Phil $
00100     Special sentinel node that has all existing set names applied to it.
00101 */
00102 
00103 #ifndef NGSENTRY_H
00104 #define NGSENTRY_H
00105 
00106 //#include "node.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00107 #include "ngprop.h"
00108 #include "opbarcreation.h"
00109 #include <vector>
00110 
00111 class BaseCamelotFilter;
00112 class TemplateAttribute;
00113 
00114 
00115 /**********************************************************************************************
00116 >   class CCAPI NodeSetProperty : public Node
00117 
00118     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00119     Created:    16/9/99
00120     Purpose:    Child node of NodeSetSentinel that stores individual property records
00121                 for a set of objects (SGNameItem).
00122     SeeAlso:    SGNameProp; SGNameItem; Node; NodeSetSentinel; NameGallery
00123 **********************************************************************************************/
00124 
00125 class CCAPI NodeSetProperty : public Node
00126 {
00127     CC_DECLARE_DYNAMIC(NodeSetProperty);
00128 public:
00129     // Creation & destruction.
00130     NodeSetProperty();
00131     NodeSetProperty(const StringBase& strName);
00132     virtual ~NodeSetProperty();
00133 
00134     // The name of the set these properties are for.
00135     const StringBase& GetName() const
00136             { return m_strName; }
00137 
00138     // Get and set the given property held by this node, returning the old one.
00139     virtual SGNameProp* SetProperty(SGNameProp* pNewProp);
00140     SGNameProp* GetProperty(INT32 nIndex) const
00141             { return m_pProp[nIndex]; }
00142 
00143     // Create default properties of all types for the named set.
00144     BOOL CreateDefaults();
00145 
00146     // Copy the properties of the given NodeSetProperty into this.
00147     BOOL CopyProperties(NodeSetProperty* pOther);
00148 
00149     // Node copying.
00150     virtual Node* SimpleCopy();
00151     virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00152 
00153 protected:
00154     virtual UINT32 GetNodeSize() const;
00155     void CopyNodeContents(NodeSetProperty* pCopy);
00156 
00157     // Version 2 native streaming.  
00158     virtual BOOL WritePreChildrenNative(BaseCamelotFilter*);
00159 
00160     // Version 2 web streaming.
00161     virtual BOOL CanWriteChildrenWeb(BaseCamelotFilter*);
00162     virtual BOOL WritePreChildrenWeb(BaseCamelotFilter*);
00163     virtual BOOL WriteBeginChildRecordsWeb(BaseCamelotFilter*);
00164     virtual BOOL WriteEndChildRecordsWeb(BaseCamelotFilter*);
00165 
00166 private:
00167     // Data.
00168     StringBase  m_strName;
00169     SGNameProp* m_pProp[SGNameProp::nPropertyCount];    // properties of the named set
00170 
00171 public:
00172     // Debugging.
00173     BOOL m_Imported;
00174 #if DEBUG_TREE  
00175     virtual void GetDebugDetails(StringBase* pStr);
00176     virtual void ShowDebugTreeDetails() const;
00177 #endif
00178 };
00179 
00180 
00181 
00182 /**********************************************************************************************
00183 >   class CCAPI NodeBarProperty : public Node
00184 
00185     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00186     Created:    16/9/99
00187     Purpose:    Child node of NodeSetSentinel that stores individual property records
00188                 for a bars.
00189     SeeAlso:    SGNameProp; SGNameItem; Node; NodeSetSentinel; NameGallery
00190 **********************************************************************************************/
00191 
00192 class CCAPI NodeBarProperty : public Node
00193 {
00194     CC_DECLARE_DYNAMIC(NodeBarProperty);
00195 public:
00196     // Creation & destruction.
00197     NodeBarProperty();
00198     NodeBarProperty(Node* pContext, AttachNodeDirection eDir);
00199 
00200     // Return how many entries in the array and allow it to be reinitialised.
00201     size_t HowMany() const                      { return m_nCount; }
00202     void Clear()                                { m_nCount = 0; }
00203 
00204     // Access the array of bar properties (NB. no range checks on these.)
00205     BarDataType& Bar(INT32 n);                  //{ return m_vecBars[n]; }
00206     const BarDataType& Bar(INT32 n) const;      //{ return m_vecBars[n]; }
00207 
00208     // Add a new bar property to the end of the array, returning its new index, or
00209     // UINT_MAX for an overflow condition.
00210     size_t Add(const BarDataType& bdt);
00211 
00212     // Changes entry n to be the new bar property in an undoable manner.
00213     BOOL MakeChange(INT32 n, const BarDataType& bdt);
00214 
00215     // Node copying.
00216     virtual Node* SimpleCopy();
00217     virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00218 
00219 protected:
00220     virtual UINT32 GetNodeSize() const;
00221     void CopyNodeContents(NodeBarProperty* pCopy);
00222 
00223     // Version 2 native streaming.  
00224     virtual BOOL WritePreChildrenNative(BaseCamelotFilter*);
00225 
00226     // Version 2 web streaming.
00227     virtual BOOL CanWriteChildrenWeb(BaseCamelotFilter*);
00228     virtual BOOL WritePreChildrenWeb(BaseCamelotFilter*);
00229     virtual BOOL WriteBeginChildRecordsWeb(BaseCamelotFilter*);
00230     virtual BOOL WriteEndChildRecordsWeb(BaseCamelotFilter*);
00231 
00232 private:
00233     // Data.
00234     std::vector<BarDataType> m_vecBars;         // indexable array of bar properties
00235     size_t m_nCount;                            // how many properties are in the array
00236     BarDataType m_NoBar;
00237 
00238 public:
00239     // Debugging.
00240 #if DEBUG_TREE  
00241     virtual void GetDebugDetails(StringBase* pStr);
00242     virtual void ShowDebugTreeDetails() const;
00243 #endif
00244 };
00245 
00246 
00247 // The maximum number of bars the user may have.
00248 const size_t MAX_BAR_PROPERTIES = 100;
00249 
00250 
00251 
00252 /**********************************************************************************************
00253 >   class CCAPI NodeSetSentinel : public Node
00254 
00255     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00256     Created:    15/9/99
00257     Purpose:    Dummy node that has one instance of each different Wix ObjectName attribute 
00258                 also applied to it.  Every document has one of these nodes after the last
00259                 default attribute and before the first chapter.  Whenever a new name
00260                 is first applied to any objects in the document, it is also applied
00261                 to this node; similarly, whenever a name is deleted (ie. hidden) from
00262                 a document, it is also deleted from this node.  Hence, during the normal
00263                 course of creating or deleting objects with particular names, even if the
00264                 last object which has a name is deleted by the user, the name still exists
00265                 as a single attribute applied to this node, will remain an active item
00266                 in the Attribute gallery, and can be saved out in the native format.  And
00267                 when the user creates or deletes names that never refer to any objects,
00268                 the action always result in tree manipulations and are properly integrated
00269                 into the undo system.
00270     SeeAlso:    Node; NodeSetProperty; NameGallery
00271 **********************************************************************************************/
00272 
00273 class CCAPI NodeSetSentinel : public Node
00274 {
00275     CC_DECLARE_DYNAMIC(NodeSetSentinel);
00276 public:
00277     // Creation & destruction.
00278     NodeSetSentinel();
00279     NodeSetSentinel(Node* pContext, AttachNodeDirection eDir);
00280 
00281     // Set names.
00282     virtual BOOL IsSetCandidate() const;
00283     TemplateAttribute* GetNameAttr(const StringBase& strName) const;
00284 
00285     // Set properties.
00286     NodeSetProperty* FindPropertyNode(const StringBase& strName) const;
00287     NodeSetProperty* CreatePropertyNode(const StringBase& strName);
00288 
00289     NodeBarProperty* FindBarProperty();
00290 
00291     BOOL TargetsExist() const;
00292 
00293     // Fix-ups of loaded/imported Wix ObjectName attributes.
00294     BOOL OnLoadName(BaseCamelotFilter* pFilter, TemplateAttribute* pImportedName);
00295 
00296     // virtual override of Node::AllowOp, to prevent AllowOp calls
00297     // travelling up the tree hierarchy.
00298     virtual BOOL AllowOp(ObjChangeParam *pParam, BOOL SetOpPermissionState,
00299                                                  BOOL DoPreTriggerEdit);
00300 protected:
00301     // Version 2 native streaming.  Children written automatically (the default).
00302     virtual BOOL WritePreChildrenNative(BaseCamelotFilter*);
00303 
00304     // Version 2 web streaming.  These overrides prevent the node or its children
00305     // from being written to web files, so as to exclude information used strictly
00306     // for editing, ie. unreferenced set names and set properties.
00307     virtual BOOL CanWriteChildrenWeb(BaseCamelotFilter*);
00308     virtual BOOL WritePreChildrenWeb(BaseCamelotFilter*);
00309     virtual BOOL WriteBeginChildRecordsWeb(BaseCamelotFilter*);
00310     virtual BOOL WriteEndChildRecordsWeb(BaseCamelotFilter*);
00311 
00312     // Copying.
00313     virtual UINT32 GetNodeSize() const;
00314     virtual Node* SimpleCopy();
00315 
00316 public:
00317     // Debugging.
00318 #if DEBUG_TREE  
00319     virtual void GetDebugDetails(StringBase* pStr);
00320     virtual void ShowDebugTreeDetails() const;
00321 #endif
00322 };
00323 
00324 #endif  /* !NGSENTRY_H */

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