CopyObjectsToClipboardAction Class Reference

When executed as an undo action nothing happens except for the creation of a redo CopyObjectsToClipboardAction. More...

#include <cpyact.h>

Inheritance diagram for CopyObjectsToClipboardAction:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 CopyObjectsToClipboardAction ()
 ~CopyObjectsToClipboardAction ()
 CopyObjectsToClipboardAction destructor.
virtual ActionCode Execute ()
 Executes the CopyObjectsToClipboardAction which when executed on an undo list does nothing except spawn a redo CopyObjectsToClipboardAction.

Static Public Member Functions

static ActionCode Init (Operation *const pOp, ActionList *pActionList, Range NodeRange, 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

Range NodeRange

Detailed Description

When executed as an undo action nothing happens except for the creation of a redo CopyObjectsToClipboardAction.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/9/93
When executed as a redo all selected objects are copied to the clipboard

See also:
-

Definition at line 122 of file cpyact.h.


Constructor & Destructor Documentation

CopyObjectsToClipboardAction::CopyObjectsToClipboardAction  ) 
 

CopyObjectsToClipboardAction::~CopyObjectsToClipboardAction  ) 
 

CopyObjectsToClipboardAction destructor.

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

Errors: -

See also:
-

Definition at line 150 of file cpyact.cpp.

00151 {
00152 }   


Member Function Documentation

ActionCode CopyObjectsToClipboardAction::Execute  )  [virtual]
 

Executes the CopyObjectsToClipboardAction which when executed on an undo list does nothing except spawn a redo CopyObjectsToClipboardAction.

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:
-
When executed on a redo action list copies all objects to the clipboard
Returns:
Errors: -
See also:
-

Reimplemented from Action.

Definition at line 174 of file cpyact.cpp.

00175 {  
00176     ActionCode ActCode;  
00177     
00178     // Create the twin action 
00179     CopyObjectsToClipboardAction* CpyObjAct; 
00180 
00181     if ( (ActCode = CopyObjectsToClipboardAction::Init(pOperation, 
00182                                               pOppositeActLst, 
00183                                               NodeRange, 
00184                                               (Action**)(&CpyObjAct)))
00185         != AC_FAIL)  
00186     {   
00187         // Is this a redo action ?
00188         if  (pOppositeActLst == pOperation->GetUndoActionList())
00189         {
00190             BOOL CopiedOK; 
00191         
00192             // After the operation ends we will need to inform all DocComponents in the clipboard
00193             // of the outcome.
00194             pOperation->InformDocComponentsOfOperationsOutcome(InternalClipboard::Instance()); 
00195 
00196             // Inform all DocComponents in the clipboard that a copy is about to take place
00197             BOOL ok;
00198             CALL_WITH_FAIL(InternalClipboard::Instance()->StartComponentCopy(), pOperation, ok)
00199             if (!ok)
00200             {
00201                 // Start Component copy has failed so abort operation
00202                 // Note that AbortComponentCopy will get called in the ops end method
00203                 return AC_FAIL;
00204             } 
00205 
00206 
00207             // Copy the selection to the clipboard
00208             CALL_WITH_FAIL(InternalClipboard::CopyObjects(NodeRange, pOperation), pOperation, CopiedOK)
00209 
00210             if (!CopiedOK)
00211             {
00212                 return AC_FAIL; 
00213             }
00214 
00215             // Now try and copy accross the component data
00216             CALL_WITH_FAIL(InternalClipboard::CopyComponentData(GetWorkingDoc()),
00217                                                                 pOperation,
00218                                                                 CopiedOK)
00219             if (!CopiedOK) return AC_FAIL; 
00220         }
00221         // else do nothing
00222     };  
00223                     
00224     return ActCode;
00225 }     

ActionCode CopyObjectsToClipboardAction::Init Operation *const   pOp,
ActionList pActionList,
Range  NodeRange,
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.

Parameters:
pOp,: The operation to which the action should be added [INPUTS]
pActionList: The action list in the operation object

NodeRange: The range of nodes to copy

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 CopyObjectsToClipboardAction.

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

Definition at line 270 of file cpyact.cpp.

00275 { 
00276     ActionCode Ac = (Action::Init(pOp,
00277                                   pActionList,
00278                                   sizeof(CopyObjectsToClipboardAction),
00279                                   CC_RUNTIME_CLASS(CopyObjectsToClipboardAction), 
00280                                   NewAction));   
00281                            
00282     if (Ac != AC_FAIL)
00283         if (*NewAction != NULL)  
00284         {
00285             // Store the range and transform in the action 
00286             ((CopyObjectsToClipboardAction*)(*NewAction))->NodeRange = NodeRange;
00287         }
00288                 
00289     return (Ac); 
00290 } 


Member Data Documentation

Range CopyObjectsToClipboardAction::NodeRange [private]
 

Definition at line 137 of file cpyact.h.


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