00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 #ifndef __CMXEXDC_H
00101 #define __CMXEXDC_H
00102 
00103 #include "kerneldc.h"
00104 
00105 #include "cmxform.h"
00106 
00107 
00108 
00109 
00110 
00111 
00112 
00113 class Filter;
00114 class CCDiskFile;
00115 class Rect;
00116 class CMXRenderRegion;
00117 class DocColour;
00118 class FillGeometryAttribute;
00119 class KernelBitmap;
00120 class CMXReferBitmap;
00121 class CMXReferListItem;
00122 class CMXReferPage;
00123 class CMXExportDC;
00124 class Operation;
00125 class Document;
00126 class PathName;
00127 
00128 
00129 #define CMX_MAX_OVERLAP_LENSES      3
00130 
00131 
00132 #define CMXFUTUREVALUECACHESIZE     128
00133 
00134 
00135 #define FUTURE_BACKLOC(obj, mem) (0-(sizeof(*obj) - ( ((INT32)(&((obj)->mem))) - ((INT32)(obj)) )))
00136 
00137 
00138 class CMXFutureUpdater : public CCObject
00139 {
00140     CC_DECLARE_DYNAMIC(CMXFutureUpdater);
00141 
00142 public:
00143     CMXFutureUpdater();
00144     ~CMXFutureUpdater();
00145     BOOL Init(CMXExportDC *pDC, INT32 RelativePos, UINT32 DataSize);
00146     virtual BOOL Write(CMXExportDC *pDC) = 0;
00147 protected:
00148     BOOL WriteValue(CMXExportDC *pDC, INT32 Value);
00149     virtual void Reset(void) {};
00150 private:
00151     INT32 AbsPosition;
00152     UINT32 DataSize;
00153 };
00154 
00155 
00156 class CMXFutureLength : public CMXFutureUpdater
00157 {
00158     CC_DECLARE_DYNAMIC(CMXFutureLength);
00159 
00160 public:
00161     CMXFutureLength();
00162     BOOL SetLengthStartPos(CMXExportDC *pDC, INT32 RelativePos);
00163     BOOL Write(CMXExportDC *pDC);
00164 protected:
00165     void Reset(void);
00166 private:
00167     INT32 StartPos;
00168 };
00169 
00170 
00171 class CMXFutureNumber : public CMXFutureUpdater
00172 {
00173     CC_DECLARE_DYNAMIC(CMXFutureNumber);
00174 
00175 public:
00176     BOOL Write(CMXExportDC *pDC);
00177 
00178     INT32 operator=(INT32 eq)   {return Number=eq;};
00179     INT32 operator++()      {return ++Number;};
00180     INT32 operator++(INT32) {return Number++;};
00181     INT32 operator--()      {return --Number;};
00182     INT32 operator--(INT32) {return Number--;};
00183     operator INT32()            {return Number;};
00184     
00185 private:
00186     INT32 Number;
00187 };
00188 
00189 
00190 class CMXFutureIndex : public CMXFutureUpdater
00191 {
00192     CC_DECLARE_DYNAMIC(CMXFutureIndex);
00193 
00194 public:
00195     BOOL Write(CMXExportDC *pDC);
00196 };
00197 
00198 #define cmxINDEX_NONE           0
00199 #define cmxINDEX_ARROW          1
00200 #define cmxINDEX_BITMAP         2
00201 #define cmxINDEX_EMBEDFILE      3
00202 #define cmxINDEX_LAYER          4
00203 #define cmxINDEX_PAGE           5
00204 #define cmxINDEX_PROCEDURE      6
00205 #define cmxINDEX_MASTERLAYER    7
00206 #define cmxINDEX_MASTERINDEX    8
00207 
00208 #define cmxDESC_NONE            0
00209 #define cmxDESC_ARROW           1
00210 #define cmxDESC_ARROWHEADS      2
00211 #define cmxDESC_DOTDASH         3
00212 #define cmxDESC_FONT            4
00213 #define cmxDESC_IMAGE           5
00214 #define cmxDESC_OUTLINE         6
00215 #define cmxDESC_LINESTYLE       7
00216 #define cmxDESC_PEN             8
00217 #define cmxDESC_LENS            9
00218 #define cmxDESC_SCREEN          10
00219 #define cmxDESC_COLOUR          11
00220 
00221 
00222 
00223 
00224 
00225 
00226 
00227 
00228 
00229 
00230 
00231 
00232 class CMXExportDC : public ExportDC
00233 {
00234 public:
00235     CMXExportDC(Filter *);
00236     BOOL Init(CCLexFile*, CMXRenderRegion *pReg, BOOL bThirtyTwoBit, BOOL ClipboardExport);
00237 
00238     
00239     typedef enum {
00240         CMXSECTION_NONE,        
00241         CMXSECTION_HEADER,
00242         CMXSECTION_PAGE,
00243         CMXSECTION_REFLIST,
00244         CMXSECTION_INDEX,
00245         CMXSECTION_ARROW,
00246         CMXSECTION_ARROWHEADS,
00247         CMXSECTION_COLOUR,
00248         CMXSECTION_DOTDASH,
00249         CMXSECTION_FONT,
00250         CMXSECTION_IMAGE,
00251         CMXSECTION_OUTLINE,
00252         CMXSECTION_LINESTYLE,
00253         CMXSECTION_PEN,
00254         CMXSECTION_LENS,
00255         CMXSECTION_SCREEN,
00256         CMXSECTION_TRAILER,
00257         CMXSECTION_IMAGINFO,
00258         CMXSECTION_IMAGDATA,
00259         CMXSECTION_PROCBITFILL,
00260         CMXSECTION_PREVIEWBITMAP
00261     } CMXSectionType;
00262 
00263     
00264     typedef struct {
00265         INT32 Location;
00266         INT32 Data;
00267         UINT32 DataSize;
00268     } CMXFutureDataCacheEntry;
00269     
00270     
00271     BOOL StartSection(CMXSectionType Type);
00272     BOOL EndSection(void);
00273     BOOL StartRIFFList(INT32 Type);
00274     BOOL EndRIFFList(void);
00275     BOOL CreateHeader(DocRect *pFileBBox);
00276     BOOL PolishOffThatFile(void);
00277     BOOL WriteNumber(INT32 Position, UINT32 DataSize, INT32 Value);
00278     BOOL WriteBBox(DocRect *BBox, BOOL Transform = TRUE);
00279     BOOL WriteString(StringBase *Str);
00280     void CleanUp(void);
00281     BOOL WriteReferenceList(void);
00282     BOOL WriteData(void *data, INT32 Size) {ExportFile->write(data, Size); return TRUE;};
00283     void WriteByte(BYTE Thing) {ExportFile->put(Thing);};   
00284     BOOL WriteIndex(void);
00285     BOOL WriteAnIndex(INT32 Which);
00286     BOOL WriteADesc(INT32 Which);
00287     BOOL WriteDescriptionSections(void);
00288     BOOL WriteMatrix(Matrix *pMatrix = NULL);
00289     INT32 GetGroupCount(void) {return PageGroupCount;};
00290     static void CalcCorelBBox(DocCoord *Coords, INT32 NumCoords, DocRect *Result);
00291     void WriteAngle(double theta);
00292     BOOL WriteReferSections(void);
00293     void WriteSizeInFile(WORD Size) {if(ThirtyTwoBit) ExportFile->write(&Size, sizeof(Size));};
00294     BOOL WriteCamComment(void);
00295     BOOL WritePreviewBitmap(void);
00296 
00297     
00298     void SetTransMatrix(Matrix *pM)
00299     {
00300         pMatrix = pM;
00301         FIXED16 sf;
00302         pMatrix->Decompose(&sf);
00303         ScaleFactor = sf.MakeDouble();
00304     };
00305 
00306     Matrix *GetTransMatrix(void) {return pMatrix;};
00307     INT32 GetFilePosition();
00308     BOOL IsThirtyTwoBit() {return ThirtyTwoBit;};
00309     INT32 GetFirstInstrFilePosition(void) {return FirstInstrFilePosition;};
00310     INT32 GetCurrentInstrFilePosition(void) {return CurrentInstrFilePosition;};
00311     INT32 GetRefListOffset(void) {return RefListOffset;};
00312     INT32 GetInstructionTally(void) {return Tally;};
00313     WORD GetLayerNumber(void) {return LayerNumber;};
00314     CMXRenderRegion *GetRenderRegion(void) {return pRenderRegion;};
00315     double GetScaleFactor(void) {return ScaleFactor;};
00316     void SetInfo(Operation* op, PathName* ptPath, Document* ptDoc) {pOp = op, pPath = ptPath, TheDocument = ptDoc;};
00317 
00318     
00319     BOOL StartPage(DocRect *BBox, BOOL IsProcedure = FALSE);
00320     BOOL EndPage(void);
00321     BOOL StartLayer(String_256 &Name);
00322     BOOL EndLayer(void);
00323     BOOL StartGroup(DocRect *BBox, BOOL TransformBBox = TRUE);
00324     BOOL EndGroup(void);
00325     void SetCMXFlag(INT32 flag);
00326 
00327     
00328     BOOL WriteCommand(UINT32 Tag, void *Data = 0, UINT32 Size = 0);
00329     BOOL StartCommand(UINT32 Tag);
00330     BOOL EndCommand(void);
00331     BOOL WriteTag(INT32 Tag, void *Data = 0, UINT32 Size = 0)
00332         {return DoWriteTag(Tag, Data, Size, FALSE);};
00333     BOOL StartTag(INT32 Tag);
00334     BOOL EndTag(void);
00335     BOOL StartNestedTag(INT32 Tag);
00336     BOOL EndNestedTag(void);
00337     BOOL WriteNestedTag(INT32 Tag, void *Data = 0, UINT32 Size = 0)
00338         {return DoWriteTag(Tag, Data, Size, TRUE);};
00339     
00340     
00341     BOOL WriteMinEndTag(void) {if(ThirtyTwoBit) WriteByte(cmxTAG_EndTag); return TRUE;};
00342 
00343     
00344     BOOL WriteAttributes(CMXRenderRegion *pReg, INT32 Tag, DocCoord *Coords, INT32 NumCoords, BOOL ForceNoFill = FALSE);
00345     BOOL WriteBlankAttributes(INT32 Tag);
00346     BOOL WriteAttrCheckLens(CMXRenderRegion *pReg, INT32 Tag, DocCoord *Coords, INT32 NumCoords, BOOL *WasLens);
00347     BOOL WriteAttrCheckIgnoreLens(CMXRenderRegion *pReg, DocCoord *Coords, INT32 NumCoords);
00348     BOOL WriteOutlineSpec(CMXRenderRegion *pReg);
00349     BOOL WriteFillSpec(CMXRenderRegion *pReg, DocCoord *Coords, INT32 NumCoords, BOOL NoFill);
00350     BOOL WriteFillType(WORD FillID);
00351     BOOL WriteFillSpecFlat(CMXRenderRegion *pReg, FillGeometryAttribute *pAttr);
00352     BOOL WriteFillSpecGrad(CMXRenderRegion *pReg, FillGeometryAttribute *pAttr, DocCoord *Coords, INT32 NumCoords);
00353     BOOL WriteFillSpecBitmap(CMXRenderRegion *pReg, FillGeometryAttribute *pAttr, DocCoord *Coords, INT32 NumCoords);
00354 
00355     
00356     WORD GetColourReference(DocColour *pTheLovelyColour);
00357     WORD GetBitmapReference(KernelBitmap *pTheLovelyBitmap, DocColour *pStartCol, DocColour *pEndCol, EFFECTTYPE Effect, CMXReferBitmap **ppRB = NULL);
00358     WORD GetProcedureReference(CMXReferListItem *pProc);
00359     WORD GetArrowReference(ArrowRec *pArrow);
00360 
00361     
00362     typedef enum {
00363         CMXBITMAPCOLOURSOURCE_NONE,
00364         CMXBITMAPCOLOURSOURCE_LINEANDFILL,
00365         CMXBITMAPCOLOURSOURCE_FILLGEOMETRY
00366     } CMXBitmapColourSource;
00367 
00368     
00369     BOOL WritePath ( DocCoord   *Coords,
00370                      PathVerb   *Verbs,
00371                      INT32      NumCoords,
00372                      BOOL       Filled);
00373 
00374     BOOL WriteBitmap ( KernelBitmap             *pBitmap,
00375                        DocCoord                 *pParallelogram,
00376                        CMXBitmapColourSource    ColSource = CMXBITMAPCOLOURSOURCE_NONE,
00377                        BOOL                     TransformParallelogram = TRUE,
00378                        WORD                     BitmapReference = 0 );
00379 
00380     static double Round ( double ToRound );
00381 
00382 protected:
00383     DoWriteTag(INT32 Tag, void *Data = 0, UINT32 Size = 0, BOOL Nested = FALSE);
00384     BOOL WriteFutureDataCache();
00385 
00386 private:        
00387     CMXRenderRegion *pRenderRegion;         
00388 
00389     CMXSectionType CurrentSection;          
00390     CMXFutureLength SectionLengthFuture;    
00391 
00392     BOOL ThirtyTwoBit;                      
00393 
00394     CMXFutureLength FileLengthFuture;       
00395     CMXFutureNumber Tally;                  
00396     CMXFutureIndex PageEndIndexFuture;      
00397     CMXFutureNumber PageInstructionCount;   
00398     CMXFutureNumber PageGroupCount;         
00399     CMXFutureNumber PageFlags;              
00400     CMXFutureNumber LayerInstructionCount;  
00401     CMXFutureNumber LayerFlags;             
00402     CMXFutureLength CommandLengthFuture;    
00403     CMXFutureIndex IndexSectionFuture;      
00404     CMXFutureIndex TrailerIndexFuture;      
00405     CMXFutureIndex ThumbnailIndexFuture;    
00406     CMXFutureLength TagLengthFuture;        
00407     CMXFutureLength RIFFListLengthFuture;   
00408 
00409     BOOL DoingCommand;                      
00410     BOOL DoingPage;                         
00411     BOOL DoingLayer;                        
00412     BOOL DoingTag;                          
00413     WORD LayerNumber;                       
00414     BOOL DoingRIFFList;                     
00415     BOOL PageIsProc;                        
00416 
00417     INT32 NestedTagLevel;                       
00418     List NestedTagList;
00419     List ReferList;                         
00420     CMXReferPage *PageRefer;                
00421     INT32 RefListOffset;                        
00422     List GroupList;                         
00423     Matrix *pMatrix;                        
00424     INT32 FirstInstrFilePosition;           
00425     INT32 CurrentInstrFilePosition;         
00426 
00427     INT32 NumberOfEntriesUsedInCache;           
00428     CMXFutureDataCacheEntry FutureDataCache[CMXFUTUREVALUECACHESIZE];
00429                                             
00430     double ScaleFactor;                     
00431 
00432     
00433     List LensBBoxes;                        
00434     BOOL OverlappedLensesHaveBeenIgnored;   
00435     BOOL AreIgnoreingOverlappedLenses;      
00436     BOOL HaveAskedUserAboutLenses;          
00437 
00438     Document *TheDocument;
00439     Operation *pOp;
00440     PathName *pPath;
00441 };
00442 
00443 
00444 
00445 class CMXReferListItem : public ListItem
00446 {
00447     CC_DECLARE_DYNAMIC(CMXReferListItem);
00448 
00449 public:
00450     CMXReferListItem(CMXExportDC *pDC) {};
00451 
00452     virtual BOOL IsInReferenceList(void) {return FALSE;};
00453     virtual BOOL WriteInReferenceList(CMXExportDC *pDC) {return TRUE;};
00454 
00455     virtual INT32 IsInWhichIndex(void) {return cmxINDEX_NONE;};
00456     virtual BOOL WriteInIndex(CMXExportDC *pDC) {return TRUE;};
00457     virtual INT32 IndexEntrySize(CMXExportDC *pDC) {return 0;};     
00458 
00459     virtual INT32 IsInWhichDesc(void) {return cmxDESC_NONE;};
00460     virtual BOOL WriteInDesc(CMXExportDC *pDC) {return TRUE;};
00461 
00462     virtual BOOL IsASection(void) {return FALSE;};
00463     virtual BOOL WriteSection(CMXExportDC *pDC) {return TRUE;};
00464 
00465     virtual BOOL IsAProcedure(void) {return FALSE;};
00466 };
00467 
00468 
00469 class CMXReferListItemOffset : public CMXReferListItem
00470 {
00471     CC_DECLARE_DYNAMIC(CMXReferListItemOffset);
00472 
00473 public:
00474     CMXReferListItemOffset(CMXExportDC *pDC);
00475 
00476 protected:
00477     INT32 Offset;
00478 };
00479 
00480 
00481 class CMXReferLayer : public CMXReferListItemOffset
00482 {
00483     CC_DECLARE_DYNAMIC(CMXReferLayer);
00484 
00485 public:
00486     CMXReferLayer(CMXExportDC *pDC) : CMXReferListItemOffset(pDC) {};
00487 
00488     void SetLayerDetails(WORD Number, String_256 *tName);
00489 
00490     BOOL IsInReferenceList(void) {return TRUE;};
00491     BOOL WriteInReferenceList(CMXExportDC *pDC);
00492 
00493     BOOL IsInWhichIndex(void) {return cmxINDEX_LAYER;};
00494     BOOL WriteInIndex(CMXExportDC *pDC);
00495     INT32 IndexEntrySize(CMXExportDC *pDC);
00496 
00497 protected:
00498     WORD LayerNumber;
00499     String_256 Name;
00500 };
00501 
00502 
00503 class CMXReferDefaultScreen : public CMXReferListItem
00504 {
00505     CC_DECLARE_DYNAMIC(CMXReferDefaultScreen);
00506 
00507 public:
00508     CMXReferDefaultScreen(CMXExportDC *pDC) : CMXReferListItem(pDC) {};
00509 
00510     INT32 IsInWhichDesc(void) {return cmxDESC_SCREEN;};
00511     BOOL WriteInDesc(CMXExportDC *pDC);
00512 };
00513 
00514 
00515 class CMXReferDotDash : public CMXReferListItem
00516 {
00517     CC_DECLARE_DYNAMIC(CMXReferDotDash);
00518 
00519 public:
00520     CMXReferDotDash(CMXExportDC *pDC) : CMXReferListItem(pDC) {pDash = 0;};
00521 
00522     void Set(DashRec *ptDash) {pDash = ptDash;};
00523 
00524     INT32 IsInWhichDesc(void) {return cmxDESC_DOTDASH;};
00525     BOOL WriteInDesc(CMXExportDC *pDC);
00526 
00527     virtual BOOL AreYouThisDotDash(DashRec *ptDash) {return ((*pDash) == (*ptDash))?TRUE:FALSE;};
00528 
00529 protected:
00530     DashRec *pDash;
00531 };
00532 
00533 
00534 class CMXReferDefaultDotDash : public CMXReferDotDash
00535 {
00536     CC_DECLARE_DYNAMIC(CMXReferDefaultDotDash);
00537 
00538 public:
00539     CMXReferDefaultDotDash(CMXExportDC *pDC) : CMXReferDotDash(pDC) {};
00540 
00541     INT32 IsInWhichDesc(void) {return cmxDESC_DOTDASH;};
00542     BOOL WriteInDesc(CMXExportDC *pDC);
00543 
00544     BOOL AreYouThisDotDash(DashRec *ptDash) {return (ptDash->Elements == 0)?TRUE:FALSE;};
00545 };
00546 
00547 #define CMXDEFAULTDOTDASHREF    1
00548 
00549 
00550 class CMXReferColour : public CMXReferListItem
00551 {
00552     CC_DECLARE_DYNAMIC(CMXReferColour);
00553 
00554 public:
00555     CMXReferColour(CMXExportDC *pDC) : CMXReferListItem(pDC) {};
00556 
00557     BOOL SetColour(DocColour *pCol) {Colour = *pCol; return TRUE;};
00558     BOOL AreYouThisColour(DocColour *pCompareColour)
00559         {return ((*pCompareColour) == (Colour))?TRUE:FALSE;};
00560 
00561     INT32 IsInWhichDesc(void) {return cmxDESC_COLOUR;};
00562     BOOL WriteInDesc(CMXExportDC *pDC);
00563 
00564 protected:
00565     DocColour Colour;
00566 };
00567 
00568 
00569 class CMXReferPen : public CMXReferListItem
00570 {
00571     CC_DECLARE_DYNAMIC(CMXReferPen);
00572 
00573 public:
00574     CMXReferPen(CMXExportDC *pDC) : CMXReferListItem(pDC) {Width = -1;};
00575 
00576     BOOL SetWidth(MILLIPOINT TWidth) {ERROR2IF(Width != -1, FALSE, "width already set");
00577                                         Width = TWidth; return TRUE;};
00578     BOOL AreYouThisWidth(MILLIPOINT CompareWidth) {return (CompareWidth == Width)?TRUE:FALSE;};
00579 
00580     INT32 IsInWhichDesc(void) {return cmxDESC_PEN;};
00581     BOOL WriteInDesc(CMXExportDC *pDC);
00582 
00583 protected:
00584     MILLIPOINT Width;
00585 };
00586 
00587 
00588 class CMXReferLineStyle : public CMXReferListItem
00589 {
00590     CC_DECLARE_DYNAMIC(CMXReferLineStyle);
00591 
00592 public:
00593     CMXReferLineStyle(CMXExportDC *pDC) : CMXReferListItem(pDC) {};
00594 
00595     void SetLineStyle(cmxLineStyle *pLineStyle) {LineStyle = *pLineStyle;};
00596     BOOL AreYouThisStyle(cmxLineStyle *pLineStyle);
00597 
00598     INT32 IsInWhichDesc(void) {return cmxDESC_LINESTYLE;};
00599     BOOL WriteInDesc(CMXExportDC *pDC);
00600 
00601 protected:
00602     cmxLineStyle LineStyle;
00603 };
00604 
00605 
00606 class CMXReferOutline : public CMXReferListItem
00607 {
00608     CC_DECLARE_DYNAMIC(CMXReferOutline);
00609 
00610 public:
00611     CMXReferOutline(CMXExportDC *pDC) : CMXReferListItem(pDC) {};
00612 
00613     void SetOutline(cmxOutline *pOutline) {Outline = *pOutline;};
00614     BOOL AreYouThisOutline(cmxOutline *pOutline);
00615 
00616     INT32 IsInWhichDesc(void) {return cmxDESC_OUTLINE;};
00617     BOOL WriteInDesc(CMXExportDC *pDC);
00618 
00619 protected:
00620     cmxOutline Outline;
00621 };
00622 
00623 
00624 class CMXReferArrowheads : public CMXReferListItem
00625 {
00626     CC_DECLARE_DYNAMIC(CMXReferArrowheads);
00627 
00628 public:
00629     CMXReferArrowheads(CMXExportDC *pDC) : CMXReferListItem(pDC) {};
00630 
00631     void SetArrowheads(WORD StartArrow, WORD EndArrow) {Start = StartArrow; End = EndArrow;};
00632     BOOL AreYouThisArrowheads(WORD StartArrow, WORD EndArrow) {return (Start == StartArrow) && (End == EndArrow);};
00633 
00634     INT32 IsInWhichDesc(void) {return cmxDESC_ARROWHEADS;};
00635     BOOL WriteInDesc(CMXExportDC *pDC);
00636 
00637 protected:
00638     WORD Start, End;
00639 };
00640 
00641 
00642 class CMXReferArrow : public CMXReferListItem
00643 {
00644     CC_DECLARE_DYNAMIC(CMXReferArrow);
00645 
00646 public:
00647     CMXReferArrow(CMXExportDC *pDC) : CMXReferListItem(pDC) {pArrow = 0;};
00648     
00649     void Set(ArrowRec *ptArrow) {pArrow = ptArrow;};
00650 
00651     INT32 IsInWhichDesc(void) {return cmxDESC_ARROW;};
00652     BOOL WriteInDesc(CMXExportDC *pDC);
00653 
00654     BOOL AreYouThisArrow(ArrowRec *ptArrow)
00655         {return ((ptArrow->ArrowID == pArrow->ArrowID) || (ptArrow == pArrow))?TRUE:FALSE;};
00656 
00657     INT32 IsInWhichIndex(void) {return cmxINDEX_ARROW;};
00658     BOOL WriteInIndex(CMXExportDC *pDC);
00659     INT32 IndexEntrySize(CMXExportDC *pDC) {return sizeof(cmxArrowIndexEntry);};
00660 
00661 protected:
00662     INT32 ArrowFilePosition;
00663     ArrowRec *pArrow;
00664 };
00665 
00666 
00667 class CMXReferLens : public CMXReferListItem
00668 {
00669     CC_DECLARE_DYNAMIC(CMXReferLens);
00670 
00671 public:
00672     CMXReferLens(CMXExportDC *pDC) : CMXReferListItem(pDC) {};
00673 
00674     BOOL Set(CMXExportDC *pDC, DocRect *tBBox);
00675 
00676     BOOL IsInReferenceList(void) {return TRUE;};
00677     BOOL WriteInReferenceList(CMXExportDC *pDC);
00678 
00679     BOOL IsASection(void) {return TRUE;};
00680     BOOL WriteSection(CMXExportDC *pDC);
00681 
00682     BOOL IsAProcedure(void) {return TRUE;};
00683 
00684     INT32 IsInWhichIndex(void) {return cmxINDEX_PROCEDURE;};
00685     BOOL WriteInIndex(CMXExportDC *pDC);
00686     INT32 IndexEntrySize(CMXExportDC *pDC) {return sizeof(cmxProcIndexEntry)+(pDC->IsThirtyTwoBit()?sizeof(WORD):0);};      
00687 
00688 protected:
00689     INT32 CommandFilePosition;  
00690     DocRect BBox;
00691     INT32 LayerNumber;
00692     INT32 LensDescFilePosition;
00693 };
00694 
00695 
00696 class CMXReferPage : public CMXReferListItemOffset
00697 {
00698     CC_DECLARE_DYNAMIC(CMXReferPage);
00699 
00700 public:
00701     CMXReferPage(CMXExportDC *pDC) : CMXReferListItemOffset(pDC) {};
00702 
00703     void SetLayerTableOffset(INT32 off) {LayerTableOffset = off;};
00704     void SetRefListOffset(INT32 off) {RefListOffset = off;};
00705 
00706     BOOL IsInWhichIndex(void) {return cmxINDEX_PAGE;};
00707     BOOL WriteInIndex(CMXExportDC *pDC);
00708     INT32 IndexEntrySize(CMXExportDC *pDC) {return sizeof(cmxPageIndexEntry)+(pDC->IsThirtyTwoBit()?sizeof(WORD):0);};
00709 
00710 protected:
00711     INT32 LayerTableOffset;
00712     INT32 RefListOffset;
00713 };
00714 
00715 
00716 class CMXReferMasterIndex : public CMXReferListItemOffset
00717 {
00718     CC_DECLARE_DYNAMIC(CMXReferMasterIndex);
00719 
00720 public:
00721     CMXReferMasterIndex(CMXExportDC *pDC) : CMXReferListItemOffset(pDC) {};
00722 
00723     void SetType(WORD tType) {Type = tType;};
00724 
00725     BOOL IsInWhichIndex(void) {return cmxINDEX_MASTERINDEX;};
00726     BOOL WriteInIndex(CMXExportDC *pDC);
00727     INT32 IndexEntrySize(CMXExportDC *pDC) {return sizeof(cmxMasterIndexEntry);};
00728 
00729 protected:
00730     WORD Type;
00731 };
00732 
00733 
00734 
00735 class CMXReferMasterLayer : public CMXReferListItemOffset
00736 {
00737     CC_DECLARE_DYNAMIC(CMXReferMasterLayer);
00738 
00739 public:
00740     CMXReferMasterLayer(CMXExportDC *pDC) : CMXReferListItemOffset(pDC) {};
00741 
00742     BOOL IsInWhichIndex(void) {return cmxINDEX_MASTERLAYER;};
00743     BOOL WriteInIndex(CMXExportDC *pDC);
00744     INT32 IndexEntrySize(CMXExportDC *pDC) {return (pDC->IsThirtyTwoBit())?sizeof(cmxMasterLayerEntry32):sizeof(cmxMasterLayerEntry16);};
00745 };
00746 
00747 
00748 
00749 class CMXReferBitmap : public CMXReferListItem
00750 {
00751     CC_DECLARE_DYNAMIC(CMXReferBitmap);
00752 
00753 public:
00754     CMXReferBitmap(CMXExportDC *pDC) : CMXReferListItem(pDC)
00755         {Effect = EFFECT_RGB; Contone = FALSE;};
00756 
00757     void Set(KernelBitmap *pBitmap, DocColour *pStartCol, DocColour *pEndCol, EFFECTTYPE tEffect)
00758         {if(pStartCol != 0 && pEndCol != 0)
00759             {StartColour = *pStartCol; EndColour = *pEndCol; Contone = TRUE;}
00760             Effect = tEffect; Ref.Attach(pBitmap, NULL);};
00761 
00762     BOOL IsInWhichIndex(void) {return cmxINDEX_EMBEDFILE;};
00763     BOOL WriteInIndex(CMXExportDC *pDC);
00764     INT32 IndexEntrySize(CMXExportDC *pDC) {return sizeof(cmxEmbedFileIndexEntry)+(pDC->IsThirtyTwoBit()?sizeof(WORD):0);};
00765 
00766     BOOL IsASection(void) {return TRUE;};
00767     BOOL WriteSection(CMXExportDC *pDC);
00768 
00769     BOOL AreYouThisBitmap(KernelBitmap *pBitmap, DocColour *pStartCol, DocColour *pEndCol, EFFECTTYPE tEffect)
00770         {return ((pBitmap == Ref.GetBitmap())
00771             && ( (!Contone && (pStartCol == NULL)) || ((pStartCol != NULL) && ((*pStartCol) == StartColour)))
00772             && ( (!Contone && (pEndCol == NULL  )) || ((pEndCol != NULL  ) && ((*pEndCol)   == EndColour  )))
00773             && (tEffect == Effect))
00774             ?TRUE:FALSE;};
00775 
00776     KernelBitmap *GetBitmap(void) {return Ref.GetBitmap();};
00777 
00778 protected:
00779     INT32 BitmapFileOffset;
00780     KernelBitmapRef Ref;
00781     DocColour StartColour;
00782     DocColour EndColour;
00783     EFFECTTYPE Effect;
00784     BOOL Contone;
00785 };
00786 
00787 #define cmxBITMAPFILLTILESIZE_X     (1024*24)
00788 #define cmxBITMAPFILLTILESIZE_Y     (1024*24)
00789 
00790 class CMXReferBitmapFill : public CMXReferListItem
00791 {
00792     CC_DECLARE_DYNAMIC(CMXReferBitmapFill);
00793 
00794 public:
00795     CMXReferBitmapFill(CMXExportDC *pDC) : CMXReferListItem(pDC) {};
00796 
00797     void Set(WORD Ref) {BitmapReference = Ref;};
00798 
00799     BOOL IsASection(void) {return TRUE;};
00800     BOOL WriteSection(CMXExportDC *pDC);
00801 
00802     BOOL IsAProcedure(void) {return TRUE;};
00803 
00804     INT32 IsInWhichIndex(void) {return cmxINDEX_PROCEDURE;};
00805     BOOL WriteInIndex(CMXExportDC *pDC);
00806     INT32 IndexEntrySize(CMXExportDC *pDC) {return sizeof(cmxProcIndexEntry)+(pDC->IsThirtyTwoBit()?sizeof(WORD):0);};      
00807 
00808 protected:
00809     WORD BitmapReference;
00810     INT32 ProcedureFilePosition;
00811 };
00812 
00813 
00814 class CMXGroupRecord : public ListItem
00815 {
00816     CC_DECLARE_DYNAMIC(CMXGroupRecord);
00817 
00818 public:
00819     CMXGroupRecord(CMXExportDC *pDC);
00820     BOOL Write(CMXExportDC *pDC);
00821 
00822 protected:
00823     INT32 Offset;
00824     INT32 TallyAtStart;
00825     INT32 GroupCountAtStart;
00826 };
00827 
00828 
00829 
00830 class CMXNestedTagRecord : public ListItem
00831 {
00832     CC_DECLARE_DYNAMIC(CMXNestedTagRecord);
00833 
00834 public:
00835     CMXFutureLength LengthFuture;
00836 };
00837 
00838 class CMXLensBBox : public ListItem
00839 {
00840     CC_DECLARE_DYNAMIC(CMXLensBBox);
00841 
00842 public:
00843     CMXLensBBox(DocRect *bbox) {BBox = *bbox;};
00844 
00845     BOOL DoesIntersect(DocRect *pBBox) {return BBox.IsIntersectedWith(*pBBox);};
00846 
00847 private:
00848     DocRect BBox;
00849 };
00850 
00851 #endif // __ CMXEXDC_H