OpMoveToLayer Class Reference

An op to move the selection from where-ever it is to the active layer. More...

#include <layermgr.h>

Inheritance diagram for OpMoveToLayer:

SelOperation UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

void Do (OpDescriptor *)
 This takes the selection and moves it to the active layer. This is a more powerful operation than the move forward/backward a layer.

Static Public Member Functions

static BOOL Init ()
 OpDelBar initialiser method.
static OpState GetState (String_256 *, OpDescriptor *)
 For finding the operations state.

Private Member Functions

 CC_DECLARE_DYNCREATE (OpMoveToLayer)

Detailed Description

An op to move the selection from where-ever it is to the active layer.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> K
Date:
3/5/00

Definition at line 296 of file layermgr.h.


Member Function Documentation

OpMoveToLayer::CC_DECLARE_DYNCREATE OpMoveToLayer   )  [private]
 

void OpMoveToLayer::Do OpDescriptor  )  [virtual]
 

This takes the selection and moves it to the active layer. This is a more powerful operation than the move forward/backward a layer.

Author:
Simon_Knight (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/5/00

Reimplemented from Operation.

Definition at line 1197 of file layermgr.cpp.

01198 {
01199     if (DoStartSelOp(FALSE,TRUE))
01200     {
01201         // get the selection
01202         Range Sel(*(GetApplication()->FindSelection()));
01203 
01204         // set the range flags so it includes shadow and bevel manager nodes
01205         RangeControl rg = Sel.GetRangeControlFlags();
01206         rg.PromoteToParent = TRUE;
01207         Sel.Range::SetRangeControl(rg);
01208 
01209         // Prepare an ObjChangeParam so we can mark which nodes will allow this op to happen to them
01210         ObjChangeFlags cFlags;
01211         cFlags.MoveNode = TRUE;
01212         ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,this);
01213 
01214         // add items directly after the layer node as its first child
01215         Node * pTail = (Node *) (Document::GetCurrent()->GetInsertionPosition());
01216         AttachNodeDirection TailAttachDirection = PREV;
01217         Spread* pSpread = Document::GetSelectedSpread();
01218 
01219         if (!pTail)
01220         {
01221             if (pSpread)
01222             {
01223                 pTail = pSpread->FindActiveLayer();
01224                 // AttachNodeDirection TailAttachDirection = LASTCHILD; <--- AMB removed this and inserted the next line 2006-04-10 presuming bug
01225                 TailAttachDirection = LASTCHILD;
01226             }
01227             else
01228             {
01229                 FailAndExecute();
01230                 End();
01231                 return; // nowhere to put the nodes
01232             }
01233         }
01234 
01235 
01236         // Mark nodes that will allow this to happen, and error if no nodes will let it happen
01237         if (!Sel.AllowOp(&ObjChange))
01238         {
01239             FailAndExecute();
01240             End();
01241             return; // op not allowed
01242         }
01243 
01244         // get a list from which to move the nodes (fixes job #10781 - the re-selection of 
01245         // moved nodes caused an infinite loop)
01246 
01247         List* pNodeList = Sel.MakeListOfNodes(FALSE);
01248         NodeListItem* CurItem = (NodeListItem*)(pNodeList->GetHead());
01249         while (CurItem)
01250         {
01251             Node* pNode = CurItem->pNode;
01252 
01253             // Make sure the current owner Layer is told about the changes
01254             // and given the chance to release any cached info it may be
01255             // holding about the selected object
01256             // (I know that the original position coincides with the destination position
01257             //  but this is hte simplest way to get the original parent layer uncached
01258             //  and to get a record in the undo history so that the layer cacheing will
01259             //  be dealt with properly during gundo/redo)
01260             DoInvalidateNodeRegion((NodeRenderableBounded*) pNode, TRUE, FALSE);
01261 
01262             // localise attribs for this node
01263             DoLocaliseForAttrChange((NodeRenderableInk*) pNode, (AttrTypeSet *)NULL, (ObjectSet*) NULL);
01264             DoMoveNode(pNode, pTail, TailAttachDirection);
01265             // factor out common attribs
01266             if (pNode->IsCompound())
01267                 DoFactorOutCommonChildAttributes((NodeRenderableInk*) pNode);
01268             else
01269                 DoFactorOutAfterAttrChange((NodeRenderableInk*) pNode, (AttrTypeSet *)NULL);
01270 
01271             // make the nodes region be redrawn
01272             DoInvalidateNodeRegion((NodeRenderableBounded*) pNode, TRUE, FALSE);
01273 
01274             CurItem = (NodeListItem*)(pNodeList->GetNext(CurItem));
01275         }
01276         // delete the the list objects 
01277         pNodeList->DeleteAll();
01278         delete pNodeList;
01279 
01280         // the selection will have changed - after all we just deleted it
01281         BROADCAST_TO_ALL(SelChangingMsg(SelChangingMsg::NONCOLOURATTCHANGED));
01282         GetApplication()->UpdateSelection();
01283 
01284         ObjChange.Define(OBJCHANGE_FINISHED,cFlags,NULL,this);
01285         UpdateChangedNodes(&ObjChange);
01286         // end the op
01287         End();
01288 
01289         // update the bars
01290         DialogBarOp::SetSystemStateChanged();
01291         DialogBarOp::UpdateStateOfAllBars(); 
01292     }
01293     else
01294     {
01295         // give up and go home
01296         FailAndExecute();
01297         End();
01298     }
01299 }

OpState OpMoveToLayer::GetState String_256 UIDescription,
OpDescriptor Bob
[static]
 

For finding the operations state.

Author:
Simon_Knight (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/5/00

Definition at line 1180 of file layermgr.cpp.

01181 {
01182     OpState OpSt;
01183     return(OpSt);   
01184 }

BOOL OpMoveToLayer::Init void   )  [static]
 

OpDelBar initialiser method.

Author:
Simon_Knight (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/5/00
Returns:
TRUE if the operation could be successfully initialised FALSE if no more memory could be allocated

Errors: ERROR will be called if there was insufficient memory to allocate the operation.

See also:
-

Reimplemented from SimpleCCObject.

Definition at line 1150 of file layermgr.cpp.

01151 {
01152     return  (RegisterOpDescriptor(0,
01153                                 _R(IDS_MOVE_SEL_TO_ACTIVE_LAYER),
01154                                 CC_RUNTIME_CLASS(OpMoveToLayer),
01155                                 OPTOKEN_MOVE_SEL_TO_ACTIVE_LAYER,
01156                                 OpMoveToLayer::GetState,
01157                                 0,                  // help ID 
01158                                 0,                  // bubble help
01159                                 0,                  // resource ID
01160                                 0,                  // control ID
01161                                 SYSTEMBAR_ILLEGAL,  // Bar ID
01162                                 TRUE,               // Receive messages
01163                                 FALSE,
01164                                 FALSE,
01165                                 0,
01166                                 (GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE) ));
01167 }


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