OpZoomFitSelectedDescriptor Class Reference

OpDescriptor for the zoom tool's "Fit to selected" button. More...

#include <zoomops.h>

Inheritance diagram for OpZoomFitSelectedDescriptor:

OpZoomDescriptor OpDescriptor MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpZoomFitSelectedDescriptor ()
 Constructs an OpDescriptor for the "Zoom to selected objects" button.

Protected Member Functions

virtual Spread * GetSpread (DocView *pDocView) const
 Provides the spread that OpZoomDescriptor::HandleButtonMsg will zoom in on.
virtual DocRect GetRect (Spread *pSpread)
 Assuming that some objects are selected, this calculates the bounding rectangle of the selected objects, including blobs.
virtual void AdjustRect (DocRect *pRect) const
 Inflates the given rectangle by the same amount as the selector tool when it draws bounds blobs around the selection. This ensures that after a "Fit to Selected" zoom the bounds blobs of the zoomed object will be visible.

Detailed Description

OpDescriptor for the zoom tool's "Fit to selected" button.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/5/93

Definition at line 488 of file zoomops.h.


Constructor & Destructor Documentation

OpZoomFitSelectedDescriptor::OpZoomFitSelectedDescriptor (   ) 
 

Constructs an OpDescriptor for the "Zoom to selected objects" button.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/5/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
class OpZoomDescriptor

Definition at line 2149 of file zoomops.cpp.

02150   : OpZoomDescriptor(OPTOKEN_ZOOMSELECTED, _R(IDS_ZOOMSELECTEDSTATUSTEXT),
02151                      0, _R(IDBBL_FIT_TO_SELECTED))
02152 {
02153     // Empty.
02154 }


Member Function Documentation

void OpZoomFitSelectedDescriptor::AdjustRect (  DocRect *  pRect  )  const [protected, virtual]
 

Inflates the given rectangle by the same amount as the selector tool when it draws bounds blobs around the selection. This ensures that after a "Fit to Selected" zoom the bounds blobs of the zoomed object will be visible.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/94
Parameters:
pRect pointer to a DocRect to adjust [INPUTS]
The adjusted DocRect. [OUTPUTS]
Returns:
-

Errors: -

See also:
OpZoomFitSelectedDescriptor::GetRect; SelectorTool::InflateByBlobBorder

Reimplemented from OpZoomDescriptor.

Definition at line 2237 of file zoomops.cpp.

02238 {
02239 #ifndef STANDALONE
02240     SelectorTool::InflateByBlobBorder(pRect);
02241 #endif
02242 }

DocRect OpZoomFitSelectedDescriptor::GetRect (  Spread *  pSpread  )  [protected, virtual]
 

Assuming that some objects are selected, this calculates the bounding rectangle of the selected objects, including blobs.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/5/94
Parameters:
pSpread pointer to the spread containing the selection [INPUTS]
- [OUTPUTS]
Returns:
The bounding rectangle of the selected objects.

Errors: ERROR2/3 failure if there isn't any selected objects - if this happens then something is screwy, as SelRange immediately before reported that there are selected objects, or this function wouldn't have been called.

See also:
OpZoomFitSelectedDescriptor::GetSpread; SelRange::GetBlobBoundingRect

Reimplemented from OpZoomDescriptor.

Definition at line 2197 of file zoomops.cpp.

02198 {
02199     // If this function is called then we know that there is a valid selection
02200     // somewhere.
02201     SelRange* pSel = GetApplication()->FindSelection();
02202 
02203     // Doesn't do any harm to check, though!
02204     ERROR3IF(pSel == 0 || pSel->FindFirst() == 0,
02205                 "Can't find a selected node in OpZoomFitSelectedDescriptor::GetRect");
02206     ERROR3IF(pSpread != pSel->FindFirst()->FindParent(CC_RUNTIME_CLASS(Spread)),
02207                 "Spread pointer has changed between calls on SelRange");
02208     
02209     // We really need to call the equivalent of GetUnionBlobBoundingRect() for the SelRange,
02210     // but this function doesn't exist, so we mimic its result here.
02211     DocRect drSel = pSel->GetBlobBoundingRect().Union(pSel->GetBoundingRect());
02212 
02213     // And convert it into document coordinates
02214     pSpread->SpreadCoordToDocCoord(&drSel);
02215 
02216     // Return the bounding rectangle of the selection in "proper" document coordinates.
02217     return drSel;
02218 }

Spread * OpZoomFitSelectedDescriptor::GetSpread (  DocView *  pDocView  )  const [protected, virtual]
 

Provides the spread that OpZoomDescriptor::HandleButtonMsg will zoom in on.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/5/94
Parameters:
pDocView pointer to a DocView showing selected objects [INPUTS]
- [OUTPUTS]
Returns:
A pointer to the first spread within the viewed document that contains selected objects.

Errors: -

See also:
OpZoomDescriptor::HandleButtonMsg; DocView::GetFirstSelectedSpread

Reimplemented from OpZoomDescriptor.

Definition at line 2173 of file zoomops.cpp.

02174 {
02175     return pDocView->GetFirstSelectedSpread();
02176 }


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