00001 // $Id: cutop.h 1282 2006-06-09 09:46:49Z 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 // Clipboard operations 00099 00100 #ifndef INC_CUTOP 00101 #define INC_CUTOP 00102 00103 //#include "selop.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00104 //#include "trans2d.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00105 00106 class DocCoord; 00107 00108 #define OPTOKEN_CUT _T("Cut") 00109 #define OPTOKEN_COPY _T("Copy") 00110 #define OPTOKEN_PASTE _T("Paste") 00111 #define OPTOKEN_PASTEATSAMEPOS _T("PasteAtSamePos") 00112 #define OPTOKEN_DELETE _T("Delete") 00113 #define OPTOKEN_DUPLICATE _T("Duplicate") 00114 #define OPTOKEN_CLONE _T("EditClone") 00115 #define OPTOKEN_COPYANDTRANSFORM _T("CopyAndTransform") 00116 #define OPTOKEN_PASTEATTRIBUTES _T("PasteAttributes") 00117 00118 00119 /******************************************************************************************** 00120 00121 > class OpCut : public SelOperation 00122 00123 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00124 Created: 9/7/93 00125 Purpose: This class represents the Cut operation. When executed this operation hides 00126 all selected objects and places a copy of them on the Internal clipboard. 00127 00128 ********************************************************************************************/ 00129 00130 class CCAPI OpCut: public SelOperation 00131 { 00132 00133 CC_DECLARE_DYNCREATE( OpCut ) 00134 00135 public: 00136 OpCut(); 00137 static BOOL Init(); 00138 static OpState GetState(String_256*, OpDescriptor*); 00139 void Do(OpDescriptor*); 00140 00141 }; 00142 00143 /******************************************************************************************** 00144 00145 > class OpCopy : public SelOperation 00146 00147 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00148 Created: 9/7/93 00149 Purpose: This class represents the Copy operation. When executed this operation makes 00150 a copy of all selected objects and places them on the internal clipboard 00151 00152 ********************************************************************************************/ 00153 00154 class CCAPI OpCopy: public SelOperation 00155 { 00156 00157 CC_DECLARE_DYNCREATE( OpCopy ) 00158 00159 public: 00160 OpCopy(); 00161 static BOOL Init(); 00162 static OpState GetState(String_256*, OpDescriptor*); 00163 void Do(OpDescriptor*); 00164 00165 // Karim 21/01/2000 - see UndoableOperation base implementation. 00166 virtual BOOL MayChangeNodeBounds() const { return FALSE; } 00167 }; 00168 00169 00170 00171 /******************************************************************************************** 00172 > class OpParamPasteAtPosition 00173 00174 Author: Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 00175 Created: 10/10/96 00176 00177 Purpose: Holds information allowing the paste op to paste objects at a specific position 00178 00179 SeeAlso: Operation::OpParam 00180 00181 ********************************************************************************************/ 00182 00183 class OpParamPasteAtPosition : public OpParam 00184 { 00185 CC_DECLARE_DYNAMIC(OpParamPasteAtPosition) 00186 00187 public: 00188 OpParamPasteAtPosition() 00189 { pSpread = NULL; Centre.x = Centre.y = 0; } 00190 00191 OpParamPasteAtPosition(Spread* pTheSpread,DocCoord& TheCentre) 00192 { pSpread = pTheSpread; Centre = TheCentre; } 00193 00194 Spread* GetSpread() { return pSpread; } 00195 DocCoord GetCentre() { return Centre; } 00196 00197 private: 00198 Spread* pSpread; 00199 DocCoord Centre; 00200 }; 00201 00202 /******************************************************************************************** 00203 00204 > class OpPaste : public SelOperation 00205 00206 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00207 Created: 9/7/93 00208 Purpose: This class represents the Paste operation. When executed this takes a copy 00209 of all objects on the internal clipboard and adds them to the visible spread. 00210 00211 ********************************************************************************************/ 00212 00213 class CCAPI OpPaste: public SelOperation 00214 { 00215 CC_DECLARE_DYNCREATE( OpPaste ) 00216 00217 public: 00218 OpPaste(); 00219 static BOOL Init(); 00220 static OpState GetState(String_256*, OpDescriptor*); 00221 void Do(OpDescriptor*); 00222 void DoWithParam(OpDescriptor*, OpParam* pOpParam); 00223 00224 // Matt 22/01/2001 - Static function to remove names from pasted attribs if they would interfere with stretching info 00225 static BOOL RemoveNamesAlreadyUsedInStretching(Node * pAttrib, UndoableOperation* pOp); 00226 00227 protected: 00228 void DoPaste(OpDescriptor*,Spread* pSpread, DocCoord* pCentre); 00229 00230 BOOL FindCentreInsertionPosition(Spread** Spread, DocCoord* Position); 00231 BOOL DoPasteStandard(BOOL PasteAtSamePos, BOOL ExternalData, Spread* pSpread = NULL, DocCoord* pCentre = NULL); 00232 }; 00233 00234 /******************************************************************************************** 00235 00236 > class OpPasteAttributes : public SelOperation 00237 00238 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00239 Created: 24/08/95 00240 Purpose: This class represents the PasteAttributes operation. The operation applies 00241 all attributes common to the objects on the clipboard. This operation is 00242 not in itself undoable. It invokes another UndoableOperation to actually 00243 apply the attributes. 00244 00245 Phil 16/02/2005 00246 That is no longer true - the op is now derived from SelOperation and calls 00247 "Do" functions to add their actions to this operation. 00248 00249 ********************************************************************************************/ 00250 00251 class CCAPI OpPasteAttributes: public SelOperation 00252 { 00253 CC_DECLARE_DYNCREATE( OpPasteAttributes ) 00254 00255 public: 00256 OpPasteAttributes(); 00257 static BOOL Init(); 00258 static OpState GetState(String_256*, OpDescriptor*); 00259 void Do(OpDescriptor*); 00260 }; 00261 00262 00263 /******************************************************************************************** 00264 00265 > class OpDelete : public SelOperation 00266 00267 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00268 Created: 9/7/93 00269 Purpose: This class represents the Delete operation. When executed this operation hides 00270 all selected objects. 00271 00272 ********************************************************************************************/ 00273 00274 class CCAPI OpDelete: public SelOperation 00275 { 00276 00277 CC_DECLARE_DYNCREATE( OpDelete ) 00278 00279 public: 00280 OpDelete(); 00281 static BOOL Init(); 00282 static OpState GetState(String_256*, OpDescriptor*); 00283 void Do(OpDescriptor*); 00284 00285 private: 00286 // deletes fill ramp blobs 00287 // returns TRUE if any are deleted 00288 BOOL DeleteFillRampBlobs(); 00289 00290 }; 00291 00292 00293 /******************************************************************************************** 00294 00295 > class CarbonCopyOp : public SelOperation 00296 00297 Author: Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com> 00298 Created: 18/11/94 00299 Purpose: This class allows OpClone and OpDuplicate to share common code. Both are 00300 derived from it. 00301 SeeAlso: OpDuplicate, OpClone 00302 00303 ********************************************************************************************/ 00304 class CCAPI CarbonCopyOp: public SelOperation 00305 { 00306 CC_DECLARE_DYNCREATE( CarbonCopyOp ) 00307 00308 public: 00309 CarbonCopyOp(); 00310 static OpState GetState(String_256*, OpDescriptor*); 00311 BOOL DoProcessing(Trans2DMatrix Transformer, BOOL SelectCopy); 00312 }; 00313 00314 00315 /********************************************************************************************* 00316 00317 Preference: DuplicatePlacementX 00318 Section: Attributes 00319 Range: 0..Maximum DocCoord 00320 Purpose: Specifies where a duplicate copy of an object will be placed relative to the 00321 original object (X offset) 00322 00323 SeeAlso: DuplicatePlacementY 00324 00325 **********************************************************************************************/ 00326 00327 /********************************************************************************************* 00328 00329 Preference: DuplicatePlacementY 00330 Section: Attributes 00331 Range: 0..Maximum DocCoord 00332 Purpose: Specifies where a duplicate copy of an object will be placed relative to the 00333 original object (Y offset) 00334 00335 SeeAlso: DuplicatePlacementX 00336 00337 **********************************************************************************************/ 00338 00339 00340 /******************************************************************************************** 00341 00342 > class OpDuplicate : public CarbonCopyOp 00343 00344 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00345 Created: 9/7/93 00346 Purpose: This class represents the Duplicate operation. When executed this operation 00347 makes a copy of all selected objects, positioning the new objects a user 00348 prefered distance from the original. 00349 00350 ********************************************************************************************/ 00351 00352 #ifndef WEBSTER 00353 // Set to (-.5cm,-.5cm) 00354 #define DEFAULT_DUPLICATE_PLACEMENT_X (PX_MP_VAL*20) 00355 #define DEFAULT_DUPLICATE_PLACEMENT_Y -(PX_MP_VAL*20) 00356 #else 00357 // WEBSTER - markn 6/12/96 00358 // Changed default dup to be a round number of pixels 00359 #define DEFAULT_DUPLICATE_PLACEMENT_X 15000 00360 #define DEFAULT_DUPLICATE_PLACEMENT_Y -15000 00361 #endif // WEBSTER 00362 00363 class CCAPI OpDuplicate: public CarbonCopyOp 00364 { 00365 CC_DECLARE_DYNCREATE( OpDuplicate ) 00366 00367 public: 00368 OpDuplicate(); 00369 static BOOL Init(); 00370 static OpState GetState(String_256*, OpDescriptor*); 00371 virtual void Do(OpDescriptor*); 00372 00373 public: 00374 // Preference vars which specify the offset of the duplicate copy from the original 00375 // BODGE USING INT32 FOR NOW 00376 00377 // Graham 5/6/97: Made these public, so that other features 00378 //can use the duplicate offset preference 00379 static INT32 DuplicatePlacementX; 00380 static INT32 DuplicatePlacementY; 00381 }; 00382 00383 00384 /******************************************************************************************** 00385 00386 > class OpClone : public CarbonCopyOp 00387 00388 Author: Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com> 00389 Created: 18/11/94 00390 Purpose: This class represents the Clone operation. When executed this operation 00391 makes a copy of all selected objects, leaving the new objects on top of the 00392 existing objects. 00393 00394 ********************************************************************************************/ 00395 00396 class CCAPI OpClone: public CarbonCopyOp 00397 { 00398 CC_DECLARE_DYNCREATE( OpClone ) 00399 00400 public: 00401 OpClone(); 00402 static BOOL Init(); 00403 static OpState GetState(String_256*, OpDescriptor*); 00404 virtual void Do(OpDescriptor*); 00405 }; 00406 00407 00408 /******************************************************************************************** 00409 00410 > class OpCopyAndTransform : public CarbonCopyOp 00411 00412 Author: Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>, copying Peter's code heavily! 00413 Created: 25/6/96 00414 Purpose: This operation creates a transformed copy of the selected objects. 00415 00416 ********************************************************************************************/ 00417 00418 class CCAPI OpCopyAndTransform: public CarbonCopyOp 00419 { 00420 CC_DECLARE_DYNCREATE( OpCopyAndTransform ) 00421 00422 public: 00423 OpCopyAndTransform(); 00424 OpCopyAndTransform(Trans2DMatrix Transform, BOOL PassSelectCopy=FALSE); 00425 static BOOL Init(); 00426 static OpState GetState(String_256*, OpDescriptor*); 00427 virtual void Do(OpDescriptor*); 00428 00429 protected: 00430 Trans2DMatrix CopyTransform; 00431 BOOL SelectCopy; 00432 }; 00433 #endif // INC_CUTOP