AttrWebAddress Class Reference

The new Web Address attribute. This is distinct from the old Web Address attribute from CorelXARA 1.5, which was a type of AttrUser. More...

#include <webattr.h>

Inheritance diagram for AttrWebAddress:

NodeAttribute NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Member Functions

 AttrWebAddress ()
 Default constructor.
 AttrWebAddress (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
 Constructs a Web Address Attribute at a specific place in the tree.
 AttrWebAddress (WebAddress url, BOOL fBounding=FALSE, TCHAR *pcFrame=NULL)
 Specific constructor for an AttrWebAddress.
 AttrWebAddress (TCHAR *pcURL, BOOL fBounding=FALSE, TCHAR *pcFrame=NULL)
 Specific constructor for an AttrWebAddress.
virtual AttrIndex GetAttributeIndex ()
virtual INT32 operator== (const NodeAttribute &NodeAttrib)
 A virtual comparison operator.
void Render (RenderRegion *pRender)
 Set this attribute as current in the render region.
virtual BOOL Blend (BlendAttrParam *pBlendParam)
 Blends one Web Address attribute with another.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes this AttrWebAddress out to the filter.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)
 Writes this AttrWebAddress out to the filter.
NodeSimpleCopy ()
 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 UINT32 GetAttrNameID (void)
 Returns back a string resource ID describing the attribute, this base class function returns the resource _R(IDS_ATTRIBUTE).
virtual UINT32 GetNodeSize () const
 For finding the size of a node, in concrete classes derived from Node.
virtual AttributeValueGetAttributeValue ()
virtual CCRuntimeClassGetAttributeType ()
BOOL ShouldBecomeCurrent ()
 The attribute manager calls this function before making an attribute current.
DocRect GetClickableRectangle ()
 This function calls GetImagemapClickableRectangle() on this node's parent.
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.
void GetDebugDetails (StringBase *Str)
 For obtaining debug information about the Node.
void ShowDebugTreeDetails () const

Public Attributes

WebAddressAttribute Value

Private Member Functions

BOOL WriteString (CamelotFileRecord *pcfrRecord, TCHAR *pcWrite)
 Writes pcWrite out to the file.
void CopyNodeContents (AttrWebAddress *NodeCopy)
 This method copies the node's contents to the node pointed to by NodeCopy.

Detailed Description

The new Web Address attribute. This is distinct from the old Web Address attribute from CorelXARA 1.5, which was a type of AttrUser.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/3/97

Definition at line 259 of file webattr.h.


Constructor & Destructor Documentation

AttrWebAddress::AttrWebAddress  ) 
 

Default constructor.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/3/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 152 of file webattr.cpp.

00153 {
00154     Value=WebAddressAttribute();
00155 }

AttrWebAddress::AttrWebAddress Node ContextNode,
AttachNodeDirection  Direction,
BOOL  Locked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE
 

Constructs a Web Address Attribute at a specific place in the tree.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/3/97
Parameters:
See NodeAttribute for a description [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 179 of file webattr.cpp.

00185              : NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected)  
00186 {   
00187     Value=WebAddressAttribute();
00188 } 

AttrWebAddress::AttrWebAddress WebAddress  url,
BOOL  fBounding = FALSE,
TCHAR pcFrame = NULL
 

Specific constructor for an AttrWebAddress.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/3/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 205 of file webattr.cpp.

00206 {
00207     //Construct our Value member variable using the WebAddressAttribute constructor
00208     Value=WebAddressAttribute(url, fBounding, pcFrame);
00209 }

AttrWebAddress::AttrWebAddress TCHAR pcURL,
BOOL  fBounding = FALSE,
TCHAR pcFrame = NULL
 

Specific constructor for an AttrWebAddress.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/3/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 226 of file webattr.cpp.

00227 {
00228     //Construct our Value member variable using the WebAddressAttribute constructor
00229     Value=WebAddressAttribute(pcURL, fBounding, pcFrame);
00230 }


Member Function Documentation

BOOL AttrWebAddress::Blend BlendAttrParam pBlendParam  )  [virtual]
 

Blends one Web Address attribute with another.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com> from MarkN
Date:
27/3/97
Parameters:
pBlendParam = ptr to blend attribute param object holding all info needed [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise
See also:
WebAddressAttribute::Blend

Reimplemented from NodeAttribute.

Definition at line 328 of file webattr.cpp.

00329 {
00330     //Check our parameter
00331     ERROR2IF(pBlendParam == NULL, FALSE, "AttrWebAddress::Blend - NULL parameter");
00332     
00333     //Try and blend our WebAddressAttribute member variable
00334     if (Value.Blend(pBlendParam))
00335     {
00336         // Get the blended attr val. After this call, the ptr is our reponsibility
00337         // so we have to delete it if it's no longer needed
00338         AttributeValue* pBlendedAttrVal = pBlendParam->GetBlendedAttrVal();
00339 
00340         if (pBlendedAttrVal != NULL)
00341         {
00342             // We have a blended attr val, so ask it to make a NodeAttribute out of itself
00343             // and set the pBlendParam's blended NodeAttribute ptr to it
00344             NodeAttribute* pBlendedAttr = pBlendedAttrVal->MakeNode();
00345             pBlendParam->SetBlendedAttr(pBlendedAttr);
00346 
00347             if (pBlendedAttr != NULL)
00348             {
00349                 // We were able to make a blended NodeAttribute
00350                 // so delete the blended attr val, and return TRUE
00351                 delete pBlendedAttrVal;
00352                 return TRUE;
00353             }
00354             else
00355             {
00356                 // Couldn't make a blended NodeAttribute, so give the blended attr val back
00357                 // and return FALSE
00358                 pBlendParam->SetBlendedAttrVal(pBlendedAttrVal);
00359                 return FALSE;
00360             }
00361         }
00362     }
00363         
00364     return FALSE;
00365 }

void AttrWebAddress::CopyNodeContents AttrWebAddress NodeCopy  )  [private]
 

This method copies the node's contents to the node pointed to by NodeCopy.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com> from Simon
Date:
28/4/93
Parameters:
[INPUTS] 
A copy of this node [OUTPUTS]
Returns:
-

Errors: An assertion failure will occur if NodeCopy is NULL

Scope: protected

Definition at line 537 of file webattr.cpp.

00538 {
00539     NodeAttribute::CopyNodeContents( NodeCopy );
00540     
00541     NodeCopy->Value=Value;
00542 } 

virtual AttrIndex AttrWebAddress::GetAttributeIndex  )  [inline, virtual]
 

Reimplemented from NodeAttribute.

Definition at line 274 of file webattr.h.

00274 { return ATTR_WEBADDRESS; }

virtual CCRuntimeClass* AttrWebAddress::GetAttributeType  )  [inline, virtual]
 

Reimplemented from NodeAttribute.

Definition at line 308 of file webattr.h.

00309     { 
00310         return CC_RUNTIME_CLASS(AttrWebAddress);
00311     }

virtual AttributeValue* AttrWebAddress::GetAttributeValue  )  [inline, virtual]
 

Reimplemented from NodeAttribute.

Definition at line 303 of file webattr.h.

00304     { 
00305         return &Value; 
00306     }

virtual UINT32 AttrWebAddress::GetAttrNameID void   )  [inline, virtual]
 

Returns back a string resource ID describing the attribute, this base class function returns the resource _R(IDS_ATTRIBUTE).

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/2/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Attribute description ID

Errors: -

See also:
-

Reimplemented from NodeAttribute.

Definition at line 293 of file webattr.h.

00294     {
00295         return (_R(IDS_WEBADDRESSATTRIBUTE_ID)); 
00296     }

DocRect AttrWebAddress::GetClickableRectangle  ) 
 

This function calls GetImagemapClickableRectangle() on this node's parent.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/3/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The clickable rectangle of this Web Address attribute
If the parent node is a text character, the rectangle returned will be the bounding box of that text character and all adjacent text characters with the same Web Address attribute.

Otherwise, the rectangle returned will be the bounding box of the parent node.

Returns:
Errors: -
See also:
NodeRenderableBounded::GetImagemapClickableRectangle(); AbstractTextChar::GetImagemapClickableRectangle()
Scope: protected

Definition at line 597 of file webattr.cpp.

00598 {
00599     //Get our parent
00600     Node* pNode=FindParent();
00601 
00602     
00603     //If it's not an object, return a NULL value
00604     if (pNode==NULL)
00605         return DocRect(0,0,0,0);
00606     
00607     if (!pNode->IsAnObject())
00608         return DocRect(0,0,0,0);
00609 
00610     //Otherwise, return the bounding box of that object
00611     return (((NodeRenderableBounded*)pNode)->GetImagemapClickableRectangle());
00612                                                                                 
00613 } 

void AttrWebAddress::GetDebugDetails StringBase Str  )  [virtual]
 

For obtaining debug information about the Node.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/9/93
Parameters:
Str,: String giving debug info about the node [OUTPUTS]

Reimplemented from NodeRenderable.

Definition at line 669 of file webattr.cpp.

00670 {
00671 #ifdef _DEBUG
00672     NodeAttribute::GetDebugDetails( Str );
00673 
00674     (*Str) += _T("URL=");
00675     (*Str) += Value.m_url.GetWebAddress();
00676     (*Str) += _T("\r\n");
00677 
00678     (*Str) += _T("Frame=");
00679     (*Str) += Value.m_pcFrame;
00680     (*Str) += _T("\r\n");
00681     
00682     if (Value.m_fBounding)
00683         (*Str) += _T("Clickable area is RECTANGLE\r\n");
00684     else
00685         (*Str) += _T("Clickable area is OBJECT SHAPE\r\n");
00686     
00687 #endif
00688 }

virtual UINT32 AttrWebAddress::GetNodeSize  )  const [inline, virtual]
 

For finding the size of a node, in concrete classes derived from Node.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The size of the node in bytes

Errors: If this function has not been overloaded in a non-abstract class then an ENSURE failure will occur.

See also:
-

Reimplemented from Node.

Definition at line 298 of file webattr.h.

00299     {
00300         return sizeof(AttrWebAddress);
00301     }

INT32 AttrWebAddress::operator== const NodeAttribute naCompare  )  [virtual]
 

A virtual comparison operator.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/3/97
Parameters:
naCompare The NodeAttribute against which to compare this one [INPUTS]
- [OUTPUTS]
Returns:
TRUE if naCompare is identical to this attribute FALSE if naCompare is not an AttrWebAddress or if the value stored in naCompare is different from the one stored in this attribute
It checks that: a. naCompare and this attribute are the same class b. naCompare and this attribute hold identical Value member variables

Returns:
Errors: -
See also:
NodeAttribute::operator==; WebAddressAttribute::IsDifferent()

Reimplemented from NodeAttribute.

Definition at line 263 of file webattr.cpp.

00264 {
00265     //If naCompare is not an AttrWebAddress, return FALSE
00266     if (!naCompare.IsKindOf(CC_RUNTIME_CLASS(AttrWebAddress)))
00267         return FALSE;
00268 
00269     //Otherwise, cast naCompare into an AttrWebAddress pointer
00270     AttrWebAddress* pwaAttr = (AttrWebAddress*) &naCompare;
00271              
00272     //And check whether the member variables are the same
00273     BOOL fAreDifferent=Value.IsDifferent((AttributeValue*) &(pwaAttr->Value));
00274 
00275     //And return accordingly
00276     return (!fAreDifferent); 
00277 } 

void AttrWebAddress::PolyCopyNodeContents NodeRenderable pNodeCopy  )  [virtual]
 

Polymorphically copies the contents of this node to another.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/2003
Parameters:
- [OUTPUTS]
Returns:
Errors: An assertion failure will occur if NodeCopy is NULL Scope: protected

Reimplemented from NodeRenderable.

Definition at line 558 of file webattr.cpp.

00559 {
00560     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00561     ENSURE(IS_A(pNodeCopy, AttrWebAddress), "PolyCopyNodeContents given wrong dest node type");
00562 
00563     if (IS_A(pNodeCopy, AttrWebAddress))
00564         CopyNodeContents((AttrWebAddress*)pNodeCopy);
00565 }

void AttrWebAddress::Render RenderRegion pRender  )  [virtual]
 

Set this attribute as current in the render region.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/3/97
Parameters:
pRender The region into which to render this attribute [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from NodeAttribute.

Definition at line 300 of file webattr.cpp.

00301 {
00302     //Check the render region pointer
00303     if (pRender==NULL)
00304         ERROR2RAW("AttrWebAddress::Render - pRender is NULL");
00305 
00306     //Set the clickable rectangle of our WebAddressAttribute
00307     Value.SetClickableRectangleInRendering(GetClickableRectangle());
00308 
00309     //Then set our WebAddressAttribute member variable into that render region
00310     pRender->SetWebAddress(&Value, FALSE);
00311 }

BOOL AttrWebAddress::ShouldBecomeCurrent  )  [inline, virtual]
 

The attribute manager calls this function before making an attribute current.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/6/96
Returns:
TRUE if this attribute should become current.
FALSE if the user must deliberately apply this attribute to an object every time he wants to use it.

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 313 of file webattr.h.

00314     {
00315         return FALSE;
00316     }

void AttrWebAddress::ShowDebugTreeDetails  )  const
 

Node * AttrWebAddress::SimpleCopy void   )  [virtual]
 

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.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com> from Will
Date:
27/3/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A copy of the node, or NULL if memory runs out

Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory error and the function returns NULL.

Scope: protected

Reimplemented from NodeAttribute.

Definition at line 509 of file webattr.cpp.

00510 {
00511     AttrWebAddress* NodeCopy = new AttrWebAddress();
00512     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
00513     CopyNodeContents(NodeCopy);
00514     return NodeCopy;
00515 } 

BOOL AttrWebAddress::WritePreChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Writes this AttrWebAddress out to the filter.

> virtual BOOL AttrWebAddress::WritePreChildrenNative(BaseCamelotFilter* pFilter)

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/3/97
Parameters:
pFilter - ptr to the filter [INPUTS]
Returns:
TRUE if record is written, FALSE if not
Native records are written out in exactly the same way as Web records are. So we simply call WritePreChildrenWeb()

See also:
AttrWebAddress::WritePreChildrenWeb()

Reimplemented from Node.

Definition at line 482 of file webattr.cpp.

00483 {
00484 #ifdef DO_EXPORT
00485     return WritePreChildrenWeb(pFilter);
00486 #else
00487     return FALSE;
00488 #endif
00489 }

BOOL AttrWebAddress::WritePreChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Writes this AttrWebAddress out to the filter.

> virtual BOOL AttrWebAddress::WritePreChildrenWeb(BaseCamelotFilter* pFilter)

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/3/97
Parameters:
pFilter - ptr to the filter [INPUTS]
Returns:
TRUE if record is written, FALSE if not
See also:
AttrWebAddress::WriteString

Reimplemented from Node.

Definition at line 381 of file webattr.cpp.

00382 {
00383 #ifdef DO_EXPORT
00384     //Check our incoming parameter
00385     ERROR2IF(pFilter == NULL,FALSE,"AttrWebAddress::WritePreChildrenWeb - NULL parameter");
00386 
00387     //Set up some variables.
00388     //This pointer points to the record we are currently writing
00389     CamelotFileRecord* pRecord=NULL;
00390 
00391     // Add a description of the TAG_MOULD_BOUNDS record, for older importers that don't understand this record
00392     pFilter->AddTagDescription(TAG_WEBADDRESS,_R(IDS_TAG_WEBADDRESS));
00393 
00394     //And this lets us know whether there's been an error
00395     BOOL ok=TRUE;
00396 
00397     //Now, is the clickable area of this attribute the bounding box?
00398     if (Value.m_fBounding)
00399     {
00400         //Yes it is.
00401         //So create a "bounding box" record
00402         pRecord=new CamelotFileRecord(pFilter,TAG_WEBADDRESS_BOUNDINGBOX,TAG_WEBADDRESS_SIZE);
00403 
00404         //Check it's been created OK
00405         ok=(pRecord!=NULL);
00406 
00407         //Initialise it
00408         if (ok)
00409             pRecord->Init();
00410 
00411         //We also want to write out the start of the record, which is the clickable
00412         //rectangle of this record
00413 
00414         //So get the clickable rectangle
00415         DocRect rectBounding=GetClickableRectangle();
00416 
00417         //And write it out
00418         pRecord->WriteCoordInterleaved(rectBounding.lo);
00419         pRecord->WriteCoordInterleaved(rectBounding.hi);
00420     }
00421     else
00422     {
00423         //No, the clickable area of this attribute is the object shape
00424         //So create a normal Web Address record
00425         pRecord=new CamelotFileRecord(pFilter,TAG_WEBADDRESS,TAG_WEBADDRESS_SIZE);
00426 
00427         //And check it's been created OK
00428         ok=(pRecord!=NULL);
00429 
00430         //Initialise it
00431         if (ok)
00432             pRecord->Init();
00433     }
00434 
00435     //The rest of the data we need to write out is common to both types of record.
00436     //We need to write out the URL and Frame strings, in that order.
00437 
00438     
00439     //So write out the URL string
00440     String_256 strToWrite=Value.m_url.GetWebAddress();
00441 
00442     if (ok)
00443         ok=WriteString(pRecord, strToWrite);
00444 
00445     //And the Frame string
00446 
00447     //We do this using our toolkit function WriteString. This function
00448     //will write out a NULL character if the character pointer we pass it
00449     //is NULL
00450     if (ok)
00451         ok=WriteString(pRecord, Value.m_pcFrame);
00452 
00453     //And write out our record
00454     if (ok) 
00455         ok = pFilter->Write(pRecord);
00456 
00457     //And delete it
00458     delete pRecord;
00459 
00460     return ok;
00461 #else
00462     return FALSE;
00463 #endif
00464 }

BOOL AttrWebAddress::WriteString CamelotFileRecord pcfrRecord,
TCHAR pcWrite
[private]
 

Writes pcWrite out to the file.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/3/97
Parameters:
pcWrite Pointer to a string to write out to the record [INPUTS]
pcfrRecord The record to write out to [OUTPUTS]
Returns:
-
If pcWrite is NULL, a NULL character will be written out instead.

See also:
-

Definition at line 632 of file webattr.cpp.

00633 {
00634     //Does pcWrite point to a string?
00635     if (pcWrite)
00636     {
00637         //Yes. So write out that string.
00638         return pcfrRecord->WriteUnicode(pcWrite);
00639     }
00640     else
00641     {
00642         //No. So write out a NULL character
00643         TCHAR cNull='\0';
00644 
00645         return pcfrRecord->WriteUnicode(&cNull);
00646     }
00647 }


Member Data Documentation

WebAddressAttribute AttrWebAddress::Value
 

Definition at line 335 of file webattr.h.


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