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
00101
00102
00103 #ifndef INC_PRINTMARKS
00104 #define INC_PRINTMARKS
00105
00106
00107
00108 #include "lddirect.h"
00109
00110
00111
00112 class String_256;
00113 class NodeGroup;
00114 class PrintMarksMan;
00115 class PrintMarksComponent;
00116 class TextStory;
00117
00118
00119
00120 #define MAXPAGEREGIONS 16
00121 #define MAXREGIONMARKS 8
00122 #define INCH 72000
00123 #define CROPMARK_THICKNESS 425 // (0.15mm*72000/25.4)
00124 #define CROPMARK_LENGTH 27360 // (38*72000/100) 0.38 inch in length
00125 #define CROPAREA_SIZE 27360 // size reserved for crop marks
00126 #define OUTSIDEBLEEDWIDTH 0 // space to position marks beyond the bleed
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 class LoadPrintMarks : public LoadDirect
00139 {
00140 CC_DECLARE_MEMDUMP(LoadPrintMarks);
00141
00142 public:
00143 virtual ~LoadPrintMarks() {}
00144
00145 protected:
00146 virtual BOOL OnLoadDocument(Document* pKernelDoc);
00147 };
00148
00149
00150
00151
00152
00153
00154 enum MarkType
00155 {
00156 MarkType_Unknown = 0,
00157 MarkType_Star,
00158 MarkType_Registration,
00159 MarkType_ColourBar,
00160 MarkType_GreyBar,
00161 MarkType_Information,
00162 MarkType_Crop
00163 };
00164
00165
00166
00167
00168
00169
00170 enum MarkRegion
00171 {
00172 MarkRegion_TopLeft = 0,
00173 MarkRegion_Top1,
00174 MarkRegion_Top2,
00175 MarkRegion_Top3,
00176 MarkRegion_TopRight,
00177 MarkRegion_Right1,
00178 MarkRegion_Right2,
00179 MarkRegion_Right3,
00180 MarkRegion_BottomRight,
00181 MarkRegion_Bottom3,
00182 MarkRegion_Bottom2,
00183 MarkRegion_Bottom1,
00184 MarkRegion_BottomLeft,
00185 MarkRegion_Left1,
00186 MarkRegion_Left2,
00187 MarkRegion_Left3,
00188
00189 MarkRegion_FileFormatTerminator = 0xff
00190 };
00191
00192
00193
00194
00195
00196
00197 class MarkFormat
00198 {
00199 public:
00200 MarkFormat();
00201
00202 BOOL IsValid() const;
00203 void MakeValid();
00204
00205 friend INT32 operator==(const MarkFormat& x, const MarkFormat& y);
00206
00207 public:
00208 BYTE GetAsFlagByte(void);
00209 void SetFromFlagByte(BYTE Flags);
00210
00211 public:
00212 BYTE Left : 1;
00213 BYTE Centre : 1;
00214 BYTE Right : 1;
00215 BYTE Top : 1;
00216 BYTE Middle : 1;
00217 BYTE Bottom : 1;
00218 BYTE unused : 1;
00219 BYTE unused1 : 1;
00220 };
00221
00222
00223
00224
00225
00226 enum MarkOrient
00227 {
00228 MO_None = 0,
00229 MO_Vertical = 1,
00230 MO_Horizontal = 2
00231 };
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247 class MarkPosition : public ListItem
00248 {
00249 CC_DECLARE_DYNCREATE(MarkPosition);
00250
00251 public:
00252 MarkPosition();
00253
00254 void Initialise();
00255
00256 void SetRegion(MarkRegion region) { Region = region; }
00257 void SetFormat(MarkFormat format) { Format = format; }
00258
00259 inline MarkFormat GetFormat() const { return Format; }
00260 inline MarkRegion GetRegion() const { return Region; }
00261
00262 BOOL IsEqualTo(const MarkPosition* pOther) const;
00263
00264 private:
00265 MarkRegion Region;
00266 MarkFormat Format;
00267 };
00268
00269
00270
00271
00272
00273 const BYTE PRINTMARK_CROPMARKID = 0;
00274 const BYTE PRINTMARK_INFOMARKID = 1;
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289 class PrintMark : public CC_CLASS_MEMDUMP
00290 {
00291 CC_DECLARE_MEMDUMP(PrintMark);
00292
00293 public:
00294 PrintMark();
00295 ~PrintMark();
00296
00297 void SetCustomOrDefault(BOOL IsCustom) { MarkIsCustom = IsCustom; }
00298 void SetIDByte(BYTE NewID) { IDByte = NewID; }
00299 void SetType(MarkType type) { Type = type; }
00300 void SetMarkMenuText(const String_256* pMenuText);
00301 void SetOrientation(MarkOrient orient) { Orientation = orient; }
00302 void SetDefaultState(BOOL enabled) { OnAsDefault = enabled; }
00303
00304 void AddNewPosition(MarkPosition* pMarkPos);
00305 BOOL DefaultsToOn() const { return OnAsDefault; }
00306
00307 BOOL IsCustom(void) const { return(MarkIsCustom); }
00308 BYTE GetIDByte(void) const { return(IDByte); }
00309 MarkType GetType() const { return Type; }
00310 String_256 GetMarkMenuText() const;
00311 BOOL FindMarkPosition(const MarkPosition* pSearchMark, MarkPosition** pFoundMark=NULL) const;
00312 BOOL IsSimilarTo(const PrintMark* pOther) const;
00313
00314 inline MarkOrient GetOrientation() const { return Orientation; }
00315
00316 inline MarkPosition* GetFirstPosition() const { return (MarkPosition*)MarkPositions.GetHead(); }
00317
00318 inline MarkPosition* GetNextPosition(MarkPosition* pMP) const
00319 { return (MarkPosition*)MarkPositions.GetNext(pMP); }
00320
00321 private:
00322 BOOL MarkIsCustom;
00323 BYTE IDByte;
00324 MarkType Type;
00325 MarkOrient Orientation;
00326 BOOL OnAsDefault;
00327 String_256 MenuText;
00328 List MarkPositions;
00329 };
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345 class PrintMarkItem : public ListItem
00346 {
00347 CC_DECLARE_DYNCREATE(PrintMarkItem);
00348
00349 friend class PrintMarksCache;
00350
00351 public:
00352 PrintMarkItem();
00353 ~PrintMarkItem();
00354
00355 inline NodeGroup* GetMarkGlyph() const { return pMarkGlyph; }
00356 inline UINT32 GetHandle() const { return Handle; }
00357 inline PrintMark* GetPrintMark() { return &Mark; }
00358
00359 INT32 GetWidth() const;
00360 INT32 GetHeight() const;
00361 DocCoord GetOrigin() const;
00362 MarkOrient GetOrient() const;
00363 BOOL DefaultsToOn() const;
00364 BOOL NeedsSaving() const;
00365 BOOL NeedsToRender() const;
00366
00367 private:
00368 void RemoveMark();
00369 void SetType(MarkType type) { Mark.SetType(type); }
00370 void SetHandle(UINT32 hndle) { Handle=hndle; }
00371 BOOL SetMarkGlyph(NodeGroup* pMark, BOOL MakeCopy=FALSE);
00372 void SetSaveable(BOOL state);
00373 void SetRenderable(BOOL state);
00374
00375 private:
00376 UINT32 Handle;
00377 PrintMark Mark;
00378 NodeGroup* pMarkGlyph;
00379 BOOL Saveable;
00380 BOOL Renderable;
00381 };
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402 class PageMarkRegion
00403 {
00404 public:
00405 PageMarkRegion();
00406
00407 public:
00408 BOOL OrientX;
00409 BOOL Valid;
00410 DocRect Pos;
00411 };
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427 class PageMarkRegions
00428 {
00429 public:
00430 PageMarkRegions();
00431
00432 void Initialise(const DocRect& ParentPage, MILLIPOINT Bleed);
00433
00434 void HideLeft();
00435 void HideRight();
00436 void HideTop();
00437 void HideBottom();
00438
00439 void ShowLeft();
00440 void ShowRight();
00441 void ShowTop();
00442 void ShowBottom();
00443
00444 public:
00445 PageMarkRegion Region[MAXPAGEREGIONS];
00446 };
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464 class MarkPosType
00465 {
00466 public:
00467 MarkPosType();
00468
00469 PrintMarkItem *pMarkItem;
00470 DocCoord pos;
00471 DocCoord dim;
00472 BOOL rotate;
00473 };
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489 class MarkList
00490 {
00491 public:
00492 MarkList();
00493
00494 public:
00495 INT32 count;
00496 DocCoord curpos;
00497 DocCoord size;
00498 MarkPosType MarkPos[MAXREGIONMARKS];
00499 };
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520 class MarkFormatRegion : public CC_CLASS_MEMDUMP
00521 {
00522 CC_DECLARE_MEMDUMP(MarkFormatRegion);
00523
00524 public:
00525 MarkFormatRegion();
00526 MarkFormatRegion(const DocRect &Position);
00527 virtual ~MarkFormatRegion();
00528
00529 void Empty();
00530 void SetPosition(const DocRect& Position);
00531 void SetOrientation(BOOL orientX=TRUE);
00532 void SetFlipRender(BOOL flip);
00533
00534 virtual BOOL AddMark(PrintMarkItem* pMark, MarkFormat *pForm);
00535 virtual void Render(RenderRegion *pRRegion, const Matrix& Transform);
00536
00537 protected:
00538 virtual BOOL MakeMark(PrintMarkItem *pMark,
00539 DocCoord Anchor,
00540 BOOL cx,
00541 BOOL cy,
00542 BOOL posx,
00543 BOOL posy,
00544 INT32 shiftx,
00545 INT32 shifty,
00546 BOOL rotate,
00547 MarkList **pMarkList);
00548
00549 private:
00550 void Render(RenderRegion *pRRegion, MarkList *pItem, const Matrix& Transform);
00551 void RenderMark(RenderRegion* pRRegion, PrintMarkItem *pMark);
00552 Node* FindMarkChildToRender(Node* pParent, RenderRegion *const pRender);
00553 Node* FindMarkNextForClippedInkRender(Node* pRoot, Node* pNode, RenderRegion *pRender);
00554
00555 private:
00556 void Init();
00557
00558 private:
00559 DocRect TheBounds;
00560 INT32 MkCx;
00561 INT32 MkCy;
00562 BOOL OrientX;
00563 BOOL OnRenderFlipX;
00564
00565 MarkList* BLeft;
00566 MarkList* BCentre;
00567 MarkList* BRight;
00568 MarkList* MLeft;
00569 MarkList* MCentre;
00570 MarkList* MRight;
00571 MarkList* TLeft;
00572 MarkList* TCentre;
00573 MarkList* TRight;
00574 };
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590 class PageRect : public ListItem
00591 {
00592 CC_DECLARE_DYNCREATE(PageRect);
00593
00594 public:
00595 PageRect() {};
00596 PageRect(const DocRect &rect);
00597
00598 public:
00599 DocRect Rect;
00600 };
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614 class PageRectList : public List
00615 {
00616 CC_DECLARE_DYNAMIC(PageRectList)
00617
00618 public:
00619 PageRectList() {};
00620 virtual ~PageRectList();
00621
00622 BOOL AddPageRect(const DocRect &rect);
00623 void DeleteAll();
00624
00625 inline PageRect* GetFirstPageRect() const;
00626 inline PageRect* GetNextPageRect(PageRect* pItem) const;
00627
00628 PageRect* FindPageRect(const DocRect &rect) const;
00629 };
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647 class PrintMarksCache : public CC_CLASS_MEMDUMP
00648 {
00649 CC_DECLARE_MEMDUMP(PrintMarksCache);
00650
00651 friend class PrintMarksMan;
00652 friend class LoadPrintMarks;
00653 friend class PrintMarksComponent;
00654
00655 public:
00656 PrintMarksCache();
00657 ~PrintMarksCache();
00658
00659 PrintMarkItem* GetFirstMark() const;
00660 PrintMarkItem* GetNextMark(PrintMarkItem* pCurrItem) const;
00661 PrintMarkItem* FindMark(UINT32 SearchHandle);
00662
00663 private:
00664 BOOL DecodeCachedLayers(Document* pDocument);
00665 BOOL DecodeCachedLayer(Layer* pLayer);
00666 BOOL DecodeMarkFormat(const String_256* pFormatString, PrintMark* pMark);
00667 UINT32 DecodeToMarkType(const String_256* Name) const;
00668 BOOL DoesMarkExist(PrintMark* pCheckMark) const;
00669 UINT32 AddNewMark(PrintMarkItem* pCheckMark, NodeGroup* pGroup);
00670 void UpdateMarkGlyph(PrintMarkItem *pMarkItem, NodeGroup *pGroup);
00671 BOOL CreateTextInfoMark();
00672 BOOL CreateCropMark();
00673 BOOL UpdateTextInfoMark(Document* pDocument, RenderRegion* pRRegion);
00674 void DestroyTextInfoMark();
00675 void BuildTextInfoString(Document *pDocument, RenderRegion *pRegion, String_256 *pString);
00676 BOOL SetInfoMarkAttributes(TextStory *pStory, String_64 *pFontName, MILLIPOINT FontSize);
00677 BOOL DeleteChildAttribute(NodeRenderableInk* pParent, CCRuntimeClass* pReqdAttrib);
00678
00679 UINT32 GetUniqueHandle();
00680 void Invalidate();
00681
00682 private:
00683 UINT32 NextHandle;
00684 UINT32 TextInfoHandle;
00685 UINT32 CropMarkHandle;
00686 List PrintMarkCache;
00687
00688 String_256 CachedTime;
00689 };
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705 class PrintMarksMan : public CC_CLASS_MEMDUMP
00706 {
00707 CC_DECLARE_MEMDUMP(PrintMarksMan);
00708
00709 public:
00710 PrintMarksCache PMMCache;
00711
00712 PrintMarksMan();
00713 ~PrintMarksMan();
00714
00715 BOOL IsTemplateCached() const;
00716 BOOL ConstructCache();
00717 void InvalidateCache();
00718
00719 BOOL AddMarkToDoc(UINT32 MarkHandle, Document* pDocument);
00720 BOOL RemoveMarkFromDoc(UINT32 MarkHandle, Document* pDocument);
00721 void ConvertAllDocColours(Document* pDoc);
00722 BOOL AddDefaultMarksToDoc(Document* pDocument);
00723
00724 BOOL ShowPrintMarks(Document *ScopeDoc) const;
00725 void RenderPrintMarks(Document *ScopeDoc, BOOL DisplayEm=TRUE, BOOL LoadTemplateMarks=TRUE);
00726 void RenderPrintMarks(PrintMarksComponent *pComp,
00727 RenderRegion *pRRegion,
00728 const Matrix &Transform,
00729 const DocRect &ClipRect,
00730 Spread *pSpread);
00731
00732 void StartPrinting();
00733 BOOL AddPageRect(const DocRect &Rect);
00734 void ResetPageRects();
00735 void SetBleed(MILLIPOINT bleed);
00736 void SetEmulsionDown(BOOL state);
00737 void SetImagesettingRect();
00738 void EndPrinting();
00739
00740 MILLIPOINT GetCropMarkWidth(Document *ScopeDoc) const;
00741 void ClipToBleed(RenderRegion *pRRegion, Spread *pSpread);
00742
00743 private:
00744 void CompileMarkRegion(PrintMarksComponent *pComp, MarkRegion CurrRegion);
00745 void RenderPrintMarksAroundRect(PrintMarksComponent *pComp,
00746 RenderRegion *pRRegion,
00747 const Matrix *pTrans,
00748 const DocRect &Rect,
00749 MILLIPOINT bleed);
00750 void RenderCropMarksAroundRect( RenderRegion *pRRegion,
00751 const Matrix *pTrans,
00752 const DocRect &Rect,
00753 MILLIPOINT bleed);
00754 MILLIPOINT AdjustedBleed() const;
00755
00756 private:
00757 BOOL TemplateCached;
00758
00759 private:
00760 MarkFormatRegion MFRegion;
00761 DocRect ImagesettingRect;
00762 PageRectList PageRects;
00763 MILLIPOINT Bleed;
00764 BOOL EmulsionDown;
00765 };
00766
00767
00768 #endif