/******************************************************************************************** > static CCAttrMap * CCAttrMap::MakeAttrMapFromRenderRegion(RenderRegion * pRegion) Author: David_McClarnon (Xara Group Ltd) <*****@*****.**> Created: 24/2/2000 Inputs: The render region to get the attribute map from Outputs: An attribute map (copied) from the render region Returns: - Purpose: Makes an attribute out of the render region's current attribute state Notes: You MUST call DeleteAttributes afterwards to release memory - delete is not sufficient SeeAlso: - ********************************************************************************************/ CCAttrMap * CCAttrMap::MakeAttrMapFromRenderRegion(RenderRegion * pRegion) { CCAttrMap * pMap = new CCAttrMap; ENSURE(pMap,"No mem for attrmap"); if(!pMap) return NULL; // let's get every attribute in the render region AttributeValue * pAttrVal = NULL; NodeAttribute * pNewAttr = NULL; for (UINT32 i = 0; i < ATTR_FIRST_FREE_ID; i++) { pAttrVal = pRegion->GetCurrentAttribute(i); // make a new node out of this attribute value pNewAttr = pAttrVal->MakeNode(); // Karim 12/04/2000 // AttributeValues _do_not_have_to_have_ a corresponding NodeAttribute, // so can we please *check* that MakeNode didn't just return NULL! if (pNewAttr != NULL) { if(!pNewAttr->IsLinkedToNodeGeometry()) pMap->SetAt(pNewAttr->GetAttributeType(),pNewAttr); else { delete pNewAttr; pNewAttr = AttributeManager::GetDefaultAttribute((AttrIndex) i); if(pNewAttr) { ENSURE(pNewAttr->IsLinkedToNodeGeometry(),"Incorrect NodeAttribute returned by GetDefaultAttribute"); pMap->SetAt(pNewAttr->GetAttributeType(), pNewAttr); } else return NULL; } } } pMap->attrMapCreator = NULL; return pMap; }
BOOL AttrWebAddress::Blend(BlendAttrParam* pBlendParam) { //Check our parameter ERROR2IF(pBlendParam == NULL, FALSE, "AttrWebAddress::Blend - NULL parameter"); //Try and blend our WebAddressAttribute member variable if (Value.Blend(pBlendParam)) { // Get the blended attr val. After this call, the ptr is our reponsibility // so we have to delete it if it's no longer needed AttributeValue* pBlendedAttrVal = pBlendParam->GetBlendedAttrVal(); if (pBlendedAttrVal != NULL) { // We have a blended attr val, so ask it to make a NodeAttribute out of itself // and set the pBlendParam's blended NodeAttribute ptr to it NodeAttribute* pBlendedAttr = pBlendedAttrVal->MakeNode(); pBlendParam->SetBlendedAttr(pBlendedAttr); if (pBlendedAttr != NULL) { // We were able to make a blended NodeAttribute // so delete the blended attr val, and return TRUE delete pBlendedAttrVal; return TRUE; } else { // Couldn't make a blended NodeAttribute, so give the blended attr val back // and return FALSE pBlendParam->SetBlendedAttrVal(pBlendedAttrVal); return FALSE; } } } return FALSE; }