OpRemoveClipView Class Reference

Operation to take apart the selected ClipView object. More...

#include <opclip.h>

Inheritance diagram for OpRemoveClipView:

SelOperation UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpRemoveClipView ()
 Constructor.
 ~OpRemoveClipView ()
 Destructor.
virtual void GetOpName (String_256 *pstrOpName)
virtual void Do (OpDescriptor *pOpDesc)
virtual BOOL MayChangeNodeBounds () const

Static Public Member Functions

static BOOL Init ()
static OpState GetState (String_256 *pstrDescription, OpDescriptor *pOpDesc)

Private Member Functions

 CC_DECLARE_DYNCREATE (OpRemoveClipView)

Detailed Description

Operation to take apart the selected ClipView object.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
01 February 2000
NOTE: Should this Op be able to operate on multiple clipview structures?

See also:

Definition at line 177 of file opclip.h.


Constructor & Destructor Documentation

OpRemoveClipView::OpRemoveClipView  ) 
 

Constructor.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
01 February 2000
Returns:
Errors: See also:

Definition at line 505 of file opclip.cpp.

00506 {
00507     // empty.
00508 }

OpRemoveClipView::~OpRemoveClipView  ) 
 

Destructor.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
01 February 2000
Returns:
Errors: See also:

Definition at line 523 of file opclip.cpp.

00524 {
00525     // empty.
00526 }


Member Function Documentation

OpRemoveClipView::CC_DECLARE_DYNCREATE OpRemoveClipView   )  [private]
 

void OpRemoveClipView::Do OpDescriptor pOpDesc  )  [virtual]
 

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
01 February 2000
Parameters:
[INPUTS] 
[OUTPUTS] 
Returns:

Errors: See also:

Reimplemented from Operation.

Definition at line 652 of file opclip.cpp.

00653 {
00654     // try to record the selection state.
00655     if (DoStartSelOp(FALSE, FALSE))
00656     {
00657         // obtain the current selection.
00658         Range Sel(*(GetApplication()->FindSelection()));
00659         RangeControl rc = Sel.GetRangeControlFlags();
00660         rc.PromoteToParent = TRUE;
00661         Sel.Range::SetRangeControl(rc);
00662 
00663         // check that the selection is one lone NodeClipViewController.
00664         BOOL ok = FALSE;
00665         Node* pFirstNode = Sel.FindFirst();
00666         if (pFirstNode != NULL && pFirstNode->IsANodeClipViewController())
00667             if (Sel.FindNext(pFirstNode) == NULL)
00668                 ok = TRUE;
00669 
00670         // remove tool blobs and localise any common attributes.
00671         Tool* pTool = NULL;
00672         Spread* pSpread = NULL;
00673         if (ok)
00674         {
00675             // render blobs off for tools which don't automatically redraw their blobs.
00676             pTool = Tool::GetCurrent();
00677             pSpread = Document::GetSelectedSpread();
00678             if (pSpread != NULL && pTool != NULL && !pTool->AreToolBlobsRenderedOnSelection())
00679                 pTool->RenderToolBlobs(pSpread, NULL);
00680 
00681             // invalidate the region of screen covering the selection.
00682             DoInvalidateNodesRegions(*(GetApplication()->FindSelection()), TRUE, FALSE, FALSE);
00683 
00684             // localise any common attributes.
00685             ok = DoLocaliseCommonAttributes((NodeGroup*)pFirstNode);
00686         }
00687 
00688         // deselect and hide the NCVC.
00689         NodeHidden* pHiddenNode = NULL;
00690         if (ok)
00691         {
00692             // deselect the NCVC, but don't ask for its blobs to be redrawn.
00693             ((NodeRenderable*)pFirstNode)->DeSelect(FALSE);
00694             ERROR3IF(pFirstNode->IsSelected(), "Deselect failed to deselect current node");
00695 
00696             // hide the NodeClipViewController.
00697             ok = DoHideNode(pFirstNode, FALSE, &pHiddenNode, FALSE);
00698             ERROR3IF(!ok, "Unable to hide NodeClipViewController!");
00699         }
00700 
00701         // hide the NCVC's NodeClipView node.
00702         if (ok)
00703         {
00704             NodeHidden* pDummy;
00705             NodeClipView* pClipView = ((NodeClipViewController*)pFirstNode)->GetClipView();
00706             ok = DoHideNode(pClipView, FALSE, &pDummy, FALSE);
00707             ERROR3IF(!ok, "Unable to hide NodeClipView!");
00708         }
00709 
00710         // show and select the NCVC's children.
00711         // a straight loop-over should do, as it should skip the now-hidden NodeClipView.
00712         if (ok)
00713         {
00714             // get the first child node (the NCVC's keyhole node).
00715             Node* pChildNode = pFirstNode->FindFirstChild();
00716             if (pChildNode == NULL)
00717                 TRACEUSER( "Karim", _T("OpRemoveClipView::Do(); Found an empty NodeClipViewController!\n"));
00718 
00719             // move and select the child nodes in turn.
00720             Node* pAnchorNode = pHiddenNode;
00721             Node* pNextChildNode = NULL;
00722             while (pChildNode != NULL)
00723             {
00724                 // get the next child-node.
00725                 pNextChildNode = pChildNode->FindNext();
00726 
00727                 // if the node is not a NodeHidden then move the node to its new location in 
00728                 // the tree - there is no need to render the node.
00729                 if (!pChildNode->IsAnAttribute() && !pChildNode->IsNodeHidden())
00730                 {
00731                     // move pChildNode to be the next-sibling of the anchor node.
00732                     ok = DoMoveNode(pChildNode, pAnchorNode, NEXT);
00733                     if (!ok)
00734                         break;
00735 
00736                     pAnchorNode = pChildNode;
00737                 }
00738 
00739                 // select the child node and invalidate its bounding rect,
00740                 // but don't bother redrawing its blobs yet.
00741                 if (pChildNode->IsAnObject())
00742                 {
00743                     ((NodeRenderableInk*)pChildNode)->Select(FALSE);
00744                     ((NodeRenderableInk*)pChildNode)->InvalidateBoundingRect();
00745                     ok = this->DoInvalidateNodeRegion(((NodeRenderableInk*)pChildNode), TRUE);
00746                     if (!ok)
00747                         break;
00748                 }
00749 
00750                 pChildNode = pNextChildNode;
00751             }
00752         }
00753 
00754         // render blobs back on for tools which don't automatically redraw their blobs.
00755         if (ok)
00756         {
00757             if (pSpread != NULL && pTool != NULL && !pTool->AreToolBlobsRenderedOnSelection())
00758                 pTool->RenderToolBlobs(pSpread, NULL);
00759         }
00760 
00761         // fail gracefully if things went pear-shaped.
00762         else
00763             FailAndExecute();
00764     }
00765 
00766     End();
00767 }           

void OpRemoveClipView::GetOpName String_256 pstrOpName  )  [virtual]
 

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
01 February 2000
Parameters:
[INPUTS] 
[OUTPUTS] 
Returns:

Errors: See also:

Reimplemented from Operation.

Definition at line 631 of file opclip.cpp.

00632 {
00633     *pstrOpName = String_256("Remove ClipView");
00634 }

OpState OpRemoveClipView::GetState String_256 pstrDescription,
OpDescriptor pOpDesc
[static]
 

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
01 February 2000
Parameters:
pstrDescription [INPUTS] pOpDesc
[OUTPUTS] 
Returns:

Errors: See also:

Definition at line 582 of file opclip.cpp.

00583 {
00584     // default is an unticked, ungreyed, *NOT* on-menu state.
00585     OpState OpSt;
00586     OpSt.RemoveFromMenu = TRUE;
00587 
00588     // obtain the app's current selection.
00589     // we want to treat bevels/contours etc. as atomic objects.
00590     Range Sel(*(GetApplication()->FindSelection()));
00591     RangeControl rc = Sel.GetRangeControlFlags();
00592     rc.PromoteToParent = TRUE;
00593     Sel.Range::SetRangeControl(rc);
00594 
00595     // we only show ourself if the selection consists of one lone NodeClipViewController.
00596     Node* pNode = Sel.FindFirst();
00597     if (pNode != NULL && pNode->IsANodeClipViewController())
00598     {
00599         if (Sel.FindNext(pNode) == NULL)
00600         {
00601             OpSt.RemoveFromMenu = FALSE;
00602 
00603             // if it's selected inside, we gray ourself and give a reason.
00604             if (Sel.ContainsSelectInside())
00605             {
00606                 OpSt.Greyed = TRUE;
00607                 *pstrDescription = String_256(_R(IDS_GREY_WHEN_SELECT_INSIDE));
00608             }
00609         }
00610     }
00611 
00612     return OpSt;
00613 }

BOOL OpRemoveClipView::Init void   )  [static]
 

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
01 February 2000
Parameters:
[INPUTS] 
[OUTPUTS] 
Returns:

Errors: See also:

Reimplemented from SimpleCCObject.

Definition at line 544 of file opclip.cpp.

00545 {
00546     return RegisterOpDescriptor(0,                              // Tool ID
00547                                 _R(IDS_REMOVE_CLIPVIEW),                // String resource ID
00548                                 CC_RUNTIME_CLASS(OpRemoveClipView), // Runtime class
00549                                 OPTOKEN_REMOVE_CLIPVIEW,            // Token string
00550                                 OpRemoveClipView::GetState,     // GetState function
00551                                 0,                              // Help ID
00552                                 _R(IDBBL_REMOVE_CLIPVIEW),          // Bubble ID
00553                                 0,                              // Resource ID
00554                                 0,                              // Control ID
00555                                 SYSTEMBAR_ILLEGAL,              // Bar ID
00556                                 TRUE,                           // Receive system messages
00557                                 FALSE,                          // Smart duplicate operation
00558                                 FALSE,                          // Clean operation
00559                                 0,                              // We can have many instances
00560                                                                 //          of this operation.
00561                                 DONT_GREY_WHEN_SELECT_INSIDE);  // We don't ever want to be
00562                                                                 // automatically greyed out.
00563 }

virtual BOOL OpRemoveClipView::MayChangeNodeBounds  )  const [inline, virtual]
 

Reimplemented from SelOperation.

Definition at line 201 of file opclip.h.

00201 { return FALSE; }


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