OpConvertPathToShapes Class Reference

This creates objects out of the paths of the selected objects. More...

#include <opcntr.h>

Inheritance diagram for OpConvertPathToShapes:

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

Public Member Functions

 OpConvertPathToShapes ()
 ~OpConvertPathToShapes ()
virtual void Do (OpDescriptor *)
 Does the operation.
virtual void GetOpName (String_256 *OpName)
 Gets the op's name.
virtual BOOL MayChangeNodeBounds () const

Static Public Member Functions

static BOOL Declare ()
 Adds the operation to the list of all known operations.
static OpState GetState (String_256 *Description, OpDescriptor *)
 Gets the state of the operation.
static BOOL ConvertPathToShapes (OpConvertPathToShapes *pOp, NodeRenderableInk *pInk)
 Does the convert.
static BOOL AdjustStrokeAndFillAttrs (OpConvertPathToShapes *pOp, NodePath *pNewNode, NodeRenderableInk *pCreatedByNode=NULL, CCAttrMap *pAttrMap=NULL)
 This is only of use for ink nodes that had a variable width stroke attribute applied to them. In this case we wish to take the old stroke colour and make it into a new fill colour for pNewNode. We also wish to apply a transparent stroke colour.

Static Protected Member Functions

static BOOL ConvertBrush (OpConvertPathToShapes *pOp, AttrBrushType *pAttrBrush, NodeRenderableInk *pInk)
 To convert nodes with a brush attribute applied to them. Note that this ONLY works for single nodes, compound nodes are dealt with in the main Convert function as there are many different possible permutations.
static BOOL ConvertStroke (OpConvertPathToShapes *pOp, AttrStrokeType *pStroke, NodeRenderableInk *pInk)
 To convert nodes with a stroke attribute applied to them. Note that this ONLY works for single nodes, compound nodes are dealt with in the main Convert function as there are many different possible permutations. Note that this function assumes that there is also an AttrVariableWidth applied to pInk, if there is not then your stroke attr just won't do anything.

Private Member Functions

 CC_DECLARE_DYNCREATE (OpConvertPathToShapes)

Detailed Description

This creates objects out of the paths of the selected objects.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000

Definition at line 778 of file opcntr.h.


Constructor & Destructor Documentation

OpConvertPathToShapes::OpConvertPathToShapes  )  [inline]
 

Definition at line 784 of file opcntr.h.

00784 {}

OpConvertPathToShapes::~OpConvertPathToShapes  )  [inline]
 

Definition at line 785 of file opcntr.h.

00785 {}


Member Function Documentation

BOOL OpConvertPathToShapes::AdjustStrokeAndFillAttrs OpConvertPathToShapes pOp,
NodePath pNewNode,
NodeRenderableInk pCreatedByNode = NULL,
CCAttrMap pAttrMap = NULL
[static]
 

This is only of use for ink nodes that had a variable width stroke attribute applied to them. In this case we wish to take the old stroke colour and make it into a new fill colour for pNewNode. We also wish to apply a transparent stroke colour.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/11/2000
Parameters:
pNewNode - the newpath node that we have inserted into the tree [INPUTS] pCreatedByNode - the original node that created pNewNode, can be null pAttrMap - if pCreatedByNode is not supplied then an attrmap of the creator node must be supplied
Returns:
TRUE for success, FALSE for failure

Definition at line 4515 of file opcntr.cpp.

04519 {
04520     ERROR2IF(pNewNode == NULL, FALSE, "New node is NULL in OpConvertPathToShapes::AdjustStrokeAndFillAttrs");
04521     ERROR2IF(pCreatedByNode == NULL && pAttrMap == NULL, FALSE, "Both parent node and attrmap are NULL in OpConvertPathToShapes::AdjustStrokeAndFillAttrs");
04522 
04523     pNewNode->InkPath.IsFilled = TRUE;
04524     pNewNode->InkPath.IsStroked = TRUE;
04525     pNewNode->InkPath.InitialiseFlags();    
04526 
04527     // we need to get the stroke colour of our original object
04528     AttrStrokeColour * pColour = NULL;
04529 
04530     // look up this attribute
04531     if (pCreatedByNode)
04532     {
04533         pCreatedByNode->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrStrokeColour), 
04534             (NodeAttribute **)(&pColour));
04535     }
04536     else
04537     {
04538         pAttrMap->Lookup(CC_RUNTIME_CLASS(AttrStrokeColour), (void*&)pColour);
04539     }
04540 
04541     // make a new flat fill attribute and apply this to the node
04542     if (pColour)
04543     {
04544         StrokeColourAttribute * pAttrVal = (StrokeColourAttribute *)pColour->GetAttributeValue();
04545 
04546         if (pAttrVal)
04547         {
04548             AttrFlatColourFill *pFill = NULL;
04549             ALLOC_WITH_FAIL(pFill, new AttrFlatColourFill(pNewNode, FIRSTCHILD), pOp);
04550             
04551             if (pFill)
04552                 pFill->SetStartColour(&(pAttrVal->Colour));
04553         }
04554     }
04555     else
04556         ERROR3("Unable to find stroke colour in OpConvertPathToShapes::AdjustStrokeAndFillAttrs");
04557 
04558     // If we've got a current fill transparency then leave it alone
04559     AttrFillGeometry* pTranspFill = NULL;
04560     if (pCreatedByNode)
04561     {
04562         pCreatedByNode->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrTranspFillGeometry), (NodeAttribute**)&pTranspFill);
04563     }
04564     else
04565     {
04566         pAttrMap->Lookup(CC_RUNTIME_CLASS(AttrTranspFillGeometry), (void*&)pTranspFill);
04567     }
04568     if (pTranspFill && !pTranspFill->IsAFlatFill())
04569     {
04570         Node* pNewTranspFill = NULL;
04571         ALLOC_WITH_FAIL(pNewTranspFill, pTranspFill->PublicCopy(), pOp);
04572         if (pNewTranspFill)
04573         {
04574             pNewTranspFill->AttachNode(pNewNode, FIRSTCHILD);
04575         }
04576     }
04577     else
04578     {
04579         // if we've got a current stroke transparency then lets convert this to a fill transparency
04580         AttrStrokeTransp* pTransp = NULL;
04581         if (pCreatedByNode)
04582         {
04583             pCreatedByNode->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrStrokeTransp), (NodeAttribute**)&pTransp);
04584         }
04585         else
04586         {
04587             pAttrMap->Lookup(CC_RUNTIME_CLASS(AttrStrokeTransp), (void*&)pTransp);
04588         }
04589         if (pTransp)
04590         {
04591             // make a flatfill transp and apply it
04592             AttrFlatTranspFill* pTranspFill = NULL;
04593             ALLOC_WITH_FAIL(pTranspFill, new AttrFlatTranspFill(pNewNode, FIRSTCHILD), pOp);
04594 
04595             if (pTranspFill)
04596             {
04597                 pTranspFill->SetStartTransp(&pTransp->Value.Transp);
04598                 pTranspFill->SetTranspType(pTransp->Value.TranspType);
04599             }
04600         }
04601     }
04602     
04603     // apply a transparent line colour
04604     AttrStrokeColour * pTranspAttr = NULL;
04605     ALLOC_WITH_FAIL(pTranspAttr, new AttrStrokeColour(pNewNode, FIRSTCHILD), pOp);
04606     if (pTranspAttr)
04607     {
04608         StrokeColourAttribute * pTranspVal = (StrokeColourAttribute *)pTranspAttr->GetAttributeValue();
04609         pTranspVal->Colour = DocColour(COLOUR_NONE);
04610     }
04611 
04612     // apply a line width
04613     AttrLineWidth* pLineWidth = NULL;
04614     ALLOC_WITH_FAIL(pLineWidth, new AttrLineWidth(pNewNode, FIRSTCHILD), pOp);
04615     if (pLineWidth)
04616         pLineWidth->Value.LineWidth = 500;
04617 
04618     AttrWindingRule * pWindingRule = NULL;
04619     ALLOC_WITH_FAIL(pWindingRule, new AttrWindingRule(pNewNode, LASTCHILD), pOp);
04620 
04621     if (pWindingRule)
04622         pWindingRule->Value.WindingRule = NegativeWinding;
04623 
04624     return TRUE;
04625 }

OpConvertPathToShapes::CC_DECLARE_DYNCREATE OpConvertPathToShapes   )  [private]
 

BOOL OpConvertPathToShapes::ConvertBrush OpConvertPathToShapes pOp,
AttrBrushType pAttrBrush,
NodeRenderableInk pInk
[static, protected]
 

To convert nodes with a brush attribute applied to them. Note that this ONLY works for single nodes, compound nodes are dealt with in the main Convert function as there are many different possible permutations.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/11/2000
Parameters:
pAttrBrush - the brush attribute that is applied to the node we wish to convert [INPUTS] pInk - the node we wish to convert
Returns:
TRUE for success, FALSE for failure

Definition at line 4370 of file opcntr.cpp.

04371 {
04372     ERROR2IF(pAttrBrush == NULL || pInk == NULL, FALSE, "Inputs are NULL to OpConvertPathToShapes::ConvertBrush");
04373     
04374     if (pInk->IsCompound())
04375     {
04376         ERROR3("Attempting to convert brush on a compound node when we really shouldn't be");
04377         return FALSE;
04378     }
04379 
04380     PathProcessorBrush* pPPB = pAttrBrush->GetPathProcessor();
04381     if (pPPB == NULL)
04382     {
04383         ERROR3("Brush has no path processor in OpConvertPathToShapes::ConvertBrush");
04384         return FALSE;
04385     }
04386 
04387     // Fairly simple, as we let the attributes becomea function do the work
04388     pInk->ReleaseCached();                      // This call is associated with the DoInvalidateRegion call below
04389                                                 // but must be called before pInk is removed from the tree
04390     pInk->SetSelected(FALSE);
04391     BecomeA BecomeAPath(BECOMEA_REPLACE,CC_RUNTIME_CLASS(NodePath), pOp, FALSE);
04392     BOOL Retval = pAttrBrush->DoBecomeA(&BecomeAPath, pInk);
04393 
04394     // If DoBecomeA worked, pInk is no longer in the tree...
04395 
04396     // invalidate the node so we get rid of any fill there might have been
04397     if (pOp)
04398     {
04399         DocRect BRect = pAttrBrush->GetAttrBoundingRect(pInk);
04400         Spread* pSpread = Document::GetSelectedSpread();
04401         if (pSpread != NULL)
04402             pOp->DoInvalidateRegion(pSpread, BRect);
04403     }
04404 
04405     return Retval;
04406 }

BOOL OpConvertPathToShapes::ConvertPathToShapes OpConvertPathToShapes pOp,
NodeRenderableInk pInk
[static]
 

Does the convert.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000
Parameters:
pOp - pointer to the op doing this (can be NULL for external use) [INPUTS] pInk - the node to convert
Returns:
TRUE for success, FALSE for failure
DY 28/11/2000 Some serious changes have taken place now, in order to deal with groups of objects containing brushes or strokes. Basically the following can occur:

  • pInk is a single ink object with a brush or stroke attribute, in which case it is dealt with indiviually in ConvertBrush/Stroke.
  • pInk is an ink object with no brush or stroke attribute - basically the old case, here we simply sum the paths of pInk and make a new shape out of them.
  • pInk is a group containing any combination of normal shapes, brushed or stroked shapes. This is the difficult case, basically the ConvertPathToShapesBecomeA passback function will store converted brushes and strokes under a group context node (though there is one exception to this, where there are no brushes), and stores the summed paths of any normal shapes. We then extract these and put them all under one new group.

Definition at line 4111 of file opcntr.cpp.

04112 {
04113 //  UINT32 NumObjs = 0;
04114 
04115     // first, find out whether we have a non-transparent line attribute
04116 
04117     // if we do, then lets not do anything.
04118 
04119     // BUT, if we do; then lets get on a do some funky stuff ....
04120     // i.e. make the line colour into the fill colour for this node
04121 
04122     AttrStrokeColour * pColour = NULL;
04123     
04124     pInk->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrStrokeColour), 
04125         (NodeAttribute **)(&pColour));
04126 
04127     ConvertPathToShapesBecomeA MyBecomeA(BECOMEA_PASSBACK, CC_RUNTIME_CLASS(NodePath), pOp, FALSE);
04128 
04129     if (pColour)
04130     {
04131         StrokeColourAttribute * pAttrVal = (StrokeColourAttribute *)pColour->GetAttributeValue();
04132         
04133         if (pAttrVal->Colour.IsTransparent ())
04134         {
04135             return TRUE;
04136         }
04137         if (!pInk->CanBecomeA(&MyBecomeA))
04138         {
04139             ERROR3("Ink node cannot become nodepath in OpConvertPathToShapes::ConvertPathToShapes");
04140             return TRUE;
04141         }
04142     }
04143     
04144 
04145     /* find out if we have an applied brush node, if so then do our own thing
04146     Note that this block must always be before the Stroke attribute block because
04147     the stroke attribute, when used in conjunction with the brush attribute, acts
04148     as a pressure provider to the brush
04149     */
04150 //  NodeAttribute* pAttr = NULL;
04151     AttrBrushType* pBrush = NULL;
04152     pInk->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrBrushType), (NodeAttribute**)&pBrush);
04153     
04154     // note that this only deals with a single ink node case, it cannot deal with groups
04155     if (pBrush != NULL && pBrush->GetBrushHandle() != BrushHandle_NoBrush && !pInk->IsCompound())
04156     {
04157         if (ConvertBrush(pOp, pBrush, pInk))
04158             return TRUE;
04159     }
04160 
04161 
04162     // We have another special case if there is a stroke attribute applied
04163     AttrStrokeType* pStroke = NULL;
04164     pInk->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrStrokeType), (NodeAttribute**)&pStroke);
04165     AttrVariableWidth* pVarWidth = NULL;
04166     pInk->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrVariableWidth), (NodeAttribute**)&pVarWidth);
04167 
04168     /* This next block exists as the simplest stroke case, and allows us to avoid making any groups,
04169     however we can only enter the next block if we are a single ink node with an an acitve stroke applied
04170     the entry conditions to this block: 
04171     - Do you have an active PathProcessorStroke?
04172     - Do you have an active VariableWidthFunction?
04173     - Are you not compound?
04174     */
04175     if (pStroke != NULL && pStroke->HasPathProcessor() && pVarWidth != NULL &&  
04176         pVarWidth->HasActiveValueFunction() &&!pInk->IsCompound())
04177     {
04178         BOOL Success = ConvertStroke(pOp, pStroke, pInk);
04179         if (Success)
04180         {
04181             // invalidate the node so we get rid of any fill there might have been
04182             DocRect BRect = pInk->GetBoundingRect();
04183             pInk->ReleaseCached();
04184             Spread* pSpread = Document::GetSelectedSpread();
04185             if (pOp != NULL && pSpread != NULL)
04186                 pOp->DoInvalidateRegion(pSpread, BRect);    
04187 
04188             pInk->SetSelected(FALSE);
04189 
04190             NodeHidden * pHidden = NULL;
04191             
04192             if (pOp)
04193                 return pOp->DoHideNode(pInk, TRUE, &pHidden, FALSE);
04194             else
04195             {
04196                 pInk->CascadeDelete();
04197                 delete pInk;
04198                 return(TRUE);
04199             }
04200         }
04201 
04202     }
04203     
04204     /* If we have reached this point then we are one of the following:
04205     - A group, potentially containing various combinations of brushes or strokes 
04206     - A single normal ink node, with no brush or stroke applied */
04207 
04208     // create the new path node
04209     NodePath * pNewNode = NULL;
04210     ALLOC_WITH_FAIL(pNewNode, new NodePath, pOp);
04211 
04212     pNewNode->InkPath.Initialise(); 
04213     if (pOp)
04214         pOp->DoLocaliseForAttrChange(pInk, (AttrTypeSet *)NULL, (ObjectSet *)NULL);
04215     else
04216     {
04217         Node* pParent = pInk->FindParent(); 
04218         ERROR3IF(!pParent, "UndoableOperation::DoLocaliseForAttrChange called on an object which has no parent"); 
04219         if (pParent->IsCompound())
04220         {
04221             ((NodeRenderableInk*)pParent)->LocaliseCommonAttributes(FALSE, TRUE, NULL);
04222         }
04223     }
04224 
04225 
04226     // we need a group to store any groups of strokes we might have
04227     NodeRenderableInk* pGroup = NULL;
04228 
04229     // Do the conversion
04230     pInk->DoBecomeA(&MyBecomeA);
04231 
04232     // the summed path consists of the outlines of all the normal (i.e. non-brush or stroke) objects
04233     MyBecomeA.GetSummedPath(&(pNewNode->InkPath));
04234 
04235     // the context node is a group under which all strokes and brushes are placed
04236     pGroup = MyBecomeA.GetContextNode();
04237     
04238 
04239     // Right, some changes here to do with the case where we have strokes and brushes in a group
04240     // basically the BecomeA mechanism will have dealt with them separately, and generated a nodegroup
04241     // out of any brushes we may have had, and summed the paths of all other nodes.
04242 
04243     // first deal with any summed paths we may have generated
04244     if (pNewNode->InkPath.GetNumCoords() > 0)
04245     {
04246         AdjustStrokeAndFillAttrs(pOp, pNewNode, pInk);
04247     }
04248     else
04249     {
04250         delete pNewNode;
04251         pNewNode = NULL;
04252     }
04253 
04254     BOOL ok = TRUE;
04255     // ok, if we have a) a group and a nodepath or b) a group with a sibling, 
04256     // then we'll make an extra nodegroup to store them under
04257 
04258     if ((pNewNode && pGroup) || (pGroup && pGroup->FindNext()))
04259     {
04260         NodeGroup* pNewGroup = NULL;
04261         ALLOC_WITH_FAIL(pNewGroup, new NodeGroup, pOp);
04262         if (pNewGroup)
04263         {
04264             pGroup->InsertChainSimple(pNewGroup, LASTCHILD);
04265             if (pNewNode)
04266                 pNewNode->AttachNode(pNewGroup, LASTCHILD);
04267         }
04268         if (pOp)
04269         {
04270             ok = pOp->DoInsertNewNode(pNewGroup, pInk, NEXT, TRUE, FALSE, TRUE, TRUE);
04271             if (ok) ok = pOp->DoFactorOutAfterAttrChange(pNewGroup, (AttrTypeSet *)NULL);
04272         }
04273         else
04274         {
04275             pNewGroup->AttachNode(pInk, NEXT);
04276             Node* pParent;
04277             pParent = pNewGroup->FindParent();
04278             ERROR3IF(!pParent, "Trying to FactorOutCommonChildAttributes on an object which has no parent");
04279             if (pParent->IsCompound())
04280             {
04281                 ((NodeRenderableInk*)pParent)->FactorOutCommonChildAttributes(TRUE, (AttrTypeSet *)NULL);
04282             }
04283         }
04284     }
04285     else if (pNewNode != NULL)
04286     {
04287         // otherwise we've only got one new node, made from non-strokes and brushes
04288         if (pOp)
04289         {
04290             ok = pOp->DoInsertNewNode(pNewNode, pInk, NEXT, TRUE, FALSE, TRUE, TRUE);
04291 //          if (ok) ok = DoFactorOutAfterAttrChange(pNewNode, (AttrTypeSet *)NULL);
04292         }
04293         else
04294         {
04295             pNewNode->AttachNode(pInk, NEXT);
04296         }
04297     }
04298     else if (pGroup != NULL)
04299     {
04300         if (pOp)
04301         {
04302             ok = pOp->DoInsertNewNode(pGroup, pInk, NEXT, TRUE, FALSE, TRUE, TRUE);
04303             if (ok) ok = pOp->DoFactorOutAfterAttrChange(pGroup, (AttrTypeSet *)NULL);
04304         }
04305         else
04306         {
04307             pGroup->AttachNode(pInk, NEXT);
04308             Node* pParent;
04309             pParent = pGroup->FindParent();
04310             ERROR3IF(!pParent, "Trying to FactorOutCommonChildAttributes on an object which has no parent");
04311             if (pParent->IsCompound())
04312             {
04313                 ((NodeRenderableInk*)pParent)->FactorOutCommonChildAttributes(TRUE, (AttrTypeSet *)NULL);
04314             }
04315         }
04316     }
04317 
04318     if (pOp)
04319     {
04320         pOp->DoFactorOutAfterAttrChange(pInk, (AttrTypeSet *)NULL);
04321     }
04322     else
04323     {
04324         Node* pParent;
04325         pParent = pInk->FindParent();
04326         ERROR3IF(!pParent, "Trying to FactorOutCommonChildAttributes on an object which has no parent");
04327         if (pParent->IsCompound())
04328         {
04329             ((NodeRenderableInk*)pParent)->FactorOutCommonChildAttributes(TRUE, (AttrTypeSet *)NULL);
04330         }
04331     }
04332 
04333     pInk->SetSelected(FALSE);
04334 
04335     // Hide the original ink node
04336     if (pOp)
04337     {
04338         NodeHidden * pHidden = NULL;
04339         if (ok)
04340             ok = pOp->DoHideNode(pInk, TRUE, &pHidden, FALSE);
04341     }
04342     else
04343     {
04344         pInk->CascadeDelete();
04345         delete pInk;
04346     }
04347         
04348     return ok;
04349 
04350 }

BOOL OpConvertPathToShapes::ConvertStroke OpConvertPathToShapes pOp,
AttrStrokeType pStroke,
NodeRenderableInk pInk
[static, protected]
 

To convert nodes with a stroke attribute applied to them. Note that this ONLY works for single nodes, compound nodes are dealt with in the main Convert function as there are many different possible permutations. Note that this function assumes that there is also an AttrVariableWidth applied to pInk, if there is not then your stroke attr just won't do anything.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/11/2000
Parameters:
pStroke - the stroke attribute that is applied to the node we wish to convert [INPUTS] pInk - the node we wish to convert
Returns:
TRUE for success, FALSE for failure

Definition at line 4428 of file opcntr.cpp.

04429 {
04430     ERROR2IF(pStroke == NULL || pInk == NULL, FALSE, "Inputs are NULL to OpConvertPathToShapes::ConvertBrush");
04431     
04432     if (pInk->IsCompound())
04433     {
04434         ERROR3("Attempting to convert brush on a compound node when we really shouldn't be");
04435         return FALSE;
04436     }
04437 
04438     // we need the path processor to do the work
04439     PathProcessorStroke* pPPS = pStroke->GetPathProcessor();
04440     if (pPPS == NULL)
04441     {
04442         ERROR3("Can't get PathProcessorStroke in OpConvertPathToShapes::ConvertStroke");
04443         return FALSE;
04444     }
04445 
04446     // Use a SimpleBecomeA to get the path from the parent object
04447     SimpleBecomeA BecomeA(BECOMEA_PASSBACK, CC_RUNTIME_CLASS(NodePath), NULL);
04448     
04449     BOOL Retval = FALSE;
04450     
04451     if (pInk->DoBecomeA(&BecomeA))
04452     {
04453         NodePath* pNodePath = BecomeA.GetNodePath();
04454         if (pNodePath)
04455         {
04456             NodePath* pStrokePath = pPPS->GetSmoothProcessedPath(&(pNodePath->InkPath), pInk);
04457             if (pStrokePath)
04458             {
04459                 // Karim 05/12/2000
04460                 // process the returned stroke, to change its working
04461                 // winding rule from non-zero to even-odd.
04462                 Path* pInkStrokePath = &(pStrokePath->InkPath);
04463                 double Flatness = pInkStrokePath->CalculateFlatnessValueFromPath(750.0, 2.0, 375.0);
04464                 pInkStrokePath->ClipPathToPath(*pInkStrokePath, pInkStrokePath, 3 | 0x10, 20, Flatness, Flatness);
04465 
04466                 // We've got the path we wish to use
04467                 if (AdjustStrokeAndFillAttrs(pOp, pStrokePath, pInk))
04468                 {
04469                     if (pOp)
04470                         Retval = pOp->DoInsertNewNode(pStrokePath, pInk, NEXT, TRUE, FALSE, TRUE, TRUE);
04471                     else
04472                     {
04473                         pStrokePath->AttachNode(pInk, NEXT);
04474                         Retval = TRUE;
04475                     }
04476                 }
04477                 else
04478                 {
04479                     delete pStrokePath;
04480                 }
04481             }
04482             delete pNodePath;
04483             pNodePath = NULL;
04484         }
04485         else
04486         {
04487             ERROR3("Failed to get nodepath from ink object in OpConvertPathToShapes::ConvertStroke");
04488         }
04489     }
04490     return Retval;
04491 }

BOOL OpConvertPathToShapes::Declare  )  [static]
 

Adds the operation to the list of all known operations.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000
Returns:
TRUE if all went OK, False otherwise

Definition at line 3926 of file opcntr.cpp.

03927 {
03928     return (RegisterOpDescriptor(
03929                                 0, 
03930                                 _R(IDS_CONVERTPATHTOSHAPES),
03931                                 CC_RUNTIME_CLASS(OpConvertPathToShapes), 
03932                                 OPTOKEN_CONVERTPATHTOSHAPES,
03933                                 OpConvertPathToShapes::GetState));
03934 
03935 }

void OpConvertPathToShapes::Do OpDescriptor pDesc  )  [virtual]
 

Does the operation.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000
Returns:

Reimplemented from Operation.

Definition at line 4028 of file opcntr.cpp.

04029 {
04030     // run through the sel range, dealing with every node
04031     DoStartSelOp(TRUE, TRUE, TRUE, TRUE);
04032 
04033     Range * pSel = GetApplication()->FindSelection();
04034 
04035     if (!pSel)
04036     {
04037         FailAndExecute();
04038         End();
04039         return;
04040     }
04041 
04042     Node * pNode = pSel->FindFirst();
04043     Node * pNextNode = NULL;
04044 
04045     while (pNode)
04046     {
04047         // must get the next node first since the geometry will change
04048         pNextNode = pSel->FindNext(pNode);
04049 
04050         if (pNode->IsAnObject())
04051         {       
04052             if (!ConvertPathToShapes(this, (NodeRenderableInk *)pNode))
04053             {
04054                 FailAndExecute();
04055                 End();
04056                 return;
04057             }
04058         }
04059 
04060         pNode = pNextNode;      
04061     }
04062 
04063     End();
04064 }

void OpConvertPathToShapes::GetOpName String_256 OpName  )  [virtual]
 

Gets the op's name.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000
Returns:

Reimplemented from Operation.

Definition at line 4076 of file opcntr.cpp.

04077 {
04078     if (OpName)
04079     {
04080         OpName->Load(_R(IDS_CONVERTPATHTOSHAPES));
04081     }
04082 }

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

Gets the state of the operation.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000
Returns:
TRUE if all went OK, False otherwise

Definition at line 3947 of file opcntr.cpp.

03948 {
03949     OpState Blobby;
03950 
03951     // do greyed for no selection
03952     Range * pSel = GetApplication()->FindSelection();
03953 
03954     Blobby.Greyed = FALSE;
03955 
03956     if (!pSel)
03957     {
03958         Blobby.Greyed = TRUE;
03959         return Blobby;
03960     }
03961 
03962     // If there is nothing selected, grey the item and give a reason.
03963     if (pSel->IsEmpty())
03964     {
03965         Blobby.Greyed = TRUE;
03966         *Description = String_256 (_R(IDS_NO_OBJECTS_SELECTED));
03967         return Blobby;
03968     }
03969     
03970     // run through the range finding out if any nodes have promote hit test on
03971     // children to me set in their parents, or are needs parent nodes
03972     Node * pNode = pSel->FindFirst();
03973     Node * pSubNode = NULL;
03974     Node * pParent = NULL;
03975     
03976     while (pNode && Blobby.Greyed == FALSE)
03977     {
03978         if (pNode->NeedsParent(NULL))
03979         {
03980             Blobby.Greyed = TRUE;
03981             break;
03982         }
03983         
03984         pParent = pNode->FindParent();
03985         
03986         while (pParent)
03987         {
03988             if (pParent->ShouldITransformWithChildren())
03989             {
03990                 Blobby.Greyed = TRUE;
03991                 break;
03992             }
03993             
03994             pParent = pParent->FindParent();
03995         }
03996 
03997         // check all nodes under this node too
03998         pSubNode = pNode->FindFirstDepthFirst();
03999 
04000         while (pSubNode && pSubNode != pNode)
04001         {
04002             if (pSubNode->NeedsParent(NULL) ||
04003                 pSubNode->ShouldITransformWithChildren())
04004             {
04005                 Blobby.Greyed = TRUE;
04006                 break;
04007             }
04008 
04009             pSubNode = pSubNode->FindNextDepthFirst(pNode);
04010         }
04011         
04012         pNode = pSel->FindNext(pNode);
04013     }
04014 
04015     return Blobby;
04016 }

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

Reimplemented from SelOperation.

Definition at line 796 of file opcntr.h.

00796 { return FALSE; }


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