00001 // $Id: sgliboil.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 // SGLibOil.h - oily library code 00099 00100 #ifndef INC_SGLIBOIL 00101 #define INC_SGLIBOIL 00102 00103 //#include "selop.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00104 //#include "opdesc.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00105 //#include "ops.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00106 //#include "ccobject.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00107 //#include "thumb.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00108 //#include "scrvw.h" 00109 00110 class Library; 00111 class PathName; 00112 class PageDropInfo; 00113 class KernelBitmap; 00114 class LibraryGallery; 00115 class CXaraFileRecordHandler; 00116 class CXaraFile; 00117 00118 00119 00120 00121 /**************************************************************************** 00122 00123 > class OpClipartImport: public OpMenuImport 00124 00125 Author: Richard_Millican (Xara Group Ltd) <camelotdev@xara.com> 00126 Created: 20/03/95 00127 Purpose: This class represents the Undo-able operation to import and 00128 open clipart files. 00129 SeeAlso: 00130 00131 ****************************************************************************/ 00132 00133 class CCAPI ClipartImportParam 00134 { 00135 public: 00136 ClipartImportParam(); 00137 00138 public: 00139 PathName *File; 00140 BOOL Import; 00141 BOOL Result; 00142 PageDropInfo* DropInfo; 00143 }; 00144 00145 #define OPTOKEN_OPCLIPARTIMPORT _T("ClipartImport") // Optoken for the clipart import / open 00146 00147 PORTNOTE("other","Removed OpClipartImport defn.") 00148 #ifndef EXCLUDE_FROM_XARALX 00149 class OpClipartImport: public SelOperation 00150 { 00151 CC_DECLARE_DYNCREATE( OpClipartImport ) 00152 00153 public: 00154 OpClipartImport(); 00155 ~OpClipartImport(); 00156 00157 static BOOL Init(); 00158 static OpState GetState(String_256*, OpDescriptor*); 00159 00160 00161 virtual void Do(OpDescriptor *); 00162 virtual void DoWithParam(OpDescriptor* pOp, OpParam* pClipartImportParam); 00163 00164 }; 00165 #endif 00166 00167 enum FillTypeEnum 00168 { 00169 ApplyToObject, // Apply to specified object (as a fill) 00170 ApplyToObjectAsTransp, // Apply to specified object (as a transparency) 00171 SetBackground, // Set as background 00172 AddToPage // Add as a new object on the page 00173 }; 00174 00175 class CCAPI BitmapImportParam 00176 { 00177 public: 00178 BitmapImportParam(); 00179 00180 public: 00181 PathName *File; 00182 BOOL Result; 00183 00184 // The next four params mirror those of AsyncBitmapImport 00185 Document* pTargetDoc; // Document the bitmap is going into 00186 FillTypeEnum FillType; // The type of fill (ApplyToObject, SetBackground, AddToPage) 00187 UINT32 TagObjectToFill; // Object to apply the fill to (if fill type == ApplyToObject) 00188 bool TagObjectValid; // Use Tag? (if !TagObjectValid && !pObjectValid use selection) 00189 NodeRenderableInk* pObject; // Pointer to object to fill 00190 bool pObjectValid; // Use pObject? (if !TagObjectValid && !pObjectValid use selection) 00191 Spread* pSpread; // Spread (for FillType == SetBackground) 00192 DocCoord DropPos; // DropPos (for FillType == AddToPage) 00193 }; 00194 00195 #define OPTOKEN_OPBITMAPIMPORT _T("BitmapImport") // Optoken for the Bitmap load & open 00196 00197 PORTNOTE("other","Removed OpBitmapImport") 00198 #ifndef EXCLUDE_FROM_XARALX 00199 class OpBitmapImport: public Operation 00200 { 00201 CC_DECLARE_DYNCREATE( OpBitmapImport ) 00202 00203 public: 00204 OpBitmapImport(); 00205 ~OpBitmapImport(); 00206 00207 static BOOL Init(); 00208 static OpState GetState(String_256*, OpDescriptor*); 00209 00210 void Do(OpDescriptor *); 00211 void DoWithParam(OpDescriptor* pOp, OpParam* pBitmapImportParam); 00212 00213 private: 00214 bool ApplyFill(BitmapImportParam *pInfo, KernelBitmap* pBitmap); 00215 }; 00216 #endif 00217 00218 /******************************************************************************************** 00219 00220 > SGLibOil 00221 00222 Author: Richard_Millican (Xara Group Ltd) <camelotdev@xara.com> 00223 Created: 8/3/95 00224 Purpose: Initially, general OILy utilities for the library, but then the Add Library 00225 dialog code was added in... 00226 00227 ********************************************************************************************/ 00228 00229 class SGLibOil: public CCObject 00230 { 00231 CC_DECLARE_DYNCREATE( SGLibOil ) 00232 00233 public: 00234 SGLibOil() {} 00235 ~SGLibOil() {} 00236 00237 static BOOL FileCopy(PathName *Source, PathName *Destination); 00238 static BOOL FileExists(PathName *FileName); 00239 static INT32 FileSize(PathName *FileName); 00240 static BOOL FileDelete(PathName *FileName); 00241 static UINT32 FileModified(PathName *FileName); 00242 static BOOL DirExists( const PathName &FileName ); 00243 static BOOL IsRootDirectory(String_256 *Path); 00244 static void AppendSlashIfNotPresent(String_256 *Str); 00245 static DWORD GetDriveSerialNumber(String_256 *PathStr); 00246 00247 static BOOL LocateCDROMDrive(LibraryGallery *LG, SGLibType LibType, String_256 *DriveName, BOOL *OnXaraNet, String_256 *XaraMount, BOOL AdjustPressed = FALSE); 00248 static BOOL MakeSound(PathName *WaveFile); 00249 static BOOL PlayRandomSample(String_256 *SampleString, String_256 *SubPath); 00250 static BOOL GetLibPath(LibraryGallery *LG, PathName *Path, BOOL CanGenerate, SGLibType Type, BOOL *Updated = NULL); 00251 static BOOL GenerateClicked(LibraryGallery *LG, PathName *GenDirectory); 00252 static BOOL CheckForIndex(String_256 *Path, LibraryGallery *ParentGallery); 00253 static BOOL LoadSoundDefinition(CXaraFileRecordHandler *pXFileRecHandler, CXaraFile * pCXFile, INT32 Tag, UINT32 Size, UINT32 RecordNumber); 00254 static BOOL ExportWav(BaseCamelotFilter *pFilter); 00255 static BOOL TidyUp(void); 00256 protected: 00257 // For use by GetLibPath 00258 static UINT32 CALLBACK FileHook( wxWindow *hDlg, UINT32 Msg, UINT32 wParam, INT32 lParam ); 00259 #if _MFC_VER >= 0x400 00260 static UINT32 CALLBACK ExplorerFileHook(HWND hDlg, UINT32 Msg, UINT32 wParam, INT32 lParam); 00261 static BOOL ExplorerFileHookNotify(HWND hDlg, LPOFNOTIFY pofn); 00262 #endif 00263 static BOOL SearchButtonClicked; 00264 static String_256 SearchDirectory; 00265 static String_256 BrowsePath; 00266 static SGLibType LibType; 00267 static LibraryGallery *ParentLibraryGallery; 00268 static BOOL GenerateButtonClicked; 00269 static TCHAR *TmpSndName; 00270 00271 public: 00272 static BOOL UseExplorerForAdd; 00273 }; 00274 00275 00276 // a home for Internet utility functions 00277 namespace InetUtils 00278 { 00279 // Utility function - will extract a single string from a composite indexed string 00280 // The components of the composite string must be separated by vertical bars (|) and the 00281 // length less than 1024 00282 TCHAR* GetStringField(UINT32 nIndex, UINT32 nCompositeStringID); 00283 // Returns the location of a file on a remote HTTP server, given the local path of the file relative to the 00284 // application's directory and a root URL on the server (currently www.xara.com). Works on the assumption 00285 // that the directory structure on the server is identical to the local one 00286 String_256 MakeURL(const String_256& rRelativePath, const String_256& rRootURL); 00287 String_256 MakeLocalPath(const String_256& rRelPath); 00288 BOOL GetTempInetDir(String_256* pTempDir); 00289 BOOL GetAppDataPath(String_256* pPath); 00290 BOOL GetAppCachePath(String_256* pPath); 00291 BOOL DeleteDirectoryTree(const String_256& rPath); 00292 } 00293 00294 00295 #endif 00296