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 #ifndef INC_DOCUMENT
00100 #define INC_DOCUMENT
00101
00102 #include "listitem.h"
00103 #include "list.h"
00104
00105 #include "basedoc.h"
00106
00107 #include "flags.h"
00108 #include "pathname.h"
00109
00110 #include "colcarry.h"
00111 #include "units.h"
00112 #include "monotime.h"
00113
00114 #include "ralphint.h"
00115
00116
00117
00118 class WorkRect;
00119 class Document;
00120 class DocView;
00121 class View;
00122 class CCamDoc;
00123 class Path;
00124 class Spread;
00125 class Node;
00126 class NodeDocument;
00127 class NodeAttribute;
00128 class NodeSetSentinel;
00129 class DocComponent;
00130 class ArrowRec;
00131 class AttributeManager;
00132 class InsertionNode;
00133 class Filter;
00134 class EPSFilter;
00135 class EPSExportDC;
00136 class DragInformation;
00137 class RalphDocument;
00138 class BitmapList;
00139
00140
00141 const INT32 CHAPTERGAP = 5;
00142
00143
00144 typedef BOOL (*FRDocViewFunc)(DocView*);
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 enum ProcessEPSResult
00166 {
00167 EPSCommentUnknown,
00168 EPSCommentSyntaxError,
00169 EPSCommentSystemError,
00170 EPSCommentOK
00171 };
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185 class SafeRenderPointer : public CCObject
00186 {
00187 public:
00188
00189 SafeRenderPointer();
00190 ~SafeRenderPointer();
00191
00192 void SetPointerValid();
00193 void SetPointerInValid();
00194
00195 BOOL IsPointerValid();
00196
00197
00198 BOOL UpdateLastSafeNode(Node* pNewNode);
00199 Node* GetLastSafeNode();
00200
00201 protected:
00202
00203 Node* pLastSafeNodeToRender;
00204 BOOL m_bPointerValid;
00205
00206 CC_DECLARE_DYNAMIC(SafeRenderPointer)
00207 };
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219 class Document : public BaseDocument
00220 {
00221
00223
00224
00225 public:
00226
00227 Document(BOOL IsAHiddenDocument = FALSE);
00228 virtual ~Document();
00229
00230 static BOOL ReadPrefs();
00231 virtual BOOL Init(CCamDoc* pOilDoc);
00232 virtual BOOL ReInit();
00233
00234 virtual BOOL IsNotAClipboard() const { return TRUE; };
00235 virtual BOOL IsAClipboard() const { return FALSE; };
00236
00237 protected:
00238
00239 BOOL InitFailed();
00240 BOOL InitTree(NodeDocument* RootNode);
00241
00242
00243 public:
00244 INT32 GetNumLayers();
00245
00246 public:
00247
00248 BOOL IsStable() const { return m_fStable; }
00249 void SetStable(BOOL fStable) { m_fStable = fStable; }
00250
00251 private:
00252 BOOL m_fStable;
00253
00254
00256
00257
00258 public:
00259
00260 RalphDocument* GetRalphDoc() { return pRalphDocument; }
00261 BOOL IsARalphDoc(void) { return IsARalph; }
00262 void SetRalphDoc (BOOL b) { IsARalph = b; }
00263
00264 BOOL ConnectRalphDocument(RalphDocument *pDoc) { pRalphDocument = pDoc; return TRUE; }
00265
00266
00267
00268
00269
00270
00271
00272 void SetRalphViewMode(ViewMode Vmode) {Viewmode = Vmode;};
00273
00274 ViewMode GetRalphViewMode() {return Viewmode;};
00275
00276
00277 BOOL RalphDontShowPaper() {return Viewmode == DRAWING_VIEW;};
00278
00279
00280 SafeRenderPointer& GetSafeRenderPointer();
00281
00282 protected:
00283
00284
00285 BOOL IsARalph;
00286 ViewMode Viewmode;
00287 RalphDocument* pRalphDocument;
00288
00289
00290 SafeRenderPointer TheSafeRenderPointer;
00291
00292
00294
00295
00296 public:
00297
00298 String_256 GetTitle() const;
00299 String_256 GetDocName(BOOL IncludeFileType = TRUE) const;
00300 String_256 GetPathName(UINT32 MaxSize = 0) const;
00301 String_256 GetLocation(UINT32 MaxSize = 0) const;
00302
00303 const String_256& GetProducer() const;
00304
00305 const String_256& GetComment() const;
00306 void SetComment(String_256* NewComment);
00307
00308 const time_t& GetCreationTime() const;
00309 void SetCreationTime(time_t);
00310
00311 const time_t& GetLastSaveTime() const;
00312 void SetLastSaveTime(time_t);
00313 void SetLastSaveTime();
00314
00315
00316 void MakeJustCreated();
00317 void SetModified(BOOL fState);
00318
00319 BOOL IsModified() const;
00320 BOOL IsReadOnly() const;
00321 BOOL IsACopy() const;
00322
00323 BOOL IsLoadedAsVersion1File() const;
00324 BOOL SetLoadedAsVersion1File(BOOL NewState);
00325
00326 private:
00327
00328 time_t CreationTime;
00329 time_t LastSaveTime;
00330 String_256 Producer;
00331 String_256 Comment;
00332
00333
00334
00335
00336
00337
00338
00339
00340 struct
00341 {
00342 BOOL SaveWithUndo : 1;
00343 BOOL LayerMultilayer : 1;
00344 BOOL LayerAllVisible : 1;
00345 } DocFlags;
00346
00347
00348
00349
00350 BOOL LoadedAsVersion1File;
00351
00352
00354
00355
00356 public:
00357
00358 Spread* FindFirstSpread();
00359 void SetCurrent();
00360
00361 static Document* GetCurrent();
00362 static void SetNoCurrent();
00363 static Document* GetSelected();
00364 static void SetSelectedViewAndSpread(Document *TheDocument = NULL,
00365 DocView *TheView = NULL,
00366 Spread *TheSpread = NULL);
00367
00368 static void SetNoSelectedViewAndSpread(void);
00369 static Spread* GetSelectedSpread();
00370 static BOOL SpreadBelongsToDoc(Document* pDoc,Spread* pSpread);
00371
00372 BOOL IsAnimated();
00373
00374
00375
00376
00377
00378
00379
00380 private:
00381
00382 Spread* pSelSpread;
00383 static Spread* pGlobalSelSpread;
00384
00385 static Document* Current;
00386 static Document* Selected;
00387
00388
00390
00391
00392 public:
00393
00394 void GetExtents(DocCoord *Lo, DocCoord *Hi, DocRect* Extent, View *pView);
00395 void UpdateExtents(const DocCoord& Lo, const DocCoord& Hi);
00396
00397 UnitType GetDocFontUnits();
00398
00399
00400
00401
00402
00403
00404
00405
00407
00408
00409 public:
00410
00411 void DeleteContents();
00412 void InsertNewNode(Node* NewNode, Spread *pDestSpread);
00413
00414 void HandleNodeDeletion(Node* pNode);
00415
00416
00417 static void IncCurrentNodeCount();
00418 static void DecCurrentNodeCount();
00419
00420
00422
00423
00424 public:
00425
00426 CCamDoc* GetOilDoc() const;
00427
00428 DocView* GetFirstDocView() const
00429 { return (DocView*) DocViews.GetHead(); }
00430
00431 DocView* GetNextDocView(const DocView* pView) const
00432 { return (DocView*) DocViews.GetNext((const ListItem*) pView); }
00433
00434 DocView* GetTopmostView() const;
00435
00436 DocView* GetNewDocView();
00437 DocView* GetSpareDocView();
00438
00439 void OnDocViewDying(DocView* pdv);
00440
00441 void ShowViewScrollers(BOOL fIsVisible);
00442 void ShowViewRulers(BOOL fIsVisible);
00443
00444 BOOL CreateDragTargets(DragInformation * DragInfo);
00445
00446 void ForceRedraw(FRDocViewFunc = NULL);
00447 void ForceRedraw(WorkRect& forceRect);
00448 void ForceRedraw(Spread* pSpread,
00449 DocRect SpreadRect,
00450 BOOL Accumulate = FALSE,
00451 Node* pInvalidNode = NULL,
00452 BOOL bAutoRelease = TRUE);
00453 void FlushRedraw();
00454
00455 protected:
00456
00457 CCamDoc* OilDoc;
00458 List DocViews;
00459
00460
00462
00463
00464 public:
00465
00466 UINT32 GetCreatorSerialNo();
00467 UINT32 GetLastSerialNo();
00468 void SetLastEditorSerialNo(UINT32 sn);
00469
00470 private:
00471
00472 UINT32 CreatorSerialNo;
00473 UINT32 LastSerialNo;
00474
00475
00477
00478
00479 public:
00480
00481 BOOL IsMultilayer();
00482 BOOL IsAllVisible();
00483 void SetMultilayer(BOOL state);
00484 void SetAllVisible(BOOL state);
00485
00486
00487 AttributeManager& GetAttributeMgr() const;
00488 NodeSetSentinel* GetSetSentinel() const;
00489 NodeAttribute* GetDefaultAttr(CCRuntimeClass* RequiredAttr);
00490
00491
00492 MILLIPOINT GetBleedOffset() const;
00493 BOOL SetBleedOffset(MILLIPOINT);
00494
00495 private:
00496
00497 AttributeManager* AttributeMgr;
00498 NodeSetSentinel* m_pSetSentinel;
00499
00500 MILLIPOINT PasteBoardOffsetWidth;
00501 MILLIPOINT PasteBoardOffsetHeight;
00502 MILLIPOINT BleedOffset;
00503
00504
00506
00507
00508 public:
00509
00510 OperationHistory& GetOpHistory();
00511
00512
00513 BOOL EmptyOperationHistory();
00514
00515 protected:
00516 OperationHistory* OpHistory;
00517
00518
00519
00520
00521
00523
00524
00525 public:
00526 BitmapList* GetBitmapList();
00527 DocUnitList* GetDocUnitList() { return pDocUnitList; }
00528
00529 private:
00530 DocUnitList* pDocUnitList;
00531
00533
00534
00535
00536 UINT32 m_docNudge;
00537 BOOL m_bSmoothBitmaps;
00538 DocCoord m_DuplicationOffset;
00539
00540 public:
00541 UINT32 GetDocNudge() { return (m_docNudge); }
00542 BOOL SetDocNudge(UINT32 newVal);
00543
00544 BOOL GetBitmapSmoothing() { return (m_bSmoothBitmaps); }
00545 void SetBitmapSmoothing(BOOL newVal) { m_bSmoothBitmaps = newVal; }
00546
00547 DocCoord GetDuplicationOffset() { return (m_DuplicationOffset); }
00548 void SetDuplicationOffset(DocCoord newOffset) { m_DuplicationOffset = newOffset; }
00549
00550
00552
00553
00554 public:
00555
00556 virtual BOOL EPSStartImport(EPSFilter *);
00557 virtual void EPSEndImport(EPSFilter *, BOOL);
00558 virtual BOOL EPSStartExport(EPSFilter *);
00559 virtual void EPSEndExport(EPSFilter *);
00560
00561 virtual BOOL WriteEPSResources(EPSFilter *);
00562 virtual BOOL WriteEPSProlog(EPSFilter *);
00563 virtual BOOL WriteEPSSetup(EPSFilter *);
00564 virtual BOOL WriteEPSFonts(EPSFilter *);
00565 virtual BOOL WriteEPSComments(EPSFilter *);
00566 virtual BOOL WriteEPSTrailer(EPSFilter *);
00567 virtual ProcessEPSResult ProcessEPSComment(EPSFilter *, const TCHAR *);
00568 virtual void EndOfEPSComment(EPSFilter *);
00569
00570
00571 virtual INT32 GetSizeOfExport( Filter * );
00572
00573
00574 BOOL IsImporting();
00575 void SetIsImporting(BOOL NewIsImporting);
00576
00577
00578 BOOL IsTemplateLoading();
00579 void SetTemplateLoading(BOOL NewTemplateLoading);
00580
00581 static BOOL GetRestoreViewOnImport() { return fRestoreViewOnImport; }
00582 static void ShouldRestoreViewOnImport(BOOL fNewState);
00583
00584
00585 BOOL AIExportExtras(EPSExportDC *pDC);
00586
00587 protected:
00588
00589
00590 BOOL ExportPageInfo(EPSExportDC *pDC);
00591 BOOL ExportDocumentComment(EPSExportDC *pDC);
00592 BOOL ExportViewInfo(EPSExportDC *pDC);
00593 BOOL ExportStateInfo(EPSExportDC *pDC);
00594 BOOL ExportQualityInfo(EPSExportDC *pDC);
00595 BOOL ExportGridInfo(EPSExportDC *pDC);
00596 BOOL ExportFlagInfo(EPSExportDC *pDC);
00597 BOOL ExportUnitInfo(EPSExportDC *pDC);
00598 BOOL ExportDateInfo(EPSExportDC *pDC);
00599 BOOL ExportTextSetup(EPSFilter *pFilter);
00600 BOOL ExportTextTrailer(EPSFilter *pFilter);
00601
00602 BOOL ExportRulerState(EPSExportDC *pFilter);
00603 BOOL ExportUndoInfo(EPSExportDC *pDC);
00604 BOOL ExportDefaultUnitsInfo(EPSExportDC *pDC);
00605 BOOL ExportOriginInfo(EPSExportDC *pDC);
00606
00607
00608 BOOL AIExportResources(EPSExportDC *pDC, BOOL);
00609 BOOL AIExportProlog(EPSExportDC *pDC);
00610 BOOL AIExportCharEncoding(EPSExportDC *pDC);
00611 BOOL AIExportFontEncoding(EPSExportDC *pDC);
00612 BOOL AIExportFontEncoding(EPSExportDC *pDC, String_64& FontName, INT32 Style);
00613 BOOL AIExportTrailer(EPSExportDC *pDC);
00614
00615
00616 ProcessEPSResult ImportPageInfo(TCHAR* Comment);
00617 ProcessEPSResult ImportDocumentComment(TCHAR* Comment);
00618 ProcessEPSResult ImportViewInfo(TCHAR* Comment);
00619 ProcessEPSResult ImportRulerState(TCHAR* Comment);
00620 ProcessEPSResult ImportStateInfo(TCHAR* Comment);
00621 ProcessEPSResult ImportQualityInfo(TCHAR* Comment);
00622 ProcessEPSResult ImportGridInfo(TCHAR* Comment);
00623 ProcessEPSResult ImportFlagInfo(TCHAR* Comment);
00624 ProcessEPSResult ImportUnitInfo(TCHAR* Comment);
00625 ProcessEPSResult ImportDateInfo(TCHAR* Comment);
00626 ProcessEPSResult ImportUndoInfo(TCHAR* Comment);
00627 ProcessEPSResult ImportDefaultUnitsInfo(TCHAR* Comment);
00628 ProcessEPSResult ImportOriginInfo(TCHAR* Comment);
00629
00630
00631 BOOL DocIsImporting;
00632 BOOL DocTemplateLoading;
00633 static BOOL fRestoreViewOnImport;
00634
00635 private:
00636
00637
00638 BOOL InitDefaultAttributeNodes();
00639
00640
00641 InsertionNode* InsertPos;
00642
00643 CC_DECLARE_DYNAMIC(Document);
00644
00645 public:
00646
00647
00648 InsertionNode* GetInsertionPosition();
00649 void ResetInsertionPosition();
00650 void InsertionNodeDying() { InsertPos = 0; }
00651 };
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664 class TranspModeMsg : public Msg
00665 {
00666 public:
00667
00668 TranspModeMsg(BOOL fInTranspMode);
00669 BOOL InTransparencyMode() const;
00670
00671 private:
00672
00673 BOOL m_fInTranspMode;
00674 CC_DECLARE_DYNAMIC(TranspModeMsg)
00675 };
00676
00677 #endif // !INC_DOCUMENT