本文整理汇总了C++中DocView::GetDocViewRect方法的典型用法代码示例。如果您正苦于以下问题:C++ DocView::GetDocViewRect方法的具体用法?C++ DocView::GetDocViewRect怎么用?C++ DocView::GetDocViewRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocView
的用法示例。
在下文中一共展示了DocView::GetDocViewRect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindCentreInsertionPosition
/********************************************************************************************
> BOOL MakeBitmapFilter::FindCentreInsertionPosition(Spread** Spread, DocCoord* Position)
Author: Will_Cowling (Xara Group Ltd) <[email protected]> (from Simon)
Created: 12/6/96
Inputs: -
Outputs: Spread: The spread to place the clipboard objects on
Position:The centre of the view (Spread coords)
Purpose: Finds the centre insertion position for clipboard objects
********************************************************************************************/
BOOL MakeBitmapFilter::FindCentreInsertionPosition(Spread** Spread, DocCoord* Position)
{
// ---------------------------------------------------------------------------------
// Find out which spread is in the centre of the view
// this is the spread that the pasted objects will be placed on
// Obtain the current DocView
DocView* CurDocView = DocView::GetCurrent();
ENSURE(CurDocView != NULL, "The current DocView is NULL");
if (CurDocView == NULL)
return FALSE; // No DocView
// Get the view rect
WorkRect WrkViewRect = CurDocView->GetViewRect();
if (WrkViewRect.IsEmpty() || (!WrkViewRect.IsValid()) )
return FALSE; // Defensive
// Determine the centre of the view
WorkCoord WrkCentreOfView;
WrkCentreOfView.x = WrkViewRect.lox + (WrkViewRect.Width()/2);
WrkCentreOfView.y = WrkViewRect.loy + (WrkViewRect.Height()/2);
// FindEnclosing spread requires an OilCoord
OilCoord OilCentreOfView = WrkCentreOfView.ToOil(CurDocView->GetScrollOffsets());
// Find out which spread to insert the pasteboard objects onto
(*Spread) = CurDocView->FindEnclosingSpread(OilCentreOfView);
if ((*Spread) == NULL)
return FALSE; // There is no spread
// Phew
// ---------------------------------------------------------------------------------
// Now lets find the spread coordinate of the centre of the view
DocRect DocViewRect = CurDocView->GetDocViewRect(*Spread);
if ( DocViewRect.IsEmpty() || (!DocViewRect.IsValid()) )
{
ERROR3("DocViewRect is invalid");
return FALSE; // Defensive
}
// Find the centre of the DocViewRect
DocCoord DocCentreOfView;
DocCentreOfView.x = DocViewRect.lox + (DocViewRect.Width()/2);
DocCentreOfView.y = DocViewRect.loy + (DocViewRect.Height()/2);
// --------------------------------------------------------------------------------
// Now convert from DocCoords to spread coords
DocRect PhysSpreadRect = (*Spread)->GetPasteboardRect();
(*Position).x = DocCentreOfView.x - PhysSpreadRect.lo.x;
(*Position).y = DocCentreOfView.y - PhysSpreadRect.lo.y;
return TRUE;
}