#include <ai_eps.h>
Inheritance diagram for PhotoShopEPSFilter:
Public Member Functions | |
PhotoShopEPSFilter () | |
Constructor for an PhotoShopEPSFilter object. The object should be initialised before use. | |
virtual BOOL | Init () |
Initialise an PhotoShopEPSFilter object. | |
virtual BOOL | PrepareToImport () |
Displays an error, if a photoshop EPS file is imported. | |
Protected Member Functions | |
virtual void | CleanUpAfterImport (BOOL Successful) |
Cleans up after the PhotoShop "failed to import" message has been displayed. | |
virtual INT32 | EPSHeaderIsOk (ADDR pFileHeader, UINT32 HeaderSize) |
Checks to see if the EPS comment headers specify that this is an Photoshop generated EPS file, as required. | |
Private Member Functions | |
CC_DECLARE_DYNAMIC (PhotoShopEPSFilter) |
Definition at line 174 of file ai_eps.h.
|
Constructor for an PhotoShopEPSFilter object. The object should be initialised before use.
Definition at line 944 of file ai_eps.cpp. 00944 : EPSFilter () 00945 { 00946 // Set up filter descriptions. 00947 FilterNameID = _R(IDT_PHOTOSHOPEPS_FILTERNAME); 00948 FilterInfoID = _R(IDT_IMPORTMSG_PHOTOSHOPEPS); 00949 ImportMsgID = _R(IDT_IMPORTMSG_PHOTOSHOPEPS); 00950 00951 FilterID = FILTERID_PHOTOSHOPEPS; 00952 00953 Flags.CanImport = TRUE; 00954 Flags.CanExport = FALSE; 00955 }
|
|
|
|
Cleans up after the PhotoShop "failed to import" message has been displayed.
Reimplemented from EPSFilter. Definition at line 1113 of file ai_eps.cpp. 01114 { 01115 // Inform all the document components that we have finished importing 01116 TheDocument->EPSEndImport(this, FALSE); 01117 TheDocument->PostImport(); 01118 }
|
|
Checks to see if the EPS comment headers specify that this is an Photoshop generated EPS file, as required.
Reimplemented from EPSFilter. Definition at line 999 of file ai_eps.cpp. 01000 { 01001 UINT32 Lines = 0; 01002 TCHAR *Buffer = NULL; 01003 01004 // !PS-Adobe line is ok - check creator line... 01005 CCMemTextFile HeaderFile ( reinterpret_cast<char *> ( pFileHeader ), HeaderSize ); 01006 01007 if( HeaderFile.IsMemFileInited () == FALSE || HeaderFile.InitLexer () == FALSE ) 01008 { 01009 HeaderFile.close(); 01010 return 0; 01011 } 01012 01013 // Graeme (28/6/00) - Adobe have changed their file format, and so the first line can 01014 // now be a %PDF directive. Therefore look for this directive in the first twenty 01015 // lines. 01016 while ( ( Lines < 100 ) && !HeaderFile.eof () ) 01017 { 01018 // Get the current line from the file. 01019 HeaderFile.GetLineToken(); 01020 Buffer = const_cast<TCHAR *> ( HeaderFile.GetTokenBuf () ); 01021 01022 // Ensure that it's OK. 01023 ERROR2IF(Buffer == 0, 0, "Returned buffer from lex file == 0"); 01024 01025 // Increment the line counter. 01026 Lines++; 01027 01028 if (camStrncmp(Buffer, _T("%!PS-Adobe"), 10) == 0) 01029 { 01030 // Now find the %%Creator string. 01031 while ((Lines < 100) && !HeaderFile.eof()) 01032 { 01033 HeaderFile.GetLineToken(); 01034 Buffer = const_cast<TCHAR *> ( HeaderFile.GetTokenBuf() ); 01035 ERROR2IF(Buffer == 0, 0, "Returned buffer from lex file == 0"); 01036 Lines++; 01037 01038 // Return TRUE if this file was created by Illustrator, or has been exported 01039 // in Illustrator format. 01040 if (camStrncmp(Buffer, _T("%%Creator: Adobe Photoshop"), 26) == 0) 01041 { 01042 // We definitely want this. 01043 HeaderFile.close(); 01044 return 10; 01045 } 01046 01047 // If we find the compression token then stop the search as we don't want to 01048 // start looking in the compressed data! 01049 if (camStrncmp(Buffer, _T("%%Compression:"), 14)==0) 01050 break; 01051 } 01052 01053 // Remember to close the file before returning. 01054 HeaderFile.close(); 01055 01056 // The photoshop EPS filter is only there to stop Xara X from importing Photoshop 01057 // EPS files - so it's not suitable. 01058 return 0; 01059 } 01060 01061 // If we find the compression token then stop the search as we don't want to start 01062 // looking in the compressed data! 01063 if (camStrncmp(Buffer, _T("%%Compression:"), 14)==0) 01064 break; 01065 } 01066 01067 // Remember to close the file before returning. 01068 HeaderFile.close(); 01069 01070 // This file type isn't suitable. 01071 return 0; 01072 }
|
|
Initialise an PhotoShopEPSFilter object.
Reimplemented from EPSFilter. Definition at line 970 of file ai_eps.cpp. 00971 { 00972 // Get the OILFilter object 00973 pOILFilter = new PhotoShopEPSOILFilter(this); 00974 if (pOILFilter == NULL) 00975 return FALSE; 00976 00977 // Load the description strings 00978 FilterName.Load(FilterNameID); 00979 FilterInfo.Load(FilterInfoID); 00980 00981 // All ok 00982 return TRUE; 00983 }
|
|
Displays an error, if a photoshop EPS file is imported.
Reimplemented from EPSFilter. Definition at line 1086 of file ai_eps.cpp. 01087 { 01088 // Display error message. 01089 String_256 WarnMsg; 01090 01091 WarnMsg.MakeMsg(_R(IDT_IMPORTMSG_PHOTOSHOPEPS), _T("")); 01092 Error::SetError(0, WarnMsg, 0); 01093 01094 return FALSE; 01095 }
|