ActionPageResize Class Reference

When executed, this sets up an action to redo/undo a page resize. More...

#include <optspage.h>

Inheritance diagram for ActionPageResize:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 ActionPageResize ()
 ActionPageResize constructor.
 ~ActionPageResize ()
 ActionPageResize destructor.
virtual ActionCode Execute ()
 Executes the ActionPageResize to go and resize the current spread/page and generates another ActionPageResize to undo this change. Forces a redraw of the parent document for the specified spread.

Static Public Member Functions

static ActionCode Init (Operation *const pOp, ActionList *pActionList, UINT32 ActionSize, Spread *pSpread, MILLIPOINT Width, MILLIPOINT Height, MILLIPOINT Margin, MILLIPOINT Bleed, BOOL Dps, BOOL ShowDropShadow, 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

SpreadpSpread
DocRect PasteboardRect
DocRect PageRect
MILLIPOINT Width
MILLIPOINT Height
MILLIPOINT Margin
MILLIPOINT Bleed
BOOL Dps
BOOL ShowDropShadow

Detailed Description

When executed, this sets up an action to redo/undo a page resize.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/2/95
See also:
OpPageResize

Definition at line 287 of file optspage.h.


Constructor & Destructor Documentation

ActionPageResize::ActionPageResize  ) 
 

ActionPageResize constructor.

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

Definition at line 2000 of file optspage.cpp.

02001 {
02002 }

ActionPageResize::~ActionPageResize  ) 
 

ActionPageResize destructor.

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

Definition at line 2016 of file optspage.cpp.

02017 {
02018 }


Member Function Documentation

ActionCode ActionPageResize::Execute  )  [virtual]
 

Executes the ActionPageResize to go and resize the current spread/page and generates another ActionPageResize to undo this change. Forces a redraw of the parent document for the specified spread.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/2/95
Parameters:
- [INPUTS]
ActionCode indicating if the action was successfully executed or not [OUTPUTS]
Returns:
-

Reimplemented from Action.

Definition at line 2037 of file optspage.cpp.

02038 {
02039     ActionPageResize PageResizeAct;
02040     ActionCode ActCode = AC_FAIL;
02041 
02042 
02043     // Get the details on the present page layout so that we can use this to undo what we
02044     // are about to try and do
02045     MILLIPOINT PageWidth = 0;
02046     MILLIPOINT PageHeight = 0;
02047     MILLIPOINT PageMargin = 0;
02048     MILLIPOINT PageBleed = 0;
02049     BOOL PresentDps = 0;
02050     BOOL PresentDropShadow = 0;
02051         
02052     if (pSpread != NULL)
02053     {
02054         pSpread->GetPageSize(&PageWidth, &PageHeight, &PageMargin, &PageBleed,
02055                                        &PresentDps, &PresentDropShadow);
02056     }
02057 
02058      // Create an action to restore the changes we are about to make
02059     if ((ActCode = ActionPageResize::Init(pOperation,
02060                                             pOppositeActLst,
02061                                             sizeof(ActionPageResize),
02062                                             pSpread,
02063                                             PageWidth,
02064                                             PageHeight,
02065                                             PageMargin,
02066                                             PageBleed,
02067                                             PresentDps,
02068                                             PresentDropShadow,
02069                                             ( Action**)(&PageResizeAct))) != AC_FAIL)
02070     {
02071         // Need to do something here
02072         if (pSpread != NULL)
02073         {
02074             // Save away the current spreads pasteboard rectangle as the specified margin
02075             // may be overridden if the bounding rectangle of the objects on the page would
02076             // not fit into a rectangle encompassing the new page structure and having a
02077             // margin gap around all 4 sides. 
02078             PasteboardRect = pSpread->GetPasteboardRect();
02079 
02080             pSpread->SetPageSize(Width, Height, Margin, Bleed, Dps, ShowDropShadow);
02081 
02082 
02083             // Force all views onto the document to be updated 
02084             Document *pParentDoc = (Document *)pSpread->FindOwnerDoc();
02085             if (pParentDoc != NULL)
02086             {
02087                 pParentDoc->ForceRedraw();
02088 
02089                 BROADCAST_TO_ALL(OptionsChangingMsg(
02090                                                  pParentDoc,
02091                                                  OptionsChangingMsg::NEWPAGESIZE
02092                                                    )
02093                                 );
02094             }
02095         }
02096     }
02097 
02098     return (ActCode);
02099 }

ActionCode ActionPageResize::Init Operation *const   pOp,
ActionList pActionList,
UINT32  ActionSize,
Spread pTheSpread,
MILLIPOINT  NewWidth,
MILLIPOINT  NewHeight,
MILLIPOINT  NewMargin,
MILLIPOINT  NewBleed,
BOOL  NewDps,
BOOL  NewShowDropShadow,
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 ActionSize: The size of the action in bytes. This should be the total size of the action (including any objects pointed to by the action). pSpread: The target spread which will be changed when we are executed Height The new page height required. Width The new page width required. Margin The new page margin required. Bleed The new page bleed required. Dps The new single/double page spread required. ShowPageShadow The new page shadow display state required.
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 an ActionPageResize.

Returns:
Errors: -
See also:
Action::Init; OpPageResize; PageTab::SetNewSizeOfPage;

Definition at line 2153 of file optspage.cpp.

02164 {
02165     ActionCode Ac = (Action::Init(pOp,
02166                                     pActionList,
02167                                     ActionSize,
02168                                     CC_RUNTIME_CLASS(ActionPageResize), 
02169                                     NewAction));
02170     if (*NewAction != NULL)
02171     {
02172         ActionPageResize *ACC = (ActionPageResize*) (*NewAction);
02173         ACC->pSpread  = pTheSpread;
02174         ACC->Width = NewWidth;
02175         ACC->Height = NewHeight;
02176         ACC->Margin = NewMargin;
02177         ACC->Bleed = NewBleed;
02178         ACC->Dps = NewDps;
02179         ACC->ShowDropShadow = NewShowDropShadow;
02180     }
02181 
02182     return (Ac);
02183 }


Member Data Documentation

MILLIPOINT ActionPageResize::Bleed [private]
 

Definition at line 318 of file optspage.h.

BOOL ActionPageResize::Dps [private]
 

Definition at line 319 of file optspage.h.

MILLIPOINT ActionPageResize::Height [private]
 

Definition at line 316 of file optspage.h.

MILLIPOINT ActionPageResize::Margin [private]
 

Definition at line 317 of file optspage.h.

DocRect ActionPageResize::PageRect [private]
 

Definition at line 313 of file optspage.h.

DocRect ActionPageResize::PasteboardRect [private]
 

Definition at line 312 of file optspage.h.

Spread* ActionPageResize::pSpread [private]
 

Definition at line 310 of file optspage.h.

BOOL ActionPageResize::ShowDropShadow [private]
 

Definition at line 320 of file optspage.h.

MILLIPOINT ActionPageResize::Width [private]
 

Definition at line 315 of file optspage.h.


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