CMXExportDC Class Reference

Export device context for CMX files. More...

#include <cmxexdc.h>

Inheritance diagram for CMXExportDC:

ExportDC KernelDC CCDummyDC CCDC ListItem CCObject SimpleCCObject List of all members.

Public Types

enum  CMXSectionType {
  CMXSECTION_NONE, CMXSECTION_HEADER, CMXSECTION_PAGE, CMXSECTION_REFLIST,
  CMXSECTION_INDEX, CMXSECTION_ARROW, CMXSECTION_ARROWHEADS, CMXSECTION_COLOUR,
  CMXSECTION_DOTDASH, CMXSECTION_FONT, CMXSECTION_IMAGE, CMXSECTION_OUTLINE,
  CMXSECTION_LINESTYLE, CMXSECTION_PEN, CMXSECTION_LENS, CMXSECTION_SCREEN,
  CMXSECTION_TRAILER, CMXSECTION_IMAGINFO, CMXSECTION_IMAGDATA, CMXSECTION_PROCBITFILL,
  CMXSECTION_PREVIEWBITMAP
}
enum  CMXBitmapColourSource { CMXBITMAPCOLOURSOURCE_NONE, CMXBITMAPCOLOURSOURCE_LINEANDFILL, CMXBITMAPCOLOURSOURCE_FILLGEOMETRY }

Public Member Functions

 CMXExportDC (Filter *)
 Initialise a DC for exporting EPS.
BOOL Init (CCLexFile *, CMXRenderRegion *pReg, BOOL bThirtyTwoBit, BOOL ClipboardExport)
 Calls the base class Init function and then sets up the DC to throw exceptions when it gets errors as that is how the EPS stuff expects errors to be reported.
BOOL StartSection (CMXSectionType Type)
 Start writing a section to a CMX file.
BOOL EndSection (void)
 Finish off writing a section to a CMX file.
BOOL StartRIFFList (INT32 Type)
 Start writing a section to a CMX file.
BOOL EndRIFFList (void)
 Finish off writing a section to a CMX file.
BOOL CreateHeader (DocRect *pFileBBox)
 Write the file's header, and name notes of the location of things like the relevant sizes and indices and other stuff which can only be written after the export.
BOOL PolishOffThatFile (void)
 Finish off the file, update indexes and all that.
BOOL WriteNumber (INT32 Position, UINT32 DataSize, INT32 Value)
 Finish off the file, update indexes and all that.
BOOL WriteBBox (DocRect *BBox, BOOL Transform=TRUE)
 Write a bounding box to the file.
BOOL WriteString (StringBase *Str)
 Write a bounding box to the file.
void CleanUp (void)
 Cleans up after writing to a file.
BOOL WriteReferenceList (void)
 writes the reference list for the page we've just done
BOOL WriteData (void *data, INT32 Size)
void WriteByte (BYTE Thing)
BOOL WriteIndex (void)
 writes the index for the file
BOOL WriteAnIndex (INT32 Which)
 writes the a particular index to the file
BOOL WriteADesc (INT32 Which)
 writes the a particular index to the file
BOOL WriteDescriptionSections (void)
BOOL WriteMatrix (Matrix *pMatrix=NULL)
 writes a matrix to the file
INT32 GetGroupCount (void)
void WriteAngle (double theta)
 writes an angle to the file
BOOL WriteReferSections (void)
 gets all refer list items which are sections to write themselves
void WriteSizeInFile (WORD Size)
BOOL WriteCamComment (void)
 writes a helpful comment so we can see where dodgy cam cmx files come from
BOOL WritePreviewBitmap (void)
 writes a preview bitmap type thing
void SetTransMatrix (Matrix *pM)
MatrixGetTransMatrix (void)
INT32 GetFilePosition ()
 returns the position of the current file pointer in the export file
BOOL IsThirtyTwoBit ()
INT32 GetFirstInstrFilePosition (void)
INT32 GetCurrentInstrFilePosition (void)
INT32 GetRefListOffset (void)
INT32 GetInstructionTally (void)
WORD GetLayerNumber (void)
CMXRenderRegionGetRenderRegion (void)
double GetScaleFactor (void)
void SetInfo (Operation *op, PathName *ptPath, Document *ptDoc)
BOOL StartPage (DocRect *BBox, BOOL IsProcedure=FALSE)
 starts a Page
BOOL EndPage (void)
 ends a Page
BOOL StartLayer (String_256 &Name)
 starts a layer
BOOL EndLayer (void)
 ends a layer
BOOL StartGroup (DocRect *BBox, BOOL TransformBBox=TRUE)
 starts a group
BOOL EndGroup (void)
 ends a group
void SetCMXFlag (INT32 flag)
 sets a flag for pages, layers
BOOL WriteCommand (UINT32 Tag, void *Data=0, UINT32 Size=0)
 Write a command to the file -- one off operation, writes command and data in one go. Use default params for a no-data command.
BOOL StartCommand (UINT32 Tag)
 starts writing a command for a command where the data is of indetermant size. Use EndCommand to finish it off
BOOL EndCommand (void)
 ends a command
BOOL WriteTag (INT32 Tag, void *Data=0, UINT32 Size=0)
BOOL StartTag (INT32 Tag)
 starts writing a tag to the file
BOOL EndTag (void)
 ends a tag
BOOL StartNestedTag (INT32 Tag)
 starts writing a nested tag to the file
BOOL EndNestedTag (void)
 ends a nested tag
BOOL WriteNestedTag (INT32 Tag, void *Data=0, UINT32 Size=0)
BOOL WriteMinEndTag (void)
BOOL WriteAttributes (CMXRenderRegion *pReg, INT32 Tag, DocCoord *Coords, INT32 NumCoords, BOOL ForceNoFill=FALSE)
 Writes the attributes to the DC. if ForceNoFill == TRUE, the path will not be filled whatever the colour.
BOOL WriteBlankAttributes (INT32 Tag)
 writes a blank attribute tag and contents, which specifies nothing but keeps everything happy
BOOL WriteAttrCheckLens (CMXRenderRegion *pReg, INT32 Tag, DocCoord *Coords, INT32 NumCoords, BOOL *WasLens)
 checks to see if this object should be outputed as a lens. If so, we need to output the attributes for it ourselves (as we can't use the full range of possible things) and add things to the list
BOOL WriteAttrCheckIgnoreLens (CMXRenderRegion *pReg, DocCoord *Coords, INT32 NumCoords)
 checks to see if we should ignore this lens -- it sees if it's going to overlap with too many lenses. This is basically as bodge as CorelDRAW will just fall over if we export a file with lots of overlapped lenses in it.
BOOL WriteOutlineSpec (CMXRenderRegion *pReg)
 writes the outline specification to the file
BOOL WriteFillSpec (CMXRenderRegion *pReg, DocCoord *Coords, INT32 NumCoords, BOOL NoFill)
 Writes the fill specifcation to the DC.
BOOL WriteFillType (WORD FillID)
 Writes the fill type to the DC.
BOOL WriteFillSpecFlat (CMXRenderRegion *pReg, FillGeometryAttribute *pAttr)
 Writes the flat fill specifcation to the DC.
BOOL WriteFillSpecGrad (CMXRenderRegion *pReg, FillGeometryAttribute *pAttr, DocCoord *Coords, INT32 NumCoords)
 Writes the grad fill specifcation to the DC.
BOOL WriteFillSpecBitmap (CMXRenderRegion *pReg, FillGeometryAttribute *pAttr, DocCoord *Coords, INT32 NumCoords)
 Writes the bitmap fill specifcation to the DC (also does fractals).
WORD GetColourReference (DocColour *pTheLovelyColour)
 to find a reference number for the colour when writing a CMX file
WORD GetBitmapReference (KernelBitmap *pTheLovelyBitmap, DocColour *pStartCol, DocColour *pEndCol, EFFECTTYPE Effect, CMXReferBitmap **ppRB=NULL)
 to find a reference number for the bitmap when writing a CMX file. ppRB is set to a pointer to the CMXReferBitmap object if ppRB != 0
WORD GetProcedureReference (CMXReferListItem *pProc)
 checks to see if this object should be outputed as a lens. If so, we need to output the attributes for it ourselves (as we can't use the full range of possible things) and add things to the list
WORD GetArrowReference (ArrowRec *pArrow)
 to find a reference number for the arrow when writing a CMX file will return 0 (ie no arrowhead) if it isn't one
BOOL WritePath (DocCoord *Coords, PathVerb *Verbs, INT32 NumCoords, BOOL Filled)
 Writes a path instruction -- transformed by matrix.
BOOL WriteBitmap (KernelBitmap *pBitmap, DocCoord *pParallelogram, CMXBitmapColourSource ColSource=CMXBITMAPCOLOURSOURCE_NONE, BOOL TransformParallelogram=TRUE, WORD BitmapReference=0)
 writes a bitmap object to the file

Static Public Member Functions

static void CalcCorelBBox (DocCoord *Coords, INT32 NumCoords, DocRect *Result)
 calculates the corel bounding box of a path. This is just a simple union of all point. The result is not transformed by the export transform matrix.
static double Round (double ToRound)
 Rounds a value up or down to the nearest integer.

Protected Member Functions

 DoWriteTag (INT32 Tag, void *Data=0, UINT32 Size=0, BOOL Nested=FALSE)
 writes a tag in one go
BOOL WriteFutureDataCache ()
 Write the Numbers from the cache to the file See also:.

Private Attributes

CMXRenderRegionpRenderRegion
CMXSectionType CurrentSection
CMXFutureLength SectionLengthFuture
BOOL ThirtyTwoBit
CMXFutureLength FileLengthFuture
CMXFutureNumber Tally
CMXFutureIndex PageEndIndexFuture
CMXFutureNumber PageInstructionCount
CMXFutureNumber PageGroupCount
CMXFutureNumber PageFlags
CMXFutureNumber LayerInstructionCount
CMXFutureNumber LayerFlags
CMXFutureLength CommandLengthFuture
CMXFutureIndex IndexSectionFuture
CMXFutureIndex TrailerIndexFuture
CMXFutureIndex ThumbnailIndexFuture
CMXFutureLength TagLengthFuture
CMXFutureLength RIFFListLengthFuture
BOOL DoingCommand
BOOL DoingPage
BOOL DoingLayer
BOOL DoingTag
WORD LayerNumber
BOOL DoingRIFFList
BOOL PageIsProc
INT32 NestedTagLevel
List NestedTagList
List ReferList
CMXReferPagePageRefer
INT32 RefListOffset
List GroupList
MatrixpMatrix
INT32 FirstInstrFilePosition
INT32 CurrentInstrFilePosition
INT32 NumberOfEntriesUsedInCache
CMXFutureDataCacheEntry FutureDataCache [128]
double ScaleFactor
List LensBBoxes
BOOL OverlappedLensesHaveBeenIgnored
BOOL AreIgnoreingOverlappedLenses
BOOL HaveAskedUserAboutLenses
DocumentTheDocument
OperationpOp
PathNamepPath

Classes

struct  CMXFutureDataCacheEntry

Detailed Description

Export device context for CMX files.

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/6/96
See also:
ExportDC

Definition at line 232 of file cmxexdc.h.


Member Enumeration Documentation

enum CMXExportDC::CMXBitmapColourSource
 

Enumerator:
CMXBITMAPCOLOURSOURCE_NONE 
CMXBITMAPCOLOURSOURCE_LINEANDFILL 
CMXBITMAPCOLOURSOURCE_FILLGEOMETRY 

Definition at line 362 of file cmxexdc.h.

enum CMXExportDC::CMXSectionType
 

Enumerator:
CMXSECTION_NONE 
CMXSECTION_HEADER 
CMXSECTION_PAGE 
CMXSECTION_REFLIST 
CMXSECTION_INDEX 
CMXSECTION_ARROW 
CMXSECTION_ARROWHEADS 
CMXSECTION_COLOUR 
CMXSECTION_DOTDASH 
CMXSECTION_FONT 
CMXSECTION_IMAGE 
CMXSECTION_OUTLINE 
CMXSECTION_LINESTYLE 
CMXSECTION_PEN 
CMXSECTION_LENS 
CMXSECTION_SCREEN 
CMXSECTION_TRAILER 
CMXSECTION_IMAGINFO 
CMXSECTION_IMAGDATA 
CMXSECTION_PROCBITFILL 
CMXSECTION_PREVIEWBITMAP 

Definition at line 239 of file cmxexdc.h.


Constructor & Destructor Documentation

CMXExportDC::CMXExportDC Filter Parent  ) 
 

Initialise a DC for exporting EPS.

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/6/96
Parameters:
The filter object associated with this export DC. [INPUTS]

Definition at line 792 of file cmxexdc.cpp.

00792                                        : ExportDC(Parent)
00793 {
00794 }


Member Function Documentation

void CMXExportDC::CalcCorelBBox DocCoord Coords,
INT32  NumCoords,
DocRect Result
[static]
 

calculates the corel bounding box of a path. This is just a simple union of all point. The result is not transformed by the export transform matrix.

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/07/96
Parameters:
coords,num coords and output rec [INPUTS]
Returns:
-

Definition at line 1855 of file cmxdcobj.cpp.

01856 {
01857     ERROR3IF(Coords == NULL || NumCoords < 1, "dodgy coords");
01858 
01859     // write some sensible starting values
01860     Result->lo = Coords[0];
01861     Result->hi = Coords[0];
01862 
01863     // run through the rest
01864     for(INT32 l = 1; l < NumCoords; l++)
01865     {
01866         if(Result->lo.x > Coords[l].x) Result->lo.x = Coords[l].x;
01867         if(Result->lo.y > Coords[l].y) Result->lo.y = Coords[l].y;
01868         if(Result->hi.x < Coords[l].x) Result->hi.x = Coords[l].x;
01869         if(Result->hi.y < Coords[l].y) Result->hi.y = Coords[l].y;
01870     }
01871 
01872     // sorted
01873 }

void CMXExportDC::CleanUp void   ) 
 

Cleans up after writing to a file.

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/06/96
Parameters:
none [INPUTS]
Returns:
none
See also:

Definition at line 894 of file cmxexdc.cpp.

00895 {
00896     WriteFutureDataCache();
00897     ReferList.DeleteAll();
00898     LensBBoxes.DeleteAll();
00899 }

BOOL CMXExportDC::CreateHeader DocRect pFileBBox  ) 
 

Write the file's header, and name notes of the location of things like the relevant sizes and indices and other stuff which can only be written after the export.

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/06/96
Parameters:
bounding box of file [INPUTS]
Returns:
success
This fn is called Create rather than Write because it's not finished off properly until the end of the file.
See also:

Definition at line 1412 of file cmxexdc.cpp.

01413 {
01414     ERROR2IF(pMatrix == NULL, FALSE, "No matrix yet");
01415 
01416     // first of all, think about the riff file header
01417     RIFFFile_Header rhdr;
01418     rhdr.CK.ckID = RIFFTYPE_RIFF;
01419     rhdr.CK.ckSize = 0;
01420     rhdr.FormType = cmxRIFFFORMTYPE_CMX;
01421 
01422     ExportFile->write(&rhdr, sizeof(rhdr));
01423 
01424     // set up the future length object
01425     FileLengthFuture.Init(this, FUTURE_BACKLOC(&rhdr, CK.ckSize), sizeof(rhdr.CK.ckSize));
01426     FileLengthFuture.SetLengthStartPos(this, /*-((INT32)sizeof(rhdr))*/ -(INT32)sizeof(DWORD));
01427 
01428     // start the CMX header section
01429     if(!StartSection(CMXSECTION_HEADER))
01430         return FALSE;
01431 
01432     // write the CMX header
01433     cmxHeader fhdr;
01434     memset(&fhdr, 0, sizeof(fhdr));         // set everything to zero
01435     camStrcpy((char *)fhdr.Id, cmxID);
01436     camStrcpy((char *)fhdr.OS, cmxOS);
01437     fhdr.ByteOrder = cmxBYTEORDER_INTEL | 0x30;
01438     if(ThirtyTwoBit)
01439     {
01440         fhdr.CoordSize = cmxCOORDSIZE_32 | 0x30;
01441         fhdr.Major = cmxMAJOR_32 | 0x30;
01442         fhdr.Factor = cmxFACTOR_32;
01443         fhdr.Unit = cmxUNIT_MILLIMETER;
01444     }
01445     else
01446     {
01447         fhdr.CoordSize = cmxCOORDSIZE_16 | 0x30;
01448         fhdr.Major = cmxMAJOR_16 | 0x30;
01449         fhdr.Factor = cmxFACTOR_16;
01450         fhdr.Unit = cmxUNIT_INCH;
01451     }
01452     fhdr.Minor = cmxMINOR | 0x30;
01453 
01454     // bounding box
01455     DocRect bb = *pFileBBox;
01456     pMatrix->TransformBounds(&bb);
01457 
01458     fhdr.IBBLeft    = bb.lo.x;
01459     fhdr.IBBTop     = bb.hi.y;
01460     fhdr.IBBRight   = bb.hi.x;
01461     fhdr.IBBBottom  = bb.lo.y;
01462     fhdr.IThumbnail = -1;
01463 
01464     ExportFile->write(&fhdr, sizeof(fhdr));
01465 
01466     // set up it's future value objects
01467     Tally.Init(this, FUTURE_BACKLOC(&fhdr, ITally), sizeof(fhdr.ITally));
01468     Tally = 0;
01469     IndexSectionFuture.Init(this, FUTURE_BACKLOC(&fhdr, IIndexSection), sizeof(fhdr.IIndexSection));
01470     TrailerIndexFuture.Init(this, FUTURE_BACKLOC(&fhdr, IInfoSection), sizeof(fhdr.IInfoSection));
01471     ThumbnailIndexFuture.Init(this, FUTURE_BACKLOC(&fhdr, IThumbnail), sizeof(fhdr.IThumbnail));
01472 
01473     // end the CMX header section
01474     if(!EndSection())
01475         return FALSE;
01476 
01477     return TRUE;
01478 }

BOOL CMXExportDC::DoWriteTag INT32  Tag,
void *  Data = 0,
UINT32  Size = 0,
BOOL  Nested = FALSE
[protected]
 

writes a tag in one go

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/06/96
Parameters:
none [INPUTS]
Returns:
success
See also:

Definition at line 1245 of file cmxexdc.cpp.

01246 {
01247     if(!Nested)
01248     {
01249         ERROR2IF(DoingTag == TRUE, FALSE, "already doing a tag");
01250     }
01251 
01252     // if we're not doing a 32 bit file, we just want to export the data
01253     if(ThirtyTwoBit)
01254     {
01255         // write the tag header
01256         cmxTagHdr hdr;
01257         hdr.ID = (BYTE)Tag;
01258         hdr.Size = sizeof(hdr)+Size;
01259         ExportFile->write(&hdr, sizeof(hdr));
01260     }
01261 
01262     // write the data, if required
01263     if(Size != 0)
01264         ExportFile->write(Data, Size);
01265 
01266     return TRUE;
01267 }

BOOL CMXExportDC::EndCommand void   ) 
 

ends a command

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/06/96
Parameters:
none [INPUTS]
Returns:
success
See also:

Definition at line 1373 of file cmxexdc.cpp.

01374 {
01375     ERROR2IF(DoingCommand != TRUE, FALSE, "Already writing a command");
01376 
01377     // word align the file
01378     if((GetFilePosition() & 1) != 0)
01379     {
01380         // put an extra byte in the file
01381         ExportFile->put('\0');
01382     }
01383 
01384     CommandLengthFuture.Write(this);
01385 
01386     DoingCommand = FALSE;
01387 
01388     CurrentInstrFilePosition = -1;
01389 
01390     return TRUE;
01391 }

BOOL CMXExportDC::EndGroup void   ) 
 

ends a group

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/06/96
Parameters:
none [INPUTS]
Returns:
success
See also:

Definition at line 2203 of file cmxexdc.cpp.

02204 {
02205     // get the last entry off the group list
02206     CMXGroupRecord *pGRec = (CMXGroupRecord *)GroupList.GetTail();
02207 
02208     // get it to write itself
02209     if(!pGRec->Write(this))
02210         return FALSE;
02211 
02212     // delete the group record
02213     delete GroupList.RemoveTail();
02214 
02215     // write the end group command
02216     if(!WriteCommand(cmxINSTR_EndGroup))
02217         return FALSE;
02218 
02219     return TRUE;
02220 }

BOOL CMXExportDC::EndLayer void   ) 
 

ends a layer

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/06/96
Parameters:
none [INPUTS]
Returns:
success
See also:

Definition at line 2114 of file cmxexdc.cpp.

02115 {
02116     ERROR2IF(DoingLayer == FALSE, FALSE, "Already doing a layer");
02117 
02118     // write the end layer command
02119     WriteCommand(cmxINSTR_EndLayer);
02120 
02121     // write the count of instructions in the layer
02122     LayerInstructionCount.Write(this);
02123     LayerFlags.Write(this);
02124 
02125     DoingLayer = FALSE;
02126 
02127     return TRUE;
02128 }

BOOL CMXExportDC::EndNestedTag void   ) 
 

ends a nested tag

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
04/07/96
Parameters:
none [INPUTS]
Returns:
success
See also:

Definition at line 1205 of file cmxexdc.cpp.

01206 {
01207     if(!ThirtyTwoBit)
01208         return TRUE;        // 16 bit files don't have tags
01209 
01210     ERROR2IF(DoingTag == FALSE, FALSE, "not doing a tag");
01211     ERROR2IF(NestedTagLevel <= 0, FALSE, "not doing a nested tag");
01212 
01213     // get the last tag record
01214     CMXNestedTagRecord *pRec = (CMXNestedTagRecord *)NestedTagList.GetTail();
01215 
01216     // check it's OK
01217     ERROR2IF(!IS_A(pRec, CMXNestedTagRecord), FALSE, "tag record not a tag record");
01218 
01219     // write the length
01220     pRec->LengthFuture.Write(this);
01221 
01222     // delete the record
01223     delete NestedTagList.RemoveTail();
01224 
01225     // flag
01226     NestedTagLevel--;
01227 
01228     return TRUE;
01229 }

BOOL CMXExportDC::EndPage void   ) 
 

ends a Page

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/06/96
Parameters:
none [INPUTS]
Returns:
success
See also:

Definition at line 1991 of file cmxexdc.cpp.

01992 {
01993     ERROR2IF(DoingPage == FALSE, FALSE, "Not doing a page");
01994 
01995     // write the index of the end page command
01996     PageEndIndexFuture.Write(this);
01997 
01998     // write the end page command
01999     if(!PageIsProc)
02000         WriteCommand(cmxINSTR_EndPage);
02001     else
02002         WriteCommand(cmxINSTR_EndSection);
02003 
02004     // write future values
02005     PageFlags.Write(this);
02006     PageInstructionCount.Write(this);
02007     PageGroupCount.Write(this);
02008 
02009     // finish the section
02010     if(!PageIsProc)
02011         EndSection();
02012 
02013     DoingPage = FALSE;
02014 
02015     return TRUE;
02016 }

BOOL CMXExportDC::EndRIFFList void   ) 
 

Finish off writing a section to a CMX file.

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/07/96
Parameters:
none [INPUTS]
Returns:
success
See also:

Definition at line 1058 of file cmxexdc.cpp.

01059 {
01060     ERROR2IF(!DoingRIFFList, FALSE, "Tried to end a riff list which didn't exist");
01061 
01062     // write the length
01063     RIFFListLengthFuture.Write(this);
01064 
01065     // word align the file
01066     if((GetFilePosition() & 1) != 0)
01067     {
01068         // put an extra byte in the file
01069         ExportFile->put('\0');
01070     }
01071 
01072     // flag
01073     DoingRIFFList = FALSE;
01074 
01075     return TRUE;
01076 }

BOOL CMXExportDC::EndSection void   ) 
 

Finish off writing a section to a CMX file.

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/06/96
Parameters:
none [INPUTS]
Returns:
success
See also:

Definition at line 986 of file cmxexdc.cpp.

00987 {
00988     ERROR2IF(CurrentSection == CMXSECTION_NONE, FALSE, "Tried to end a section which didn't exist");
00989 
00990     // write the length
00991     SectionLengthFuture.Write(this);
00992 
00993     // set the section type to none
00994     CurrentSection = CMXSECTION_NONE;
00995 
00996     // word align the file
00997     if((GetFilePosition() & 1) != 0)
00998     {
00999         // put an extra byte in the file
01000         ExportFile->put('\0');
01001     }
01002 
01003     return TRUE;
01004 }

BOOL CMXExportDC::EndTag void   ) 
 

ends a tag

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/06/96
Parameters:
none [INPUTS]
Returns:
success
See also:

Definition at line 1129 of file cmxexdc.cpp.

01130 {
01131     if(!ThirtyTwoBit)
01132         return TRUE;        // 16 bit files don't have tags
01133 
01134     ERROR2IF(DoingTag == FALSE, FALSE, "not doing a tag");
01135     ERROR2IF(NestedTagLevel != 0, FALSE, "tried to end a main tag when nested tags are active");
01136 
01137     // write the length
01138     TagLengthFuture.Write(this);
01139 
01140     // flag
01141     DoingTag = FALSE;
01142 
01143     return TRUE;
01144 }

WORD CMXExportDC::GetArrowReference ArrowRec pArrow  ) 
 

to find a reference number for the arrow when writing a CMX file will return 0 (ie no arrowhead) if it isn't one

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/07/96
Parameters:
colour [INPUTS]
Returns:
reference number of a colour

Definition at line 1201 of file cmxdcobj.cpp.

01202 {
01203     // check to see if the arrowrec is in fact an arrowhead
01204     if(pArrow->IsNullArrow())
01205         return 0;       // ie no arrow on here mate
01206 
01207     // the reference we need -- references count up from 1
01208     INT32 Ref = 0;
01209 
01210     // scan that list!
01211     CMXReferListItem *pEn = (CMXReferListItem *)ReferList.GetHead();
01212     while(pEn != 0)
01213     {
01214         ERROR3IF(!pEn->IsKindOf(CC_RUNTIME_CLASS(CMXReferListItem)), "unexpected type of entry in refer list");
01215 
01216         if(pEn->IsInWhichDesc() == cmxDESC_ARROW)
01217         {
01218             Ref++;
01219 
01220             CMXReferArrow *pAr = (CMXReferArrow *)pEn;
01221             ERROR3IF(!pAr->IsKindOf(CC_RUNTIME_CLASS(CMXReferArrow)), "not an arrow, when it said it was");
01222             
01223             // is it this colour?
01224             if(pAr->AreYouThisArrow(pArrow))
01225             {
01226                 // yep. return the reference number
01227                 return Ref;
01228             }
01229         }
01230 
01231         pEn = (CMXReferListItem *)ReferList.GetNext(pEn);
01232     }
01233 
01234     // we haven't got one... make a new one, set it up and add it to the list
01235     CMXReferArrow *pNewArrow = new CMXReferArrow(this);
01236     if(pNewArrow == 0)
01237         return 0;
01238 
01239     pNewArrow->Set(pArrow);
01240 
01241     ReferList.AddTail(pNewArrow);
01242 
01243     // return the next reference number, Ref is the ref of the last one in the list
01244     return (WORD)Ref + 1;
01245 }

WORD CMXExportDC::GetBitmapReference KernelBitmap pTheLovelyBitmap,
DocColour pStartCol,
DocColour pEndCol,
EFFECTTYPE  Effect,
CMXReferBitmap **  ppRB = NULL
 

to find a reference number for the bitmap when writing a CMX file. ppRB is set to a pointer to the CMXReferBitmap object if ppRB != 0

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/07/96
Parameters:
bitmap [INPUTS]
Returns:
refernce number of a bitmap

Definition at line 1261 of file cmxdcobj.cpp.

01263 {
01264     // the reference we need -- references count up from 1
01265     INT32 Ref = 0;
01266 
01267     // scan that list!
01268     CMXReferListItem *pEn = (CMXReferListItem *)ReferList.GetHead();
01269     while(pEn != 0)
01270     {
01271         ERROR3IF(!pEn->IsKindOf(CC_RUNTIME_CLASS(CMXReferListItem)), "unexpected type of entry in refer list");
01272 
01273         if(pEn->IsInWhichIndex() == cmxINDEX_EMBEDFILE && IS_A(pEn, CMXReferBitmap))
01274         {
01275             Ref++;
01276 
01277             CMXReferBitmap *pBitty = (CMXReferBitmap *)pEn;
01278             
01279             // is it this bitmap?
01280             if(pBitty->AreYouThisBitmap(pTheLovelyBitmap, pStartCol, pEndCol, Effect))
01281             {
01282                 // yep. set bitmap object addr and return the reference number
01283                 if(ppRB != 0)
01284                     (*ppRB) = pBitty;
01285 
01286                 return Ref;
01287             }
01288         }
01289 
01290         pEn = (CMXReferListItem *)ReferList.GetNext(pEn);
01291     }
01292 
01293     // we haven't got one... make a new one, set it up and add it to the list
01294     CMXReferBitmap *pNewRefBit = new CMXReferBitmap(this);
01295     if(pNewRefBit == 0)
01296         return 0;
01297 
01298     pNewRefBit->Set(pTheLovelyBitmap, pStartCol, pEndCol, Effect);
01299 
01300     ReferList.AddTail(pNewRefBit);
01301 
01302     // set bitmap object addr
01303     if(ppRB != 0)
01304         (*ppRB) = pNewRefBit;
01305 
01306     // return the next reference number, Ref is the ref of the last one in the list
01307     return (WORD)Ref + 1;
01308 }

WORD CMXExportDC::GetColourReference DocColour pTheLovelyColour  ) 
 

to find a reference number for the colour when writing a CMX file

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
04/07/96
Parameters:
colour [INPUTS]
Returns:
refernce number of a colour

Definition at line 1140 of file cmxdcobj.cpp.

01141 {
01142     // algorithm:
01143     // scan the refer list to see if the colour is already there.
01144     // if it is, return it's index.
01145     // if it isn't add the colour to the refer list, and return the new index.
01146 
01147     // the reference we need -- references count up from 1
01148     INT32 Ref = 0;
01149 
01150     // scan that list!
01151     CMXReferListItem *pEn = (CMXReferListItem *)ReferList.GetHead();
01152     while(pEn != 0)
01153     {
01154         ERROR3IF(!pEn->IsKindOf(CC_RUNTIME_CLASS(CMXReferListItem)), "unexpected type of entry in refer list");
01155 
01156         if(pEn->IsInWhichDesc() == cmxDESC_COLOUR)
01157         {
01158             Ref++;
01159 
01160             CMXReferColour *pLC = (CMXReferColour *)pEn;
01161             ERROR3IF(!pLC->IsKindOf(CC_RUNTIME_CLASS(CMXReferColour)), "not a refer colour, when it said it was");
01162             
01163             // is it this colour?
01164             if(pLC->AreYouThisColour(pTheLovelyColour))
01165             {
01166                 // yep. return the reference number
01167                 return Ref;
01168             }
01169         }
01170 
01171         pEn = (CMXReferListItem *)ReferList.GetNext(pEn);
01172     }
01173 
01174     // we haven't got one... make a new one, set it up and add it to the list
01175     CMXReferColour *pNewRefCol = new CMXReferColour(this);
01176     if(pNewRefCol == 0)
01177         return 0;
01178 
01179     pNewRefCol->SetColour(pTheLovelyColour);
01180 
01181     ReferList.AddTail(pNewRefCol);
01182 
01183     // return the next reference number, Ref is the ref of the last one in the list
01184     return (WORD)Ref + 1;
01185 }

INT32 CMXExportDC::GetCurrentInstrFilePosition void   )  [inline]
 

Definition at line 310 of file cmxexdc.h.

00310 {return CurrentInstrFilePosition;};

INT32 CMXExportDC::GetFilePosition  ) 
 

returns the position of the current file pointer in the export file

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/06/96
Parameters:
none [INPUTS]
Returns:
success
See also:

Definition at line 1535 of file cmxexdc.cpp.

01536 {
01537     return ExportFile->tell();
01538 }

INT32 CMXExportDC::GetFirstInstrFilePosition void   )  [inline]
 

Definition at line 309 of file cmxexdc.h.

00309 {return FirstInstrFilePosition;};

<
INT32 CMXExportDC::GetGroupCount