00001 // $Id: rechprnt.cpp 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 // The printer/imagesetting settings record handler for native and web files. 00099 00100 #include "camtypes.h" 00101 00102 //#include "cxfrec.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00103 //#include "cxfrech.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00104 #include "cxftags.h" 00105 //#include "prnmkcom.h" 00106 //#include "princomp.h" 00107 #include "rechprnt.h" 00108 00109 DECLARE_SOURCE("$Revision: 1688 $"); 00110 00111 00112 CC_IMPLEMENT_DYNAMIC(PrintingRecordHandler, CamelotRecordHandler); 00113 00114 // Declare smart memory handling in Debug builds 00115 #define new CAM_DEBUG_NEW 00116 00117 00118 /******************************************************************************************** 00119 00120 > virtual BOOL PrintingRecordHandler::BeginImport() 00121 00122 Author: Jason_Williams (Xara Group Ltd) <camelotdev@xara.com> 00123 Created: 15/8/96 00124 00125 Returns: TRUE if ok 00126 FALSE otherwise 00127 00128 Purpose: Initialises the record handler ready for importing 00129 00130 ********************************************************************************************/ 00131 00132 BOOL PrintingRecordHandler::BeginImport() 00133 { 00134 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX) 00135 pPrintComponent = GetPrintComponent(); 00136 00137 // Let's not faff around for the print marks component - just find it for ourselves 00138 Document *ScopeDoc = GetDocument(); 00139 if (ScopeDoc != NULL) 00140 { 00141 pPrintMarksComponent = (PrintMarksComponent *) 00142 ScopeDoc->GetDocComponent(CC_RUNTIME_CLASS(PrintMarksComponent)); 00143 } 00144 00145 return (pPrintComponent != NULL && pPrintMarksComponent != NULL); 00146 #else 00147 return TRUE; 00148 #endif 00149 } 00150 00151 00152 /******************************************************************************************** 00153 00154 > virtual UINT32* PrintingRecordHandler::GetTagList() 00155 00156 Author: Jason_Williams (Xara Group Ltd) <camelotdev@xara.com> 00157 Created: 29/5/96 00158 00159 Returns: Ptr to a list of tag values, terminated by CXFRH_TAG_LIST_END 00160 00161 Purpose: Provides the record handler system with a list of records handled by this 00162 handler 00163 00164 ********************************************************************************************/ 00165 00166 UINT32* PrintingRecordHandler::GetTagList() 00167 { 00168 static UINT32 TagList[] = 00169 { 00170 TAG_PRINTERSETTINGS, 00171 TAG_IMAGESETTING, 00172 TAG_COLOURPLATE, 00173 TAG_PRINTMARKDEFAULT, 00174 TAG_PRINTMARKCUSTOM, 00175 CXFRH_TAG_LIST_END 00176 }; 00177 00178 return(TagList); 00179 } 00180 00181 00182 00183 /******************************************************************************************** 00184 00185 > virtual BOOL PrintingRecordHandler::HandleRecord(CXaraFileRecord* pCXaraFileRecord) 00186 00187 Author: Jason_Williams (Xara Group Ltd) <camelotdev@xara.com> 00188 Created: 29/5/96 00189 00190 Inputs: pCXaraFileRecord = ptr to record to handle 00191 00192 Returns: TRUE if handled successfuly 00193 FALSE otherwise 00194 00195 Purpose: Handles the given record. 00196 00197 ********************************************************************************************/ 00198 00199 BOOL PrintingRecordHandler::HandleRecord(CXaraFileRecord* pCXaraFileRecord) 00200 { 00201 ERROR2IF(pCXaraFileRecord == NULL, FALSE, "PrintingRecordHandler::HandleRecord pCXaraFileRecord is NULL"); 00202 00203 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX) 00204 // When we're "opening" a file, we load, but if we're "importing" then we ignore all 00205 // printing options from the imported file (we don't want to override the existing 00206 // settings when you import into a different document) 00207 if (IsImporting()) 00208 return(TRUE); 00209 00210 switch (pCXaraFileRecord->GetTag()) 00211 { 00212 case TAG_PRINTERSETTINGS: 00213 if (pPrintComponent) 00214 pPrintComponent->ImportPrintSettings(pCXaraFileRecord); 00215 break; 00216 00217 case TAG_IMAGESETTING: 00218 if (pPrintComponent) 00219 pPrintComponent->ImportImagesetting(pCXaraFileRecord); 00220 break; 00221 00222 case TAG_COLOURPLATE: 00223 if (pPrintComponent) 00224 pPrintComponent->ImportColourPlate(pCXaraFileRecord, this); 00225 break; 00226 00227 case TAG_PRINTMARKDEFAULT: 00228 if (pPrintMarksComponent) 00229 pPrintMarksComponent->ImportDefaultPrintMark(pCXaraFileRecord); 00230 break; 00231 00232 case TAG_PRINTMARKCUSTOM: 00233 if (pPrintMarksComponent) 00234 pPrintMarksComponent->StartImportCustomPrintMark(this, pCXaraFileRecord); 00235 break; 00236 00237 default: 00238 ERROR3_PF(("PrintingRecordHandler::HandleRecord doesn't handle records with the tag (%d)\n",pCXaraFileRecord->GetTag())); 00239 return(FALSE); 00240 } 00241 #endif 00242 return(TRUE); 00243 } 00244 00245 00246 00247 /******************************************************************************************** 00248 00249 > virtual BOOL PrintingRecordHandler::BeginSubtree(UINT32 Tag) 00250 00251 Author: Jason_Williams (Xara Group Ltd) <camelotdev@xara.com> 00252 Created: 3/9/96 00253 00254 Inputs: Tag = tag value of the tag this handler last handled 00255 Returns: TRUE if this func wants exclusive handling of the tag 00256 FALSE otherwise 00257 Purpose: Informs the record handler that a subtree is following a tag of type 'Tag' 00258 00259 If you override this func and you do not wish other parts of the system to be informed of the 00260 subtree start, you should return TRUE 00261 00262 ********************************************************************************************/ 00263 00264 BOOL PrintingRecordHandler::BeginSubtree(UINT32 Tag) 00265 { 00266 // We only want to know about following subtrees when doing custom print mark records. 00267 // If we are doing one, then we grab the subtree so nobody else can faff about with it 00268 if (Tag != TAG_PRINTMARKCUSTOM) 00269 return(FALSE); 00270 00271 return(TRUE); 00272 } 00273 00274 00275 00276 /******************************************************************************************** 00277 00278 > virtual BOOL PrintingRecordHandler::EndSubtree(UINT32 Tag) 00279 00280 Author: Jason_Williams (Xara Group Ltd) <camelotdev@xara.com> 00281 Created: 3/9/96 00282 00283 Inputs: Tag = tag value of the tag this handler last handled 00284 Returns: TRUE if this func wants exclusive handling of the tag 00285 FALSE otherwise 00286 00287 Purpose: Informs the record handler that a subtree that followed a tag of type 'Tag' has ended 00288 00289 If you override this func and you do not wish other parts of the system to be informed of the 00290 subtree end, you should return TRUE 00291 00292 ********************************************************************************************/ 00293 00294 BOOL PrintingRecordHandler::EndSubtree(UINT32 Tag) 00295 { 00296 // We only want to know about following subtrees when doing custom print mark records. 00297 // If we are doing one, then we grab the subtree so nobody else can faff about with it 00298 if (Tag != TAG_PRINTMARKCUSTOM) 00299 return(FALSE); 00300 00301 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX) 00302 // OK, it is the end of a custom print mark record, so complete the import 00303 if (pPrintMarksComponent && !IsImporting()) 00304 pPrintMarksComponent->EndImportCustomPrintMark(this); 00305 #endif 00306 00307 return(TRUE); 00308 } 00309 00310 00311 00312 /******************************************************************************************** 00313 00314 > virtual void PrintingRecordHandler::GetRecordDescriptionText(CXaraFileRecord* pRecord,StringBase* pStr) 00315 00316 Author: Jason_Williams (Xara Group Ltd) <camelotdev@xara.com> 00317 Created: 12/6/96 00318 00319 Inputs: pRecord = ptr to a record 00320 pStr = ptr to string to update 00321 Returns: - 00322 Purpose: This provides descriptions for the define colour records. 00323 00324 Notes: This funciton is only present in _DEBUG builds 00325 00326 ********************************************************************************************/ 00327 00328 #ifdef XAR_TREE_DIALOG 00329 void PrintingRecordHandler::GetRecordDescriptionText(CXaraFileRecord* pRecord, StringBase* pStr) 00330 { 00331 if (pStr == NULL || pRecord == NULL) 00332 return; 00333 00334 // Call base class first to output the tag and size 00335 CamelotRecordHandler::GetRecordDescriptionText(pRecord, pStr); 00336 00337 UINT32 Tag = pRecord->GetTag(); 00338 // INT32 RecordNumber = pRecord->GetRecordNumber(); 00339 00340 switch (Tag) 00341 { 00342 case TAG_PRINTERSETTINGS: 00343 break; 00344 00345 case TAG_IMAGESETTING: 00346 break; 00347 00348 case TAG_COLOURPLATE: 00349 break; 00350 00351 case TAG_PRINTMARKDEFAULT: 00352 { 00353 BYTE ID; 00354 pRecord->ReadBYTE(&ID); 00355 String_16 Temp; 00356 Temp._MakeMsg(_T("Printers mark, ID = #1%ld"), (INT32)ID); 00357 *pStr += Temp; 00358 } 00359 break; 00360 00361 case TAG_PRINTMARKCUSTOM: 00362 *pStr += _T("Custom printers mark subtree follows..."); 00363 break; 00364 00365 default: 00366 ERROR3("Unknown tag passed to PrintingRecordHandler"); 00367 break; 00368 } 00369 } 00370 00371 #endif // _DEBUG 00372