00001 // $Id: tmpltatr.h 1688 2006-08-10 12:05:20Z gerry $ 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 #ifndef INC_TMPLTATR 00100 #define INC_TMPLTATR 00101 00102 #define ENSURE_NOT_NULL(Pointer) ERROR2IF(Pointer == NULL, 0, "NULL Args") 00103 00104 00105 extern const String_8 NullString; 00106 00107 00108 class WizOp; 00109 class WizOpStyles; 00110 /*********************************************************************************************** 00111 00112 > class TemplateAttribute : public AttrUser 00113 00114 Author: Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> 00115 Created: 21/06/97 00116 00117 Purpose: This represents a TemplateOp/Argument/user-changable from the template file 00118 attribute. 00119 It will probably be superceded, but for now it's derived from AttrUser with a 00120 value of the form <InternalName>[/<Param>][;<Question>] 00121 Bring on the plug-in attributes I say. 00122 00123 ***********************************************************************************************/ 00124 class TemplateAttribute : public AttrUser 00125 { 00126 CC_DECLARE_DYNAMIC(TemplateAttribute) 00127 public: 00128 TemplateAttribute( const StringBase& ArgumentName = NullString, 00129 const StringBase& Question = NullString, 00130 const StringBase& Param = NullString); 00131 00132 00133 00134 // Overridden 00135 virtual Node* SimpleCopy(); 00136 void CopyNodeContents(TemplateAttribute* pAttr); 00137 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy); 00138 virtual UINT32 GetAttrNameID(); 00139 virtual BOOL IsAnObjectName() const; 00140 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter); 00141 virtual AttributeIdentifier GetAttributeClassID() const; 00142 virtual VisibleAttribute* CreateVisibleAttribute() const; 00143 00144 // Data Access 00145 String_256 GetQuestion() const; 00146 String_256 GetInternalName() const; 00147 String_256 GetParam() const; 00148 StringBase& GetUserName() const; 00149 00150 BOOL SetWizOpNameAndParam(const StringBase& Name, const StringBase& Param); 00151 00152 protected: 00153 BOOL m_fIsAnObjectName; 00154 static const TCHAR s_ParamDelimiter; 00155 static const String_8 s_TemplateKey; 00156 }; 00157 00158 00159 // Shorthand - we use these a lot in the Name gallery. 00160 #define TA_CLASS (CC_RUNTIME_CLASS(TemplateAttribute)) 00161 #define TA_NAME (String(TEXT("ObjectName"))) 00162 00163 00164 00165 /*********************************************************************************************** 00166 00167 > class TemplateAttrRecordHandler : public CamelotRecordHandler 00168 00169 Author: Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> 00170 Created: 27/06/97 00171 00172 Purpose: Handles the reading of WizOp records in the v2 file format 00173 00174 ***********************************************************************************************/ 00175 class TemplateAttrRecordHandler : public CamelotRecordHandler 00176 { 00177 // Give my name in memory dumps 00178 CC_DECLARE_DYNAMIC(TemplateAttrRecordHandler); 00179 00180 public: 00181 // functions that must be implemented. 00182 virtual UINT32* GetTagList(); 00183 virtual BOOL HandleRecord(CXaraFileRecord* pCXaraFileRecord); 00184 00185 #ifdef XAR_TREE_DIALOG 00186 virtual void GetRecordDescriptionText(CXaraFileRecord* pCXaraFileRecord,StringBase* Str); 00187 virtual void GetTagText(UINT32 Tag,String_256& Str); 00188 #endif 00189 00190 private: 00191 // nothing here but us mice 00192 }; 00193 00194 class WizOpStyle; 00195 /*********************************************************************************************** 00196 00197 > class StyleReferenceAttribute : public TemplateAttribute 00198 00199 Author: Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> 00200 Created: 21/06/97 00201 00202 Purpose: This represents a TemplateOp/Argument/user-changable from the template file 00203 attribute. 00204 It will probably be superceded, but for now it's derived from AttrUser with a 00205 value of the form <InternalName>[/<Param>][;<Question>] 00206 Bring on the plug-in attributes I say. 00207 00208 ***********************************************************************************************/ 00209 class StyleReferenceAttribute : public TemplateAttribute 00210 { 00211 CC_DECLARE_MEMDUMP(StyleReferenceAttribute) 00212 public: 00213 StyleReferenceAttribute(const WizOpStyle& Style); 00214 00215 // Overridden 00216 virtual Node* SimpleCopy(); 00217 virtual UINT32 GetAttrNameID(void); 00218 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter); 00219 virtual BOOL CopyComponentData(BaseDocument* SrcDoc, BaseDocument* NodesDoc); 00220 00221 virtual VisibleAttribute* CreateVisibleAttribute() const; 00222 00223 const StringBase& GetStyleName() const; 00224 00225 protected: 00226 // Implementation 00227 BOOL SetStyle(const Style& StyleToReference); 00228 00229 WizOpStyles* GetStylesForFilter(BaseCamelotFilter& Filter) const; 00230 WizOpStyles* GetStylesForDoc(BaseDocument& Doc) const; 00231 // WizOpStyles* GetStyles() const; 00232 }; 00233 00234 00235 00236 /*********************************************************************************************** 00237 00238 > class WizOpStyleRefRecordHandler : public CamelotRecordHandler 00239 00240 Author: Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> 00241 Created: 27/06/97 00242 00243 Purpose: Handles the reading of WizOpStyleRef records in the v2 file format 00244 00245 ***********************************************************************************************/ 00246 class WizOpStyleRefRecordHandler : public CamelotRecordHandler 00247 { 00248 // Give my name in memory dumps 00249 CC_DECLARE_DYNAMIC(WizOpStyleRefRecordHandler); 00250 00251 public: 00252 WizOpStyleRefRecordHandler() : m_pStyleComponent(NULL) {} 00253 BOOL Init(BaseCamelotFilter* pFilter); 00254 00255 // functions that must be implemented. 00256 virtual UINT32* GetTagList(); 00257 virtual BOOL HandleRecord(CXaraFileRecord* pCXaraFileRecord); 00258 00259 #ifdef XAR_TREE_DIALOG 00260 virtual void GetRecordDescriptionText(CXaraFileRecord* pCXaraFileRecord,StringBase* Str); 00261 virtual void GetTagText(UINT32 Tag,String_256& Str); 00262 #endif 00263 00264 protected: 00265 WizOpStyles& GetImportedStyles() const; 00266 00267 private: 00268 WizOpStyles* m_pStyleComponent; 00269 }; 00270 00271 #endif //ifdef INC_USERATTR