#include <opnode.h>
Inheritance diagram for OpRemoveAttributeFromSelection:
Public Member Functions | |
virtual void | DoWithParam (OpDescriptor *pOp, OpParam *pParam) |
Performs the OpRemoveAttributeFromSelection operation. It removes all attributes with the given AttributeIdentifier from the selected objects. | |
virtual void | GetOpName (String_256 *pOpName) |
The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies. | |
Static Public Member Functions | |
static BOOL | Declare () |
Declares the OpDescriptor for OpRemoveAttributeFromSelection. Should be called on start up. | |
static OpState | GetState (String_256 *Description, OpDescriptor *) |
For finding OpRemoveAttributeFromSelection state. | |
Protected Member Functions | |
NodeAttribute * | FindAttributeOfClassID (Node *const pNode, AttributeIdentifier AttrID) |
Support function to find an attribute of the given class. | |
BOOL | DoRemove (NodeAttribute *const pOldAttr) |
Support function to remove the attribute. |
Definition at line 144 of file opnode.h.
|
Declares the OpDescriptor for OpRemoveAttributeFromSelection. Should be called on start up.
Definition at line 139 of file opnode.cpp. 00140 { 00141 00142 // Register the opdescriptors for the OpRemoveAttributeFromSelection operation 00143 00144 return (RegisterOpDescriptor( 0, 00145 _R(IDS_DELETEATTROP), 00146 CC_RUNTIME_CLASS(OpRemoveAttributeFromSelection), 00147 OPTOKEN_DELETEATTR, 00148 OpRemoveAttributeFromSelection::GetState, 00149 0, /* help ID */ 00150 0, 00151 0, 00152 0, 00153 SYSTEMBAR_ILLEGAL, // For now ! 00154 FALSE, // Receive messages 00155 FALSE, 00156 FALSE, 00157 0, 00158 0 // (GREY_WHEN_NO_CURRENT_DOC | GREY_WHEN_NO_SELECTION) 00159 )); 00160 }
|
|
Support function to remove the attribute.
Definition at line 335 of file opnode.cpp. 00336 { 00337 ENSURE_NOT_NULL(pOldAttr); // well use a reference then! 00338 00339 BOOL Ok = TRUE; 00340 00341 Node* CurrentNode = pOldAttr->FindParent(); 00342 ERROR3IF(CurrentNode == NULL, "Can't find parent node in Replace Attr"); 00343 00344 // Now we have done with the old attribute, so lets hide it, so 00345 // the changes can be undone 00346 Ok = DoHideNode(pOldAttr, 00347 TRUE, // Include the subtree size (not that there is one) 00348 NULL, // the hidden node 00349 TRUE); // make sure the attribute's HidingNode function is called 00350 00351 return Ok; 00352 }
|
|
Performs the OpRemoveAttributeFromSelection operation. It removes all attributes with the given AttributeIdentifier from the selected objects.
Reimplemented from Operation. Definition at line 222 of file opnode.cpp. 00223 { 00224 VOID_ENSURE_NOT_NULL(pOpParam); 00225 ENSURE_KIND(pOpParam, RemoveAttributeParam); 00226 00227 const RemoveAttributeParam* const pRemoveParam = (RemoveAttributeParam*)pOpParam; 00228 00229 // Objects used to mark changed nodes, so that parents will update after attr replacement 00230 ObjChangeFlags cFlags; 00231 cFlags.Attribute = TRUE; 00232 ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,this); 00233 00234 BOOL Ok = TRUE; 00235 00236 Ok = DoStartSelOp(FALSE, FALSE, FALSE, FALSE); // FALSE's == don't render the blobs 00237 00238 // Obtain the current selection 00239 SelRange* const pSelRange = GetApplication()->FindSelection(); 00240 Ok = (pSelRange != NULL); 00241 00242 if (Ok) 00243 { 00244 00245 if (Ok) 00246 { 00247 Range CurrentSelection(*pSelRange); 00248 // Mark nodes that will allow this to happen, 00249 // and error if no nodes will let it happen 00250 00251 Ok = CurrentSelection.AllowOp(&ObjChange); 00252 } 00253 } 00254 00255 if (Ok) 00256 { 00257 AttributeIdentifier AttrIDToDelete = pRemoveParam->GetAttrIDToDelete(); 00258 00259 Node* pNode = pSelRange->FindFirst(); 00260 while (pNode != NULL && Ok) 00261 { 00262 NodeAttribute* const pAttr = FindAttributeOfClassID(pNode, AttrIDToDelete); 00263 if (pAttr != NULL) 00264 { 00265 Ok = DoRemove(pAttr); 00266 } 00267 00268 pNode = pSelRange->FindNext(pNode); 00269 } 00270 } 00271 00272 if (Ok) 00273 { 00274 // Update all parents of this 00275 ObjChange.Define(OBJCHANGE_FINISHED,cFlags,NULL,this); 00276 Ok = UpdateChangedNodes(&ObjChange); 00277 } 00278 00279 if (!Ok) 00280 { 00281 FailAndExecute(); 00282 } 00283 00284 End(); // End of operation 00285 }
|
|
Support function to find an attribute of the given class.
Definition at line 304 of file opnode.cpp. 00305 { 00306 NodeAttribute* pAttr = NodeAttribute::FindFirstAppliedAttr(pNode); 00307 00308 while (pAttr) 00309 { 00310 if (pAttr->GetAttributeClassID() == AttrID) 00311 return pAttr; 00312 00313 pAttr = NodeAttribute::FindPrevAppliedAttr(pAttr); 00314 } 00315 00316 return NULL; 00317 }
|
|
The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies.
Reimplemented from Operation. Definition at line 200 of file opnode.cpp. 00201 { 00202 *OpName += String_256(_R(IDS_ATTR_CHANGE)); 00203 }
|
|
For finding OpRemoveAttributeFromSelection state.
Definition at line 177 of file opnode.cpp.
|