00001 // $Id: attrappl.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 // AttrAppl.h - The OpApplyAttributeToSelected class 00099 00100 #ifndef INC_ATTRAPPL 00101 #define INC_ATTRAPPL 00102 00103 #define OPTOKEN_APPLYATTRIB _T("ApplyAttribute") 00104 #define OPTOKEN_APPLYATTRIBS _T("ApplyAttributes") 00105 #define OPTOKEN_REPEATAPPLYATTRIB _T("RepeatApplyAttribute") 00106 #define OPTOKEN_APPLYTONODE _T("ApplyAttributeToNode") 00107 #define OPTOKEN_REPLACEATTRS _T("ReplaceAttributes") 00108 #define OPTOKEN_APPLYATTRINTERACTIVE _T("ApplyAttributeInteractive") 00109 00110 //#include "selop.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00111 //#include "fillattr.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00112 00113 class AttrBrushType; 00114 //class AttrFillGeometry; 00115 00116 /******************************************************************************************** 00117 00118 > class OpApplyAttrib : public SelOperation 00119 00120 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 00121 Created: 30/1/95 00122 Purpose: Virtual base class for ops that apply attibutes. 00123 00124 ********************************************************************************************/ 00125 00126 class CCAPI OpApplyAttrib: public SelOperation 00127 { 00128 CC_DECLARE_DYNCREATE( OpApplyAttrib ) 00129 00130 public: 00131 virtual CCRuntimeClass* GetValueChangeType(); 00132 virtual BOOL IsMergeableApplyOp(); 00133 virtual void SetMergeable(BOOL bNewState) {MergeRepeats = bNewState;} 00134 00135 // DMc 00136 // fn which tests the PromoteAttributeApplicationToMe of all compound nodes above the given node 00137 static NodeRenderableInk * FindCompoundNodeWhichRequiresAttribute(NodeRenderableInk * pStartNode, 00138 CCRuntimeClass *pAttribClass); 00139 00140 NodeAttribute * GetAttributeToApply() { return m_pAttr; } 00141 static BOOL KeepExistingCharacteristics(AttrFillGeometry*, AttrFillGeometry*); // Should be member of AttrFillGeometry 00142 00143 static BOOL DoApplyToSelection(SelOperation* pOp, NodeAttribute* Attrib, BOOL bMutate, BOOL bOptimise); 00144 00145 protected: 00146 BOOL DoInvalidateRegions(Range* NodeRange, 00147 NodeAttribute* Attrib, 00148 BOOL Mutate, 00149 NodeAttribute* OtherAttr, 00150 BOOL OtherMutate); 00151 00152 CCRuntimeClass* ValueChangeType; 00153 BOOL MergeRepeats; 00154 00155 // attribute to apply 00156 NodeAttribute * m_pAttr; 00157 }; 00158 00159 00160 00161 00162 /******************************************************************************************** 00163 00164 > class OpApplyAttribToSelected: public OpApplyAttrib 00165 00166 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00167 Created: 9/7/93 00168 Purpose: This class represents the OpApplyAttribToSelected operation. 00169 It applies the specified attribute to all selected objects 00170 00171 ********************************************************************************************/ 00172 00173 class CCAPI OpApplyAttribToSelected: public OpApplyAttrib 00174 { 00175 00176 CC_DECLARE_DYNCREATE( OpApplyAttribToSelected ) 00177 00178 public: 00179 OpApplyAttribToSelected(); 00180 static BOOL Init(); 00181 static OpState GetState(String_256*, OpDescriptor*); 00182 void DoWithParam(OpDescriptor* OpDesc, OpParam* pOpParam); 00183 virtual void GetOpName(String_256* OpName); // Overloaded so that we can store the undo string in 00184 // the operation rather than the OpDescriptor. 00185 00186 protected: 00187 BOOL ApplyToSelection(NodeAttribute* Attrib, BOOL Mutate); 00188 UINT32 UndoAttribStrID; // Undo string resource ID 00189 00190 }; 00191 00192 00193 00194 00195 /******************************************************************************************** 00196 00197 > class OpApplyAttrInteractive: public OpApplyAttrib 00198 00199 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 00200 Created: 10/08/2005 00201 Purpose: - 00202 00203 ********************************************************************************************/ 00204 00205 class CCAPI OpApplyAttrInteractive: public OpApplyAttrib 00206 { 00207 CC_DECLARE_DYNCREATE(OpApplyAttrInteractive) 00208 00209 public: 00210 OpApplyAttrInteractive(); 00211 static BOOL Init(); 00212 static OpState GetState(String_256*, OpDescriptor*); 00213 virtual void GetOpName(String_256* OpName); 00214 00215 virtual void DragFinished(DocCoord PointerPos, 00216 ClickModifiers ClickMods, 00217 Spread* pSpread, 00218 BOOL Success, 00219 BOOL bSolidDrag); 00220 00221 virtual BOOL DoDragAttr(AttrValueChange* pNewValue); 00222 virtual BOOL DragAttrChanged(AttrValueChange* pNewValue); 00223 virtual BOOL DragAttrFinished(AttrValueChange* pNewValue, BOOL bSuccess = TRUE); 00224 virtual void PerformMergeProcessing(); 00225 00226 private: 00227 UINT32 m_UndoAttribStrID; // Undo string resource ID 00228 List m_AttrGroupList; 00229 AttrTypeSet m_AttrTypes; 00230 }; 00231 00232 00233 00234 00235 /******************************************************************************************** 00236 00237 > class ApplyAttribsToSelectedParam : public OpParam 00238 00239 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00240 Created: 3/10/95 00241 Purpose: Parameters for the OpApplyAttribsToSelected operation. See 00242 OpApplyAttribsToSelected::DoWithParam for a description. 00243 00244 SeeAlso: OpApplyAttribsToSelected 00245 SeeAlso: OpParam 00246 00247 00248 ********************************************************************************************/ 00249 00250 00251 class ApplyAttribsToSelectedParam: public OpParam 00252 { 00253 CC_DECLARE_MEMDUMP( ApplyAttribsToSelectedParam ) 00254 00255 public: 00256 ApplyAttribsToSelectedParam(List* attribsToApply, 00257 UINT32 undoAttribStrID, 00258 List* attrGroupList, 00259 BOOL* success, 00260 BOOL* anyAttrsApplied) 00261 { AttribsToApply = attribsToApply; 00262 UndoAttribStrID = undoAttribStrID; 00263 AttrGroupList = attrGroupList; 00264 Success = success; 00265 AnyAttrsApplied = anyAttrsApplied;}; 00266 00267 List* AttribsToApply; 00268 List* AttrGroupList; 00269 UINT32 UndoAttribStrID; // The name of the operation used for undo (eg. Paste Attributes) 00270 BOOL* Success; // Has the operation actually failed 00271 BOOL* AnyAttrsApplied; // Have any attributes been applied by the op. (Has it done anything?) 00272 }; 00273 00274 /******************************************************************************************** 00275 00276 > class OpApplyAttribsToSelected: public OpApplyAttrib 00277 00278 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00279 Created: 03/10/95 00280 Purpose: This class represents the OpApplyAttribsToSelected operation. 00281 It applies the specified set of attributes to all selected objects 00282 SeeAlso: ApplyAttribsToSelectedParam 00283 00284 ********************************************************************************************/ 00285 00286 class CCAPI OpApplyAttribsToSelected: public OpApplyAttrib 00287 { 00288 CC_DECLARE_DYNCREATE( OpApplyAttribsToSelected ) 00289 00290 public: 00291 OpApplyAttribsToSelected(); 00292 static BOOL Init(); 00293 static OpState GetState(String_256*, OpDescriptor*); 00294 void DoWithParam(OpDescriptor* OpDesc, OpParam* pOpParam); 00295 virtual void GetOpName(String_256* OpName); // Overloaded so that we can store the undo string in 00296 // the operation rather than the OpDescriptor. 00297 00298 List * GetAttributeList() { return m_pAttribList; } 00299 00300 protected: 00301 UINT32 UndoAttribStrID; // Undo string resource ID 00302 List *m_pAttribList; 00303 }; 00304 00305 00306 /******************************************************************************************** 00307 00308 > class OpRepeatApplyAttribToSelected: public OpApplyAttrib 00309 00310 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 00311 Created: 7/3/95 00312 Purpose: This class represents the OpApplyAttribToSelected operation. 00313 It applies the specified attribute to all selected objects 00314 00315 ********************************************************************************************/ 00316 00317 class CCAPI OpRepeatApplyAttribToSelected: public Operation 00318 { 00319 00320 CC_DECLARE_DYNCREATE( OpRepeatApplyAttribToSelected ) 00321 00322 public: 00323 OpRepeatApplyAttribToSelected(); 00324 static BOOL Init(); 00325 static OpState GetState(String_256*, OpDescriptor*); 00326 void DoWithParam(OpDescriptor* OpDesc, OpParam* pOpParam); 00327 virtual void GetOpName(String_256* OpName); // Overloaded so that we can store the undo string in 00328 // the operation rather than the OpDescriptor. 00329 public: 00330 // Fill blob selection state, for operation merge code 00331 static FillBlobSelectionState FillBlobState; 00332 00333 protected: 00334 BOOL ApplyToSelection(NodeAttribute* Attrib, BOOL Mutate); 00335 virtual BOOL DoApply(Node* CurrentNode, NodeAttribute* Attrib, BOOL Mutate, BOOL bEffectRootOnly); 00336 }; 00337 00338 /******************************************************************************************** 00339 00340 > class OpApplyAttribToNode: public OpApplyAttrib 00341 00342 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 00343 Created: 28/1/95 00344 Purpose: This class represents the OpApplyAttribsToSelected operation. 00345 It applies the attribute to a specified object 00346 00347 ********************************************************************************************/ 00348 00349 class CCAPI OpApplyAttribToNode: public OpApplyAttrib 00350 { 00351 00352 CC_DECLARE_DYNCREATE( OpApplyAttribToNode ) 00353 00354 public: 00355 OpApplyAttribToNode(); 00356 static BOOL Init(); 00357 static OpState GetState(String_256*, OpDescriptor*); 00358 void DoWithParam(OpDescriptor* OpDesc, OpParam* pOpParam); 00359 virtual void GetOpName(String_256* OpName); // Overloaded so that we can store the undo string in 00360 // the operation rather than the OpDescriptor. 00361 private: 00362 BOOL DoApplyAttrib(NodeRenderableInk* InkNode, 00363 NodeAttribute* NewAttr, 00364 AttrTypeSet* pAttrTypesToBeApplied, 00365 ObjectSet* pLocalisedCompounds, 00366 BOOL InvalidateBounds=FALSE); 00367 00368 UINT32 UndoAttribStrID; // Undo string resource ID 00369 }; 00370 00371 /******************************************************************************************** 00372 00373 > class OpReplaceAttributes: public SelOperation 00374 00375 Author: Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> 00376 Created: 29/1/95 00377 Purpose: This class represents the OpReplaceAttributes operation. 00378 It replaces specific attributes with a new one. 00379 00380 ********************************************************************************************/ 00381 00382 class CCAPI OpReplaceAttributes: public SelOperation 00383 { 00384 00385 CC_DECLARE_DYNCREATE( OpReplaceAttributes ) 00386 00387 public: 00388 OpReplaceAttributes(); 00389 static BOOL Init(); 00390 static OpState GetState(String_256*, OpDescriptor*); 00391 void DoWithParam(OpDescriptor* OpDesc, OpParam* pOpParam); 00392 virtual void GetOpName(String_256* OpName); // Overloaded so that we can store the undo string in 00393 // the operation rather than the OpDescriptor. 00394 00395 // DMc - we need to get the attribute change 00396 NodeAttribute * GetAttribute() { return m_pAttr; } 00397 00398 private: 00399 BOOL DoReplace(NodeAttribute* NewAttr, NodeAttribute* OldAttr); 00400 UINT32 UndoAttribStrID; // Undo string resource ID 00401 NodeAttribute * m_pAttr; 00402 }; 00403 00404 00405 /******************************************************************************************** 00406 00407 > class ReplaceAttributesParam : public OpParam 00408 00409 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 00410 Created: 07/01/2005 00411 Purpose: The parameter for the OpReplaceAttributes operation 00412 00413 ********************************************************************************************/ 00414 class ReplaceAttributesParam : public OpParam 00415 { 00416 CC_DECLARE_DYNCREATE(ReplaceAttributesParam) 00417 00418 public: 00419 ReplaceAttributesParam() {m_pAttr = NULL; m_pOldAttrs = NULL;} 00420 00421 ReplaceAttributesParam(NodeAttribute* pAttrib, List* pOldAttrs) 00422 { 00423 m_pAttr = pAttrib; 00424 m_pOldAttrs = pOldAttrs; 00425 } 00426 00427 NodeAttribute* m_pAttr; 00428 List* m_pOldAttrs; 00429 }; 00430 00431 00432 00433 #endif 00434