StoreCharCodeAction Class Reference

This action is used to restore a character's UniCode value on undo. Using this an op can chage the character code of a TextChar without having to hide the old char and create a new one. More...

#include <textacts.h>

Inheritance diagram for StoreCharCodeAction:

BaseTextAction Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 StoreCharCodeAction ()
 Constructor - initialises the member variables.
 ~StoreCharCodeAction ()
 Destructor.
virtual ActionCode Execute ()
 Called during undo/redo to restore a character code to a particular character Inserts StoreCharCodeAction to restore the current character code then sets it to the value in the action.

Static Public Member Functions

static ActionCode Init (Operation *, ActionList *, TextStory *, TextChar *)
static BOOL DoStoreCharacterCode (Operation *pOp, ActionList *, TextChar *)

Protected Attributes

TextCharpChar
WCHAR CharCode

Detailed Description

This action is used to restore a character's UniCode value on undo. Using this an op can chage the character code of a TextChar without having to hide the old char and create a new one.

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

Definition at line 145 of file textacts.h.


Constructor & Destructor Documentation

StoreCharCodeAction::StoreCharCodeAction  ) 
 

Constructor - initialises the member variables.

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

Definition at line 150 of file textacts.cpp.

00151 {
00152     pChar = NULL;
00153     CharCode = 0;
00154 }

StoreCharCodeAction::~StoreCharCodeAction  ) 
 

Destructor.

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

Definition at line 164 of file textacts.cpp.

00165 {
00166 }


Member Function Documentation

BOOL StoreCharCodeAction::DoStoreCharacterCode Operation pOp,
ActionList ,
TextChar
[static]
 

Definition at line 253 of file textacts.cpp.

00254 {
00255     // Check the parameters
00256     ERROR2IF(pOp == NULL, AC_FAIL, "The operation pointer is NULL");
00257     ERROR2IF(pActionList == NULL, AC_FAIL, "The action list pointer is NULL");
00258     ERROR2IF(pTextChar == NULL, AC_FAIL, "TextChar pointer is NULL");
00259 
00260     // Get a pointer to the characters parent TextStory
00261     TextStory* pParentStory = (TextStory*)pTextChar->FindParent(CC_RUNTIME_CLASS(TextStory));
00262     ERROR2IF(pParentStory == NULL, AC_FAIL, "TextChar has no parent TextStory");
00263 
00264     // Insert the action
00265     ActionCode Ac;
00266     Ac = Init(pOp, pActionList, pParentStory, pTextChar);
00267 
00268     return (Ac != AC_FAIL);
00269 }

ActionCode StoreCharCodeAction::Execute  )  [virtual]
 

Called during undo/redo to restore a character code to a particular character Inserts StoreCharCodeAction to restore the current character code 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 178 of file textacts.cpp.

00179 {
00180     // Check the member variables
00181     ERROR2IF(pStory == NULL, AC_FAIL, "The TextStory pointer is NULL");
00182     ERROR2IF(pChar == NULL, AC_FAIL, "TextChar pointer is NULL");
00183 
00184     // Insert an action to restore the character code to its current value on redo
00185     ActionCode ActCode;
00186     ActCode = StoreCharCodeAction::Init(pOperation, pOppositeActLst, pStory, pChar);
00187 
00188     // Now set the character code the old value
00189     if (ActCode != AC_FAIL)
00190         pChar->SetUnicodeValue(CharCode);
00191 
00192     return ActCode;
00193 }

ActionCode StoreCharCodeAction::Init Operation ,
ActionList ,
TextStory ,
TextChar
[static]
 

Definition at line 213 of file textacts.cpp.

00214 {
00215     // Check the parameters
00216     ERROR2IF(pOp == NULL, AC_FAIL, "The operation pointer is NULL");
00217     ERROR2IF(pActionList == NULL, AC_FAIL, "The action list pointer is NULL");
00218     ERROR2IF(pTextStory == NULL, AC_FAIL, "The TextStory pointer is NULL");
00219     ERROR2IF(pTextChar == NULL, AC_FAIL, "TextChar pointer is NULL");
00220 
00221     // Create a new action and insert it in the action list
00222     UINT32 ActSize = sizeof(StoreCharCodeAction);
00223     StoreCharCodeAction* pNewAction = NULL;
00224     ActionCode Ac = Action::Init( pOp, pActionList, ActSize, CC_RUNTIME_CLASS(StoreCharCodeAction), (Action**)&pNewAction);
00225 
00226     // Set the members of the new action
00227     if ((Ac == AC_OK) && (pNewAction != NULL))
00228     {
00229         pNewAction->pStory = pTextStory;
00230         pNewAction->pChar = pTextChar;
00231         pNewAction->CharCode = pTextChar->GetUnicodeValue();
00232     }
00233 
00234     return Ac;
00235 }


Member Data Documentation

WCHAR StoreCharCodeAction::CharCode [protected]
 

Definition at line 159 of file textacts.h.

TextChar* StoreCharCodeAction::pChar [protected]
 

Definition at line 158 of file textacts.h.


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