本文整理汇总了C++中Page::IsKindOf方法的典型用法代码示例。如果您正苦于以下问题:C++ Page::IsKindOf方法的具体用法?C++ Page::IsKindOf怎么用?C++ Page::IsKindOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::IsKindOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InsertBitmapIntoDocument
/********************************************************************************************
> BOOL MakeBitmapFilter::InsertBitmapIntoDocument(UndoableOperation *pOp, KernelBitmap* KernelBmp, Document* DestDoc)
Author: Will_Cowling (Xara Group Ltd) <[email protected]>
Created: 11/6/96
Purpose: Exports the current selection as a bitmap, via the virtual fns of the
inherited class.
Returns: TRUE if worked, FALSE if failed.
SeeAlso: GetExportOptions; PrepareToExport; ExportRenderNodes; CleanUpAfterExport;
********************************************************************************************/
BOOL MakeBitmapFilter::InsertBitmapIntoDocument(UndoableOperation *pOp, KernelBitmap* KernelBmp, Document* DestDoc)
{
Spread *pSpread;
DocCoord Origin;
// Remember the selection rect, before we change it
DocRect SelRect = GetApplication()->FindSelection()->GetBoundingRect();
// For now, position Draw objects on 1st page of spread 1
PORTNOTE("spread", "Multi-spread warning!")
pSpread = GetFirstSpread(DestDoc);
Page *pPage = (Page *) pSpread->FindFirstPageInSpread();
ERROR3IF(!pPage->IsKindOf(CC_RUNTIME_CLASS(Page)),
"MakeBitmapFilter::InsertBitmapIntoDocument: Could not find first Page");
// Use bottom left of page as origin
DocRect PageRect = pPage->GetPageRect();
Origin.x = PageRect.lo.x;
Origin.y = PageRect.hi.y;
// Get a new NodeBitmap object to import into.
NodeBitmap *pNodeBitmap = new NodeBitmap;
if ((pNodeBitmap == NULL) || (!pNodeBitmap->SetUpPath(12,12)))
return FALSE;
// Attach the Imported Bitmap to our Node
pNodeBitmap->GetBitmapRef()->Attach(KernelBmp, DestDoc); //GetDocument());
if (pNodeBitmap->GetBitmap() != KernelBmp)
delete KernelBmp; // It didn't use the bitmap we gave it, so we can delete it
// Import worked - try to add the bitmap object into the tree.
// First, set the rectangle to the right size for the bitmap...
BitmapInfo Info;
pNodeBitmap->GetBitmap()->ActualBitmap->GetInfo(&Info);
DocRect BoundsRect;
BoundsRect.lo = Origin;
BoundsRect.hi.x = BoundsRect.lo.x + Info.RecommendedWidth;
BoundsRect.hi.y = BoundsRect.lo.y + Info.RecommendedHeight;
// And set this in our bitmap node
pNodeBitmap->CreateShape(BoundsRect);
// Make sure that there is a layer to put the bitmap onto
if (!MakeSureLayerExists(DestDoc))
{
// There is no layer and one could not be made, so we will have to fail
delete pNodeBitmap;
return FALSE;
}
// Set the default attrs
// This MUST be done before the NodeBitmap is Inserted into the tree
if (!pNodeBitmap->ApplyDefaultBitmapAttrs(pOp))
return FALSE;
// Insert the node, but don't invalidate its region
if (!pOp->DoInsertNewNode(pNodeBitmap, pSpread, FALSE))
{
// It didn't work - delete the sub-tree we just created, and report error.
delete pNodeBitmap;
return FALSE;
}
// bitmap is currently positioned so its bottom left hand
// corner is at the top left of the page
// By default we'll move it down so the top-left of the bitmap is on the top-left of the page
INT32 XTranslate = 0;
INT32 YTranslate = -Info.RecommendedHeight;
ClickModifiers ClickMods = ClickModifiers::GetClickModifiers();
if (ClickMods.Adjust && !SelRect.IsEmpty())
{
// If shift is down, then we'll try and place the bitmap exactly on top of the selection
DocCoord SelectionCentre(SelRect.lo.x + (SelRect.Width()/2), SelRect.lo.y + (SelRect.Height()/2));
XTranslate = SelectionCentre.x - Origin.x - (Info.RecommendedWidth/2);
YTranslate = SelectionCentre.y - Origin.y - (Info.RecommendedHeight/2);
}
else
{
// Otherwise we'll try and centre it within the current view
Spread* pCurrentSpread;
DocCoord ViewCentre;
if (FindCentreInsertionPosition(&pCurrentSpread, &ViewCentre))
//.........这里部分代码省略.........
示例2: Sel
void BitmapEffectAtom::Test2(UndoableOperation * Op)
{
BOOL CarryOn=TRUE;
Range Sel(*(GetApplication()->FindSelection()));
Node* FirstSelectedNode = Sel.FindFirst();
if (FirstSelectedNode != NULL) // No nodes selected so End
{
Node* CurrentNode = FirstSelectedNode;
Node* NextCurrent;
// Do all bitmaps
while ((CurrentNode != NULL) && CarryOn)
{
NextCurrent = Sel.FindNext(CurrentNode);
if ( (CurrentNode->IsSelected()) && (CurrentNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeBitmap)) )
{
KernelBitmap * pBitmap = ((NodeBitmap *)(CurrentNode))->GetBitmap();
BitmapInfo BMInfo;
UINT32 bpp;
pBitmap->ActualBitmap->GetInfo(&BMInfo);
bpp=BMInfo.PixelDepth;
TRACEUSER( "Alex", _T("Bitmap found %d bpp\n"),bpp);
if ((bpp==32) || TRUE)
{
CarryOn = FALSE;
NodeBitmap *pNodeBitmap = new NodeBitmap;
if ((pNodeBitmap == NULL) || (!pNodeBitmap->SetUpPath(12,12)))
return;
Spread *pSpread;
DocCoord Origin;
// For now, position Draw objects on 1st page of spread 1
Node *pNode = (Document::GetSelected())->GetFirstNode()->FindNext()->FindFirstChild();
while ((pNode != NULL) && (!pNode->IsKindOf(CC_RUNTIME_CLASS(Chapter))))
pNode = pNode->FindNext();
ENSURE(pNode->IsKindOf(CC_RUNTIME_CLASS(Chapter)),
"Filter::GetFirstSpread(): Could not find Chapter");
Chapter *pChapter = (Chapter *) pNode;
// pSpread is a child of pChapter
pSpread = (Spread *) pChapter->FindFirstChild();
ENSURE(pSpread->IsKindOf(CC_RUNTIME_CLASS(Spread)),
"Filter::GetFirstSpread(): Could not find Spread");
Page *pPage = (Page *) pSpread->FindFirstPageInSpread();
ENSURE(pPage->IsKindOf(CC_RUNTIME_CLASS(Page)),
"BaseBitmapFilter::DoImport(): Could not find first Page");
// Use bottom left of page as origin
DocRect PageRect = pPage->GetPageRect();
Origin = PageRect.lo;
KernelBitmap* kb = new KernelBitmap(BMInfo.PixelWidth,BMInfo.PixelHeight,32,100);
// Get a new bitmap object for this node.
pNodeBitmap->GetBitmapRef()->Attach(kb);
if (pNodeBitmap->GetBitmap() != kb)
{
// It didn't use the bitmap we gave it, so we can delete it
delete kb;
}
ENSURE(pNodeBitmap->GetBitmap()->ActualBitmap != NULL, "No bitmap object found!");
// Import worked - try to add the bitmap object into the tree.
// First, set the rectangle to the right size for the bitmap...
BitmapInfo Info;
pNodeBitmap->GetBitmap()->ActualBitmap->GetInfo(&Info);
DocRect BoundsRect;
BoundsRect.lo = Origin;
BoundsRect.hi.x = BoundsRect.lo.x + Info.RecommendedWidth;
BoundsRect.hi.y = BoundsRect.lo.y + Info.RecommendedHeight;
// And set this in our bitmap node
pNodeBitmap->CreateShape(BoundsRect);
// Apply some default attrs for the bitmap
// This Must be done before the NodeBitmap is inserted into the tree
if (!pNodeBitmap->ApplyDefaultBitmapAttrs(Op))
{
return;
}
// Insert the node, but don't invalidate its region
if (!Op->DoInsertNewNode(pNodeBitmap, pSpread, FALSE))
{
// It didn't work - delete the sub-tree we just created, and report error.
delete pNodeBitmap;
return;
}
// Invalidate the region
Op->DoInvalidateNodeRegion(pNodeBitmap, TRUE, FALSE);
//.........这里部分代码省略.........