ndmldgrp.cpp

Go to the documentation of this file.
00001 // $Id: ndmldgrp.cpp 1361 2006-06-25 16:43:38Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // NodeMouldGroup implementation. 
00099 
00100 // Comments
00101 //
00102 // NodeMouldGroup is a node which lives inside NodeMould. Its purpose is
00103 // to contain all mould source objects and thus by its simple structure allow
00104 // messages to be passed to all mould shape producers without having to keep
00105 // a list of who does what etc. Messages can be sent to the NodeMouldGroup
00106 // which will then send them on to all children.
00107 
00108 /*
00109 */
00110 
00111 
00112 #include "camtypes.h"
00113 #include "ndmldgrp.h"
00114 #include "nodemldr.h"
00115 //#include "mike.h"
00116 //#include "mario.h"
00117 //#include "tim.h"
00118 #include "nodepath.h"
00119 #include "nodebmp.h"
00120 //#include "matrix.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00121 //#include "trans2d.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00122 #include "nativeps.h"       // The old style EPS native filter, used in v1.1
00123 #include "aw_eps.h"
00124 
00125 #include "cxftags.h"
00126 //#include "cxfdefs.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00127 //#include "cxfrec.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00128 //#include "camfiltr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00129 //#include "webster.h"
00130 #include "taglists.h"
00131 
00132 #include "extender.h"
00133 
00134 DECLARE_SOURCE("$Revision: 1361 $");
00135 
00136 CC_IMPLEMENT_DYNAMIC(NodeMouldGroup,NodeGroup )  
00137 
00138 // Declare smart memory handling in Debug builds
00139 #define new CAM_DEBUG_NEW
00140 
00141 
00142 /*********************************************************************************************
00143 
00144 >    NodeMouldGroup::NodeMouldGroup() 
00145 
00146      Author:    Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00147      Created:   5/12/94
00148      Inputs:    
00149      Outputs:   
00150      Returns:   
00151      Purpose:   This constructor creates a NodeMouldGroup linked to no other, with all status
00152                 flags false and an uninitialised bounding rectangle.           
00153             
00154      Errors:    
00155 
00156 **********************************************************************************************/
00157  
00158 NodeMouldGroup::NodeMouldGroup(): NodeGroup()
00159 {
00160 }
00161 
00162 
00163 /***********************************************************************************************
00164 
00165 >   void NodeMouldGroup::NodeMouldGroup
00166     (
00167         Node* ContextNode,  
00168         AttachNodeDirection Direction,  
00169         BOOL Locked = FALSE, 
00170         BOOL Mangled = FALSE,  
00171         BOOL Marked = FALSE, 
00172         BOOL Selected = FALSE, 
00173     )
00174 
00175     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00176     Created:    5/12/94
00177     Inputs:     ContextNode: Pointer to a node which this node is to be attached to.     
00178     
00179                 Direction: 
00180             
00181                     Specifies the direction in which this node is to be attached to the 
00182                     ContextNode. The values this variable can take are as follows: 
00183                                       
00184                     PREV      : Attach node as a previous sibling of the context node
00185                     NEXT      : Attach node as a next sibling of the context node
00186                     FIRSTCHILD: Attach node as the first child of the context node
00187                     LASTCHILD : Attach node as a last child of the context node                               
00188                           
00189                 The remaining inputs specify the status of the node: 
00190             
00191                 Locked:     Is node locked ?
00192                 Mangled:    Is node mangled ?
00193                 Marked:     Is node marked ?
00194                 Selected:   Is node selected ?
00195             
00196     Outputs: -
00197     Returns: - 
00198     Purpose:    This method initialises the node and links it to ContextNode in the
00199                 direction specified by Direction. All necessary tree links are
00200                 updated.     
00201              
00202     Errors:     An assertion error will occur if ContextNode is NULL
00203 
00204 
00205 ***********************************************************************************************/
00206 
00207 NodeMouldGroup::NodeMouldGroup(Node* ContextNode,  
00208                      AttachNodeDirection Direction,  
00209                      BOOL Locked, 
00210                      BOOL Mangled,  
00211                      BOOL Marked, 
00212                      BOOL Selected   
00213                ):NodeGroup(ContextNode, Direction, Locked, Mangled, Marked, 
00214                 Selected) 
00215 { 
00216 } 
00217 
00218 
00219 /*********************************************************************************************
00220 
00221 >    NodeMouldGroup::~NodeMouldGroup() 
00222 
00223      Author:    Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00224      Created:   5/11/94
00225      Inputs:    
00226      Outputs:   
00227      Returns:   
00228      Purpose:   This destructor calls the parent class destructor
00229 
00230 **********************************************************************************************/
00231  
00232 NodeMouldGroup::~NodeMouldGroup()
00233 {
00234 }
00235 
00236 
00237 
00238 /*******************************************************************************************
00239 
00240 >   virtual String NodeMouldGroup::Describe(BOOL Plural, BOOL Verbose = TRUE)
00241 
00242     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00243     Created:    5/12/94
00244     Inputs:     Plural: Flag indicating if the string description should be plural or
00245                         singular. 
00246     Outputs:    -
00247     Retuns:     Description of the mould group node 
00248     Purpose:    To return a description of the Mould object in either the singular or the 
00249                 plural. This method is called by the DescribeRange method.
00250                 
00251                 The description will always begin with a lower case letter.   
00252                 
00253     Errors:     -
00254     SeeAlso:    -
00255 
00256 ********************************************************************************************/
00257 
00258 String NodeMouldGroup::Describe(BOOL Plural, BOOL Verbose) 
00259 {     
00260     if (Plural)
00261         return(String(_R(IDS_MOULDGROUP_DESCRP)));  
00262     else
00263         return(String(_R(IDS_MOULDGROUP_DESCRS))); 
00264 }; 
00265 
00266 
00267 
00268 
00269 /***********************************************************************************************
00270 
00271 > Node* NodeMouldGroup::SimpleCopy()  
00272 
00273     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00274     Created:    5/12/94
00275     Inputs:     -  
00276     Outputs:    -
00277     Returns:    A copy of the node, or NULL if memory has run out 
00278          
00279     Purpose:    This method returns a shallow copy of the node with all Node pointers NULL. 
00280                 The function is virtual, and must be defined for all derived classes.  
00281                 
00282     Errors:     If memory runs out when trying to copy, then ERROR is called with an out of memory
00283                 error and the function returns NULL.                                                                      
00284                                                                                  
00285 **********************************************************************************************/
00286 
00287 Node* NodeMouldGroup::SimpleCopy()
00288 {
00289     NodeMouldGroup* pCopyOfNode = new NodeMouldGroup();
00290     ERROR1IF(pCopyOfNode == NULL,NULL,_R(IDE_NOMORE_MEMORY)); 
00291     CopyNodeContents(pCopyOfNode);
00292     return (pCopyOfNode);
00293 }   
00294 
00295 
00296 /***********************************************************************************************
00297 
00298 >   void NodeMouldGroup::CopyNodeContents(NodeMouldGroup* pCopyOfNode)
00299 
00300     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00301     Created:    5/12/94
00302     Inputs:     pCopyOfNode - The node to copy data to
00303     Outputs:    -
00304     Returns:    -
00305     Purpose:    Copies the data from this node to pCopyOfNode by first calling the base class 
00306                 to get it to copy its stuff, and then copying its own stuff
00307     Scope:      protected
00308     SeeAlso:    NodeGroup::CopyNodeContents
00309 
00310 ***********************************************************************************************/
00311 
00312 void NodeMouldGroup::CopyNodeContents(NodeMouldGroup* pCopyOfNode)
00313 {
00314     ERROR3IF(pCopyOfNode==NULL,"NodeMouldGroup::CopyNodeContents() passed a null node");
00315     if (pCopyOfNode==NULL)
00316         return;
00317 
00318     // just call the parent copy function for the mo.
00319     NodeGroup::CopyNodeContents(pCopyOfNode);
00320 }
00321 
00322 
00323    
00324 /***********************************************************************************************
00325 >   void NodeMouldGroup::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
00326 
00327     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00328     Created:    18/12/2003
00329     Outputs:    -
00330     Purpose:    Polymorphically copies the contents of this node to another
00331     Errors:     An assertion failure will occur if NodeCopy is NULL
00332     Scope:      protected
00333                                      
00334 ***********************************************************************************************/
00335 
00336 void NodeMouldGroup::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
00337 {
00338     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00339     ENSURE(IS_A(pNodeCopy, NodeMouldGroup), "PolyCopyNodeContents given wrong dest node type");
00340 
00341     if (IS_A(pNodeCopy, NodeMouldGroup))
00342         CopyNodeContents((NodeMouldGroup*)pNodeCopy);
00343 }
00344 
00345 
00346 
00347 /********************************************************************************************
00348 
00349 >   virtual UINT32 NodeMouldGroup::GetNodeSize() const
00350 
00351     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00352     Created:    5/12/94
00353     Inputs:     -
00354     Outputs:    -
00355     Returns:    The size of the node in bytes
00356     Purpose:    For finding the size of the node 
00357                 
00358     SeeAlso:    Node::GetSubtreeSize
00359 
00360 ********************************************************************************************/
00361 
00362 UINT32 NodeMouldGroup::GetNodeSize() const 
00363 {     
00364     return (sizeof(NodeMouldGroup)); 
00365 }  
00366 
00367 
00368 /********************************************************************************************
00369 
00370 >   BOOL NodeMouldGroup::ShouldBeRendered()
00371 
00372     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00373     Created:    03/07/95
00374     Returns:    FALSE => this node should not be rendered.
00375     Purpose:    Indicate to the caller that this node should never be rendered.
00376                 This is mainly used during printing where due to complications to do with
00377                 banding and transparency, we cannot use NeedsToRender() to filter out
00378                 such nodes, so we use this function instead.
00379     SeeAlso:    Node::ShouldBeRendered
00380 
00381 ********************************************************************************************/
00382 
00383 BOOL NodeMouldGroup::ShouldBeRendered() const
00384 {
00385     // Don't render the un-moulded objects!
00386     return FALSE;
00387 }
00388 
00389 
00390 /********************************************************************************************
00391 
00392 >   DocRect NodeMouldGroup::GetBoundingRect(BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE)
00393 
00394     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00395     Created:    17/01/95
00396     Inputs:     DontUseAttrs - TRUE if you don't want to use the nodes attrs to calculate
00397                 the bounding rect (defaults will be used). Defaults to FALSE.
00398                 HitTest      - TRUE if being called during HitTest
00399     Returns:    A null rectangle
00400     Purpose:    Returns a completely null rectangle
00401 
00402 ********************************************************************************************/
00403 
00404 DocRect NodeMouldGroup::GetBoundingRect(BOOL DontUseAttrs, BOOL HitTest)
00405 {
00406     // a rect to put the new version of the bounding rect into
00407     DocRect Rect;
00408     return Rect;
00409 }
00410 
00411 /********************************************************************************************
00412 
00413 >   DocRect NodeMouldGroup::GetBlobBoundingRect()
00414 
00415     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00416     Created:    17/01/95
00417     Returns:    DocRect - The bounding rect of the mould group and its blobs
00418     Purpose:    Returns a completely null rectangle
00419 
00420 ********************************************************************************************/
00421 
00422 DocRect NodeMouldGroup::GetBlobBoundingRect()
00423 {
00424     DocRect Rect;
00425     return Rect;
00426 }
00427 
00428 
00429 /********************************************************************************************
00430 
00431 >   DocRect NodeMouldGroup::GetChildrensBounds(BOOL DontUseAttrs = FALSE)
00432 
00433     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00434     Created:    17/01/95
00435     Inputs:     DontUseAttrs - TRUE if you don't want to use the nodes attrs to calculate
00436                 the bounding rect (defaults will be used). Defaults to FALSE.
00437     Returns:    A null rectangle
00438     Purpose:    Returns the bounding rect of this object. For internal use only
00439 
00440 ********************************************************************************************/
00441 
00442 DocRect NodeMouldGroup::GetChildrensBounds(BOOL DontUseAttrs)
00443 {
00444     return NodeRenderableBounded::GetBoundingRect(DontUseAttrs);
00445 }
00446 
00447 
00448 
00449 
00450 /********************************************************************************************
00451 
00452 >   BOOL NodeMouldGroup::OnClick( DocCoord PointerPos, ClickType Click, ClickModifiers ClickMods,
00453                              Spread* pSpread )
00454 
00455     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00456     Created:    5/12/94
00457     Inputs:     PointerPos  - The Location of the mouse pointer at the time of the click
00458                 Click       - The type of click received (single, double, drag etc)
00459                 ClickMods   - The modifiers to the click (eg shift, control etc )
00460     Returns:    TRUE    - if the node claims the click as its own
00461                 FALSE   - if it is not interested in the click
00462     Purpose:    Does nothing at the moment - Just returns FALSE.
00463         
00464 ********************************************************************************************/
00465 
00466 BOOL NodeMouldGroup::OnClick( DocCoord PointerPos, ClickType Click, ClickModifiers ClickMods,
00467                         Spread* pSpread )
00468 {
00469     // we did not use the click, so let someone else try
00470     return FALSE;
00471 }
00472 
00473 
00474 /***********************************************************************************************
00475 
00476 >   BOOL NodeMouldGroup::HidingNode()
00477 
00478     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00479     Created:    5/12/94
00480     Inputs:     -
00481     Outputs:    -
00482     Purpose:    Called whenever the node gets hidden. The function will call all base class
00483                 derivations of this object and then all children connected to this object
00484                 in the tree.
00485 
00486 ***********************************************************************************************/
00487 
00488 BOOL NodeMouldGroup::HidingNode()
00489 {
00490     // Call the base class first
00491     if (!NodeGroup::HidingNode())
00492         return FALSE;
00493 
00494     BOOL ok = TRUE;
00495 /*
00496     Node* pNode = FindFirstChild();
00497     while (pNode != NULL && ok)
00498     {
00499         // send the hiding node message on to our children
00500         ok = pNode->HidingNode();
00501         pNode = pNode->FindNext();
00502     }
00503 */
00504     return ok;
00505 }
00506 
00507 
00508 /***********************************************************************************************
00509 
00510 >   BOOL NodeMouldGroup::ShowingNode()
00511 
00512     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00513     Created:    5/12/94
00514     Inputs:     -
00515     Outputs:    -
00516     Purpose:    Called whenever the node gets shown after it's been hidden.
00517 
00518 ***********************************************************************************************/
00519 
00520 BOOL NodeMouldGroup::ShowingNode()
00521 {
00522     // Call the base class first
00523     if (!NodeGroup::ShowingNode())
00524         return FALSE;
00525 
00526     // and then all the child objects
00527     BOOL ok = TRUE;
00528 
00529 /*
00530     Node* pNode = FindFirstChild();
00531     while (pNode != NULL && ok)
00532     {
00533         ok = pNode->ShowingNode();
00534         pNode = pNode->FindNext();
00535     }
00536 */
00537     return ok;
00538 }
00539 
00540 
00541 /********************************************************************************************
00542 
00543 >   BOOL NodeMouldGroup::NeedsToRender(RenderRegion *pRender)
00544 
00545     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00546     Created:    13/01/95
00547     Inputs:     pRender - A pointer to the current render region (null if none)
00548     Returns:    TRUE  => This node should be rendered,
00549                 FALSE => This node does not need to be rendered.
00550     Purpose:    Virtual function - this function will indicate to the caller whether or not
00551                 we want to render the given node, according to the information passed in.
00552     SeeAlso:    Node::NeedsToRender
00553 
00554 ********************************************************************************************/
00555 
00556 SubtreeRenderState NodeMouldGroup::RenderSubtree(RenderRegion* pRender, Node** ppNextNode, BOOL bClip)
00557 {
00558     if (pRender && pRender->RenderPaperAsInk())
00559         return SUBTREE_ROOTANDCHILDREN;
00560 
00561     return SUBTREE_NORENDER;
00562 }
00563 
00564 
00565 /********************************************************************************************
00566 
00567 >   void NodeMouldGroup::Transform( TransformBase& Trans )
00568 
00569     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00570     Created:    13/01/95
00571     Inputs:     Trans - A transformation object
00572     Purpose:    Will allow certain transformations through to the original objects. So
00573                 INT32 as the mould shape and source bbox are updated in the parent above
00574                 us then all will be well.
00575 
00576 ********************************************************************************************/
00577 
00578 void NodeMouldGroup::Transform( TransformBase& Trans )
00579 {
00580     // there are only two types of transform that dont alter the
00581     // relationship of the bounding box with respect to its objects.
00582     // These are the only ones I can allow through otherwise the 
00583     // mould will shear.
00584     // Unfortunately Scales don't seem to work too well either
00585     // so we're gonna have to put up with simple translations only
00586     // ok I've commented this lot out for now until someone complains
00587     // about it... Moving the source objects about is a bit of a pain
00588     // as during undo the final position of the object is weird.
00589     // (See bug 4630 for instance)
00590 
00591     if (IS_A(&Trans, Trans2DMatrix))
00592     {
00593         Trans2DMatrix* t = (Trans2DMatrix*)(&Trans);
00594         Matrix m = t->GetMatrix();
00595         
00596         if (m.IsTranslation())
00597             NodeRenderableInk::TransformChildren(Trans);            
00598     }
00599 }
00600 
00601 
00602 /********************************************************************************************
00603 
00604 >   BOOL NodeMouldGroup::NeedsToExport(RenderRegion* pRender, BOOL VisibleLayersOnly = FALSE,
00605                                        BOOL CheckSelected = FALSE)
00606 
00607     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00608     Created:    23/03/95
00609     Inputs:     pRender - A pointer to the current export region
00610                 VisibleLayersOnly - TRUE => remove nodes which are on invisible layers
00611                                    - FALSE => export everything
00612                 CheckSelected - TRUE => we check if object selected and only export selected bjects
00613                               - FALSE => we don't bother checking for selection or not
00614     Returns:    TRUE => please export me.
00615     Purpose:    Virtual function - this version will return FALSE for exporting to 
00616                 ArtWorks or Camelot EPS render regions.
00617 
00618 ********************************************************************************************/
00619 
00620 BOOL NodeMouldGroup::NeedsToExport(RenderRegion* pRender, BOOL VisibleLayersOnly, BOOL CheckSelected)
00621 {
00622     if (pRender==NULL)
00623         return TRUE;
00624 
00625 #if !defined(EXCLUDE_FROM_RALPH)
00626     // only export to native documents!
00627     if (pRender->GetRuntimeClass() == CC_RUNTIME_CLASS(NativeRenderRegion))
00628         return TRUE;
00629 #endif  
00630     return FALSE;
00631 }
00632 
00633 
00634 /*********************************************************************************************
00635 
00636 >    void NodeMouldGroup::PreExportRender(RenderRegion* pRegion)
00637 
00638      Author:    Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00639      Created:   14/03/95
00640      Inputs:    pRegion = ptr to the export render region to export to
00641      Outputs:   
00642      Returns:   
00643      Purpose:   Called before this node or any of its children have been rendered to the 
00644                 export region. This outputs the "start mould source objects" command.
00645                 Supports ArtWorks EPS and Camelot EPS
00646      Errors:    
00647 
00648 **********************************************************************************************/
00649  
00650 void NodeMouldGroup::PreExportRender(RenderRegion* pRegion)
00651 {
00652 #if !defined(EXCLUDE_FROM_RALPH)
00653     if (pRegion->IS_KIND_OF(NativeRenderRegion))
00654     {
00655         PreExportNATEPS(pRegion);
00656         return;
00657     } 
00658 
00659     if (pRegion->IS_KIND_OF(ArtWorksEPSRenderRegion))
00660     {
00661         PreExportAWEPS(pRegion);
00662         return;
00663     }
00664 #endif
00665 }
00666 
00667 /*********************************************************************************************
00668 
00669 >    BOOL NodeMouldGroup::ExportRender(RenderRegion* pRegion)
00670 
00671      Author:    Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00672      Created:   14/03/95
00673      Inputs:    pRegion = ptr to the export render region to export to
00674      Outputs:   
00675      Returns:   TRUE if ok, FALSE if something went wrong
00676      Purpose:   Called after this node and all of its children have been rendered to the
00677                 export region. This outputs the "end mould source objs" command.
00678                 Supports ArtWorks EPS and Camelot EPS
00679      Errors:    
00680 
00681 **********************************************************************************************/
00682  
00683 BOOL NodeMouldGroup::ExportRender(RenderRegion* pRegion) 
00684 {
00685 #if !defined(EXCLUDE_FROM_RALPH)
00686     if (pRegion->IS_KIND_OF(NativeRenderRegion))
00687         return PostExportNATEPS(pRegion);
00688 
00689     if (pRegion->IS_KIND_OF(ArtWorksEPSRenderRegion))
00690         return PostExportAWEPS(pRegion);
00691 #endif  
00692     return FALSE;
00693 }
00694 
00695 
00696 /*********************************************************************************************
00697 
00698     BOOL NodeMouldGroup::Pre/Post ExportNATEPS(RenderRegion* pRegion)
00699 
00700     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00701     Created:    14/03/95
00702     Purpose:    Export delimiter tokens for this particular object.
00703                 The format is defined as
00704                     csmp
00705                         path description
00706                     cemp
00707 
00708 **********************************************************************************************/
00709 
00710 void NodeMouldGroup::PreExportNATEPS(RenderRegion* pRegion)
00711 {
00712 #if !defined(EXCLUDE_FROM_RALPH)
00713     EPSExportDC *pDC = (EPSExportDC *) pRegion->GetRenderDC();
00714     pDC->OutputToken(_T("csso"));           // Camelot "start mould source" token
00715     pDC->OutputNewLine();
00716 #endif
00717 }
00718 
00719 
00720 BOOL NodeMouldGroup::PostExportNATEPS(RenderRegion* pRegion)
00721 {
00722 #if !defined(EXCLUDE_FROM_RALPH)
00723     EPSExportDC *pDC = (EPSExportDC *) pRegion->GetRenderDC();
00724     pDC->OutputToken(_T("ceso"));           // Camelot "end mould source" token
00725     pDC->OutputNewLine();
00726 #endif
00727     return TRUE;
00728 }
00729 
00730 
00731 /*********************************************************************************************
00732 
00733     void NodeMouldGroup::Pre/Post ExportAWEPS(RenderRegion* pRegion)
00734 
00735     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00736     Created:    14/03/95
00737 
00738 **********************************************************************************************/
00739 
00740 void NodeMouldGroup::PreExportAWEPS(RenderRegion* pRegion)
00741 {
00742 }
00743 
00744 BOOL NodeMouldGroup::PostExportAWEPS(RenderRegion* pRegion)
00745 {
00746     return TRUE;
00747 }
00748 
00749 
00750 /********************************************************************************************
00751 
00752 >   virtual ChangeCode NodeMouldGroup::OnChildChange(ObjChangeParam* pParam)
00753 
00754     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00755     Created:    07/06/95
00756     Inputs:     pParam  = pointer to a object change parameter class
00757     Returns:    CC_OK       if we have successfully processed the change.
00758                 CC_FAIL     if we cannot handle this particular change and must prevent the
00759                             child from continuing
00760     Purpose:    This function should be overridden in derived object classes.
00761                 Composite objects can use this function to respond to one of their children
00762                 undergoing a change. They should return CC_FAIL whenever they are unable to
00763                 cope with the change.
00764 
00765     SeeAlso:    WarnParentOfChange(),AllowOp();
00766 
00767 ********************************************************************************************/
00768 
00769 ChangeCode NodeMouldGroup::OnChildChange(ObjChangeParam* pParam)
00770 {
00771     return CC_OK;
00772 }
00773 
00774 /********************************************************************************************
00775 
00776 >   virtual BOOL NodeMouldGroup::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
00777 
00778     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00779     Created:    19/7/96
00780     Inputs:     pFilter = ptr to the filter to write to
00781     Returns:    TRUE is a record has been written, FALSE otherwise
00782     Purpose:    Writes out a records associated with this node
00783 
00784                 It either writes out an envelope or perspective record, depending on the geometry.
00785 
00786                 The only piece of data that needs to be saved out with a node mould is the
00787                 error threshold.
00788 
00789 ********************************************************************************************/
00790 
00791 BOOL NodeMouldGroup::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
00792 {
00793     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
00794 
00795     // WEBSTER - markn 10/2/97
00796     // Mould bounds record
00797 
00798     BOOL ok = TRUE;
00799 
00800     // Add a description of the TAG_MOULD_BOUNDS record, for older importers that don't understand this record
00801     pFilter->AddTagDescription(TAG_MOULD_BOUNDS,_R(IDS_TAG_MOULD_BOUNDS));
00802 
00803     // Write out the bounds record
00804     DocRect Rect = GetChildrensBounds(FALSE);
00805     
00806     CamelotFileRecord BoundsRec(pFilter,TAG_MOULD_BOUNDS,TAG_MOULD_BOUNDS_SIZE);
00807 
00808     ok = BoundsRec.Init();
00809 
00810     if (ok) ok = BoundsRec.WriteCoord(Rect.lo);
00811     if (ok) ok = BoundsRec.WriteCoord(Rect.hi);
00812     if (ok) ok = pFilter->Write(&BoundsRec);
00813 
00814     // Write out the actual mould group record
00815     CXaraFileRecord Rec(TAG_MOULD_GROUP,TAG_MOULD_GROUP_SIZE);
00816 
00817     if (ok) ok = pFilter->Write(&Rec);
00818 
00819     if (!ok)
00820         pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
00821 
00822     return ok;
00823 }
00824 
00825 //------------------------------------------------------------------
00826 // See comments for NodeMouldGroup::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
00827 BOOL NodeMouldGroup::WritePreChildrenNative(BaseCamelotFilter* pFilter)
00828 {
00829     return WritePreChildrenWeb(pFilter);
00830 }
00831 

Generated on Sat Nov 10 03:45:49 2007 for Camelot by  doxygen 1.4.4