ngscan.h

Go to the documentation of this file.
00001 // $Id: ngscan.h 803 2006-04-11 14:36:26Z luke $
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 /*
00099     $Header: /wxCamelot/Kernel/ngscan.h 8     20/07/05 15:39 Luke $
00100     Scans and iterations to find, apply and hide Wix ObjectName attributes to nodes.
00101 */
00102 
00103 #ifndef NGSCAN_H
00104 #define NGSCAN_H
00105 
00106 #include "ngiter.h"
00107 #include <list>
00108 
00109 class ObjectChangeParam;
00110 class NodeSetProperty;
00111 class NamedStretchProp;
00112 class SGUsedNames;
00113 
00114 
00115 /***********************************************************************************************
00116 >   class CCAPI BaseSelectScan : public NodeScan
00117 
00118     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00119     Created:    27/5/99
00120     Purpose:    Base class for scans which select objects which are in the SGNameItem sets.
00121     SeeAlso:    SelectScan; SelectUnionScan; SelectIntersectScan
00122 ***********************************************************************************************/
00123 
00124 class CCAPI BaseSelectScan : public NodeScan
00125 {
00126 public:
00127     enum Change { TOGGLE = -1, DESELECT, SELECT, SELECT_EXCLUSIVE };
00128 
00129     BaseSelectScan(Change eChange, BOOL fQuiet = FALSE);
00130 
00131 protected:
00132     virtual BOOL OnSelectable(NodeRenderable* pRender);
00133     Change m_eChange;
00134     BOOL m_fShout;
00135     INT32 m_nAffected;
00136 
00137 private:
00138     virtual BOOL Pre();
00139     virtual BOOL Do(Node*);
00140     virtual BOOL Post();
00141 };
00142 
00143 
00144 
00145 /***********************************************************************************************
00146 >   class CCAPI SelectScan : public BaseSelectScan
00147 
00148     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00149     Created:    27/5/99
00150     Purpose:    Selects objects which are in the set item whose selection toggle has been
00151                 clicked.
00152     SeeAlso:    BaseSelectScan
00153 ***********************************************************************************************/
00154 
00155 class CCAPI SelectScan : public BaseSelectScan
00156 {
00157 public:
00158     SelectScan(SGNameItem* pItem, Change eChange, BOOL fQuiet = FALSE);
00159 
00160 protected:
00161     virtual BOOL OnSelectable(NodeRenderable*);
00162 
00163     SGNameItem* m_pItem;
00164 };
00165 
00166 
00167 
00168 /***********************************************************************************************
00169 >   class CCAPI SelectUnionScan : public BaseSelectScan
00170 
00171     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00172     Created:    27/5/99
00173     Purpose:    Selects objects which are in any of the highlighted set items.
00174     SeeAlso:    BaseSelectScan
00175 ***********************************************************************************************/
00176 
00177 class CCAPI SelectUnionScan : public BaseSelectScan
00178 {
00179 public:
00180     SelectUnionScan(Change eChange);
00181 
00182 protected:
00183     class CCAPI Test : public NameItemIter
00184     {
00185     public:
00186         enum Question { IS_NON_MEMBER = FALSE, IS_MEMBER = TRUE };
00187         Test(NodeRenderable* pRender, Question eQ);
00188 
00189     protected:  
00190         virtual BOOL Do(SGNameItem*);
00191 
00192         NodeRenderable* m_pRender;
00193         BOOL m_nXor;
00194     };
00195 
00196     virtual BOOL OnSelectable(NodeRenderable*);
00197 };
00198 
00199 
00200 
00201 /***********************************************************************************************
00202 >   class CCAPI SelectIntersectScan : public SelectUnionScan
00203 
00204     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00205     Created:    27/5/99
00206     Purpose:    Selects objects which are in all of the highlighted set items.
00207     SeeAlso:    BaseSelectScan; SelectUnionScan
00208 ***********************************************************************************************/
00209 
00210 class CCAPI SelectIntersectScan : public SelectUnionScan
00211 {
00212 public:
00213     SelectIntersectScan(Change eChange);
00214 
00215 protected:
00216     virtual BOOL OnSelectable(NodeRenderable*);
00217 };
00218 
00219 
00220 
00221 /********************************************************************************************
00222 >   class CCAPI AllowOpScan : public UndoableNodeScan
00223     class CCAPI AllowOpSingleScan : public AllowOpScan
00224 
00225     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00226     Created:    21/5/99
00227     Purpose:    Performs an AllowOp test and update on all the objects which are members
00228                 of highlighted 'Used Name' items in the Attribute gallery; performs the
00229                 same, but only on members of a specified set.
00230     Notes:      The present implementation is not reentrant or thread-safe.
00231 ********************************************************************************************/
00232 
00233 class CCAPI AllowOpScan : public UndoableNodeScan
00234 {
00235 public:
00236     AllowOpScan(UndoableOperation* pOp, Source* ps);
00237     virtual BOOL Update();
00238 
00239 protected:
00240     class CCAPI IsLitUsedName : public NameIterOp
00241     {
00242     public:
00243         IsLitUsedName(Node* pNode);
00244 
00245     protected:
00246         virtual BOOL Do(SGNameItem*);
00247     };
00248 
00249     virtual BOOL Do(Node*);
00250     static ObjChangeParam m_OCP;
00251 };
00252 
00253 
00254 
00255 class CCAPI AllowOpSingleScan : public AllowOpScan
00256 {
00257 public:
00258     AllowOpSingleScan(UndoableOperation* pOp, Source* ps, const StringBase& strName);
00259 
00260 protected:
00261     virtual BOOL Do(Node*);
00262     
00263     const StringBase& m_strName;
00264     SGUsedNames* m_pUsedNames;
00265 };
00266 
00267 
00268 
00269 /********************************************************************************************
00270 >   class CCAPI ApplyScan : public UndoableNodeScan
00271     class CCAPI ApplySingleScan : public ApplyScan
00272     class CCAPI ApplyPropScan : public ApplySingleScan
00273 
00274     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00275     Created:    21/5/99
00276     Purpose:    Applies all the highlighted 'Used Name' items in the Attribute gallery to
00277                 all the selected objects (if they don't already have them); a single
00278                 name to all the selected objects if they don't already have it; 'applies'
00279                 a NodeSetProperty for a set, with default SGNameProps, to the NodeSetSentinel.
00280 ********************************************************************************************/
00281 
00282 class CCAPI ApplyScan : public UndoableNodeScan
00283 {
00284 public:
00285     ApplyScan(UndoableOperation* pOp, Source* ps);
00286 
00287     // Unfortunately a bug in MSVC6 prevents this class being declared protected.
00288     class CCAPI ApplyItems : public NameIterOp
00289     {
00290     public:
00291         ApplyItems(Node* pNode, UndoableOperation* pOp);
00292 
00293     protected:
00294         virtual BOOL Do(SGNameItem*);
00295     };
00296 
00297 protected:
00298     virtual BOOL Do(Node*);
00299 };
00300 
00301 
00302 
00303 class CCAPI ApplySingleScan : public ApplyScan
00304 {
00305 public:
00306     ApplySingleScan(UndoableOperation* pOp, Source* ps, const StringBase& strName);
00307 
00308 protected:
00309     virtual BOOL Do(Node*);
00310     const StringBase& m_strName;
00311 };
00312 
00313 
00314 
00315 class CCAPI ApplyPropScan : public ApplySingleScan
00316 {
00317 public:
00318     ApplyPropScan(UndoableOperation* pOp, const StringBase& strName,
00319                   NodeSetProperty* pCopyPropNode = 0);
00320 
00321 protected:
00322     virtual BOOL Do(Node*);
00323     NodeSetProperty* m_pCopyPropNode;
00324 };
00325 
00326 
00327 
00328 /********************************************************************************************
00329 >   class CCAPI HideScan : public UndoableNodeScan
00330     class CCAPI HidePropScan : public HideScan
00331     class CCAPI HideSingleScan : public HideScan
00332 
00333     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00334     Created:    21/5/99
00335     Purpose:    Hides names of objects and their properties which are highlighted members
00336                 of the 'Used Names' group in the Attribute gallery; hides a specified
00337                 name of objects.
00338 ********************************************************************************************/
00339 
00340 class CCAPI HideScan : public UndoableNodeScan
00341 {
00342 public:
00343     HideScan(UndoableOperation* pOp, Source* ps);
00344 
00345     class CCAPI HideItems : public NameIterOp
00346     {
00347     public:
00348         HideItems(Node* pNode, UndoableOperation* pOp);
00349 
00350     private:
00351         virtual BOOL Do(SGNameItem*);
00352     };
00353 
00354 protected:
00355     virtual BOOL Do(Node*);
00356 };
00357 
00358 
00359 
00360 class CCAPI HidePropScan : public HideScan
00361 {
00362 public:
00363     HidePropScan(UndoableOperation* pOp);
00364 
00365 protected:
00366     class CCAPI HideProp : public HideScan::HideItems
00367     {
00368     public:
00369         HideProp(Node* pNode, UndoableOperation* pOp);
00370 
00371     private:
00372         virtual BOOL Do(SGNameItem*);
00373     };
00374 
00375     virtual BOOL Do(Node*);
00376 };
00377 
00378 
00379 
00380 class CCAPI HideSingleScan : public HideScan
00381 {
00382 public:
00383     HideSingleScan(UndoableOperation* pOp, Source* ps, const StringBase& strName);
00384 
00385 protected:
00386     virtual BOOL Do(Node*);
00387     const StringBase& m_strName;
00388     SGUsedNames* m_pUsedNames;
00389 };
00390 
00391 
00392 
00393 /***********************************************************************************************
00394 >   class CCAPI CreateDisplayScan : public NodeScan
00395 
00396     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00397     Created:    27/5/99
00398     Purpose:    Scans the 'selected' document and creates/refreshes the groups and items of
00399                 the Attribute gallery's display.
00400 ***********************************************************************************************/
00401 
00402 class CCAPI CreateDisplayScan : public NodeScan
00403 {
00404 public:
00405     CreateDisplayScan();
00406 
00407 protected:
00408     // Resets the counters in all the gallery's items.
00409     class CCAPI ClearCounters : public NameItemIter
00410     {
00411         virtual BOOL Do(SGNameItem*);
00412     };
00413 
00414     // Creates items for all the sets which include the given object.
00415     class CCAPI CreateItems : public NameGroupIter
00416     {
00417     public:
00418         CreateItems(Node* pNode);
00419 
00420     protected:
00421         virtual BOOL Do(SGNameGroup*);
00422         Node* m_pNode;
00423     };
00424 
00425     // Deletes all items with node counts of zero.
00426     class CCAPI DelItemIfUnref : public NameItemIter
00427     {
00428         virtual BOOL Do(SGNameItem*);
00429     };
00430 
00431     // Folds all groups which don't have items.
00432     class CCAPI FoldGroupIfEmpty : public NameGroupIter
00433     {
00434         virtual BOOL Do(SGNameGroup*);
00435     };
00436 
00437     virtual BOOL Pre();
00438     virtual BOOL Do(Node*);
00439     virtual BOOL Post();
00440 };
00441 
00442 
00443 
00444 
00445 // This stores delayed calls to the Extender::Extend function.
00446 struct ExtParam
00447 {
00448     NodeRenderableInk*  pInk;
00449     BYTE                nType;
00450     DocRect             drTriggerRef;
00451     DocRect             drTargetRef;
00452     DocRect             drNewTrigger;
00453     DocRect             drLastTarget;
00454     DocRect             drMinDiff;
00455 };
00456 
00457 #endif  /* !NGSCAN_H */

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