NodeSetSentinel Class Reference

Dummy node that has one instance of each different Wix ObjectName attribute also applied to it. Every document has one of these nodes after the last default attribute and before the first chapter. Whenever a new name is first applied to any objects in the document, it is also applied to this node; similarly, whenever a name is deleted (ie. hidden) from a document, it is also deleted from this node. Hence, during the normal course of creating or deleting objects with particular names, even if the last object which has a name is deleted by the user, the name still exists as a single attribute applied to this node, will remain an active item in the Attribute gallery, and can be saved out in the native format. And when the user creates or deletes names that never refer to any objects, the action always result in tree manipulations and are properly integrated into the undo system. More...

#include <ngsentry.h>

Inheritance diagram for NodeSetSentinel:

Node CCObject SimpleCCObject List of all members.

Public Member Functions

 NodeSetSentinel ()
 See Node::GetDebugDetails See Node::ShowDebugTreeDetails Default constructor for a NodeSetSentinel, a parent node of all the cloned Wix object name attributes.
 NodeSetSentinel (Node *pContext, AttachNodeDirection eDir)
 Constructor for a NodeSetSentinel, a parent node of all the cloned Wix object name attributes.
virtual BOOL IsSetCandidate () const
 See Node::IsSetCandidate.
TemplateAttributeGetNameAttr (const StringBase &strName) const
NodeSetPropertyFindPropertyNode (const StringBase &strName) const
NodeSetPropertyCreatePropertyNode (const StringBase &strName)
NodeBarPropertyFindBarProperty ()
BOOL TargetsExist () const
BOOL OnLoadName (BaseCamelotFilter *pFilter, TemplateAttribute *pImportedName)
 Attaches duplicates of newly inserted Wix ObjectName attributes as children of the sentinel when the web importer is in operation, as the web exporter doesn't export children of the sentinel (ie. it discards editing information for the sake of compactness).
virtual BOOL AllowOp (ObjChangeParam *pParam, BOOL SetOpPermissionState, BOOL DoPreTriggerEdit)
 Virtual override of Node::AllowOp(), to prevent an AllowOp call to this node from chaining up the tree. AllowOp chains usually originate somewhere beneath a Layer node in the tree, propagate up to the Layer node and stop there.

Protected Member Functions

virtual BOOL WritePreChildrenNative (BaseCamelotFilter *)
 Writes out a SetSentinel record.
virtual BOOL CanWriteChildrenWeb (BaseCamelotFilter *)
 Prevents children of the sentinel being written out in the web format.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *)
 Web files don't write out SetSentinel records. This code assumes the document will only contain one SetSentinel.
virtual BOOL WriteBeginChildRecordsWeb (BaseCamelotFilter *)
 Begins the child record sequence for SetSentinel in the web format. Web export doesn't write out SetSentinel records or children of the sentinel, so this overrides the default behaviour in Node by ensuring the DOWN record does not get written.
virtual BOOL WriteEndChildRecordsWeb (BaseCamelotFilter *)
 Ends the child record sequence for SetSentinel in the web format. Web export doesn't write out SetSentinel records or children of the sentinel, so this overrides the default behaviour in Node by ensuring the UP record does not get written.
virtual UINT32 GetNodeSize () const
 See Node::GetNodeSize.
virtual NodeSimpleCopy ()
 See Node::SimpleCopy.

Private Member Functions

 CC_DECLARE_DYNAMIC (NodeSetSentinel)

Detailed Description

Dummy node that has one instance of each different Wix ObjectName attribute also applied to it. Every document has one of these nodes after the last default attribute and before the first chapter. Whenever a new name is first applied to any objects in the document, it is also applied to this node; similarly, whenever a name is deleted (ie. hidden) from a document, it is also deleted from this node. Hence, during the normal course of creating or deleting objects with particular names, even if the last object which has a name is deleted by the user, the name still exists as a single attribute applied to this node, will remain an active item in the Attribute gallery, and can be saved out in the native format. And when the user creates or deletes names that never refer to any objects, the action always result in tree manipulations and are properly integrated into the undo system.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
See also:
Node; NodeSetProperty; NameGallery

Definition at line 273 of file ngsentry.h.


Constructor & Destructor Documentation

NodeSetSentinel::NodeSetSentinel  ) 
 

See Node::GetDebugDetails See Node::ShowDebugTreeDetails Default constructor for a NodeSetSentinel, a parent node of all the cloned Wix object name attributes.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
See also:
Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc

Definition at line 966 of file ngsentry.cpp.

00967 {
00968     // Empty.
00969 }

NodeSetSentinel::NodeSetSentinel Node pContext,
AttachNodeDirection  eDir
 

Constructor for a NodeSetSentinel, a parent node of all the cloned Wix object name attributes.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Parameters:
See Node::Node [INPUTS]
See also:
Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc

Definition at line 984 of file ngsentry.cpp.

00985   : Node(pContext, eDir)
00986 {
00987     // Empty.
00988 }


Member Function Documentation

BOOL NodeSetSentinel::AllowOp ObjChangeParam pParam,
BOOL  SetOpPermissionState,
BOOL  DoPreTriggerEdit
[virtual]
 

Virtual override of Node::AllowOp(), to prevent an AllowOp call to this node from chaining up the tree. AllowOp chains usually originate somewhere beneath a Layer node in the tree, propagate up to the Layer node and stop there.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/01/2000
Parameters:
pParam ) [INPUTS] SetOpPermissionState ) unused by this function DoPreTriggerEdit )
[OUTPUTS] 
Returns:
TRUE.
However, NodeSetSentinel lives above Layer in the tree and may have AllowOp called on it, hence the need for this override.

See also:
Layer::AllowOp(); Node::AllowOp()

Reimplemented from Node.

Definition at line 1369 of file ngsentry.cpp.

01370 {
01371     return TRUE;
01372 }

BOOL NodeSetSentinel::CanWriteChildrenWeb BaseCamelotFilter  )  [protected, virtual]
 

Prevents children of the sentinel being written out in the web format.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/9/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
FALSE.

Reimplemented from Node.

Definition at line 1244 of file ngsentry.cpp.

01245 {
01246     return FALSE;
01247 }

NodeSetSentinel::CC_DECLARE_DYNAMIC NodeSetSentinel   )  [private]
 

NodeSetProperty * NodeSetSentinel::CreatePropertyNode const StringBase strName  ) 
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Parameters:
strName --- the name of the set to create properties for [INPUTS]
Returns:
Pointer to the new node, or null if out of memory.
See also:
NodeSetSentinel::FindPropertyNode

Definition at line 1090 of file ngsentry.cpp.

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 }

NodeBarProperty * NodeSetSentinel::FindBarProperty  ) 
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Returns:
Pointer to the node holding the given property, or null if there isn't one.
See also:
NodeSetSentinel::CreatePropertyNode

Definition at line 1065 of file ngsentry.cpp.

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 }

NodeSetProperty * NodeSetSentinel::FindPropertyNode const StringBase strName  )  const
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Parameters:
strName --- the name of the set to retrieve properties for [INPUTS]
Returns:
Pointer to the node holding the given property, or null if there isn't one.
See also:
NodeSetSentinel::CreatePropertyNode

Definition at line 1042 of file ngsentry.cpp.

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 }

TemplateAttribute * NodeSetSentinel::GetNameAttr const StringBase strName  )  const
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Parameters:
strName --- the name to search for [INPUTS]
Returns:
Returns the address of the child Wix ObjectName attribute of the given value, or null if there isn't one.
See also:
TemplateAttribute

Definition at line 1020 of file ngsentry.cpp.

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 }

UINT32 NodeSetSentinel::GetNodeSize  )  const [protected, virtual]
 

See Node::GetNodeSize.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
See also:
Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc

Reimplemented from Node.

Definition at line 1318 of file ngsentry.cpp.

01319 {
01320     return sizeof(*this);
01321 }

BOOL NodeSetSentinel::IsSetCandidate  )  const [virtual]
 

See Node::IsSetCandidate.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Returns:
TRUE.
See also:
NodeRenderableInk::IsSetCandidate

Reimplemented from Node.

Definition at line 1002 of file ngsentry.cpp.

01003 {
01004     return TRUE;
01005 }

BOOL NodeSetSentinel::OnLoadName BaseCamelotFilter pFilter,
TemplateAttribute pImportedName
 

Attaches duplicates of newly inserted Wix ObjectName attributes as children of the sentinel when the web importer is in operation, as the web exporter doesn't export children of the sentinel (ie. it discards editing information for the sake of compactness).

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Parameters:
pFilter --- the filter which is loading/importing [INPUTS] pImportedName --- the newly imported Wix ObjectName attribute
Returns:
TRUE if the name is successfully registered, FALSE if out of memory.
See also:
TemplateAttrRecordHandler::HandleRecord; HideNodeAction::Init

Definition at line 1155 of file ngsentry.cpp.

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 }

Node * NodeSetSentinel::SimpleCopy void   )  [protected, virtual]
 

See Node::SimpleCopy.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
See also:
Node; NameGallery; OpApplyNames; OpDeleteNames; OpRenameNames etc Notes: If you add any data members to class NodeSetSentinel, then you should define a (non-virtual) CopyNodeContents function and call that to do the copy.

Reimplemented from Node.

Definition at line 1337 of file ngsentry.cpp.

01338 {
01339     NodeSetSentinel* pCopy = new NodeSetSentinel;
01340     ERRORIF(pCopy == 0, _R(IDE_NOMORE_MEMORY), 0);
01341     CopyNodeContents(pCopy);
01342     return pCopy;
01343 }

BOOL NodeSetSentinel::TargetsExist  )  const
 

Author:
Simon_Knight (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/00
Returns:
TRUE if sets within the document are targets for stretches. Purpose Replaces the above TriggerExist since it is easier to work out if a target exists or not.
See also:
NodeSetProperty; NamedStretchProp

Definition at line 1117 of file ngsentry.cpp.

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 }

BOOL NodeSetSentinel::WriteBeginChildRecordsWeb BaseCamelotFilter  )  [protected, virtual]
 

Begins the child record sequence for SetSentinel in the web format. Web export doesn't write out SetSentinel records or children of the sentinel, so this overrides the default behaviour in Node by ensuring the DOWN record does not get written.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/8/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
TRUE.

Reimplemented from Node.

Definition at line 1282 of file ngsentry.cpp.

01283 {
01284     return TRUE;
01285 }

BOOL NodeSetSentinel::WriteEndChildRecordsWeb BaseCamelotFilter  )  [protected, virtual]
 

Ends the child record sequence for SetSentinel in the web format. Web export doesn't write out SetSentinel records or children of the sentinel, so this overrides the default behaviour in Node by ensuring the UP record does not get written.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/8/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
TRUE.

Reimplemented from Node.

Definition at line 1302 of file ngsentry.cpp.

01303 {
01304     return TRUE;
01305 }

BOOL NodeSetSentinel::WritePreChildrenNative BaseCamelotFilter pFilter  )  [protected, virtual]
 

Writes out a SetSentinel record.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/9/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
TRUE if the node has written out a record to the filter, FALSE otherwise.

Reimplemented from Node.

Definition at line 1216 of file ngsentry.cpp.

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 }

BOOL NodeSetSentinel::WritePreChildrenWeb BaseCamelotFilter  )  [protected, virtual]
 

Web files don't write out SetSentinel records. This code assumes the document will only contain one SetSentinel.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/9/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
FALSE.

Reimplemented from Node.

Definition at line 1262 of file ngsentry.cpp.

01263 {
01264     return FALSE;
01265 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:57:11 2007 for Camelot by  doxygen 1.4.4