StoreKernCodeAction Class Reference

This action is used to restore a kern value on undo. Using this an op can change the kern value without having to hide the old KernCode and create a new one. More...

#include <textacts.h>

Inheritance diagram for StoreKernCodeAction:

BaseTextAction Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 StoreKernCodeAction ()
 Constructor - initialises the member variables.
 ~StoreKernCodeAction ()
 Destructor.
virtual ActionCode Execute ()
 Called during undo/redo to restore a kern code value Inserts a StoreKernCodeAction to restore the current kern value then sets it to the value in the action.
KernCode * GetKernCode () const
DocCoord GetKernValue () const
void SetKernCode (DocCoord NewValue)

Static Public Member Functions

static ActionCode Init (Operation *, ActionList *, TextStory *, KernCode *)
static BOOL DoStoreKernValue (Operation *pOp, ActionList *, KernCode *)

Protected Attributes

KernCode * pKernCode
DocCoord KernValue

Detailed Description

This action is used to restore a kern value on undo. Using this an op can change the kern value without having to hide the old KernCode and create a new one.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/5/95
See also:
BaseTextAction

Definition at line 177 of file textacts.h.


Constructor & Destructor Documentation

StoreKernCodeAction::StoreKernCodeAction (   ) 
 

Constructor - initialises the member variables.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/5/95

Definition at line 283 of file textacts.cpp.

00284 {
00285     pKernCode = NULL;
00286     KernValue = DocCoord(0,0);
00287 }

StoreKernCodeAction::~StoreKernCodeAction (   ) 
 

Destructor.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/5/95

Definition at line 297 of file textacts.cpp.

00298 {
00299 }


Member Function Documentation

BOOL StoreKernCodeAction::DoStoreKernValue (  Operation *  pOp,
ActionList *  ,
KernCode * 
)  [static]
 

Definition at line 386 of file textacts.cpp.

00387 {
00388     // Check the parameters
00389     ERROR2IF(pOp == NULL, AC_FAIL, "The operation pointer is NULL");
00390     ERROR2IF(pActionList == NULL, AC_FAIL, "The action list pointer is NULL");
00391     ERROR2IF(pKern == NULL, AC_FAIL, "TextChar pointer is NULL");
00392 
00393     // Get a pointer to the characters parent TextStory
00394     TextStory* pParentStory = (TextStory*)pKern->FindParent(CC_RUNTIME_CLASS(TextStory));
00395     ERROR2IF(pParentStory == NULL, AC_FAIL, "TextChar has no parent TextStory");
00396 
00397     // Insert the action
00398     ActionCode Ac;
00399     Ac = Init(pOp, pActionList, pParentStory, pKern);
00400 
00401     return (Ac != AC_FAIL);
00402 }

ActionCode StoreKernCodeAction::Execute (   )  [virtual]
 

Called during undo/redo to restore a kern code value Inserts a StoreKernCodeAction to restore the current kern value then sets it to the value in the action.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/5/95

Reimplemented from Action.

Definition at line 311 of file textacts.cpp.

00312 {
00313     // Check the member variables
00314     ERROR2IF(pStory == NULL, AC_FAIL, "The TextStory pointer is NULL");
00315     ERROR2IF(pKernCode == NULL, AC_FAIL, "TextChar pointer is NULL");
00316 
00317     // Insert an action to restore the kern code to its current value on redo
00318     ActionCode ActCode;
00319     ActCode = StoreKernCodeAction::Init(pOperation, pOppositeActLst, pStory, pKernCode);
00320 
00321     // Now set the kern code the old value
00322     if (ActCode != AC_FAIL)
00323         pKernCode->SetValue(KernValue);
00324 
00325     return ActCode;
00326 }

KernCode* StoreKernCodeAction::GetKernCode (   )  const [inline]
 

Definition at line 190 of file textacts.h.

00190 {return pKernCode;}

DocCoord StoreKernCodeAction::GetKernValue (   )  const [inline]
 

Definition at line 191 of file textacts.h.

00191 {return KernValue;}

ActionCode StoreKernCodeAction::Init (  Operation *  ,
ActionList *  ,
TextStory *  ,
KernCode * 
)  [static]
 

Definition at line 346 of file textacts.cpp.

00347 {
00348     // Check the parameters
00349     ERROR2IF(pOp == NULL, AC_FAIL, "The operation pointer is NULL");
00350     ERROR2IF(pActionList == NULL, AC_FAIL, "The action list pointer is NULL");
00351     ERROR2IF(pTextStory == NULL, AC_FAIL, "The TextStory pointer is NULL");
00352     ERROR2IF(pKern == NULL, AC_FAIL, "KernCode pointer is NULL");
00353 
00354     // Create a new action and insert it in the action list
00355     UINT32 ActSize = sizeof(StoreKernCodeAction);
00356     StoreKernCodeAction* pNewAction = NULL;
00357     ActionCode Ac = Action::Init( pOp, pActionList, ActSize, CC_RUNTIME_CLASS(StoreKernCodeAction), (Action**)&pNewAction);
00358 
00359     // Set the members of the new action
00360     if ((Ac == AC_OK) && (pNewAction != NULL))
00361     {
00362         pNewAction->pStory = pTextStory;
00363         pNewAction->pKernCode = pKern;
00364         pNewAction->KernValue = pKern->GetValue();
00365     }
00366 
00367     return Ac;
00368 }

void StoreKernCodeAction::SetKernCode (  DocCoord  NewValue  )  [inline]
 

Definition at line 192 of file textacts.h.

00192 {KernValue = NewValue;}


Member Data Documentation

DocCoord StoreKernCodeAction::KernValue [protected]
 

Definition at line 196 of file textacts.h.

KernCode* StoreKernCodeAction::pKernCode [protected]
 

Definition at line 195 of file textacts.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:01:27 2007 for Camelot by  doxygen 1.4.4