00001 // $Id: ngsentry.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 $Header: /wxCamelot/Kernel/ngsentry.cpp 23 20/07/05 15:39 Luke $ 00100 Special sentinel node that has all existing set names applied to it. 00101 */ 00102 00103 #include "camtypes.h" 00104 00105 //#include "ngcore.h" 00106 //#include "ngprop.h" 00107 #include "ngsentry.h" 00108 //#include "ngsetop.h" 00109 00110 #include "opbarcreation.h" 00111 00112 //#include "selop.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00113 //#include "cxfdefs.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00114 #include "cxftags.h" 00115 //#include "cxfrec.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00116 //#include "cxfrech.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00117 //#include "attrval.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00118 #include "userattr.h" 00119 #include "tmpltatr.h" 00120 00121 //#include "mario.h" 00122 //#include "tim.h" 00123 00124 #ifdef _DEBUG 00125 #undef THIS_FILE 00126 static char BASED_CODE THIS_FILE[] = __FILE__; 00127 #endif 00128 00129 DECLARE_SOURCE("$Revision: 1282 $"); 00130 00131 CC_IMPLEMENT_DYNAMIC(NodeSetSentinel, Node); 00132 CC_IMPLEMENT_DYNAMIC(NodeSetProperty, Node); 00133 CC_IMPLEMENT_DYNAMIC(NodeBarProperty, Node); 00134 00135 // This line mustn't go before any CC_IMPLEMENT_... macros 00136 // Declare smart memory handling in Debug builds 00137 #define new CAM_DEBUG_NEW 00138 00139 00140 00141 /******************************************************************************************** 00142 > NodeSetProperty::NodeSetProperty() 00143 00144 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00145 Created: 15/9/99 00146 Inputs: strName --- name of the set to hold properties for 00147 Purpose: Default constructor for a NodeSetProperty, a container node for a group of 00148 properties for a named set. 00149 SeeAlso: SGNameProp; Node; NodeSetSentinel; NameGallery 00150 ********************************************************************************************/ 00151 00152 NodeSetProperty::NodeSetProperty() 00153 { 00154 memset(m_pProp, 0, sizeof(m_pProp)); 00155 m_Imported = FALSE; 00156 } 00157 00158 00159 00160 /******************************************************************************************** 00161 > NodeSetProperty::NodeSetProperty(const StringBase& strName) 00162 00163 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00164 Created: 15/9/99 00165 Inputs: (See Node::Node) 00166 strName --- the name of the set to hold properties for 00167 Purpose: Constructor for a NodeSetProperty, a container of properties associated 00168 with particular SGNameItems. 00169 SeeAlso: SGNameProp; Node; NodeSetSentinel; NameGallery 00170 ********************************************************************************************/ 00171 00172 NodeSetProperty::NodeSetProperty(const StringBase& strName) 00173 { 00174 memset(m_pProp, 0, sizeof(m_pProp)); 00175 m_strName.Alloc(strName.Length() + 1); 00176 m_strName = strName; 00177 m_Imported = FALSE; 00178 } 00179 00180 00181 00182 /******************************************************************************************** 00183 > virtual NodeSetProperty::~NodeSetProperty() 00184 00185 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00186 Created: 15/9/99 00187 Purpose: Destroys a NodeSetProperty. 00188 SeeAlso: SGNameProp; Node; NodeSetSentinel; NameGallery 00189 ********************************************************************************************/ 00190 00191 NodeSetProperty::~NodeSetProperty() 00192 { 00193 // If we still have valid pointers to properties then take responsibility for 00194 // deallocating them. 00195 for (SGNameProp** ppProp = &m_pProp[SGNameProp::nPropertyCount]; 00196 --ppProp >= &m_pProp[0]; /* empty */ ) 00197 if (*ppProp != 0) 00198 { 00199 delete *ppProp; 00200 *ppProp = 0; 00201 } 00202 } 00203 00204 00205 00206 /******************************************************************************************** 00207 > virtual SGNameProp* NodeSetProperty::SetProperty(SGNameProp* pNewProp) 00208 00209 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00210 Created: 15/9/99 00211 Inputs: pNewProp --- the new property this node should hold. 00212 Returns: The old property. 00213 Purpose: See Node::GetNodeSize 00214 SeeAlso: SGNameProp; Node; NodeSetSentinel; NameGallery 00215 ********************************************************************************************/ 00216 00217 SGNameProp* NodeSetProperty::SetProperty(SGNameProp* pNewProp) 00218 { 00219 ERROR3IF(pNewProp == 0, "NodeSetProperty::SetProperty: null input"); 00220 00221 INT32 i = pNewProp->GetIndex(); 00222 ERROR3IF(i < 0 || i >= SGNameProp::nPropertyCount, 00223 "NodeSetProperty::SetProperty: out of range"); 00224 00225 SGNameProp* pOld = m_pProp[i]; 00226 m_pProp[i] = pNewProp; 00227 00228 m_Imported = FALSE; 00229 return pOld; 00230 } 00231 00232 00233 00234 /******************************************************************************************** 00235 > BOOL NodeSetProperty::CreateDefaults() 00236 00237 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00238 Created: 15/9/99 00239 Returns: FALSE if out of memory. 00240 Purpose: Create default properties of every type for this set. 00241 SeeAlso: SGNameProp; Node; NodeSetSentinel; NameGallery 00242 ********************************************************************************************/ 00243 00244 BOOL NodeSetProperty::CreateDefaults() 00245 { 00246 // Create a new default property of every type and delete any old ones. 00247 for (INT32 i = 0; i < SGNameProp::nPropertyCount; i++) 00248 { 00249 if (m_pProp[i] != 0) delete m_pProp[i]; 00250 m_pProp[i] = SGNameProp::CreateDefault(m_strName, i); 00251 if (m_pProp[i] == 0) return FALSE; 00252 } 00253 00254 return TRUE; 00255 } 00256 00257 00258 00259 /******************************************************************************************** 00260 > BOOL NodeSetProperty::CopyProperties(NodeSetProperty* pOther) 00261 00262 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00263 Created: 15/9/99 00264 Inputs: pOther --- where to copy properties from 00265 Returns: FALSE if out of memory. 00266 Purpose: Copy the given NodeSetProperty's SGNameProps into this. 00267 SeeAlso: SGNameProp; Node; NodeSetSentinel; NameGallery 00268 ********************************************************************************************/ 00269 00270 BOOL NodeSetProperty::CopyProperties(NodeSetProperty* pOther) 00271 { 00272 // Replace properties in this with clones of the other's. 00273 for (INT32 i = 0; i < SGNameProp::nPropertyCount; i++) 00274 { 00275 SGNameProp* pNewProp; 00276 if (pOther->m_pProp[i] == 0) 00277 pNewProp = 0; 00278 else 00279 { 00280 pNewProp = pOther->m_pProp[i]->Clone(); 00281 ERRORIF(pNewProp == 0, _R(IDE_NOMORE_MEMORY), FALSE); 00282 } 00283 00284 delete m_pProp[i]; 00285 m_pProp[i] = pNewProp; 00286 } 00287 00288 return TRUE; 00289 } 00290 00291 00292 00293 /******************************************************************************************** 00294 > virtual UINT32 NodeSetProperty::GetNodeSize() const 00295 00296 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00297 Created: 15/9/99 00298 Purpose: See Node::GetNodeSize 00299 SeeAlso: SGNameProp; Node; NodeSetSentinel; NameGallery 00300 ********************************************************************************************/ 00301 00302 UINT32 NodeSetProperty::GetNodeSize() const 00303 { 00304 return sizeof(*this); 00305 } 00306 00307 00308 00309 /******************************************************************************************** 00310 > virtual Node* NodeSetProperty::SimpleCopy() 00311 00312 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00313 Created: 15/9/99 00314 Purpose: See Node::SimpleCopy. 00315 SeeAlso: SGNameProp; Node; NodeSetSentinel; NameGallery 00316 Notes: If you add any data members to class NodeSetProperty, then you should 00317 define a (non-virtual) CopyNodeContents function and call that to 00318 do the copy. 00319 ********************************************************************************************/ 00320 00321 Node* NodeSetProperty::SimpleCopy() 00322 { 00323 NodeSetProperty* pCopy = new NodeSetProperty; 00324 ERRORIF(pCopy == 0, _R(IDE_NOMORE_MEMORY), 0); 00325 CopyNodeContents(pCopy); 00326 return pCopy; 00327 } 00328 00329 00330 00331 /******************************************************************************************** 00332 > void NodeSetProperty::CopyNodeContents(NodeSetProperty* pCopy) 00333 00334 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00335 Created: 15/9/99 00336 Purpose: See Node::SimpleCopy. 00337 SeeAlso: SGNameProp; Node; NodeSetSentinel; NameGallery 00338 ********************************************************************************************/ 00339 00340 void NodeSetProperty::CopyNodeContents(NodeSetProperty* pCopy) 00341 { 00342 ERROR3IF(pCopy == 0, "NodeSetProperty::CopyNodeContents: null input"); 00343 Node::CopyNodeContents(pCopy); 00344 00345 // Copy the name of the set. 00346 pCopy->m_strName.Alloc(m_strName.Length() + 1); 00347 pCopy->m_strName = m_strName; 00348 00349 // Create copies in the heap of this node's contained properties. 00350 for (INT32 i = 0; i < SGNameProp::nPropertyCount; i++) 00351 { 00352 if (m_pProp[i] == 0) 00353 pCopy->m_pProp[i] = 0; 00354 else 00355 { 00356 // TODO: verify that this is the out of memory convention for this func. 00357 pCopy->m_pProp[i] = m_pProp[i]->Clone(); 00358 if (pCopy->m_pProp[i] == 0) 00359 { 00360 ERROR1RAW(_R(IDE_NOMORE_MEMORY)); 00361 return; 00362 } 00363 } 00364 } 00365 } 00366 00367 00368 /*********************************************************************************************** 00369 > void NodeSetProperty::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 00370 00371 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 00372 Created: 18/12/2003 00373 Outputs: - 00374 Purpose: Polymorphically copies the contents of this node to another 00375 Errors: An assertion failure will occur if NodeCopy is NULL 00376 Scope: protected 00377 00378 ***********************************************************************************************/ 00379 00380 void NodeSetProperty::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 00381 { 00382 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 00383 ENSURE(IS_A(pNodeCopy, NodeSetProperty), "PolyCopyNodeContents given wrong dest node type"); 00384 00385 if (IS_A(pNodeCopy, NodeSetProperty)) 00386 CopyNodeContents((NodeSetProperty*)pNodeCopy); 00387 } 00388 00389 00390 00391 /******************************************************************************************** 00392 > virtual BOOL NodeSetProperty::WritePreChildrenNative(BaseCamelotFilter* pFilter) 00393 00394 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00395 Created: 31/9/99 00396 Inputs: pFilter --- filter to write to 00397 Returns: TRUE if the node has written out a record to the filter, FALSE otherwise. 00398 Purpose: Writes out a SetProperty record. 00399 ********************************************************************************************/ 00400 00401 BOOL NodeSetProperty::WritePreChildrenNative(BaseCamelotFilter* pFilter) 00402 { 00403 #ifdef DO_EXPORT 00404 // Write out the SetProperty record header. 00405 CXaraFileRecord rec(TAG_SETPROPERTY, TAG_SETPROPERTY_SIZE); 00406 if (!rec.Init() || 00407 !rec.WriteUnicode(m_strName) || 00408 !rec.WriteINT16((INT16) SGNameProp::nPropertyCount)) 00409 { 00410 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR)); 00411 return FALSE; 00412 } 00413 00414 // Write out each property in ascending index order. 00415 for (INT32 i = 0; i < SGNameProp::nPropertyCount; i++) 00416 { 00417 ERROR3IF(m_pProp[i] == NULL, "NodeSetProperty::WritePreChildrenNative: no property"); 00418 if (!rec.WriteINT16((INT16) i) || !m_pProp[i]->Write(&rec)) 00419 { 00420 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR)); 00421 return FALSE; 00422 } 00423 } 00424 00425 // We've built up a record, now write it out. 00426 UINT32 r = pFilter->Write(&rec); 00427 if (r == 0) pFilter->GotError(_R(IDE_FILE_WRITE_ERROR)); 00428 return (BOOL) r; 00429 #else 00430 return FALSE; 00431 #endif 00432 } 00433 00434 00435 00436 /******************************************************************************************** 00437 > virtual BOOL NodeSetProperty::CanWriteChildrenWeb(BaseCamelotFilter* pFilter) 00438 00439 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00440 Created: 31/9/99 00441 Inputs: pFilter --- filter to write to 00442 Returns: FALSE. 00443 Purpose: Prevents children of the sentinel being written out in the web format. 00444 ********************************************************************************************/ 00445 00446 BOOL NodeSetProperty::CanWriteChildrenWeb(BaseCamelotFilter*) 00447 { 00448 return FALSE; 00449 } 00450 00451 00452 00453 /******************************************************************************************** 00454 > virtual BOOL NodeSetProperty::WritePreChildrenWeb(BaseCamelotFilter* pFilter) 00455 00456 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00457 Created: 31/9/99 00458 Inputs: pFilter --- filter to write to 00459 Returns: FALSE. 00460 Purpose: Web files don't write out SetSentinel records. This code assumes the 00461 document will only contain one SetSentinel. 00462 ********************************************************************************************/ 00463 00464 BOOL NodeSetProperty::WritePreChildrenWeb(BaseCamelotFilter*) 00465 { 00466 return FALSE; 00467 } 00468 00469 00470 00471 /******************************************************************************************** 00472 > BOOL NodeSetProperty::WriteBeginChildRecordsWeb(BaseCamelotFilter* pFilter) 00473 00474 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00475 Created: 1/8/99 00476 Inputs: pFilter --- filter to write to 00477 Returns: TRUE. 00478 Purpose: Begins the child record sequence for SetSentinel in the web format. 00479 Web export doesn't write out SetSentinel records or children of the 00480 sentinel, so this overrides the default behaviour in Node by ensuring 00481 the DOWN record does not get written. 00482 ********************************************************************************************/ 00483 00484 BOOL NodeSetProperty::WriteBeginChildRecordsWeb(BaseCamelotFilter*) 00485 { 00486 return TRUE; 00487 } 00488 00489 00490 00491 /******************************************************************************************** 00492 > BOOL NodeSetProperty::WriteEndChildRecordsWeb(BaseCamelotFilter* pFilter) 00493 00494 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00495 Created: 1/8/99 00496 Inputs: pFilter --- filter to write to 00497 Returns: TRUE. 00498 Purpose: Ends the child record sequence for SetSentinel in the web format. 00499 Web export doesn't write out SetSentinel records or children of the 00500 sentinel, so this overrides the default behaviour in Node by ensuring 00501 the UP record does not get written. 00502 ********************************************************************************************/ 00503 00504 BOOL NodeSetProperty::WriteEndChildRecordsWeb(BaseCamelotFilter*) 00505 { 00506 return TRUE; 00507 } 00508 00509 00510 00511 /******************************************************************************************** 00512 > virtual void NodeSetProperty::GetDebugDetails(StringBase* pStr) 00513 00514 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00515 Created: 15/9/99 00516 Purpose: See Node::GetDebugDetails 00517 SeeAlso: Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc 00518 ********************************************************************************************/ 00519 00520 #if DEBUG_TREE 00521 00522 void NodeSetProperty::GetDebugDetails(StringBase* pStr) 00523 { 00524 Node::GetDebugDetails(pStr); 00525 00526 *pStr += TEXT("\r\nProperties for set \""); 00527 *pStr += m_strName; 00528 *pStr += TEXT("\"\r\n"); 00529 00530 for (INT32 i = 0; i < SGNameProp::nPropertyCount; i++) 00531 if (m_pProp[i] != 0) m_pProp[i]->GetDebugInfo(pStr); 00532 } 00533 00534 #endif 00535 00536 00537 /******************************************************************************************** 00538 > virtual void NodeSetProperty::ShowDebugTreeDetails() const 00539 00540 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00541 Created: 15/9/99 00542 Purpose: See Node::ShowDebugTreeDetails 00543 SeeAlso: Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc 00544 ********************************************************************************************/ 00545 00546 #if DEBUG_TREE 00547 00548 void NodeSetProperty::ShowDebugTreeDetails() const 00549 { 00550 TRACE( _T("NodeSetProperty ")); 00551 Node::ShowDebugTreeDetails(); 00552 } 00553 00554 #endif 00555 00556 00557 00558 00559 00564 00565 00566 00567 00568 00569 /******************************************************************************************** 00570 > NodeBarProperty::NodeBarProperty() 00571 00572 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00573 Created: 15/9/99 00574 Purpose: Default constructor for a NodeBarProperty, which retains bar attributes 00575 in an undoable storage. 00576 SeeAlso: Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc 00577 ********************************************************************************************/ 00578 00579 NodeBarProperty::NodeBarProperty() 00580 : m_nCount(0) 00581 { 00582 m_vecBars.reserve(MAX_BAR_PROPERTIES); 00583 00584 m_NoBar.IsLive = TRUE; 00585 } 00586 00587 00588 00589 /******************************************************************************************** 00590 > NodeBarProperty::NodeBarProperty(Node* pContext, AttachNodeDirection eDir) 00591 00592 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00593 Created: 15/9/99 00594 Inputs: See Node::Node 00595 Purpose: Constructor for a NodeBarProperty, which retains bar attributes 00596 in an undoable storage. 00597 SeeAlso: Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc 00598 ********************************************************************************************/ 00599 00600 NodeBarProperty::NodeBarProperty(Node* pContext, AttachNodeDirection eDir) 00601 : Node(pContext, eDir), 00602 m_nCount(0) 00603 { 00604 m_vecBars.reserve(MAX_BAR_PROPERTIES); 00605 } 00606 00607 /******************************************************************************************** 00608 > BarDataType& NodeBarProperty::Bar(INT32 n) 00609 00610 Author: Simon_Knight (Xara Group Ltd) <camelotdev@xara.com> 00611 Created: 19/5/00 00612 Inputs: Entry to retrieve 00613 Purpose: Read the bars property 00614 ********************************************************************************************/ 00615 BarDataType& NodeBarProperty::Bar(INT32 n) 00616 { 00617 if (n >= 0) 00618 return m_vecBars[n]; 00619 00620 return m_NoBar; 00621 } 00622 00623 const BarDataType& NodeBarProperty::Bar(INT32 n) const 00624 { 00625 if (n >= 0) 00626 return m_vecBars[n]; 00627 00628 return m_NoBar; 00629 } 00630 00631 00632 00633 /******************************************************************************************** 00634 > size_t NodeBarProperty::Add(const BarDataType& bdt) 00635 00636 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00637 Created: 15/9/99 00638 Inputs: bdt --- the BarDataType to add to the end of the array 00639 Returns: The index of the entry that was appended, or UINT_MAX for an error. 00640 Purpose: Appends the given property to the end of the array of bar properties. 00641 SeeAlso: Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc 00642 ********************************************************************************************/ 00643 00644 size_t NodeBarProperty::Add(const BarDataType& bdt) 00645 { 00646 // Test for overflow. 00647 if (HowMany() >= MAX_BAR_PROPERTIES) 00648 { 00649 ERROR3("NodeBarProperty::Add: array overflow"); 00650 return UINT_MAX; 00651 } 00652 00653 // Append to the end. 00654 m_vecBars[m_nCount] = bdt; 00655 return m_nCount++; 00656 } 00657 00658 00659 00660 /******************************************************************************************** 00661 > BOOL NodeBarProperty::MakeChange(INT32 n, const BarDataType& bdt) 00662 00663 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00664 Created: 15/9/99 00665 Inputs: n --- the index of the bar to change 00666 bdt --- the new data for the given bar 00667 Returns: TRUE if successful. 00668 Purpose: Creates a duplicate of this node and then hides this node, writing the 00669 given changes into the duplicate. 00670 SeeAlso: Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc 00671 ********************************************************************************************/ 00672 00673 BOOL NodeBarProperty::MakeChange(INT32 n, const BarDataType& bdt) 00674 { 00675 PORTNOTETRACE("dialog","NodeBarProperty::MakeChange - do nothing"); 00676 #ifndef EXCLUDE_FROM_XARALX 00677 // Package up the parameters into an OpParam. 00678 OpChangeBarPropParam prm; 00679 prm.m_nIndex = n; 00680 prm.m_pbdtInfo = &bdt; 00681 prm.m_Prop = this; 00682 00683 // Call the op to duplicate and hide this node. 00684 OpDescriptor* pDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGE_BAR_PROPERTY); 00685 ERROR3IF(pDesc == 0, "NodeBarProperty::MakeChange: can't find descriptor"); 00686 pDesc->Invoke(&prm); 00687 return TRUE; 00688 #else 00689 return FALSE; 00690 #endif 00691 } 00692 00693 00694 00695 /******************************************************************************************** 00696 > virtual UINT32 NodeBarProperty::GetNodeSize() const 00697 00698 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00699 Created: 15/9/99 00700 Purpose: See Node::GetNodeSize 00701 SeeAlso: SGNameProp; Node; NodeSetSentinel; NameGallery 00702 ********************************************************************************************/ 00703 00704 UINT32 NodeBarProperty::GetNodeSize() const 00705 { 00706 return sizeof(*this); 00707 } 00708 00709 00710 00711 /******************************************************************************************** 00712 > virtual Node* NodeBarProperty::SimpleCopy() 00713 00714 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00715 Created: 15/9/99 00716 Purpose: See Node::SimpleCopy. 00717 SeeAlso: SGNameProp; Node; NodeSetSentinel; NameGallery 00718 Notes: If you add any data members to class NodeBarProperty, then you should 00719 define a (non-virtual) CopyNodeContents function and call that to 00720 do the copy. 00721 ********************************************************************************************/ 00722 00723 Node* NodeBarProperty::SimpleCopy() 00724 { 00725 NodeBarProperty* pCopy = new NodeBarProperty; 00726 ERRORIF(pCopy == 0, _R(IDE_NOMORE_MEMORY), 0); 00727 CopyNodeContents(pCopy); 00728 return pCopy; 00729 } 00730 00731 00732 00733 /******************************************************************************************** 00734 > void NodeBarProperty::CopyNodeContents(NodeBarProperty* pCopy) 00735 00736 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00737 Created: 15/9/99 00738 Purpose: See Node::SimpleCopy. 00739 SeeAlso: SGNameProp; Node; NodeSetSentinel; NameGallery 00740 ********************************************************************************************/ 00741 00742 void NodeBarProperty::CopyNodeContents(NodeBarProperty* pCopy) 00743 { 00744 ERROR3IF(pCopy == 0, "NodeBarProperty::CopyNodeContents: null input"); 00745 Node::CopyNodeContents(pCopy); 00746 00747 // copy over the data of the first count bars 00748 for( size_t i = 0; i < m_nCount; i++ ) 00749 pCopy->m_vecBars[i] = m_vecBars[i]; 00750 00751 pCopy->m_nCount = m_nCount; 00752 } 00753 00754 00755 00756 /*********************************************************************************************** 00757 > void NodeBarProperty::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 00758 00759 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 00760 Created: 18/12/2003 00761 Outputs: - 00762 Purpose: Polymorphically copies the contents of this node to another 00763 Errors: An assertion failure will occur if NodeCopy is NULL 00764 Scope: protected 00765 00766 ***********************************************************************************************/ 00767 00768 void NodeBarProperty::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 00769 { 00770 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 00771 ENSURE(IS_A(pNodeCopy, NodeBarProperty), "PolyCopyNodeContents given wrong dest node type"); 00772 00773 if (IS_A(pNodeCopy, NodeBarProperty)) 00774 CopyNodeContents((NodeBarProperty*)pNodeCopy); 00775 } 00776 00777 00778 00779 /******************************************************************************************** 00780 > virtual BOOL NodeBarProperty::WritePreChildrenNative(BaseCamelotFilter* pFilter) 00781 00782 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00783 Created: 31/9/99 00784 Inputs: pFilter --- filter to write to 00785 Returns: TRUE if the node has written out a record to the filter, FALSE otherwise. 00786 Purpose: Writes out a bar property record. 00787 ********************************************************************************************/ 00788 00789 BOOL NodeBarProperty::WritePreChildrenNative(BaseCamelotFilter* pFilter) 00790 { 00791 #ifdef DO_EXPORT 00792 // Write out the SetProperty record header. 00793 CXaraFileRecord rec(TAG_BARPROPERTY, TAG_BARPROPERTY_SIZE); 00794 if (!rec.Init() || !rec.WriteINT32(HowMany())) 00795 { 00796 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR)); 00797 return FALSE; 00798 } 00799 00800 // Write out each property in ascending index order. 00801 for (UINT32 i = 0; i < HowMany(); i++) 00802 { 00803 const BarDataType& bdt = Bar(i); 00804 BYTE nCode = bdt.IsLive | 00805 (bdt.IsHorizontal << 1) | 00806 (bdt.RequiresShuffle << 2) | 00807 (bdt.ButtonsExtend << 3) | 00808 (bdt.ButtonsScale << 4) | 00809 (bdt.GroupsStretch << 5); 00810 00811 if (!rec.WriteINT32(bdt.Spacing) || !rec.WriteBYTE(nCode) || !rec.WriteBYTE(bdt.SameSize)) 00812 { 00813 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR)); 00814 return FALSE; 00815 } 00816 } 00817 00818 // We've built up a record, now write it out. 00819 UINT32 r = pFilter->Write(&rec); 00820 if (r == 0) pFilter->GotError(_R(IDE_FILE_WRITE_ERROR)); 00821 return (BOOL) r; 00822 #else 00823 return FALSE; 00824 #endif 00825 } 00826 00827 00828 00829 /******************************************************************************************** 00830 > virtual BOOL NodeBarProperty::CanWriteChildrenWeb(BaseCamelotFilter* pFilter) 00831 00832 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00833 Created: 31/9/99 00834 Inputs: pFilter --- filter to write to 00835 Returns: FALSE. 00836 Purpose: Prevents children of the sentinel being written out in the web format. 00837 ********************************************************************************************/ 00838 00839 BOOL NodeBarProperty::CanWriteChildrenWeb(BaseCamelotFilter*) 00840 { 00841 return FALSE; 00842 } 00843 00844 00845 00846 /******************************************************************************************** 00847 > virtual BOOL NodeBarProperty::WritePreChildrenWeb(BaseCamelotFilter* pFilter) 00848 00849 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00850 Created: 31/9/99 00851 Inputs: pFilter --- filter to write to 00852 Returns: FALSE. 00853 Purpose: Web files don't write out SetSentinel records. This code assumes the 00854 document will only contain one SetSentinel. 00855 ********************************************************************************************/ 00856 00857 BOOL NodeBarProperty::WritePreChildrenWeb(BaseCamelotFilter*) 00858 { 00859 return FALSE; 00860 } 00861 00862 00863 00864 /******************************************************************************************** 00865 > BOOL NodeBarProperty::WriteBeginChildRecordsWeb(BaseCamelotFilter* pFilter) 00866 00867 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00868 Created: 1/8/99 00869 Inputs: pFilter --- filter to write to 00870 Returns: TRUE. 00871 Purpose: Begins the child record sequence for SetSentinel in the web format. 00872 Web export doesn't write out SetSentinel records or children of the 00873 sentinel, so this overrides the default behaviour in Node by ensuring 00874 the DOWN record does not get written. 00875 ********************************************************************************************/ 00876 00877 BOOL NodeBarProperty::WriteBeginChildRecordsWeb(BaseCamelotFilter*) 00878 { 00879 return TRUE; 00880 } 00881 00882 00883 00884 /******************************************************************************************** 00885 > BOOL NodeBarProperty::WriteEndChildRecordsWeb(BaseCamelotFilter* pFilter) 00886 00887 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00888 Created: 1/8/99 00889 Inputs: pFilter --- filter to write to 00890 Returns: TRUE. 00891 Purpose: Ends the child record sequence for SetSentinel in the web format. 00892 Web export doesn't write out SetSentinel records or children of the 00893 sentinel, so this overrides the default behaviour in Node by ensuring 00894 the UP record does not get written. 00895 ********************************************************************************************/ 00896 00897 BOOL NodeBarProperty::WriteEndChildRecordsWeb(BaseCamelotFilter*) 00898 { 00899 return TRUE; 00900 } 00901 00902 00903 00904 /******************************************************************************************** 00905 > virtual void NodeBarProperty::GetDebugDetails(StringBase* pStr) 00906 00907 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00908 Created: 15/9/99 00909 Purpose: See Node::GetDebugDetails 00910 SeeAlso: Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc 00911 ********************************************************************************************/ 00912 00913 #if DEBUG_TREE 00914 00915 void NodeBarProperty::GetDebugDetails(StringBase* pStr) 00916 { 00917 Node::GetDebugDetails(pStr); 00918 00919 *pStr += TEXT("\r\nBar data\r\n"); 00920 } 00921 00922 #endif 00923 00924 00925 /******************************************************************************************** 00926 > virtual void NodeBarProperty::ShowDebugTreeDetails() const 00927 00928 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00929 Created: 15/9/99 00930 Purpose: See Node::ShowDebugTreeDetails 00931 SeeAlso: Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc 00932 ********************************************************************************************/ 00933 00934 #if DEBUG_TREE 00935 00936 void NodeBarProperty::ShowDebugTreeDetails() const 00937 { 00938 TRACE( _T("NodeBarProperty ")); 00939 Node::ShowDebugTreeDetails(); 00940 } 00941 00942 #endif 00943 00944 00945 00946 00951 00952 00953 00954 00955 00956 /******************************************************************************************** 00957 > NodeSetSentinel::NodeSetSentinel() 00958 00959 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00960 Created: 15/9/99 00961 Purpose: Default constructor for a NodeSetSentinel, a parent node of all the 00962 cloned Wix object name attributes. 00963 SeeAlso: Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc 00964 ********************************************************************************************/ 00965 00966 NodeSetSentinel::NodeSetSentinel() 00967 { 00968 // Empty. 00969 } 00970 00971 00972 00973 /******************************************************************************************** 00974 > NodeSetSentinel::NodeSetSentinel(Node* pContext, AttachNodeDirection eDir) 00975 00976 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00977 Created: 15/9/99 00978 Inputs: See Node::Node 00979 Purpose: Constructor for a NodeSetSentinel, a parent node of all the cloned 00980 Wix object name attributes. 00981 SeeAlso: Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc 00982 ********************************************************************************************/ 00983 00984 NodeSetSentinel::NodeSetSentinel(Node* pContext, AttachNodeDirection eDir) 00985 : Node(pContext, eDir) 00986 { 00987 // Empty. 00988 } 00989 00990 00991 00992 /******************************************************************************************** 00993 > virtual BOOL NodeSetSentinel::IsSetCandidate() const 00994 00995 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 00996 Created: 15/9/99 00997 Returns: TRUE. 00998 Purpose: See Node::IsSetCandidate 00999 SeeAlso: NodeRenderableInk::IsSetCandidate 01000 ********************************************************************************************/ 01001 01002 BOOL NodeSetSentinel::IsSetCandidate() const 01003 { 01004 return TRUE; 01005 } 01006 01007 01008 01009 /******************************************************************************************** 01010 > TemplateAttribute* NodeSetSentinel::GetNameAttr(const StringBase& strName) const 01011 01012 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 01013 Created: 15/9/99 01014 Inputs: strName --- the name to search for 01015 Returns: Returns the address of the child Wix ObjectName attribute of the given 01016 value, or null if there isn't one. 01017 SeeAlso: TemplateAttribute 01018 ********************************************************************************************/ 01019 01020 TemplateAttribute* NodeSetSentinel::GetNameAttr(const StringBase& strName) const 01021 { 01022 Node *pn; 01023 for ( pn = FindFirstChild(); pn != 0; pn = pn->FindNext()) 01024 if (pn->IsAnObjectName() && ((TemplateAttribute*) pn)->GetParam() == strName) 01025 break; 01026 01027 return (TemplateAttribute*) pn; 01028 } 01029 01030 01031 01032 /******************************************************************************************** 01033 > NodeSetProperty* NodeSetSentinel::FindPropertyNode(const StringBase& strName) const 01034 01035 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 01036 Created: 15/9/99 01037 Inputs: strName --- the name of the set to retrieve properties for 01038 Returns: Pointer to the node holding the given property, or null if there isn't one. 01039 SeeAlso: NodeSetSentinel::CreatePropertyNode 01040 ********************************************************************************************/ 01041 01042 NodeSetProperty* NodeSetSentinel::FindPropertyNode(const StringBase& strName) const 01043 { 01044 // Search children for the given property. 01045 for (Node* pNode = FindLastChild(); 01046 pNode != 0; 01047 pNode = pNode->FindPrevious()) 01048 if (IS_A(pNode, NodeSetProperty) && 01049 ((NodeSetProperty*) pNode)->GetName() == strName) 01050 return (NodeSetProperty*) pNode; 01051 01052 // Not found. 01053 return NULL; 01054 } 01055 01056 /******************************************************************************************** 01057 > NodeBarProperty* NodeSetSentinel::FindBarProperty() 01058 01059 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 01060 Created: 15/9/99 01061 Returns: Pointer to the node holding the given property, or null if there isn't one. 01062 SeeAlso: NodeSetSentinel::CreatePropertyNode 01063 ********************************************************************************************/ 01064 01065 NodeBarProperty* NodeSetSentinel::FindBarProperty() 01066 { 01067 // Search children for the given property. 01068 Node *pNode; 01069 for ( pNode = FindLastChild(); 01070 pNode != 0; 01071 pNode = pNode->FindPrevious()) 01072 if (IS_A(pNode, NodeBarProperty)) 01073 break; 01074 01075 return (NodeBarProperty*) pNode; 01076 } 01077 01078 01079 01080 /******************************************************************************************** 01081 > NodeSetProperty* NodeSetSentinel::CreatePropertyNode(const StringBase& strName) 01082 01083 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 01084 Created: 15/9/99 01085 Inputs: strName --- the name of the set to create properties for 01086 Returns: Pointer to the new node, or null if out of memory. 01087 SeeAlso: NodeSetSentinel::FindPropertyNode 01088 ********************************************************************************************/ 01089 01090 NodeSetProperty* NodeSetSentinel::CreatePropertyNode(const StringBase& strName) 01091 { 01092 // I commented this out since I call this function after I have added an action 01093 // that deletes the older copy of the properties, but this error3 finds them and 01094 // wont let me create the new version! 01095 // ERROR3IF(FindPropertyNode(strName) != 0, 01096 // "NodeSetSentinel::CreatePropertyNode: NodeSetProperty already exists"); 01097 01098 NodeSetProperty* pPropNode = new NodeSetProperty(strName); 01099 if (pPropNode == 0) return 0; 01100 pPropNode->AttachNode(FindLastChild(), PREV); 01101 return pPropNode; 01102 } 01103 01104 01105 01106 01107 /******************************************************************************************** 01108 > BOOL NodeSetSentinel::TargetsExist() const 01109 01110 Author: Simon_Knight (Xara Group Ltd) <camelotdev@xara.com> 01111 Created: 3/4/00 01112 Returns: TRUE if sets within the document are targets for stretches. 01113 Purpose Replaces the above TriggerExist since it is easier to work out if a target exists or not. 01114 01115 SeeAlso: NodeSetProperty; NamedStretchProp 01116 ********************************************************************************************/ 01117 BOOL NodeSetSentinel::TargetsExist() const 01118 { 01119 // Search children for a trigger stretching property. 01120 for (Node* pNode = FindLastChild(); 01121 pNode != 0; 01122 pNode = pNode->FindPrevious()) 01123 if (IS_A(pNode, NodeSetProperty)) 01124 { 01125 NamedStretchProp* pProp = (NamedStretchProp*) 01126 ((NodeSetProperty*) pNode)->GetProperty(NamedStretchProp::nIndex); 01127 01128 // if any are ticked and any have a tigger defined then a target exists 01129 if (pProp->GetState() && !pProp->GetTriggers().empty()) 01130 return TRUE; 01131 } 01132 01133 // None found. 01134 return FALSE; 01135 } 01136 01137 01138 01139 /******************************************************************************************** 01140 > BOOL NodeSetSentinel::OnLoadName(BaseCamelotFilter* pFilter, 01141 TemplateAttribute* pImportedName) 01142 01143 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 01144 Created: 15/9/99 01145 Inputs: pFilter --- the filter which is loading/importing 01146 pImportedName --- the newly imported Wix ObjectName attribute 01147 Returns: TRUE if the name is successfully registered, FALSE if out of memory. 01148 Purpose: Attaches duplicates of newly inserted Wix ObjectName attributes as 01149 children of the sentinel when the web importer is in operation, as 01150 the web exporter doesn't export children of the sentinel (ie. it 01151 discards editing information for the sake of compactness). 01152 SeeAlso: TemplateAttrRecordHandler::HandleRecord; HideNodeAction::Init 01153 ********************************************************************************************/ 01154 01155 BOOL NodeSetSentinel::OnLoadName(BaseCamelotFilter* pFilter, 01156 TemplateAttribute* pImportedName) 01157 { 01158 // If it's not the web filter, or we already have this name, there's nothing to do. 01159 if (!pFilter->IsWebFilter() || GetNameAttr(pImportedName->GetParam()) != 0) 01160 return TRUE; 01161 01162 // Try to clone the attribute and attach the clone as a child, preserving the order. 01163 TemplateAttribute* pCopy = (TemplateAttribute*) pImportedName->SimpleCopy(); 01164 ERRORIF(pCopy == 0, _R(IDE_NOMORE_MEMORY), FALSE); 01165 pCopy->AttachNode(this, FIRSTCHILD); 01166 01167 // Create default properties for the new set name. 01168 NodeSetProperty* pProp = new NodeSetProperty(pImportedName->GetParam()); 01169 ERRORIF(pProp == 0 || !pProp->CreateDefaults(), _R(IDE_NOMORE_MEMORY), FALSE); 01170 pProp->AttachNode(FindLastChild(), PREV); 01171 01172 // If importing into a document, rather than loading, then try to create undo 01173 // actions for the new attachments. 01174 if (pFilter->IsImporting() && pFilter->GetImportSelOp() != 0) 01175 { 01176 // Attach and create an action to hide the new attribute when we Undo. 01177 HideNodeAction* pHideAct; 01178 if (AC_FAIL == HideNodeAction::Init(pFilter->GetImportSelOp(), 01179 pFilter->GetImportSelOp()->GetUndoActions(), 01180 pCopy, TRUE, (Action**) &pHideAct)) 01181 { 01182 // Tidy up on fail. 01183 pCopy->UnlinkNodeFromTree(); 01184 delete pCopy; 01185 return FALSE; 01186 } 01187 01188 // Ditto for the set property. 01189 if (AC_FAIL == HideNodeAction::Init(pFilter->GetImportSelOp(), 01190 pFilter->GetImportSelOp()->GetUndoActions(), 01191 pProp, TRUE, (Action**) &pHideAct)) 01192 { 01193 // Tidy up on fail. 01194 pProp->UnlinkNodeFromTree(); 01195 delete pProp; 01196 return FALSE; 01197 } 01198 } 01199 01200 // Success. 01201 return TRUE; 01202 } 01203 01204 01205 01206 /******************************************************************************************** 01207 > virtual BOOL NodeSetSentinel::WritePreChildrenNative(BaseCamelotFilter* pFilter) 01208 01209 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 01210 Created: 31/9/99 01211 Inputs: pFilter --- filter to write to 01212 Returns: TRUE if the node has written out a record to the filter, FALSE otherwise. 01213 Purpose: Writes out a SetSentinel record. 01214 ********************************************************************************************/ 01215 01216 BOOL NodeSetSentinel::WritePreChildrenNative(BaseCamelotFilter* pFilter) 01217 { 01218 #ifdef DO_EXPORT 01219 CXaraFileRecord rec(TAG_SETSENTINEL, TAG_SETSENTINEL_SIZE); 01220 if (!rec.Init() || !pFilter->Write(&rec)) 01221 { 01222 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR)); 01223 return FALSE; 01224 } 01225 01226 return TRUE; 01227 #else 01228 return FALSE; 01229 #endif 01230 } 01231 01232 01233 01234 /******************************************************************************************** 01235 > virtual BOOL NodeSetSentinel::CanWriteChildrenWeb(BaseCamelotFilter* pFilter) 01236 01237 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 01238 Created: 31/9/99 01239 Inputs: pFilter --- filter to write to 01240 Returns: FALSE. 01241 Purpose: Prevents children of the sentinel being written out in the web format. 01242 ********************************************************************************************/ 01243 01244 BOOL NodeSetSentinel::CanWriteChildrenWeb(BaseCamelotFilter*) 01245 { 01246 return FALSE; 01247 } 01248 01249 01250 01251 /******************************************************************************************** 01252 > virtual BOOL NodeSetSentinel::WritePreChildrenWeb(BaseCamelotFilter* pFilter) 01253 01254 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 01255 Created: 31/9/99 01256 Inputs: pFilter --- filter to write to 01257 Returns: FALSE. 01258 Purpose: Web files don't write out SetSentinel records. This code assumes the 01259 document will only contain one SetSentinel. 01260 ********************************************************************************************/ 01261 01262 BOOL NodeSetSentinel::WritePreChildrenWeb(BaseCamelotFilter*) 01263 { 01264 return FALSE; 01265 } 01266 01267 01268 01269 /******************************************************************************************** 01270 > BOOL NodeSetSentinel::WriteBeginChildRecordsWeb(BaseCamelotFilter* pFilter) 01271 01272 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 01273 Created: 1/8/99 01274 Inputs: pFilter --- filter to write to 01275 Returns: TRUE. 01276 Purpose: Begins the child record sequence for SetSentinel in the web format. 01277 Web export doesn't write out SetSentinel records or children of the 01278 sentinel, so this overrides the default behaviour in Node by ensuring 01279 the DOWN record does not get written. 01280 ********************************************************************************************/ 01281 01282 BOOL NodeSetSentinel::WriteBeginChildRecordsWeb(BaseCamelotFilter*) 01283 { 01284 return TRUE; 01285 } 01286 01287 01288 01289 /******************************************************************************************** 01290 > BOOL NodeSetSentinel::WriteEndChildRecordsWeb(BaseCamelotFilter* pFilter) 01291 01292 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 01293 Created: 1/8/99 01294 Inputs: pFilter --- filter to write to 01295 Returns: TRUE. 01296 Purpose: Ends the child record sequence for SetSentinel in the web format. 01297 Web export doesn't write out SetSentinel records or children of the 01298 sentinel, so this overrides the default behaviour in Node by ensuring 01299 the UP record does not get written. 01300 ********************************************************************************************/ 01301 01302 BOOL NodeSetSentinel::WriteEndChildRecordsWeb(BaseCamelotFilter*) 01303 { 01304 return TRUE; 01305 } 01306 01307 01308 01309 /******************************************************************************************** 01310 > virtual UINT32 NodeSetSentinel::GetNodeSize() const 01311 01312 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 01313 Created: 15/9/99 01314 Purpose: See Node::GetNodeSize 01315 SeeAlso: Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc 01316 ********************************************************************************************/ 01317 01318 UINT32 NodeSetSentinel::GetNodeSize() const 01319 { 01320 return sizeof(*this); 01321 } 01322 01323 01324 01325 /******************************************************************************************** 01326 > virtual Node* NodeSetSentinel::SimpleCopy() 01327 01328 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 01329 Created: 15/9/99 01330 Purpose: See Node::SimpleCopy. 01331 SeeAlso: Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc 01332 Notes: If you add any data members to class NodeSetSentinel, then you should 01333 define a (non-virtual) CopyNodeContents function and call that to 01334 do the copy. 01335 ********************************************************************************************/ 01336 01337 Node* NodeSetSentinel::SimpleCopy() 01338 { 01339 NodeSetSentinel* pCopy = new NodeSetSentinel; 01340 ERRORIF(pCopy == 0, _R(IDE_NOMORE_MEMORY), 0); 01341 CopyNodeContents(pCopy); 01342 return pCopy; 01343 } 01344 01345 01346 01347 /******************************************************************************************** 01348 > virtual BOOL NodeSetSentinel::AllowOp(ObjChangeParam* pParam, 01349 BOOL SetOpPermissionState = TRUE, 01350 BOOL DoPreTriggerEdit = TRUE) 01351 01352 Author: Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com> 01353 Created: 24/01/2000 01354 Inputs: pParam ) 01355 SetOpPermissionState ) unused by this function 01356 DoPreTriggerEdit ) 01357 Outputs: 01358 Returns: TRUE. 01359 Purpose: Virtual override of Node::AllowOp(), to prevent an AllowOp call to this node 01360 from chaining up the tree. AllowOp chains usually originate somewhere beneath 01361 a Layer node in the tree, propagate up to the Layer node and stop there. 01362 01363 However, NodeSetSentinel lives above Layer in the tree and may have AllowOp 01364 called on it, hence the need for this override. 01365 01366 SeeAlso: Layer::AllowOp(); Node::AllowOp() 01367 ********************************************************************************************/ 01368 01369 BOOL NodeSetSentinel::AllowOp(ObjChangeParam*, BOOL, BOOL) 01370 { 01371 return TRUE; 01372 } 01373 01374 01375 01376 /******************************************************************************************** 01377 > virtual void NodeSetSentinel::GetDebugDetails(StringBase* pStr) 01378 01379 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 01380 Created: 15/9/99 01381 Purpose: See Node::GetDebugDetails 01382 SeeAlso: Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc 01383 ********************************************************************************************/ 01384 01385 #if DEBUG_TREE 01386 01387 void NodeSetSentinel::GetDebugDetails(StringBase* pStr) 01388 { 01389 Node::GetDebugDetails(pStr); 01390 } 01391 01392 #endif 01393 01394 01395 /******************************************************************************************** 01396 > virtual void NodeSetSentinel::ShowDebugTreeDetails() const 01397 01398 Author: Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> 01399 Created: 15/9/99 01400 Purpose: See Node::ShowDebugTreeDetails 01401 SeeAlso: Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc 01402 ********************************************************************************************/ 01403 01404 #if DEBUG_TREE 01405 01406 void NodeSetSentinel::ShowDebugTreeDetails() const 01407 { 01408 TRACE( _T("NodeSetSentinel ")); 01409 Node::ShowDebugTreeDetails(); 01410 } 01411 01412 #endif