00001 // $Id: cxflists.cpp 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 // Implements bits of the stuff defined in cxflists.h 00100 00101 #include "camtypes.h" 00102 //#include "camfiltr.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00103 #include "cxflists.h" 00104 //#include "group.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00105 #include "cxftags.h" 00106 00107 /*********************************************************************************************** 00108 00109 > CXaraFileTextStoryGroupRefListItem::~CXaraFileTextStoryGroupRefListItem(); 00110 00111 Author: Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 00112 Created: 31/8/96 00113 Inputs: - 00114 Returns: - 00115 Purpose: Destroys every last fragmented morsal of this pathetic excuse for an object. 00116 00117 If it has a group, its children are deleted via CascadeDelete(), then the group 00118 itself is deleted 00119 00120 ***********************************************************************************************/ 00121 00122 // WEBSTER - markn 31/1/97 00123 // Replaced with general system 00124 /* 00125 CXaraFileTextStoryGroupRefListItem::~CXaraFileTextStoryGroupRefListItem() 00126 { 00127 if (pNodeGroup != NULL) 00128 { 00129 pNodeGroup->CascadeDelete(); 00130 delete pNodeGroup; 00131 pNodeGroup = NULL; 00132 } 00133 } 00134 */ 00135 00136 //---------------------------------------------------------------------------------------------- 00137 //---------------------------------------------------------------------------------------------- 00138 00139 /*********************************************************************************************** 00140 00141 > CXaraFileNodeGroupRefListItem::~CXaraFileNodeGroupRefListItem(); 00142 00143 Author: Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 00144 Created: 29/1/97 00145 Inputs: - 00146 Returns: - 00147 Purpose: Destroys every last fragmented morsal of this pathetic excuse for an object. 00148 00149 If it has a group, its children are deleted via CascadeDelete(), then the group 00150 itself is deleted 00151 00152 WEBSTER - markn 29/1/97 00153 Part of the general form of the system used to convert text to outlines in v1.5 00154 00155 ***********************************************************************************************/ 00156 00157 CXaraFileNodeGroupRefListItem::~CXaraFileNodeGroupRefListItem() 00158 { 00159 if (pNodeGroup != NULL) 00160 { 00161 pNodeGroup->CascadeDelete(); 00162 delete pNodeGroup; 00163 pNodeGroup = NULL; 00164 } 00165 } 00166 00167 //---------------------------------------------------------------------------------------------- 00168 //---------------------------------------------------------------------------------------------- 00169 00170 /*********************************************************************************************** 00171 00172 > InsertLevelStackItem::InsertLevelStackItem(BaseCamelotFilter* pThisFilter) 00173 00174 Author: Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 00175 Created: 2/9/96 00176 Inputs: pThisFilter = ptr to the filter this item is used by 00177 Returns: - 00178 Purpose: The default constructor 00179 00180 ***********************************************************************************************/ 00181 00182 InsertLevelStackItem::InsertLevelStackItem(BaseCamelotFilter* pThisFilter) 00183 { 00184 NumNodesInserted = 0; 00185 pLastInsertedNode = NULL; 00186 pLastHandler = NULL; 00187 LastHandledTag = TAG_UNDEFINED; 00188 pFilter = pThisFilter; 00189 LastNodeInformedChildrenComplete = FALSE; 00190 00191 ERROR3IF(pFilter == NULL,"pFilter is NULL"); 00192 } 00193 00194 /*********************************************************************************************** 00195 00196 > BOOL InsertLevelStackItem::SetLastInsertedNode(Node* pNode) 00197 00198 Author: Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 00199 Created: 18/9/96 00200 Inputs: pNode = ptr to node just inserted into the tree 00201 Returns: TRUE if ok, FALSE if a failure has ocurred 00202 Purpose: Sets the last inserted node of this tree 00203 00204 ***********************************************************************************************/ 00205 00206 BOOL InsertLevelStackItem::SetLastInsertedNode(Node* pNode) 00207 { 00208 ERROR3IF(pNode == NULL,"pNode is NULL"); 00209 00210 if (pNode != NULL) 00211 { 00212 if (pNode->FindPrevious() == pLastInsertedNode) 00213 { 00214 if (!InformLastInsertedNodeChildrenComplete()) 00215 return FALSE; 00216 } 00217 00218 pLastInsertedNode = pNode; 00219 LastNodeInformedChildrenComplete = FALSE; 00220 00221 IncNumNodesInserted(); // Inc the number of nodes on this level 00222 } 00223 00224 return TRUE; 00225 } 00226 00227 /*********************************************************************************************** 00228 00229 > BOOL InsertLevelStackItem::InformLastInsertedNodeChildrenComplete() 00230 00231 Author: Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 00232 Created: 18/9/96 00233 Inputs: - 00234 Returns: TRUE if ok, FALSE if a failure has ocurred 00235 Purpose: Tells the last inserted node that its children are complete 00236 00237 ***********************************************************************************************/ 00238 00239 BOOL InsertLevelStackItem::InformLastInsertedNodeChildrenComplete() 00240 { 00241 ERROR3IF(pFilter == NULL,"pFilter is NULL"); 00242 00243 if (!LastNodeInformedChildrenComplete && pLastInsertedNode != NULL && pFilter != NULL) 00244 { 00245 if (!pFilter->ReadPostChildren(pLastInsertedNode)) 00246 return FALSE; 00247 00248 LastNodeInformedChildrenComplete = TRUE; 00249 } 00250 00251 return TRUE; 00252 } 00253 00254 00255 //---------------------------------------------------------------------------------------------- 00256 //---------------------------------------------------------------------------------------------- 00257 00258 /*********************************************************************************************** 00259 00260 > InsertLevelStack::InsertLevelStack(); 00261 00262 Author: Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 00263 Created: 3/9/96 00264 Inputs: - 00265 Returns: - 00266 Purpose: The default constructor 00267 00268 ***********************************************************************************************/ 00269 00270 InsertLevelStack::InsertLevelStack() 00271 { 00272 InsertLevel = 0; 00273 } 00274 00275 /*********************************************************************************************** 00276 00277 > InsertLevelStack::~InsertLevelStack(); 00278 00279 Author: Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 00280 Created: 3/9/96 00281 Inputs: - 00282 Returns: - 00283 Purpose: The default destructor - deletes all the list's items 00284 00285 ***********************************************************************************************/ 00286 00287 InsertLevelStack::~InsertLevelStack() 00288 { 00289 DeleteAll(); 00290 } 00291 00292 /*********************************************************************************************** 00293 00294 > void InsertLevelStack::Add(InsertLevelStackItem* pItem) 00295 00296 Author: Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 00297 Created: 3/9/96 00298 Inputs: pItem 00299 Returns: - 00300 Purpose: Adds the item to the top of the stack 00301 00302 ***********************************************************************************************/ 00303 00304 void InsertLevelStack::Add(InsertLevelStackItem* pItem) 00305 { 00306 InsertLevel++; 00307 AddTail(pItem); 00308 } 00309 00310 /*********************************************************************************************** 00311 00312 > InsertLevelStackItem* InsertLevelStack::Get() 00313 00314 Author: Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 00315 Created: 3/9/96 00316 Inputs: - 00317 Returns: ptr to a InsertLevelStackItem 00318 Purpose: Returns a ptr to the item on the top of the stack, without removing it 00319 00320 ***********************************************************************************************/ 00321 00322 InsertLevelStackItem* InsertLevelStack::Get() 00323 { 00324 return (InsertLevelStackItem*)List::GetTail(); 00325 } 00326 00327 /*********************************************************************************************** 00328 00329 > InsertLevelStackItem* InsertLevelStack::Pop() 00330 00331 Author: Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 00332 Created: 3/9/96 00333 Inputs: - 00334 Returns: ptr to a InsertLevelStackItem 00335 Purpose: Removes the item from the top of the stack, and returns a ptr to it 00336 00337 ***********************************************************************************************/ 00338 00339 InsertLevelStackItem* InsertLevelStack::Pop() 00340 { 00341 if (InsertLevel == 0) 00342 { 00343 ERROR3("InsertLevel == 0"); 00344 return NULL; 00345 } 00346 00347 InsertLevel--; 00348 00349 return (InsertLevelStackItem*)List::RemoveTail(); 00350 } 00351