#include <userattr.h>
Inheritance diagram for AttrUser:
Public Member Functions | |
AttrUser () | |
Default constructor for User Attribute class. | |
AttrUser (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE) | |
Creates a User Attribute. | |
AttrUser (const StringBase &NewKey, const StringBase &NewSubKey, const StringBase &NewValue) | |
Constructs a User Attribute node given a Key, SubKey and Value. | |
AttrUser (const StringBase &NewLongKey, const StringBase &NewValue) | |
Constructs an AttrUser (User attribute node) from a long key. | |
virtual void | Render (RenderRegion *pRender) |
We don't need to render a user attribute. So simply do nothing. | |
virtual Node * | SimpleCopy () |
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes. | |
virtual INT32 | operator== (const NodeAttribute &NodeAttrib) |
A virtual comparison operator. See NodeAttribute::operator== for a description of why it's required. | |
virtual UINT32 | GetAttrNameID (void) |
Returns back a string resource ID describing the attribute. | |
virtual BOOL | IsUserAttribute () const |
void | ShowDebugTreeDetails () const |
void | GetDebugDetails (StringBase *Str) |
For obtaining debug information about the Node. | |
virtual UINT32 | GetNodeSize () const |
For finding the size of the node. | |
virtual void | Transform (TransformBase &) |
We don't need to transform a User Attribute - so this function does nothing. | |
virtual BOOL | CanBeMultiplyApplied () |
virtual BOOL | ShouldBeOptimized () |
When applying multiple template args / WizOp user attributes we want them to remain associated with the object they were applied to rather than migrating to groups, otherwise where there was once two questions for two objects in a group there would instead be one. The default AttrUser should always be optimized out. | |
virtual BOOL | EffectsParentBounds () |
Virtual function for determining if the node will effect it's parent bounds. eg. ArrowHeads. | |
virtual BOOL | Blend (BlendAttrParam *pBlendParam) |
Blends one User attribute with another. | |
virtual AttributeValue * | GetAttributeValue () |
virtual CCRuntimeClass * | GetAttributeType () |
virtual AttributeIdentifier | GetAttributeClassID () const |
Generates an AttributeIdentifier for this Attribute. Since the RuntimeClass is inadequate for dynamically generated Atrributes (read Nodes), we need to provide an ID that can be created dynamically too. This is what an AttributeIdentifier is supposed to be. In the case of an AttrUser it returns a pointer to a template handler. | |
virtual AttrIndex | GetAttributeIndex () |
virtual VisibleAttribute * | CreateVisibleAttribute () const |
Creates a VisibleAttribute representing this AttrUser that the user can edit. (this is all horribly wrong). | |
virtual BOOL | WritePreChildrenWeb (BaseCamelotFilter *pFilter) |
Writes the line width record to the filter. | |
virtual BOOL | WritePreChildrenNative (BaseCamelotFilter *pFilter) |
BOOL | ShouldBecomeCurrent () |
The attribute manager calls this function before making an attribute current. | |
StringBase & | GetWebAddress () |
This is only used for Web Address User Attributes. | |
virtual void | PolyCopyNodeContents (NodeRenderable *pNodeCopy) |
Polymorphically copies the contents of this node to another. | |
Public Attributes | |
UserAttribute | Value |
Protected Member Functions | |
void | CopyNodeContents (AttrUser *NodeCopy) |
This method copies the node's contents to the node pointed to by NodeCopy. | |
Static Protected Attributes | |
static const TCHAR | s_KeyDelimiter = TEXT('\\') |
Definition at line 164 of file userattr.h.
|
Default constructor for User Attribute class.
Definition at line 445 of file userattr.cpp.
|
|
Creates a User Attribute.
Definition at line 423 of file userattr.cpp. 00429 : NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected) 00430 { 00431 // Empty. 00432 }
|
|
Constructs a User Attribute node given a Key, SubKey and Value.
Definition at line 461 of file userattr.cpp. 00463 { 00464 if (!Value.Key.Alloc(NewKey.Length())) return; 00465 Value.Key = NewKey; 00466 00467 INT32 n = NewKey.Length(); 00468 if (!NewSubKey.IsEmpty()) n += 1 + NewSubKey.Length(); 00469 00470 if (!Value.LongKey.Alloc(n)) return; 00471 Value.LongKey = NewKey; 00472 if (!NewSubKey.IsEmpty()) 00473 { 00474 Value.LongKey += s_KeyDelimiter; 00475 Value.LongKey += NewSubKey; 00476 } 00477 00478 if (!Value.Value.Alloc(NewValue.Length())) return; 00479 Value.Value = NewValue; 00480 }
|
|
Constructs an AttrUser (User attribute node) from a long key.
Definition at line 493 of file userattr.cpp. 00494 { 00495 // Find the first bit of the long key 00496 INT32 DelimiterPosition = NewLongKey.FindNextChar(s_KeyDelimiter); 00497 if (DelimiterPosition < 0) 00498 { 00499 // couldn't find the end so the delimiter is beyond the end of the string 00500 DelimiterPosition = NewLongKey.Length(); 00501 } 00502 00503 INT32 ShortKeyLength = DelimiterPosition; 00504 if (ShortKeyLength > 0) 00505 { 00506 // Added by Craig Hamilton 2/8/00. 00507 // This section of code deals with the situation where the length of Value.Key.Length is 00508 // less than ShortKeyLength. This was causing problems with the call to StringBase::Left 00509 // which would fail in this eventuality. To prevent this we just allocate Value.Key more 00510 // space. We did try another method involving the use of a String_256 being passed to 00511 // StringBase::Left and then asigning Value.Key to the String_256, but this caused a 00512 // Damage: after normal block error in the VC++ debug library. 00513 if(Value.Key.Length() < ShortKeyLength) 00514 { 00515 Value.Key.Alloc(ShortKeyLength); 00516 } 00517 // End Added. 00518 00519 NewLongKey.Left(&Value.Key, ShortKeyLength); 00520 } 00521 else 00522 { 00523 TRACE( _T("AttrUser::AttrUser - no key\n")); 00524 } 00525 00526 if (!Value.LongKey.Alloc(NewLongKey.Length())) return; 00527 Value.LongKey = NewLongKey; 00528 00529 if (!Value.Value.Alloc(NewValue.Length())) return; 00530 Value.Value = NewValue; 00531 }
|
|
Blends one User attribute with another.
Reimplemented from NodeAttribute. Definition at line 795 of file userattr.cpp. 00796 { 00797 // Get the User member to blend to the User member of the other NodeAttribute. 00798 // If it succeeds, ask the blended Value to make a NodeAttribute out of itself. 00799 ERROR3IF(pBlendParam == NULL,"NULL entry param"); 00800 if (Value.Blend(pBlendParam)) 00801 { 00802 // Get the blended attr val. After this call, the ptr is our reponsibility 00803 // so we have to delete it if it's no longer needed 00804 AttributeValue* pBlendedAttrVal = pBlendParam->GetBlendedAttrVal(); 00805 if (pBlendedAttrVal != NULL) 00806 { 00807 // We have a blended attr val, so ask it to make a NodeAttribute out of itself 00808 // and set the pBlendParam's blended NodeAttribute ptr to it 00809 NodeAttribute* pBlendedAttr = pBlendedAttrVal->MakeNode(); 00810 pBlendParam->SetBlendedAttr(pBlendedAttr); 00811 00812 if (pBlendedAttr != NULL) 00813 { 00814 // We were able to make a blended NodeAttribute 00815 // so delete the blended attr val, and return TRUE 00816 delete pBlendedAttrVal; 00817 return TRUE; 00818 } 00819 else 00820 { 00821 // Couldn't make a blended NodeAttribute, so give the blended attr val back 00822 // and return FALSE 00823 pBlendParam->SetBlendedAttrVal(pBlendedAttrVal); 00824 } 00825 } 00826 } 00827 00828 return FALSE; 00829 }
|
|
Reimplemented from NodeAttribute. Definition at line 195 of file userattr.h. 00195 { return TRUE; }
|
|
This method copies the node's contents to the node pointed to by NodeCopy.
Definition at line 666 of file userattr.cpp. 00667 { 00668 NodeAttribute::CopyNodeContents(NodeCopy); 00669 NodeCopy->Value = Value; 00670 }
|
|
Creates a VisibleAttribute representing this AttrUser that the user can edit. (this is all horribly wrong).
Reimplemented from NodeAttribute. Reimplemented in TemplateAttribute, and StyleReferenceAttribute. Definition at line 961 of file userattr.cpp. 00962 { 00963 VisibleAttribute* pVisibleAttribute = NULL; // return this 00964 00965 PORTNOTETRACE("other","AttrUser::CreateVisibleAttribute - do nothing"); 00966 #ifndef EXCLUDE_FROM_XARALX 00967 pVisibleAttribute = new VisibleUserAttribute(Value.LongKey, Value.Value); 00968 #endif 00969 return pVisibleAttribute; 00970 }
|
|
Virtual function for determining if the node will effect it's parent bounds. eg. ArrowHeads.
Reimplemented from NodeAttribute. Definition at line 197 of file userattr.h. 00197 { return TRUE; }
|
|
Generates an AttributeIdentifier for this Attribute. Since the RuntimeClass is inadequate for dynamically generated Atrributes (read Nodes), we need to provide an ID that can be created dynamically too. This is what an AttributeIdentifier is supposed to be. In the case of an AttrUser it returns a pointer to a template handler.
Reimplemented from NodeAttribute. Reimplemented in TemplateAttribute. Definition at line 942 of file userattr.cpp.
|
|
Reimplemented from NodeAttribute. Definition at line 204 of file userattr.h. 00204 { return ATTR_USERATTRIBUTE; }
|
|
Reimplemented from NodeAttribute. Definition at line 202 of file userattr.h. 00202 { return CC_RUNTIME_CLASS(AttrUser); }
|
|
Reimplemented from NodeAttribute. Definition at line 201 of file userattr.h. 00201 { return &Value; }
|
|
Returns back a string resource ID describing the attribute.
Reimplemented from NodeAttribute. Reimplemented in TemplateAttribute, and StyleReferenceAttribute. Definition at line 642 of file userattr.cpp. 00643 { 00644 return (_R(IDS_USERATTRIBUTE_ID)); 00645 }
|
|
For obtaining debug information about the Node.
Reimplemented from NodeRenderable. Definition at line 717 of file userattr.cpp. 00718 { 00719 #ifdef _DEBUG 00720 NodeAttribute::GetDebugDetails( Str ); 00721 00722 *Str += TEXT("\r\nKey = "); 00723 *Str += Value.Key; 00724 *Str += TEXT("\r\nLongKey = "); 00725 *Str += Value.LongKey; 00726 *Str += TEXT("\r\nData= "); 00727 *Str += Value.Value; 00728 #endif 00729 }
|
|
For finding the size of the node.
Reimplemented from Node. Definition at line 747 of file userattr.cpp.
|
|
This is only used for Web Address User Attributes.
Definition at line 921 of file userattr.cpp.
|
|
Reimplemented from Node. Definition at line 184 of file userattr.h. 00184 { return TRUE; }
|
|
A virtual comparison operator. See NodeAttribute::operator== for a description of why it's required.
Reimplemented from NodeAttribute. Definition at line 616 of file userattr.cpp. 00617 { 00618 ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrUser)), 00619 "Trying to compare two objects with different types"); 00620 00621 AttrUser& OtherUserNode = (AttrUser&) Attrib; 00622 return !(Value.IsDifferent(&OtherUserNode.Value)); 00623 }
|
|
Polymorphically copies the contents of this node to another.
Reimplemented from NodeRenderable. Reimplemented in TemplateAttribute. Definition at line 686 of file userattr.cpp. 00687 { 00688 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 00689 ENSURE(IS_A(pNodeCopy, AttrUser), "PolyCopyNodeContents given wrong dest node type"); 00690 00691 if (IS_A(pNodeCopy, AttrUser)) 00692 CopyNodeContents((AttrUser*)pNodeCopy); 00693 }
|
|
We don't need to render a user attribute. So simply do nothing.
Reimplemented from NodeAttribute. Definition at line 545 of file userattr.cpp.
|
|
The attribute manager calls this function before making an attribute current.
There are some attributes - like this URL Hot Link attribute I'm about to put in - that the user probably won't want to become current. For example, if a user puts a HotLink on an object and happens to have the Give Other Objects Most Recent Attributes option on, all his new objects are going to have HotLinks. That's not good. So those attributes will override this function and return FALSE. Reimplemented from NodeAttribute. Definition at line 902 of file userattr.cpp. 00903 { 00904 //No, don't pass this attribute on 00905 return FALSE; 00906 }
|
|
When applying multiple template args / WizOp user attributes we want them to remain associated with the object they were applied to rather than migrating to groups, otherwise where there was once two questions for two objects in a group there would instead be one. The default AttrUser should always be optimized out.
Reimplemented from NodeAttribute. Definition at line 774 of file userattr.cpp. 00775 { 00776 return Value.Key.IsEmpty() && Value.LongKey.IsEmpty() && Value.Value.IsEmpty(); 00777 }
|
|
|
|
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.
Reimplemented from NodeAttribute. Reimplemented in TemplateAttribute, and StyleReferenceAttribute. Definition at line 586 of file userattr.cpp. 00587 { 00588 AttrUser* pNodeCopy = new AttrUser; 00589 ERRORIF(pNodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 00590 CopyNodeContents(pNodeCopy); 00591 return pNodeCopy; 00592 }
|
|
We don't need to transform a User Attribute - so this function does nothing.
Reimplemented from NodeRenderable. Definition at line 562 of file userattr.cpp.
|
|
Reimplemented from Node. Definition at line 871 of file userattr.cpp. 00872 { 00873 #ifdef DO_EXPORT 00874 return WritePreChildrenWeb(pFilter); 00875 #else 00876 return FALSE; 00877 #endif 00878 }
|
|
Writes the line width record to the filter. > virtual BOOL AttrUser::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
Reimplemented from Node. Reimplemented in TemplateAttribute, and StyleReferenceAttribute. Definition at line 846 of file userattr.cpp. 00847 { 00848 #ifdef DO_EXPORT 00849 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param"); 00850 00851 BOOL ok = TRUE; 00852 00853 CamelotFileRecord Rec(pFilter,TAG_USERVALUE,TAG_USERVALUEATTRSIZE); 00854 00855 ok = Rec.Init(); 00856 00857 if (ok) ok = Rec.WriteUnicode((TCHAR*)Value.LongKey); 00858 if (ok) ok = Rec.WriteUnicode((TCHAR*)Value.Value); 00859 00860 if (ok) ok = pFilter->Write(&Rec); 00861 00862 return ok; 00863 #else 00864 return FALSE; 00865 #endif 00866 }
|
|
Definition at line 221 of file userattr.h. |
|
Definition at line 224 of file userattr.h. |