FactorOutCommonChildAttrAct Class Reference

When executed this action will factor out all attributes which are common to all children of the compound object. All common attributes become first children of the compound object. More...

#include <ndoptmz.h>

Inheritance diagram for FactorOutCommonChildAttrAct:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 FactorOutCommonChildAttrAct ()
 FactorOutCommonChildAttrAct constructor.
virtual ActionCode Execute ()
 Executes the FactorOutCommonChildAttrAct which factors out all attributes which are common to all children of the compound object. All common attributes become first children of the compound object.
virtual void Slaughter ()
 destructor which gets called when an operation is deleted

Static Public Member Functions

static ActionCode Init (Operation *const pOp, ActionList *pActionList, NodeRenderableInk *CompoundObject, BOOL Global, AttrTypeSet *pAffectedAttrTypes, Action **NewAction)
 To check that there is sufficient room for the action in the operation history, and if there is, then to add the action to the operations action list.

Private Attributes

NodeRenderableInkCompoundObj
AttrTypeSetpSetOfAffectedAttrTypes
BOOL Global

Detailed Description

When executed this action will factor out all attributes which are common to all children of the compound object. All common attributes become first children of the compound object.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/9/93
A LocaliseCommonAttrAct action twin is generated to redo

See also:
UndoableOperation::DoLocaliseCommonAttributes

Definition at line 171 of file ndoptmz.h.


Constructor & Destructor Documentation

FactorOutCommonChildAttrAct::FactorOutCommonChildAttrAct  ) 
 

FactorOutCommonChildAttrAct constructor.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1171 of file ndoptmz.cpp.

01172 {
01173 }   


Member Function Documentation

ActionCode FactorOutCommonChildAttrAct::Execute  )  [virtual]
 

Executes the FactorOutCommonChildAttrAct which factors out all attributes which are common to all children of the compound object. All common attributes become first children of the compound object.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/93
Parameters:
- [INPUTS]
ActionCode indicating if the action was successfully executed or not [OUTPUTS]
Returns:
-

Errors: -

See also:
LocaliseCommonAttrAct

Reimplemented from Action.

Definition at line 1193 of file ndoptmz.cpp.

01194 {
01195     LocaliseCommonAttrAct* NewAct;  
01196     ActionCode ActCode;  
01197 
01198     // Attempt to initialise the LocaliseCommonAttrAct action which will localise the attributes
01199     if ((ActCode = LocaliseCommonAttrAct::Init(pOperation,                    
01200                                                pOppositeActLst,  
01201                                                CompoundObj,
01202                                                Global,  
01203                                                pSetOfAffectedAttrTypes,
01204                                                ( Action**)(&NewAct))) != AC_FAIL) 
01205     { 
01206         if (!CompoundObj->FactorOutCommonChildAttributes(Global, pSetOfAffectedAttrTypes))
01207         {
01208             return AC_FAIL; 
01209         }                   
01210     }             
01211     return (ActCode);                        
01212 }    

ActionCode FactorOutCommonChildAttrAct::Init Operation *const   pOp,
ActionList pActionList,
NodeRenderableInk pCompound,
BOOL  global,
AttrTypeSet pAffectedAttrTypes,
Action **  NewAction
[static]
 

To check that there is sufficient room for the action in the operation history, and if there is, then to add the action to the operations action list.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/9/93
Parameters:
pOp,: The operation to which the action should be added [INPUTS]
pActionList: The action list in the operation object

pCompound: The compound object

Global: When TRUE the attributes on all parent compounds are also factored out.

pAffectedAttrTypes: An optional set of attribute types. If this is specified then we only consider factoring out those attributes which have a type which is in this set.

Parameters:
NewAction,: A pointer to the action if it could be allocated. [OUTPUTS]
Returns:
AC_FAIL: There was not enough room in the operation history for the action and the user did not wish to continue. Usually End() should be called in this situation.
AC_NORECORD: There was not enough room in the operation history for the action, but the user requested that he wished to continue without undo.

AC_OK : The action was successfully initialised and added to the operation.

The function calls the Action::Init function passing the runtime class of a FactorOutCommonChildAttrAct.

Returns:
Errors: -
See also:
Action::Init

Definition at line 1265 of file ndoptmz.cpp.

01272 {  
01273     ActionCode Ac = (Action::Init(pOp,
01274                      pActionList,
01275                      sizeof(FactorOutCommonChildAttrAct), 
01276                      CC_RUNTIME_CLASS(FactorOutCommonChildAttrAct), 
01277                      NewAction)); 
01278 
01279     if (*NewAction != NULL) 
01280     {
01281         ((FactorOutCommonChildAttrAct*)(*NewAction))->CompoundObj = pCompound;
01282         ((FactorOutCommonChildAttrAct*)(*NewAction))->pSetOfAffectedAttrTypes = pAffectedAttrTypes;
01283         ((FactorOutCommonChildAttrAct*)(*NewAction))->Global = global;
01284     }
01285                   
01286     return (Ac); 
01287 } 

void FactorOutCommonChildAttrAct::Slaughter void   )  [virtual]
 

destructor which gets called when an operation is deleted

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/05/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
Action::Slaughter

Reimplemented from Action.

Definition at line 1304 of file ndoptmz.cpp.

01305 {         
01306     // Destroy the set of attribute types
01307     if (pSetOfAffectedAttrTypes)
01308     {
01309         pSetOfAffectedAttrTypes->DeleteAll(); 
01310         delete pSetOfAffectedAttrTypes;
01311     }
01312 
01313     // call the base class to destroy the action
01314     Action::Slaughter();
01315 }   


Member Data Documentation

NodeRenderableInk* FactorOutCommonChildAttrAct::CompoundObj [private]
 

Definition at line 190 of file ndoptmz.h.

BOOL FactorOutCommonChildAttrAct::Global [private]
 

Definition at line 192 of file ndoptmz.h.

AttrTypeSet* FactorOutCommonChildAttrAct::pSetOfAffectedAttrTypes [private]
 

Definition at line 191 of file ndoptmz.h.


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