OpPullOntoGrid Class Reference

Translate the selection so that one of it's corners lies on the grid. More...

#include <oppull.h>

Inheritance diagram for OpPullOntoGrid:

OpTranslateTrans TransOperation UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

virtual void Do (OpDescriptor *pOpDesc)
 The pull onto grid op's Do() function.

Static Public Member Functions

static BOOL Init ()
 OpPullOntoGrid initialiser method.
static OpState GetState (String_256 *, OpDescriptor *)
 For finding OpPullOntoGrid's state.

Private Member Functions

 CC_DECLARE_DYNCREATE (OpPullOntoGrid)

Detailed Description

Translate the selection so that one of it's corners lies on the grid.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/03/95

Definition at line 117 of file oppull.h.


Member Function Documentation

OpPullOntoGrid::CC_DECLARE_DYNCREATE OpPullOntoGrid   )  [private]
 

void OpPullOntoGrid::Do OpDescriptor pOpDesc  )  [virtual]
 

The pull onto grid op's Do() function.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/03/95
Parameters:
pOpDesc = ptr to the op descriptor [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 200 of file oppull.cpp.

00201 {  
00202     DocCoord        Offset;
00203     TransformData   TransData;
00204 
00205     // Set up the transform data
00206     TransData.CentreOfTrans.x   = 0;
00207     TransData.CentreOfTrans.y   = 0;
00208     TransData.StartBlob         = 0;
00209     TransData.LockAspect        = TRUE;
00210     TransData.LeaveCopy         = FALSE;
00211     TransData.ScaleLines        = FALSE;
00212     TransData.TransFills        = TRUE;
00213     TransData.pRange = 0;
00214 
00215     SelRange* pSel = GetApplication()->FindSelection();
00216     if (pSel)
00217     {
00218         // Set up the Offset DocCoord to contain the X and Y translation values
00219         DocRect Bounds = pSel->GetBoundingRect();
00220         DocCoord Offset = Bounds.lo;
00221         DocView::ForceSnapToGrid(Document::GetSelectedSpread(),&Offset);
00222         Offset = Offset - Bounds.lo;
00223 
00224         // Call OpTranslateTrans::DoWithParams() with a ptr to the transform data and a ptr to a DocCoord
00225         // that specs the X and Y offsets of the translation
00226         OpParam temp((void *)&TransData, (void *)&Offset);
00227         DoWithParam(pOpDesc, &temp);
00228     }
00229 }

OpState OpPullOntoGrid::GetState String_256 UIDescription,
OpDescriptor
[static]
 

For finding OpPullOntoGrid's state.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/03/95
Parameters:
ptr to a string to place a description of what went wrong (if it did!) [INPUTS]
- [OUTPUTS]
Returns:
The state of the OpPullOntoGrid operation

Errors: -

See also:
-

Reimplemented from TransOperation.

Definition at line 169 of file oppull.cpp.

00170 {
00171     OpState OpSt;
00172 
00173     SelRange* pSelRange = GetApplication()->FindSelection();
00174     if (pSelRange != NULL && pSelRange->FindFirst() != NULL)
00175         OpSt.Greyed = FALSE;
00176     else
00177         OpSt.Greyed = TRUE;
00178 
00179     return (OpSt);   
00180 }

BOOL OpPullOntoGrid::Init void   )  [static]
 

OpPullOntoGrid initialiser method.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/03/95
Parameters:
- [INPUTS]
- [OUTPUTS]
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 137 of file oppull.cpp.

00138 {
00139     BOOL registered = RegisterOpDescriptor(
00140                                             0,
00141                                             _R(IDS_PULLONTOGRID),
00142                                             CC_RUNTIME_CLASS(OpPullOntoGrid),
00143                                             OPTOKEN_PULLONTOGRID,
00144                                             OpPullOntoGrid::GetState,
00145                                             0,
00146                                             _R(IDBBL_PULLONTOGRID)
00147                                           );
00148     return registered;
00149 }               


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