CamelotEPSFilter Class Reference

A filter that imports EPS files in Camelot EPS format. More...

#include <cameleps.h>

Inheritance diagram for CamelotEPSFilter:

ArtWorksEPSFilter EPSFilter VectorFilter Filter ListItem CCObject SimpleCCObject CamelotNativeEPSFilter List of all members.

Public Member Functions

 CamelotEPSFilter ()
 Constructor for an CamelotEPSFilter object. The object should be initialised before use.
BOOL Init ()
 Initialise an CamelotEPSFilter object.
BOOL IsDefaultDocRequired (const TCHAR *pcszPathName)
 Works out if opening a file of this type requires a default document to be loaded. If the file format supplies the document then return FALSE otherwise return TRUE. An example would be opening a bitmap file. This has no document defined in the file format and so we need to load the default document before importing the bitmap into this file. In this baseclass version return FALSE and hence assume that the filters that need to will override this function to return TRUE.
BOOL PrepareToExport (CCLexFile *, Spread *pSpread)
 Prepare to import EPS data using this filter. This sets up the filter to a sensible state for reading.
TCHARGetEPSCommand (EPSCommand Cmd)
 Given an EPS token, return the string representation of it; mainly for debugging purposes.
BOOL ExportBitmap (KernelBitmap &)
 Export a bitmap to a Camelot EPS file. This outputs the standard tokens and data required to embed a bitmap in a Camelot EPS file.
virtual BOOL CanIncludePreviewBmp ()
 Admits that Camelot EPS is able to have a Preview Bitmap attached to the document. To actually put a bitmap into the file, call the IncludePreviewBmp(TRUE).

Protected Member Functions

virtual void LookUpToken ()
 Compare the current token against the Camelot keywords to see if it is one of them.
virtual BOOL ProcessToken ()
 Processes EPS tokens that are not part of the standard Illustrator set, or which need to be handled differently to the standard Illustrator meanings. i.e. this is the function that handles all the Camelot EPS operators.
INT32 EPSHeaderIsOk (ADDR pFileHeader, UINT32 HeaderSize)
 Checks to see if the EPS comment headers specify that this is an Camelot generated EPS file, as required.
BOOL PrepareToImport ()
 See base class. This just sets up the bitmap fill flag for Camelot EPS.
void CleanUpAfterImport (BOOL Successful)
 stops stuff happening after clearing up for a Camelot EPS import
virtual BOOL GetExportOptions ()
 Allows the user to be prompted to get information for export. In this Camelot EPS case, we are affectively exporting a printable EPS and so require the user to set a few options. Moves the code from OilFilters to a proper function. Scope: Protected.
virtual BOOL ReadBitmap ()
 Reads the bitmap info from the eps stack and loads in the bitmap data It loads a type 0 bitmap.
virtual void BitmapPoolAttach (KernelBitmap *pBitmap)
 Makes a reference to the bitmap so that it can be used throughout the eps file with repeating the data. This base class version actually does nothing but delete the bitmap. CamelotNativeEPS is where the real processing is done.
BOOL ProcessBlend ()
 Reads in all the elements of a blend structure in the EPS file.
BOOL ProcessBlender ()
 Reads in all the elements of a blender structure in the EPS file.
BOOL StartBlend ()
 Used when a blend structure needs to be created - after this is called, all new nodes added with AddNewNode() will be added as children of this new blend, until EndBlend is called.
BOOL StartBlender ()
 Used when a blender structure needs to be created - after this is called, all paths will be discarded, until EndBlender is called.
BOOL EndBlend ()
 Used when a blend has finished being constructed and we want to return to normal node positioning. The blend is added to the document when this function is called (although that depending on the current filter mode, i.e. whether this is a new or existing layer, it may not be added directly to the documnent tree straight away - it may be deferred until the next layer is found, or the import has ended).
BOOL EndBlender ()
 Used when a blender has finished being constructed. Path importing is returned to normal (i.e. they're no longer discarded).
BOOL ProcessRegularShape ()
 Reads in all the elements of a blend structure in the EPS file.
BOOL ProcessRegularShapeParams ()
 Reads in all the parameters of a regular shape structure in the EPS file.
BOOL ProcessEnvelope ()
 Reads in all the elements of an envelope structure in the EPS file.
BOOL ProcessPerspective ()
 Reads in all the elements of an perspective structure in the EPS file.
BOOL StartMould (MouldSpace mSpace)
 Used when an mould structure needs to be created - after this is called, all new nodes added with AddNewNode() will be added as children of this new mould, until EndMould is called.
BOOL EndMould ()
 Used when a mould has finished being constructed and we want to return to normal node positioning.
BOOL RemoveUnwantedAttributes (NodeMould *pNodeMould)
 Removes unwanted attributes added as first children of the node mould. It does this by scanning the children of the nodemouldgroup and determining what attributes are applied here.
void BuildSubtreeAttrMap (CCAttrMap *pAttribMap, Node *pNode)
 Adds all attribute pointers to the pAttribMap which it finds as children of pParent. Notes: Told off by MarkN for not commenting ... oopps.
BOOL ProcessMould ()
 Processes tokens inside a mould object. Tokens specific to mould objects are processed along with some overridding of default tokens such as groups.
BOOL ProcessMouldTokens ()
 Processes tokens inside a mould object. Tokens specific to mould objects are processed along with some overridding of default tokens such as groups.
BOOL ProcessMouldShape ()
 Reads in all the elements of a mould geometry held in the EPS file. The description of the geometry for this particular file type is that of a path. Input Stack = coord, coord.
BOOL ProcessMouldSourceObjs ()
 Reads in all the objects within the mould source grouping.
BOOL ProcessMouldDestinObjs ()
 Reads in all the objects within the mould destination grouping.
BOOL ProcessMouldThreshold ()
 Reads in all the elements of a mould threshold structure in the EPS file. The threshold structure is defined as an extension token as it only came into existance after version 1.1 documents. This function is called from the extension token parser. We read the threshold value and set the EPSFilter variable NewMouldThreshold. Having read in the mould, the threshold will be read from this variable and overwrite the default constructed threshold.
BOOL ReadSimplePath (Path *TempPath)
 Reads in the defined mould path shape.
BOOL ProcessFontFlags ()
 Reads in all the elements of a font flags structure in the EPS file.
BOOL ProcessBitmapFlags ()
 Reads in all the elements of a bitmap flags structure in the EPS file.
BOOL ProcessFontType ()
 Reads in all the elements of a font type structure in the EPS file.
BOOL FindEndOfTag ()
 Continues reading tokens until the ceo token is found.
BOOL ProcessGuideLayer ()
 Reads in a guide layer object.
BOOL ProcessGuideline ()
 Reads in a guide line object.

Protected Attributes

PendingBitmap m_PendingBitmap
INT32 BitmapTransparencyIndex
KernelBitmappBitmap
NodeRegularShapepRegularShape
BOOL RegularShapeIsFilled
BOOL RegularShapeIsStroked
CamelotEPSFilter::_BitmapAttrs BitmapAttrs

Static Protected Attributes

static CommandMap CamelotCommands []

Private Member Functions

 CC_DECLARE_DYNAMIC (CamelotEPSFilter)

Classes

struct  _BitmapAttrs

Detailed Description

A filter that imports EPS files in Camelot EPS format.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/03/94
See also:
EPSFilter; ArtWorksEPSFilter

Definition at line 262 of file cameleps.h.


Constructor & Destructor Documentation

CamelotEPSFilter::CamelotEPSFilter  ) 
 

Constructor for an CamelotEPSFilter object. The object should be initialised before use.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/10/93
See also:
EPSFilter::Init

Definition at line 293 of file cameleps.cpp.

00294 {
00295     // Set up filter descriptions.
00296     FilterNameID = _R(IDT_CAMEPS_FILTERNAME);
00297     FilterInfoID = _R(IDT_CAMEPS_FILTERINFO);
00298     ImportMsgID  = _R(IDT_IMPORTMSG_CAMELOT);
00299     ExportMsgID  = _R(IDT_EXPORTMSG_CAMEPS);
00300 
00301     FilterID = FILTERID_CAMELOT_EPS;
00302 
00303 #ifndef STANDALONE
00304     Flags.CanImport = TRUE;
00305     //WEBSTER-Martin-27/01/97
00306 #ifdef WEBSTER
00307     Flags.CanExport = FALSE;
00308 #else
00309     Flags.CanExport = TRUE;
00310 #endif //WEBSTER
00311 #else
00312     Flags.CanImport = FALSE;
00313     Flags.CanExport = FALSE;
00314 #endif
00315 
00316     // We don't want to re-position Camelot files because they should be ok and
00317     // Charles gets upset if his drawings move.
00318     AdjustOrigin = FALSE;
00319 
00320 }


Member Function Documentation

void CamelotEPSFilter::BitmapPoolAttach KernelBitmap pBitmap  )  [protected, virtual]
 

Makes a reference to the bitmap so that it can be used throughout the eps file with repeating the data. This base class version actually does nothing but delete the bitmap. CamelotNativeEPS is where the real processing is done.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/1/95
Parameters:
pBitmap - The bitmap to attach [INPUTS]

Reimplemented in CamelotNativeEPSFilter.

Definition at line 1494 of file cameleps.cpp.

01495 {
01496     // Base class version of the function just deletes the bitmap as it does not really know
01497     // what it needs to do with it
01498     if (pBitmap!=NULL)
01499         delete pBitmap;
01500 }

void CamelotEPSFilter::BuildSubtreeAttrMap CCAttrMap pAttribMap,
Node pParent
[protected]
 

Adds all attribute pointers to the pAttribMap which it finds as children of pParent. Notes: Told off by MarkN for not commenting ... oopps.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/10/95
Parameters:
pAttribMap = a pointer to an attribute map [INPUTS] pParent = a pointer to the parent node
Returns:
-

Definition at line 2519 of file cameleps.cpp.

02520 {
02521     CCRuntimeClass* pTypeInfo;
02522     void* pDummy;
02523 
02524     Node* qNode = pParent->FindFirstChild();
02525     while (qNode)
02526     {
02527         if (qNode->IsAnAttribute())
02528         {
02529             NodeAttribute* pAttrib = (NodeAttribute*)qNode;
02530             pTypeInfo = pAttrib->GetAttributeType();
02531             if (!pAttribMap->Lookup(pTypeInfo, pDummy))
02532                 pAttribMap->SetAt(pTypeInfo, qNode);
02533         }
02534 
02535         if (qNode->FindFirstChild())
02536         {
02537             BuildSubtreeAttrMap(pAttribMap, qNode);
02538         }
02539 
02540         qNode = qNode->FindNext();
02541     }
02542 }

BOOL CamelotEPSFilter::CanIncludePreviewBmp  )  [virtual]
 

Admits that Camelot EPS is able to have a Preview Bitmap attached to the document. To actually put a bitmap into the file, call the IncludePreviewBmp(TRUE).

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/2/95
Returns:
TRUE
See also:
Filters::CanIncludePreviewBmp

Reimplemented from Filter.

Definition at line 364 of file cameleps.cpp.

00365 {
00366     return TRUE;
00367 }

CamelotEPSFilter::CC_DECLARE_DYNAMIC CamelotEPSFilter   )  [private]
 

void CamelotEPSFilter::CleanUpAfterImport BOOL  Successful  )  [protected, virtual]
 

stops stuff happening after clearing up for a Camelot EPS import

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/07/95
Parameters:
[INPUTS] 
Returns:
-

Errors: -

Reimplemented from EPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 524 of file cameleps.cpp.

00525 {
00526     if(IS_A(this, CamelotEPSFilter))
00527         return;
00528 
00529     ArtWorksEPSFilter::CleanUpAfterImport(Successful);
00530 }

BOOL CamelotEPSFilter::EndBlend  )  [protected]
 

Used when a blend has finished being constructed and we want to return to normal node positioning. The blend is added to the document when this function is called (although that depending on the current filter mode, i.e. whether this is a new or existing layer, it may not be added directly to the documnent tree straight away - it may be deferred until the next layer is found, or the import has ended).

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/11/94
Returns:
TRUE if the blend was ended ok; FALSE if not.

Errors: Out of memory

See also:
CamelotEPSFilter::StartBlend

Reimplemented from ArtWorksEPSFilter.

Definition at line 1912 of file cameleps.cpp.

01913 {
01914     // Sanity check
01915     ENSURE(pNode->IsKindOf(CC_RUNTIME_CLASS(NodeBlend)), "No blend in CamelotEPSFilter::EndBlend");
01916 
01917     // Keep the blend ptr and find the first child of the node before we reset pNode.
01918     Node* pNodeBlend = pNode;
01919     Node* pChildNode = pNode->FindFirstChild();
01920 
01921     // Get the parent of the blend node, and use that to add new objects to
01922     pNode = pNodeBlend->FindParent();
01923     ENSURE(pNode != NULL, "Blend has no parent in ProcessBlend()");
01924 
01925     // Initialise all the child blender nodes
01926     UINT32 BlenderCount=0;
01927     while (pChildNode != NULL)
01928     {
01929         if (IS_A(pChildNode,NodeBlender))
01930         {
01931             NodeBlender* pNodeBlender = (NodeBlender*)pChildNode;
01932 
01933             // Get the imported blender params
01934             INT32 PathIndexStart = pNodeBlender->GetPathIndexStart();
01935             INT32 PathIndexEnd   = pNodeBlender->GetPathIndexEnd();
01936             INT32 ObjIndexStart     = pNodeBlender->GetObjIndexStart();
01937             INT32 ObjIndexEnd       = pNodeBlender->GetObjIndexEnd();
01938 
01939             // Find the nodes this blender is to blend together
01940             NodeRenderableInk* pNodeStart = pNodeBlender->FindObjIndexedNode(ObjIndexStart);
01941             NodeRenderableInk* pNodeEnd   = pNodeBlender->FindObjIndexedNode(ObjIndexEnd);
01942 
01943             // They should not be NULL
01944             if (pNodeStart == NULL || pNodeEnd == NULL)
01945                 return FALSE;
01946 
01947             // Init the blender with the start and end nodes.
01948             if (!pNodeBlender->Initialise(pNodeStart,pNodeEnd,PathIndexStart,PathIndexEnd,ImportInfo.pOp,NULL,TRUE))
01949                 return FALSE;
01950 
01951             BlenderCount++;
01952         }
01953         pChildNode = pChildNode->FindNext();
01954     }
01955 
01956     if (BlenderCount == 0)
01957     {
01958         ERROR3("Imported Blend node doesn't contain any blender nodes");
01959         if (!ImportInfo.pOp->DoHideNode(pNodeBlend, TRUE))
01960             return FALSE;
01961     }
01962 
01963     return TRUE;
01964 }

BOOL CamelotEPSFilter::EndBlender  )  [protected]
 

Used when a blender has finished being constructed. Path importing is returned to normal (i.e. they're no longer discarded).

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/11/94
Returns:
TRUE if the blender was ended ok; FALSE if not.

Errors: -

See also:
CamelotEPSFilter::StartBlender

Reimplemented from ArtWorksEPSFilter.

Definition at line 2077 of file cameleps.cpp.

02078 {
02079     ThePathType = PATH_NORMAL;
02080     return TRUE;
02081 }

BOOL CamelotEPSFilter::EndMould  )  [protected]
 

Used when a mould has finished being constructed and we want to return to normal node positioning.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/03/95
Returns:
TRUE if the envelope was ended ok; FALSE if not.
See also:
CamelotEPSFilter::StartMould()

Reimplemented from ArtWorksEPSFilter.

Definition at line 2408 of file cameleps.cpp.

02409 {
02410     // Sanity check
02411     ERROR3IF(!pNode->IsKindOf(CC_RUNTIME_CLASS(NodeMould)), "No MouldParent in CamelotEPSFilter::EndMould");
02412 
02413     // Get a pointer to the mould object
02414     NodeMould* pNodeMould = (NodeMould*)pNode;
02415     // move pNode up one level
02416     pNode = pNode->FindParent();
02417     ERROR3IF(pNode==NULL, "No parent of mould in CamelotEPSFilter::EndMould");
02418 
02419     // for loaded docs we need to set the default threshold to the
02420     // old 1024 threshold until such time as it changes by way of parsing
02421     // the threshold token. This avoids blends from remapping!
02422     pNodeMould->GetGeometry()->SetThreshold(EPSFilter::NewMouldThreshold);
02423 
02424     // We should really have these items, otherwise well, we have nothing whatsoever
02425     NodeMouldPath* pNodeMouldPath = (NodeMouldPath*)pNodeMould->FindFirstChild(CC_RUNTIME_CLASS(NodeMouldPath));
02426     NodeMouldGroup* pNodeMouldGroup = (NodeMouldGroup*)pNodeMould->FindFirstChild(CC_RUNTIME_CLASS(NodeMouldGroup));
02427 
02428     if (pNodeMouldPath==NULL || pNodeMouldGroup==NULL)
02429     {
02430         // delete the object and all its children
02431         pNodeMould->CascadeDelete();
02432     }
02433 
02434     // Finally trash any unwanted attributes which may have been added
02435     // by SnapShotCurrentAttributes.
02436     RemoveUnwantedAttributes(pNodeMould);
02437 
02438     // All is well and lovely
02439     return TRUE;
02440 }

INT32 CamelotEPSFilter::EPSHeaderIsOk ADDR  pFileHeader,
UINT32  HeaderSize
[protected, virtual]
 

Checks to see if the EPS comment headers specify that this is an Camelot generated EPS file, as required.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/02/94
Returns:
TRUE if the header is ok and import should proceed, FALSE if not.

Reimplemented from ArtWorksEPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 408 of file cameleps.cpp.

00409 {
00410     // THIS ROUTINE IS NOT UNICODE
00411     // Check the first line in EPS file
00412     if (strncmp((char *) pFileHeader, "%!PS-Adobe-2.0 EPSF-1.2", 23) != 0)
00413     {
00414         // Incorrect version of EPS header line - we don't want this
00415         return 0;
00416     }
00417 
00418     // !PS-Adobe line is ok - check creator line...
00419     istringstream HeaderFile( (char*)pFileHeader );
00420     char Buffer[200];
00421 
00422     UINT32 Lines = 0;
00423     while ((Lines < 20) && !HeaderFile.eof())
00424     {
00425         HeaderFile.getline(Buffer, 200);
00426         Lines++;
00427 
00428         // Return TRUE if this file was created by Camelot
00429         if (strncmp(Buffer, "%%Creator: Camelot", 18) == 0)
00430         {
00431             // Camelot is the creator.
00432             return 10;
00433         }
00434         // (ChrisG 8/11/00) Changed creator type to "Xara X")
00435         else if (strncmp (Buffer, "%%Creator: Xara X", 17) == 0)
00436         {
00437             // New Xara X string was set as the creator.
00438             return 10;
00439         }
00440 
00441         // If we find the compression token then stop the search as we don't want to start
00442         // looking in the compressed data!
00443         if (strncmp(Buffer, "%%Compression:", 14)==0)
00444             break;
00445     }
00446 
00447     // Didn't find a suitable Creator line, but we did find an EPS line, so indicate
00448     // that we're interested, but not sure.
00449     return 5;
00450 }

BOOL CamelotEPSFilter::ExportBitmap KernelBitmap TheBitmap  )  [virtual]
 

Export a bitmap to a Camelot EPS file. This outputs the standard tokens and data required to embed a bitmap in a Camelot EPS file.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/09/94
Parameters:
TheBitmap - the bitmap to export [INPUTS]
Returns:
TRUE if the bitmap was exported ok (or if it wasn't exported because the file format does not support it; FALSE if an error occured.

Errors: Usual disk/file errors.

See also:
Filter::ExportBitmap

Reimplemented from Filter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 1520 of file cameleps.cpp.

01521 {
01522 #if !defined(EXCLUDE_FROM_RALPH)
01523     BitmapInfo Info;
01524     String_256 BitmapName;
01525 
01526     // Check to seed if the bitmap has a transparent Index, 
01527     // and output a special token if so
01528     if (TheBitmap.ActualBitmap->GetBPP() <= 8)
01529     {
01530         INT32 TransparencyIndex;
01531 
01532         if (TheBitmap.ActualBitmap->GetTransparencyIndex(&TransparencyIndex))
01533         {
01534             TRACEUSER( "Will", _T("Exporting bitmap with Transparent Index %d\n"), TransparencyIndex);
01535 
01536             ExportDCPtr->OutputValue((INT32) EOTAG_BITMAPFLAGS);
01537             ExportDCPtr->OutputToken(_T("cso"));    // Start of new object type
01538 
01539             ExportDCPtr->OutputValue((INT32) TransparencyIndex);
01540             ExportDCPtr->OutputToken(_T("cbti"));   // Index of the colour that is transparent
01541 
01542             ExportDCPtr->OutputToken(_T("ceo"));    // End of new object type
01543             ExportDCPtr->OutputNewLine();
01544         }
01545     }
01546 
01547     // Get details of the bitmap
01548     TheBitmap.ActualBitmap->GetInfo(&Info);
01549     BitmapName = TheBitmap.ActualBitmap->GetName();
01550 
01551     // Write them out to the EPS file.
01552     ExportDCPtr->OutputString((TCHAR*)BitmapName);
01553     ExportDCPtr->OutputValue((UINT32) Info.PixelWidth);
01554     ExportDCPtr->OutputValue((UINT32) Info.PixelHeight);
01555     ExportDCPtr->OutputValue((UINT32) Info.PixelDepth);
01556     ExportDCPtr->OutputValue((UINT32) Info.NumPaletteEntries);
01557     ExportDCPtr->OutputUserSpaceValue(Info.RecommendedWidth);
01558     ExportDCPtr->OutputUserSpaceValue(Info.RecommendedHeight);
01559 
01560     // Bitmap type is 0 as this is the type that exports all the bitmap data
01561     // Type 1 is used as a reference to a bitmap in the pool
01562     ExportDCPtr->OutputToken(_T("0"));
01563 
01564     // Write out the bitmap start token
01565     ExportDCPtr->OutputToken(_T("csbm"));
01566     ExportDCPtr->OutputNewLine();
01567 
01568     // Write out the bitmap data
01569     TheBitmap.ActualBitmap->ExportBitmap(ExportRegion);
01570 
01571     // Write out the bitmap end token
01572     ExportDCPtr->OutputToken(_T("cebm"));
01573     ExportDCPtr->OutputNewLine();
01574 #endif
01575     // All ok
01576     return TRUE;
01577 }

BOOL CamelotEPSFilter::FindEndOfTag  )  [protected]
 

Continues reading tokens until the ceo token is found.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/06/95
Returns:
TRUE if the end of tag token was found, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 1703 of file cameleps.cpp.

01704 {
01705     // Keep processing tokens until we find the 'end of tag' token
01706     while (!EPSFile->eof())
01707     {
01708         GetToken();
01709         switch (Token)
01710         {
01711             case EPSC_ceo:
01712                 return TRUE;
01713                 break;
01714 
01715             default:
01716                 if (!HandleToken())
01717                     return FALSE;
01718                 break;
01719         }
01720     }
01721     HandleEPSError();
01722     return FALSE;
01723 }

TCHAR * CamelotEPSFilter::GetEPSCommand EPSCommand  Cmd  ) 
 

Given an EPS token, return the string representation of it; mainly for debugging purposes.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/02/94
Parameters:
Cmd - the EPS token, e.g. EPSC_aoa [INPUTS]
Returns:
Pointer to the string representation of the token, e.g. "aoa"

Reimplemented from ArtWorksEPSFilter.

Definition at line 1399 of file cameleps.cpp.

01400 {
01401     INT32 i = 0;
01402     while (CamelotCommands[i].Cmd != EPSC_Invalid)
01403     {
01404         if (CamelotCommands[i].Cmd == Cmd)
01405             return CamelotCommands[i].CmdStr;
01406 
01407         // Try next command
01408         i++;
01409     }
01410 
01411     // Couldn't find it - default to base class method
01412     return ArtWorksEPSFilter::GetEPSCommand(Cmd);
01413 }

BOOL CamelotEPSFilter::GetExportOptions  )  [protected, virtual]
 

Allows the user to be prompted to get information for export. In this Camelot EPS case, we are affectively exporting a printable EPS and so require the user to set a few options. Moves the code from OilFilters to a proper function. Scope: Protected.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> HUmphrys
Date:
22/12/95
Parameters:
- [INPUTS]
Returns:
TRUE if OK, FALSE if user pressed Cancel.

Reimplemented from EPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 548 of file cameleps.cpp.

00549 {
00550 #if !defined(EXCLUDE_FROM_RALPH)
00551     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(XSEPSExportOptions)); 
00552     if ( pOpDesc )
00553         pOpDesc->Invoke();
00554     
00555     return !XSEPSExportOptions::Aborted;
00556 #endif
00557     return TRUE;
00558 }

BOOL CamelotEPSFilter::Init void   )  [virtual]
 

Initialise an CamelotEPSFilter object.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/02/94
Returns:
TRUE if the filter was initialised ok, FALSE otherwise.

Errors: Will fail if not enough memory to initialise the EPS stack.

See also:
EPSStack

Reimplemented from ArtWorksEPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 335 of file cameleps.cpp.

00336 {
00337     // Get the OILFilter object
00338     pOILFilter = new CamelotEPSOILFilter(this);
00339     if (pOILFilter == NULL)
00340         return FALSE;
00341 
00342     // Load the description strings
00343     FilterName.Load(FilterNameID);
00344     FilterInfo.Load(FilterInfoID);
00345 
00346     // All ok
00347     return TRUE;
00348 }

BOOL CamelotEPSFilter::IsDefaultDocRequired const TCHAR pcszPathName  )  [virtual]
 

Works out if opening a file of this type requires a default document to be loaded. If the file format supplies the document then return FALSE otherwise return TRUE. An example would be opening a bitmap file. This has no document defined in the file format and so we need to load the default document before importing the bitmap into this file. In this baseclass version return FALSE and hence assume that the filters that need to will override this function to return TRUE.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/10/95
Parameters:
pcszPathName pointer to the pathname to check [INPUTS]
Returns:
TRUE if the filter requires a default document, FALSE if not.
See also:
Filter; Filter::IsDefaultDocRequired; CCamDoc::OnOpenDocument;

FilterFamily::DoImport; Filter::DoImport;

Reimplemented from EPSFilter.

Definition at line 389 of file cameleps.cpp.

00390 {
00391     // Return false here. All derived classes should return what they need
00392     return FALSE;
00393 }   

void CamelotEPSFilter::LookUpToken  )  [protected, virtual]
 

Compare the current token against the Camelot keywords to see if it is one of them.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/02/94
Returns:
TRUE if the token is an Camelot EPS token; FALSE if not.
See also:
EPSFilter::LookUpToken; EPSFilter::DecodeToken

Reimplemented from ArtWorksEPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 625 of file cameleps.cpp.

00626 {
00627     // Not interested in comments
00628     if (Token == EPSC_Comment)
00629         return;
00630 
00631     // Check to see if it is a keyword - cycle through the array of keyword names and
00632     // compare against our token (could use a hash table?)
00633     INT32 i = 0;
00634     while (CamelotCommands[i].Cmd != EPSC_Invalid)
00635     {
00636         if (camStrcmp(TokenBuf, CamelotCommands[i].CmdStr) == 0)
00637         {
00638             // Found the token - set the token variable and return success
00639             Token = CamelotCommands[i].Cmd;
00640             return;
00641         }
00642         // Try next command
00643         i++;
00644     }
00645 
00646     // Did not find this token - pass on to base class.
00647     ArtWorksEPSFilter::LookUpToken();
00648 }

BOOL CamelotEPSFilter::PrepareToExport CCLexFile pFile,
Spread pSpread
[virtual]
 

Prepare to import EPS data using this filter. This sets up the filter to a sensible state for reading.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/04/94
Parameters:
pFile - The file to export to [INPUTS] pSpread - the spread to export
Returns:
TRUE if succeeded, FALSE if not (e.g. no memory for EPS stack)

Errors: Out of memory.

See also:
EPSFilter::DoImport; EPSFilter::CleanUpAfterImport Scope: Private

Reimplemented from ArtWorksEPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 577 of file cameleps.cpp.

00578 {
00579 #if !defined(EXCLUDE_FROM_RALPH)
00580     // Use base class to do most of it
00581     if (!EPSFilter::PrepareToExport(pFile, pSpread))
00582         return FALSE;
00583 
00584     // Set export device to use full Camelot accuracy for user space values.
00585     ExportDCPtr->SetFullAccuracy(TRUE);
00586 
00587     // Create the region if it is this class
00588     if (IS_A(this, CamelotEPSFilter))
00589     {
00590         // Don't care about clip regions when exporting - create a null region.
00591         DocRect NullClipRect;
00592         NullClipRect.MakeEmpty();
00593 
00594         // Don't use rendering matrix when exporting EPS as it uses fractional coordinates.
00595         Matrix Identity;
00596 
00597         // Don't use view scale; set to 1
00598         FIXED16 Scale(1);
00599 
00600         ExportRegion = new CamelotEPSRenderRegion(NullClipRect, Identity, Scale);
00601         if (ExportRegion == NULL)
00602             return FALSE;
00603 
00604         // Attach to the right device.
00605         ExportRegion->AttachDevice(DocView::GetSelected(), ExportDCPtr->GetDC(), pSpread);
00606     }
00607 #endif
00608     // All ok
00609     return TRUE;
00610 };

BOOL CamelotEPSFilter::PrepareToImport  )  [protected, virtual]
 

See base class. This just sets up the bitmap fill flag for Camelot EPS.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/08/94
Returns:
TRUE if filter initialised ok; FALSE if not.

Errors: See base class.

See also:
EPSFilter::PrepareToImport;

Reimplemented from EPSFilter.

Reimplemented in CamelotNativeEPSFilter.

Definition at line 466 of file cameleps.cpp.

00467 {
00468     if(IS_A(this, CamelotEPSFilter))
00469     {
00470         // tell the user that we can't do it
00471         PathName Path;
00472         String_256 FileName;
00473         BOOL HaveName = FALSE;
00474         if(EPSFile->IsKindOf(CC_RUNTIME_CLASS(CCDiskFile)))
00475         {
00476             CCDiskFile *DF = (CCDiskFile *)EPSFile;
00477 
00478             Path = DF->GetPathName();
00479             FileName = Path.GetFileName();
00480             HaveName = TRUE;
00481         }
00482         String_256 ErrMsg;
00483         if(HaveName)
00484         {
00485             String_256 ErrMsg;
00486             ErrMsg.MakeMsg(_R(IDE_LOADCAMELOTEPSITHINKNOTNAMED), (TCHAR *)FileName);
00487             Error::SetError(0, ErrMsg, 0);
00488         }
00489         else
00490         {
00491             Error::SetError(_R(IDE_LOADCAMELOTEPSITHINKNOT));
00492         }
00493         return FALSE;
00494     }
00495     else
00496     {
00497         // Initialise base class first.
00498         if (!ArtWorksEPSFilter::PrepareToImport())
00499             return FALSE;
00500 
00501         // Not expecting a bitmap fill initially
00502         m_PendingBitmap = PENDING_BITMAP_NONE;
00503         BitmapTransparencyIndex = -1;
00504         pBitmap = FALSE;
00505         pRegularShape = NULL;
00506     }
00507 
00508     return TRUE;
00509 }

BOOL CamelotEPSFilter::ProcessBitmapFlags  )  [protected]
 

Reads in all the elements of a bitmap flags structure in the EPS file.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/06/95
Returns:
TRUE if the bitmap flags were processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 1745 of file cameleps.cpp.

01746 {
01747     // Keep processing tokens until we find the end of the bitmap flags tag object
01748     while (!EPSFile->eof())
01749     {
01750         GetToken();
01751 
01752         // Look for the only bitmap tokens we're interested in
01753         switch (Token)
01754         {
01755             case EPSC_ceo:
01756                 // found the end of the bitmap flags block so return done.
01757                 return TRUE;
01758                 break;
01759 
01760             case EPSC_cbot:
01761                 // This token indicates that the next bitmap fill is really 
01762                 // a bitmap object
01763                 m_PendingBitmap = PENDING_BITMAP_OBJECT_FILL;
01764                 break;
01765 
01766             case EPSC_cbti:
01767                 // The next bitmap must have a transparency Index
01768                 INT32 Index;
01769 
01770                 if (!Stack.Pop(&Index))
01771                 {
01772                     HandleEPSError();
01773                     return FALSE;
01774                 }
01775 
01776                 BitmapTransparencyIndex = Index;
01777                 break;
01778 
01779             default:
01780                 // try to handle whatever token this is.
01781                 if (!HandleToken()) 
01782                     return FALSE;
01783                 break;
01784         }
01785     }
01786 
01787     HandleEPSError();
01788     return FALSE;
01789 }

BOOL CamelotEPSFilter::ProcessBlend  )  [protected]
 

Reads in all the elements of a blend structure in the EPS file.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/11/94
Returns:
TRUE if the blend was processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Reimplemented from ArtWorksEPSFilter.

Definition at line 1803 of file cameleps.cpp.

01804 {
01805     if (!StartBlend())
01806         return FALSE;
01807 
01808     // Keep processing tokens until we find the end of the blend
01809     do
01810     {
01811         GetToken();
01812 
01813         // Look for the end of the blend token...
01814         if (Token == EPSC_cebd)
01815         {
01816             return EndBlend();
01817         }
01818     }
01819     // Otherwise keep going until an error or eof is encountered
01820     while (HandleToken() && (!EPSFile->eof()));
01821 
01822     if (EPSFile->eof())
01823     {
01824         // Didn't find end of blend - syntax error; deal with it
01825         HandleEPSError();
01826     }
01827 
01828     // If we're here, something went wrong
01829     return FALSE;
01830 }

BOOL CamelotEPSFilter::ProcessBlender  )  [protected]
 

Reads in all the elements of a blender structure in the EPS file.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/11/94
Returns:
TRUE if the blender was processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Reimplemented from ArtWorksEPSFilter.

Definition at line 1979 of file cameleps.cpp.

01980 {
01981     if (!StartBlender())
01982         return FALSE;
01983 
01984     // Keep processing tokens until we find the end of the blender
01985     do
01986     {
01987         GetToken();
01988 
01989         // Look for the end of the blender token...
01990         if (Token == EPSC_cebr)
01991         {
01992             return EndBlender();
01993         }
01994     }
01995     // Otherwise keep going until an error or eof is encountered
01996     while (HandleToken() && (!EPSFile->eof()));
01997 
01998     if (EPSFile->eof())
01999     {
02000         // Didn't find end of blender - syntax error; deal with it
02001         HandleEPSError();
02002     }
02003 
02004     // If we're here, something went wrong
02005     return FALSE;
02006 }

BOOL CamelotEPSFilter::ProcessEnvelope  )  [protected]
 

Reads in all the elements of an envelope structure in the EPS file.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Returns:
TRUE if the envelope object was processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Reimplemented from ArtWorksEPSFilter.

Definition at line 2280 of file cameleps.cpp.

02281 {
02282     // NOT IMPLEMENTED
02283     if (!StartMould(MOULDSPACE_ENVELOPE))
02284         return FALSE;
02285     
02286     if (ProcessMould())
02287         // If we've completed then all is well
02288         return EndMould();
02289 
02290     if (EPSFile->eof())
02291     {
02292         // Didn't find end of envelope - syntax error; deal with it
02293         HandleEPSError();
02294     }
02295 
02296     // if made it here all is not well
02297     return FALSE;
02298 }

BOOL CamelotEPSFilter::ProcessFontFlags  )  [protected]
 

Reads in all the elements of a font flags structure in the EPS file.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/06/95
Returns:
TRUE if the font flags were processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 1593 of file cameleps.cpp.

01594 {
01595     FontFlags.Bold = FALSE;
01596     FontFlags.Italic = FALSE;
01597     // Keep processing tokens until we find the end of the font flags tag object
01598     while (!EPSFile->eof())
01599     {
01600         GetToken();
01601 
01602         // Look for the only font tokens we're interrested in
01603         switch (Token)
01604         {
01605             case EPSC_ceo:
01606                 // found the end of the font flags block so return done.
01607                 return TRUE;
01608                 break;
01609 
01610             case EPSC_cfft:
01611                 // This flag indicates that the next bold/italic attributes are to
01612                 // be applied to the current font style rather than as physical attributes
01613                 FontFlags.Bold = TRUE;
01614                 FontFlags.Italic = TRUE;
01615                 break;
01616 
01617             default:
01618                 // try to handle whatever token this is.
01619                 if (!HandleToken()) 
01620                     return FALSE;
01621                 break;
01622         }
01623     }
01624 
01625     HandleEPSError();
01626     return FALSE;
01627 }

BOOL CamelotEPSFilter::ProcessFontType  )  [protected]
 

Reads in all the elements of a font type structure in the EPS file.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/06/95
Returns:
TRUE if the font type was processed correctly, FALSE if not.

Errors: Syntax error in EPS file, Out of memory

Definition at line 1643 of file cameleps.cpp.

01644 {
01645     EPSFilter::ClassOfFont = FC_TRUETYPE;
01646     // Keep processing tokens until we find the end of the font flags tag object
01647     while (!EPSFile->eof())
01648     {
01649         GetToken();
01650 
01651         // Look for the only font tokens we're interrested in
01652         switch (Token)
01653         {
01654             case EPSC_ceo:
01655                 // found the end of the font flags block so return done.
01656                 return TRUE;
01657                 break;
01658 
01659