OpDragStoryIndent Class Reference

This is the operation that is used to drag the indent position along the path the text story is on. More...

#include <textops.h>

Inheritance diagram for OpDragStoryIndent:

OpTextUndoable SelOperation UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject OpDragStoryNonPathIndent OpDragStoryPathIndent OpDragStoryNonPathLeftIndent OpDragStoryNonPathRightIndent OpDragStoryPathLeftIndent OpDragStoryPathRightIndent List of all members.

Public Member Functions

 OpDragStoryIndent ()
 Constructor - inits member variables.
 ~OpDragStoryIndent ()
 Destructor.
BOOL DoDrag (DocCoord Anchor, Spread *pSpread, ClickModifiers ClickMods, TextStory *pStory)
 Starts a drag operation to move the path indent position for a text story.
virtual void DragPointerMove (DocCoord PointerPos, ClickModifiers ClickMods, Spread *pSpread, BOOL bSolidDrag)
 Starts a drag operation to move the path indent position for a text story.
virtual void DragFinished (DocCoord PointerPos, ClickModifiers ClickMods, Spread *pSpread, BOOL Success, BOOL bSolidDrag)
 Completes the drag operation, stores the new path indent in the story.
virtual void RenderDragBlobs (DocRect, Spread *, BOOL bSolidDrag)
 Renders the EOR drag blobs, either putting them on or taking them off. Also renders the story's object blobs.

Static Public Member Functions

static OpState GetState (String_256 *Description, OpDescriptor *)
 Get state function. Never ticked, Never greyed.

Protected Member Functions

virtual DocCoord GetOtherIndent ()=0
virtual DocCoord GetThisIndent ()=0
virtual BOOL DoIndentChange ()=0
virtual DocCoord InternalConstrain (DocCoord Current, ClickModifiers ClickMods)=0
virtual BOOL SetCurrentPos (DocCoord MousePos, ClickModifiers ClickMods)=0
void RenderDraggingBlobs (DocRect, Spread *)
 Renders the EOR drag blob for the margin being dragged.
BOOL GetLeftHandLength (MILLIPOINT *pResult)
 Gets the length along the path from the start of the path to the current pos.
BOOL GetRightHandLength (MILLIPOINT *pResult)
 Gets the length along the path from the end of the path to the current pos.

Static Protected Member Functions

static BOOL GetLeftHandLength (DocCoord Coord, NodePath *pPath, MILLIPOINT *pResult)
 Gets the length along the path from the start of the path to the given point.
static BOOL GetRightHandLength (DocCoord Coord, NodePath *pPath, MILLIPOINT *pResult)
 Gets the length along the path from the end of the path to the given point.

Protected Attributes

DocCoord mStartPoint
DocCoord mCurrentBlobPos
SpreadmpStartSpread
TextStorympDragStory
NodePathmpStoryPath

Private Member Functions

 CC_DECLARE_DYNAMIC (OpDragStoryIndent)

Detailed Description

This is the operation that is used to drag the indent position along the path the text story is on.

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

Definition at line 785 of file textops.h.


Constructor & Destructor Documentation

OpDragStoryIndent::OpDragStoryIndent  ) 
 

Constructor - inits member variables.

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

Definition at line 4968 of file textops.cpp.

04969 {
04970     mpStartSpread = NULL;
04971     mpDragStory = NULL;
04972     mpStoryPath = NULL;
04973 }

OpDragStoryIndent::~OpDragStoryIndent  ) 
 

Destructor.

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

Definition at line 4984 of file textops.cpp.

04985 {
04986 
04987 }


Member Function Documentation

OpDragStoryIndent::CC_DECLARE_DYNAMIC OpDragStoryIndent   )  [private]
 

BOOL OpDragStoryIndent::DoDrag DocCoord  Anchor,
Spread pSpread,
ClickModifiers  ClickMods,
TextStory pStory
 

Starts a drag operation to move the path indent position for a text story.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/95
Parameters:
Anchor - the start point of the drag [INPUTS] pSpread - the spread Anchor is on ClickMods - the click modifiers at the start of the drag pStory - pointer to the text story to edit.
Returns:
TRUE if the drag started ok, FALSE if an error occured

Definition at line 5019 of file textops.cpp.

05020 {
05021     ERROR2IF((pSpread == NULL) || (pStory == NULL), FALSE, "NULL entry param");
05022     ERROR3IF(pSpread != pStory->FindParentSpread(), "Spread pointer didn't point to the spread the story was on. Is this bad?");
05023     BOOL ok = TRUE;
05024 
05025     // Record the initial parameters for later use
05026     mStartPoint = Anchor;
05027     mpStartSpread = pSpread;
05028     mpDragStory = pStory;
05029     mpStoryPath = pStory->GetTextPath();
05030 
05031     // Get the initial indent along the line
05032     if (ok)
05033     {
05034         SetCurrentPos(mStartPoint, ClickMods);
05035         mStartPoint = mCurrentBlobPos;
05036     }
05037 
05038     // Put the drag blobs on for the first time
05039     DocRect Empty;
05040     Empty.MakeEmpty();
05041     RenderDragBlobs(Empty, mpStartSpread, FALSE);
05042     
05043     // Start the drag going
05044     if (ok)
05045         ok = StartDrag( DRAGTYPE_AUTOSCROLL );
05046 
05047     return ok;
05048 }

virtual BOOL OpDragStoryIndent::DoIndentChange  )  [protected, pure virtual]
 

Implemented in OpDragStoryPathLeftIndent, OpDragStoryPathRightIndent, OpDragStoryNonPathLeftIndent, and OpDragStoryNonPathRightIndent.

void OpDragStoryIndent::DragFinished DocCoord  PointerPos,
ClickModifiers  ClickMods,
Spread pSpread,
BOOL  Success,
BOOL  bSolidDrag
[virtual]
 

Completes the drag operation, stores the new path indent in the story.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/95
Parameters:
PointerPos - the mouse position at the end of the drag [INPUTS] ClickMods - the current click modifiers pSpread - the spread the mouse position is on Success - FALSE if the drag was aborted by the user

Reimplemented from Operation.

Definition at line 5105 of file textops.cpp.

05106 {
05107     BOOL ok = TRUE;
05108 
05109     // Take the drag blob off
05110     DocRect Empty;
05111     Empty.MakeEmpty();
05112     RenderDragBlobs(Empty, mpStartSpread, bSolidDrag);
05113 
05114     BeginSlowJob();
05115     EndDrag();
05116 
05117     if (Success)
05118     {
05119         if (ok)
05120             ok = DoStartTextOp(mpDragStory, TRUE, TRUE);
05121 
05122         // Ask the story if it minds being altered (also does reformatting for us)
05123         if (ok)
05124         {
05125             ObjChangeParam ObjInsert(OBJCHANGE_STARTING, ObjChangeFlags(), NULL, this);
05126             ok = mpDragStory->AllowOp(&ObjInsert);
05127         }
05128 
05129         // Store the current indent in undo history
05130         if (ok)
05131             ok = StorePathIndentAction::DoStoreIndent(this, &UndoActions, mpDragStory);
05132 
05133         if (ok)
05134             ok = DoIndentChange();
05135 
05136         GetApplication()->FindSelection()->Update();
05137 
05138         // Tell the story we have finished fiddling with it (reformats for us)
05139         if (ok)
05140         {
05141             ObjChangeParam ObjChange(OBJCHANGE_FINISHED, ObjChangeFlags(), NULL, this);
05142             ok = UpdateChangedNodes(&ObjChange);
05143         }
05144     }
05145         
05146     if (!ok)
05147         FailAndExecute();
05148     
05149     End();
05150 }

void OpDragStoryIndent::DragPointerMove DocCoord  PointerPos,
ClickModifiers  ClickMods,
Spread pSpread,
BOOL  bSolidDrag
[virtual]
 

Starts a drag operation to move the path indent position for a text story.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/95
Parameters:
PointerPos - the new mouse position [INPUTS] ClickMods - the current click modifiers pSpread - the spread the mouse position is on

Reimplemented from Operation.

Definition at line 5061 of file textops.cpp.

05062 {
05063     // Salary check
05064     if ((mpStartSpread == NULL) || (mpDragStory == NULL))
05065     {
05066         ERROR3("A pointer was NULL");
05067         return;
05068     }
05069 
05070     // If drag has moved onto a different spread, convert the coord to be relative to the original spread.
05071     if (pSpread != mpStartSpread)
05072         PointerPos = MakeRelativeToSpread(mpStartSpread, pSpread, PointerPos);
05073 
05074     // Take the previous blobs off
05075     DocRect Empty;
05076     Empty.MakeEmpty();
05077     RenderDraggingBlobs(Empty, mpStartSpread);
05078 
05079     // Get the new distance along the path
05080     SetCurrentPos(PointerPos, ClickMods);
05081 
05082     // Put the blob back on
05083     RenderDraggingBlobs(Empty, mpStartSpread);
05084 
05085     // Set the status line to be helpful
05086     if (mpStoryPath==NULL)
05087     {
05088         String_256 HelpString(_R(IDS_TEXTTOOL_DRAGSTORYHANDLE));
05089         GetApplication()->UpdateStatusBarText(&HelpString);
05090     }
05091 }

BOOL OpDragStoryIndent::GetLeftHandLength MILLIPOINT pResult  )  [protected]
 

Gets the length along the path from the start of the path to the current pos.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/9/96
Parameters:
- [INPUTS]
pResult - Length along the path from the start [OUTPUTS]
Returns:
TRUE/FALSE for success/failure

Definition at line 5227 of file textops.cpp.

05228 {
05229     return GetLeftHandLength(mCurrentBlobPos, mpStoryPath, pResult);
05230 }

BOOL OpDragStoryIndent::GetLeftHandLength DocCoord  Coord,
NodePath pPath,
MILLIPOINT pResult
[static, protected]
 

Gets the length along the path from the start of the path to the given point.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/9/96
Parameters:
Coord - coord of point [INPUTS] pPath - pointer to a path
pResult - Length along the path from the start to Coord [OUTPUTS]
Returns:
TRUE/FALSE for success/failure

Definition at line 5262 of file textops.cpp.

05263 {
05264     ERROR2IF(pResult==NULL, FALSE, "NULL output parameter");
05265     *pResult = 0;
05266     ERROR2IF(pPath==NULL, FALSE, "NULL path pointer");
05267 
05268     return pPath->InkPath.GetDistanceToPoint(Coord, pResult);
05269 }

virtual DocCoord OpDragStoryIndent::GetOtherIndent  )  [protected, pure virtual]
 

Implemented in OpDragStoryPathLeftIndent, OpDragStoryPathRightIndent, OpDragStoryNonPathLeftIndent, and OpDragStoryNonPathRightIndent.

BOOL OpDragStoryIndent::GetRightHandLength MILLIPOINT pResult  )  [protected]
 

Gets the length along the path from the end of the path to the current pos.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/9/96
Parameters:
- [INPUTS]
TRUE/FALSE for success/failure [OUTPUTS]
Returns:
Length along the path from the end

Definition at line 5244 of file textops.cpp.

05245 {
05246     return GetRightHandLength(mCurrentBlobPos, mpStoryPath, pResult);
05247 }

BOOL OpDragStoryIndent::GetRightHandLength DocCoord  Coord,
NodePath pPath,
MILLIPOINT pResult
[static, protected]
 

Gets the length along the path from the end of the path to the given point.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/9/96
Parameters:
Coord - coord of point [INPUTS] pPath - pointer to a path
pResult - Length along the path from the end to Coord [OUTPUTS]
Returns:
TRUE/FALSE for success/failure

Definition at line 5284 of file textops.cpp.

05285 {
05286     ERROR2IF(pResult==NULL, FALSE, "NULL output parameter");
05287     *pResult = 0;
05288     ERROR2IF(pPath==NULL, FALSE, "NULL path pointer");
05289 
05290     // Get the length of the whole path
05291     MILLIPOINT TotalLength = (MILLIPOINT)(pPath->InkPath.GetPathLength());
05292 
05293     // Get the distance from the start of the path to where the drag ended
05294     MILLIPOINT Distance = 0;
05295     BOOL ok = pPath->InkPath.GetDistanceToPoint(Coord, &Distance);
05296 
05297     *pResult = TotalLength - Distance;
05298         
05299     return ok;
05300 }

OpState OpDragStoryIndent::GetState String_256 Description,
OpDescriptor
[static]
 

Get state function. Never ticked, Never greyed.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/95
Parameters:
unused [INPUTS]
Returns:
Current state of the operation

Definition at line 5000 of file textops.cpp.

05001 {
05002     OpState apple;
05003     return apple;
05004 }

virtual DocCoord OpDragStoryIndent::GetThisIndent  )  [protected, pure virtual]
 

Implemented in OpDragStoryPathLeftIndent, OpDragStoryPathRightIndent, OpDragStoryNonPathLeftIndent, and OpDragStoryNonPathRightIndent.

virtual DocCoord OpDragStoryIndent::InternalConstrain DocCoord  Current,
ClickModifiers  ClickMods
[protected, pure virtual]
 

Implemented in OpDragStoryPathLeftIndent, OpDragStoryPathRightIndent, and OpDragStoryNonPathIndent.

void OpDragStoryIndent::RenderDragBlobs DocRect  ClipRect,
Spread pSpread,
BOOL  bSolidDrag
[virtual]
 

Renders the EOR drag blobs, either putting them on or taking them off. Also renders the story's object blobs.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/95
Parameters:
ClipRect - a clipping rectangle [INPUTS] pSpread - the spread to render on

Reimplemented from Operation.

Definition at line 5163 of file textops.cpp.

05164 {
05165     DocCoord OtherIndent = GetOtherIndent();
05166         
05167     if (ClipRect.IsEmpty())
05168         TextToolBlobPosList::RenderBlob(pSpread, NULL, OtherIndent);
05169     else
05170         TextToolBlobPosList::RenderBlob(pSpread, &ClipRect, OtherIndent);
05171 
05172     RenderDraggingBlobs(ClipRect, pSpread);
05173 }

void OpDragStoryIndent::RenderDraggingBlobs DocRect  ClipRect,
Spread pSpread
[protected]
 

Renders the EOR drag blob for the margin being dragged.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/95
Parameters:
ClipRect - a clipping rectangle [INPUTS] pSpread - the spread to render on
- [OUTPUTS]
Returns:
-

Definition at line 5187 of file textops.cpp.

05188 {
05189     if (ClipRect.IsEmpty())
05190         TextToolBlobPosList::RenderBlob(pSpread, NULL, mCurrentBlobPos);
05191     else
05192         TextToolBlobPosList::RenderBlob(pSpread, &ClipRect, mCurrentBlobPos);
05193 
05194     // Render a line connecting the blobs if not on a path
05195     if (mpStoryPath==NULL)
05196     {
05197         DocRect* pClipper = &ClipRect;
05198         if (ClipRect.IsEmpty())
05199             pClipper = NULL;
05200     
05201         RenderRegion* pRegion = DocView::RenderOnTop(pClipper, pSpread, ClippedEOR);
05202         while (pRegion != NULL)
05203         {
05204             // Draw a Cross Hair
05205             pRegion->SetLineColour(COLOUR_XOREDIT);
05206             pRegion->SetFillColour(COLOUR_TRANS);
05207             pRegion->DrawLine(mCurrentBlobPos, GetOtherIndent());
05208 
05209             // Get the next region in the list
05210             pRegion = DocView::GetNextOnTop(pClipper);
05211         }
05212     }
05213 }

virtual BOOL OpDragStoryIndent::SetCurrentPos DocCoord  MousePos,
ClickModifiers  ClickMods
[protected, pure virtual]
 

Implemented in OpDragStoryPathIndent, and OpDragStoryNonPathIndent.


Member Data Documentation

DocCoord OpDragStoryIndent::mCurrentBlobPos [protected]
 

Definition at line 823 of file textops.h.

TextStory* OpDragStoryIndent::mpDragStory [protected]
 

Definition at line 825 of file textops.h.

Spread* OpDragStoryIndent::mpStartSpread [protected]
 

Definition at line 824 of file textops.h.

NodePath* OpDragStoryIndent::mpStoryPath [protected]
 

Definition at line 826 of file textops.h.

DocCoord OpDragStoryIndent::mStartPoint [protected]
 

Definition at line 822 of file textops.h.


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