Document Class Reference

To represent a platform independent document object. More...

#include <document.h>

Inheritance diagram for Document:

BaseDocument ListItem CCObject SimpleCCObject BitmapExportDocument InternalClipboard List of all members.

Public Member Functions

 Document (BOOL IsAHiddenDocument=FALSE)
 Constructor. Initialises the link to the OIL document.
virtual ~Document ()
 Destructor. Deletes the whole document tree of this object, and all memory is returned to the heaps whence it came. The busy cursor is displayed while this is happening.
virtual BOOL Init (CCamDoc *pOilDoc)
 Sets up the document tree. At the moment it fills it with test data (paths etc) but in future only the initial tree nodes will be set up. When the document has been completely initialised, it becomes the selected and current document: DocChangingMsg message broadcasts will occur (in the order BORN, CURRENT, SELECTED).
virtual BOOL ReInit ()
 Calls InitFailed to delete the Tree and various others and follows this with an Init to put the Document back into a virgin state Not used just yet...
virtual BOOL IsNotAClipboard () const
virtual BOOL IsAClipboard () const
INT32 GetNumLayers ()
 Counts the layers in this document.
BOOL IsStable () const
void SetStable (BOOL fStable)
RalphDocumentGetRalphDoc ()
BOOL IsARalphDoc (void)
void SetRalphDoc (BOOL b)
BOOL ConnectRalphDocument (RalphDocument *pDoc)
void SetRalphViewMode (ViewMode Vmode)
ViewMode GetRalphViewMode ()
BOOL RalphDontShowPaper ()
SafeRenderPointerGetSafeRenderPointer ()
 Returns a reference to the document's 'Safe render pointer'.
String_256 GetTitle () const
 Returns the Title of the document. The title is the text that appears in the documents windows (when it is not maximised). For example 'Untitled #1' or 'Untitled #1 (Modified)' or even 'Blobby.art (Modified)'.
String_256 GetDocName (BOOL IncludeFileType=TRUE) const
 Returns the name of the document. The name will be the first part of the title which is the text that appears in the document windows (when it is not maximised). For example 'Untitled #1' or 'Untitled #1 (Modified)' or even 'Blobby.art (Modified)'.
String_256 GetPathName (UINT32 MaxSize=0) const
 Returns the pathname of the document.
String_256 GetLocation (UINT32 MaxSize=0) const
 Returns the location of the document, which is the pathname with no filename.
const String_256GetProducer () const
const String_256GetComment () const
 Getting the time the document was created.
void SetComment (String_256 *NewComment)
 Setting the document's comment string.
const time_t & GetCreationTime () const
void SetCreationTime (time_t)
 Allows setting of the document's creation time.
const time_t & GetLastSaveTime () const
 Getting the time the document was last saved.
void SetLastSaveTime (time_t)
 Allows setting of the document's last saved time.
void SetLastSaveTime ()
 Call on saving a document. Sets the document's last saved time.
void MakeJustCreated ()
 Resets member variables of the document so it abbears as if the document has just been created (eg CreationTime is set to the current time).
void SetModified (BOOL fState)
 Sets (or clears) the "document is modified" flag.
BOOL IsModified () const
 Tests the "Modified" flag.
BOOL IsReadOnly () const
 Tests the "Read Only" flag.
BOOL IsACopy () const
 Tests the "Copy" flag.
BOOL IsLoadedAsVersion1File () const
 Returns the current state of the IsLoadedAsVersion1File flag. Flag to say that the document was loaded as a version 1 file and so the user needs to be given the option of saving it in this form when the document is saved.
BOOL SetLoadedAsVersion1File (BOOL NewState)
 Sets a new current state of the IsLoadedAsVersion1File flag. Flag to say that the document was loaded as a version 1 file and so the user needs to be given the option of saving it in this form when the document is saved.
SpreadFindFirstSpread ()
 Finds the first spread in this document.
void SetCurrent ()
BOOL IsAnimated ()
 Finds whether this document is an animation.
void GetExtents (DocCoord *Lo, DocCoord *Hi, DocRect *Extent, View *pView)
 Find the extents of the document. These are in DocCoords - Lo is the bottom-left corner of the last chapter, and Hi is the top-right corner of the first chapter.
void UpdateExtents (const DocCoord &Lo, const DocCoord &Hi)
 Change the document extents. This will only be done by objects of class NodeDocument. All related DocViews are informed of the change.
UnitType GetDocFontUnits ()
 return Font Units for this document default to COMP_POINTS if no unit list available
void DeleteContents ()
 None. Nothing. Does not do anything. And don't even think about making it do anything!
void InsertNewNode (Node *NewNode, Spread *pDestSpread)
 Inserts the Node into the Document at the position specified. The node is added to the active layer on this spread.
void HandleNodeDeletion (Node *pNode)
 Calls DocView::ForceRedraw(WorkRect&) for each DocView attached to this Document.
CCamDocGetOilDoc () const
 Find the Oil document associated with the Document.
DocViewGetFirstDocView () const
DocViewGetNextDocView (const DocView *pView) const
DocViewGetTopmostView () const
 Finds out which of this Document's DocViews is 'selected'.
DocViewGetNewDocView ()
 Returns a new DocView for the client. If any unconnected views already exist for this document, the first is returned. Otherwise a new DocView is created and returned. If a new DocView is obtained, it becomes the 'current' DocView before it is returned to the caller.
DocViewGetSpareDocView ()
 Looks for a DocView with no attached OilView, so we can recycle it.
void OnDocViewDying (DocView *pdv)
void ShowViewScrollers (BOOL fIsVisible)
void ShowViewRulers (BOOL fIsVisible)
BOOL CreateDragTargets (DragInformation *DragInfo)
 Calls all (OILY) views to create their drag targets.
void ForceRedraw (FRDocViewFunc=NULL)
 Calls DocView::ForceRedraw() for each DocView attached to this Document. i.e. This forces a *complete* redraw for the whole document in all views attached to it.
void ForceRedraw (WorkRect &forceRect)
 Calls DocView::ForceRedraw(WorkRect&) for each DocView attached to this Document.
void ForceRedraw (Spread *pSpread, DocRect SpreadRect, BOOL Accumulate=FALSE, Node *pInvalidNode=NULL, BOOL bAutoRelease=TRUE)
 Calls DocView::ForceRedraw(Spread*, DocRect) for each DocView attached to this Document.
void FlushRedraw ()
 Calls DocView::FlushRedraw() for each DocView attached to this Document.
UINT32 GetCreatorSerialNo ()
UINT32 GetLastSerialNo ()
void SetLastEditorSerialNo (UINT32 sn)
BOOL IsMultilayer ()
 Interogate the multilayer status of this document.
BOOL IsAllVisible ()
 Interogate the "all visible" status of this document.
void SetMultilayer (BOOL state)
 Lets you set the state of the multilayer document flag.
void SetAllVisible (BOOL state)
 Lets you set the state of the "all visible" document flag.
AttributeManagerGetAttributeMgr () const
 For finding the documents operation history.
NodeSetSentinelGetSetSentinel () const
NodeAttributeGetDefaultAttr (CCRuntimeClass *RequiredAttr)
 Finds the default attribute node for a document, given the attribute class to look for. For instance, to find out the default line width for a document: MonoOn.
MILLIPOINT GetBleedOffset () const
 For getting the Document's bleed area size.
BOOL SetBleedOffset (MILLIPOINT)
 For setting a new value for the Document's bleed area size.
OperationHistoryGetOpHistory ()
 For finding the documents operation history.
BOOL EmptyOperationHistory ()
 This function deletes the operation history, destroying everything in it. It then creates a new empty Operation History and sets it up ready for use. This function was really created to allow the New and Open Document options to get rid of the undo that is created by the file importing.
BitmapListGetBitmapList ()
 Gets the bitmap list from this documents doc component.
DocUnitListGetDocUnitList ()
UINT32 GetDocNudge ()
BOOL SetDocNudge (UINT32 newVal)
 Sets the documents nudge size.
BOOL GetBitmapSmoothing ()
void SetBitmapSmoothing (BOOL newVal)
DocCoord GetDuplicationOffset ()
void SetDuplicationOffset (DocCoord newOffset)
virtual BOOL EPSStartImport (EPSFilter *)
 Inform the document that an EPS import is about to start.
virtual void EPSEndImport (EPSFilter *, BOOL)
 Inform the document that an EPS import has just finished.
virtual BOOL EPSStartExport (EPSFilter *)
 Inform the document that an EPS export is about to start.
virtual void EPSEndExport (EPSFilter *)
 Inform the document that an EPS export has just finished.
virtual BOOL WriteEPSResources (EPSFilter *)
 Write out the EPS resources for this document, using the EPS filter object supplied. (The base class does nothing except return TRUE).
virtual BOOL WriteEPSProlog (EPSFilter *)
 Write out the EPS prolog for this document, using the EPS filter object supplied. (The base class does nothing except return TRUE).
virtual BOOL WriteEPSSetup (EPSFilter *)
 Write out the EPS setup for this document, using the EPS filter object supplied. (The base class does nothing except return TRUE).
virtual BOOL WriteEPSFonts (EPSFilter *)
 Write out the EPS fonts for this document, using the EPS filter object supplied. (The base class does nothing except return TRUE).
virtual BOOL WriteEPSComments (EPSFilter *)
 Write out any comments that need to be in the initial batch of EPS comments (i.e. before the %EndComments line), using the specified EPS Filter object. (The base class does nothing except return TRUE).
virtual BOOL WriteEPSTrailer (EPSFilter *)
 Write out the EPS trailer for this document, using the EPS filter object supplied. (The base class does nothing except return TRUE).
virtual ProcessEPSResult ProcessEPSComment (EPSFilter *, const TCHAR *)
 Process an EPS comment found in the file, if it 'belongs' to the document. If it does not, then the document should return EPSCommentUnknown, and the comment will be passed on to the document components. If the function returns EPSCommentOK, and the next line in the file starts with "%%+", i.e. an EPS/PostScript continuation comment, then this will be passed to this document immediately, without trying any of the document components first. This allows items such a colour lists to be imported easily, as they are usually specified on multiple lines in the file, using "%%+" comments. (The base class does nothing - it returns EPSCommentUnknown).
virtual void EndOfEPSComment (EPSFilter *)
 Informs the document that the comment it has been decoding has now finished, and it should take whatever action required to act on the comment. This call is made even for single-line comments, because by the nature of DSC comments, it is not known until the next comment starts or a non-comment line is encountered that the comment is over and is not multi-line.
virtual INT32 GetSizeOfExport (Filter *)
 Find out how many nodes will be exported when this document is exported. The node can use the filter to find out how it will be exported. NB. This is virtual - the default implementation just returns 1 - only override if this is not accurate.
BOOL IsImporting ()
 Helps work out if the document is in the process of opening an existing file or if it is importing data into itself. Called during the reading of the Document Info section of the .art files. All the DocInfo section is ignored if the file is actually being imported.
void SetIsImporting (BOOL NewIsImporting)
 Sets the IsImporting flag for the document.
BOOL IsTemplateLoading ()
 Helps work out if the document being opened or imported is a default or template document. At present, used in Webster to check if we need to use layers or not. Template documents are allowed to have layers. Non-template docs are not.
void SetTemplateLoading (BOOL NewTemplateLoading)
 Sets the TemplateLoading flag for the document.
BOOL AIExportExtras (EPSExportDC *pDC)
 Export an Illustrator compatible trailer.
InsertionNodeGetInsertionPosition ()
 This function should be called to find the position in the document where a new object should be inserted. The object should always be inserted as a previous child of the InsertionNode which is returned.
void ResetInsertionPosition ()
 Forces the insertion node to move to the end of the layer that it is currently on. This is used by the filters so they can insert an arbitrary number of nodes into the tree without worryng about the insertion position being updated every time and then it can just update it at the end using this function.
void InsertionNodeDying ()

Static Public Member Functions

static BOOL ReadPrefs ()
 Reads preferences for the Document class from the program's .INI file.
static DocumentGetCurrent ()
 Find the current Document object.
static void SetNoCurrent ()
 Set the current document pointer to be NULL, i.e., there is no current document object. Changed 22/7/94 by MarkN **** Does NOT broadcasts a message to all that this is happening any more.
static DocumentGetSelected ()
 Find the selected Document object.
static void SetSelectedViewAndSpread (Document *TheDocument=NULL, DocView *TheView=NULL, Spread *TheSpread=NULL)
 To set the Selected Document, DocView, and Spread.
static void SetNoSelectedViewAndSpread (void)
 To set the Selected Document, DocView, and Spread. This sets all three of these entities to NULL - no selected entity.
static SpreadGetSelectedSpread ()
 THIS METHOD IS DEFUNCT! DO NOT CALL IT! Use Document::SetSelectedViewAndSpread() instead (This call is currently indirected to that one, and gives TRACE warnings)THIS METHOD IS DEFUNCT! DO NOT CALL IT! Use Document::SetNoSelectedViewAndSpread() instead (This call is currently indirected to that one, and gives TRACE warnings)THIS METHOD IS DEFUNCT! DO NOT CALL IT! Use Document::SetSelectedViewAndSpread() instead (This call is currently indirected to that one, and gives TRACE warnings)Returns the selected spread.
static BOOL SpreadBelongsToDoc (Document *pDoc, Spread *pSpread)
 Tests to see if the spread belongs to the document.
static void IncCurrentNodeCount ()
 Adds one to the NodesInTree counter of the Current Document object, if it exists. Called by the constructors of class Node.
static void DecCurrentNodeCount ()
 Decrements the node counter in the current Document, if there is one. Called by the destructor of class Node.
static BOOL GetRestoreViewOnImport ()
static void ShouldRestoreViewOnImport (BOOL fNewState)
 Sets/clears a flag that if TRUE will ask this document to restore the view saved within the doc, if FALSE it won't bother. Normally we want the view saved in the doc to be restore, but if we are restoring the entire workspace then this is dealt with elsewhere.

Protected Member Functions

BOOL InitFailed ()
 Called by Document::Init when it fails; encapsulates all necessary tidying up, and then returns FALSE so that it can be called as part of the final return statement. Replaces some completely unnecessary goto code.
BOOL InitTree (NodeDocument *RootNode)
 Called by Document::Init to initialise the document tree structure.
BOOL ExportPageInfo (EPSExportDC *pDC)
 Exports a Document Info continuation comment that describes the page layout. It takes the following form :- %+p VersionNum if VersionNum is zero then the following will be on the rest of the line Width Height Margin Bleed DPS(1 for yes, 0 for no) ShowDropShadow(1 for yes, 0 for no).
BOOL ExportDocumentComment (EPSExportDC *pDC)
 Will export as many Document Info continuation comments as are needed to save out the whole comment. Each continuation comment takes the form as follows :- %+c CommentHere Each line will not have more that about 100 chars of comment on it (they will all be simple joined together when importing). If there is a new line char in the comment the continuation comment will end at that point, but the last char of the continuation comment will be ^.
BOOL ExportViewInfo (EPSExportDC *pDC)
 Exports the View Settings continuation comment (part of the Document Info comment). It has the following form %+v VersionNum(1) XScrollOffset YScrollOffset ScaleFactor Active DrawingScale RealScale. ScaleFactor is represented 1000 times the actual scale factor. eg when the document is viewed at 100% the scale factor is 1.0. This is export as 1000. 200% would be 2000 etc. Active is a flag to say if the Document Scale Factor is active or not. It is followed by the Drawing and Real scales in the document.
BOOL ExportStateInfo (EPSExportDC *pDC)
 Part of the Document Info comment. This is document state information It takes the following form :- %+s VersionNum Version 0 comment lines follows this with ShowGrid SnapToGrid SnapToMagObjects SnapToObjects ForeBackMode (and zero as a dummy value, see comments in the function). Each of the values is a flag and will hold either 0 for FALSE or 1 for TRUE.
BOOL ExportQualityInfo (EPSExportDC *pDC)
 Part of the Document Info comment. It takes the following form :- %+q VersionNum(0) ViewQuality. ViewQuality is the numerical value of the view Quality.
BOOL ExportGridInfo (EPSExportDC *pDC)
BOOL ExportFlagInfo (EPSExportDC *pDC)
BOOL ExportUnitInfo (EPSExportDC *pDC)
 Saves out all the user defined units. These are saved in version 0 comments lines, 1 unit per line. The default units being used for page and fonts are exported in:-.
BOOL ExportDateInfo (EPSExportDC *pDC)
 exports a continuation comment that holds the Last Saved Date and the Creation Date. It takes the follwoing form :- %+d Version(0) CreationDate LastSavedDate
BOOL ExportTextSetup (EPSFilter *pFilter)
BOOL ExportTextTrailer (EPSFilter *pFilter)
BOOL ExportRulerState (EPSExportDC *pFilter)
 Exports the View Settings continuation comment (part of the Document Info comment). It has the following form %+r VersionNum(0) ScrollersVisible RulersVisible.
BOOL ExportUndoInfo (EPSExportDC *pDC)
 Exports a Document Info continuation comment that describes the document's OperationHistory size. It takes the following form :- %+h VersionNum if VersionNum is zero then the following will be on the rest of the line Size(bytes).
BOOL ExportDefaultUnitsInfo (EPSExportDC *pDC)
 Saves out the user default units for displaying things like page units and font units to the user. These are saved in version 0 comments lines followed by a string for the page units and a string for the font units. Must come after the user units section as the default might be one of these user units. The usert unit definitions are exported in:-.
BOOL ExportOriginInfo (EPSExportDC *pDC)
 Export grid/user origin Note: Should be exported after grid and page info as when importing, these both reset the origin to the origin of the page.
BOOL AIExportResources (EPSExportDC *pDC, BOOL)
 Export an Illustrator standard needed resources.
BOOL AIExportProlog (EPSExportDC *pDC)
 Export an Illustrator standard prolog.
BOOL AIExportCharEncoding (EPSExportDC *pDC)
 Export an Illustrator compatible character encoding vector but only in EPS format.
BOOL AIExportFontEncoding (EPSExportDC *pDC)
 Export an Illustrator compatible font encodings but only in EPS format.
BOOL AIExportFontEncoding (EPSExportDC *pDC, String_64 &FontName, INT32 Style)
 Export an Illustrator compatible font encoding but only in EPS format.
BOOL AIExportTrailer (EPSExportDC *pDC)
 Export an Illustrator compatible trailer.
ProcessEPSResult ImportPageInfo (TCHAR *Comment)
 Tries to import the page info. This function only returns FALSE if there was an actual error in the file that needs reporting.
ProcessEPSResult ImportDocumentComment (TCHAR *Comment)
ProcessEPSResult ImportViewInfo (TCHAR *Comment)
ProcessEPSResult ImportRulerState (TCHAR *Comment)
ProcessEPSResult ImportStateInfo (TCHAR *Comment)
 Imports state information. Version 0 holds view state information such as:- grid showing and snap to grid magnetic snap to objects foregound background redraw modes.
ProcessEPSResult ImportQualityInfo (TCHAR *Comment)
ProcessEPSResult ImportGridInfo (TCHAR *Comment)
 Imports the global grid that covers the whole spread.
ProcessEPSResult ImportFlagInfo (TCHAR *Comment)
ProcessEPSResult ImportUnitInfo (TCHAR *Comment)
 Imports a continuation comment with details about a user defined unit on it There is 1 unit per comment. This comment always creates a new user unit in version prior to Studio 1.00b, code updated to not do this 4/9/95.
ProcessEPSResult ImportDateInfo (TCHAR *Comment)
 Reads in the Last saved Date and Creation Date from the file.
ProcessEPSResult ImportUndoInfo (TCHAR *Comment)
 Reads in the Last saved operation history size from the file.
ProcessEPSResult ImportDefaultUnitsInfo (TCHAR *Comment)
 Imports a continuation comment with details about the default units which are going to be used for showing page and font measurements. Cannot use units as on older version will always create a new user unit for each ++u found..
ProcessEPSResult ImportOriginInfo (TCHAR *Comment)
 Imports the spread grid/user origin Note: The origin should already have been set up to the page origin when importing the grid (ie already has a sensible default if the origin import fails) Also since the origin does not affect the look of the doc, if possible don't abort importing if an error is encountered so the doc can be recovered.

Protected Attributes

BOOL IsARalph
ViewMode Viewmode
RalphDocumentpRalphDocument
SafeRenderPointer TheSafeRenderPointer
CCamDocOilDoc
List DocViews
OperationHistoryOpHistory
BOOL DocIsImporting
BOOL DocTemplateLoading

Static Protected Attributes

static BOOL fRestoreViewOnImport = TRUE

Private Member Functions

BOOL InitDefaultAttributeNodes ()
 This function adds the document's default attributes as nodes at the start of the tree (i.e. as first children of the NodeDocument).
 CC_DECLARE_DYNAMIC (Document)

Private Attributes

BOOL m_fStable
time_t CreationTime
time_t LastSaveTime
String_256 Producer
String_256 Comment
struct {
   BOOL   SaveWithUndo: 1
   BOOL   LayerMultilayer: 1
   BOOL   LayerAllVisible: 1
DocFlags
BOOL LoadedAsVersion1File
SpreadpSelSpread
UINT32 CreatorSerialNo
UINT32 LastSerialNo
AttributeManagerAttributeMgr
NodeSetSentinelm_pSetSentinel
MILLIPOINT PasteBoardOffsetWidth
MILLIPOINT PasteBoardOffsetHeight
MILLIPOINT BleedOffset
DocUnitListpDocUnitList
UINT32 m_docNudge
BOOL m_bSmoothBitmaps
DocCoord m_DuplicationOffset
InsertionNodeInsertPos

Static Private Attributes

static SpreadpGlobalSelSpread = NULL
static DocumentCurrent = NULL
static DocumentSelected = NULL

Detailed Description

To represent a platform independent document object.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> (messed about by Tim) (sorted out by JustinF)
Date:
13/4/1993

Definition at line 219 of file document.h.


Constructor & Destructor Documentation

Document::Document BOOL  bIsAHiddenDoc = FALSE  ) 
 

Constructor. Initialises the link to the OIL document.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/5/93
Parameters:
IsAHiddenDoc - FALSE for a normal document (see below) [INPUTS] TRUE for a hidden document (including clipboards, etc)
Notes: You MUST call Document::Init after Creation of the document, to fill in the defaults and build the document tree root.

HIDDEN DOCUMENTS A hidden document is one which is not shown to the user in any UI. Hidden docs are used mainly for clipboard (and OLE) data transfer operations.

Note that if you pass in (pCCamDoc = NULL) then the document is forced to be hidden. SeeAlso IsAHiddenDoc() and IsNotAHiddenDoc() in document.h

The InternalClipboard is now based upon Document. It creates a Hidden Document. Generally nobody should care about this, but some bits of code might have to be careful of the differences. Use IsAClipboard() to check if the doc is really a clipboard. Note also that Clipboard documents do not broadcast DocChangingMsgs.

Returns:
Errors: None.
See also:
Document::Init; InternalClipboard; BaseDocument

Definition at line 230 of file document.cpp.

00231   : BaseDocument(bIsAHiddenDoc),
00232     OilDoc(0)
00233 {
00234     // NB. Make sure all the Document stuff is set up before calling routines which
00235     // might interrogate the Document object.
00236     
00237     // Set the default state of the flags.
00238     DocFlags.LayerMultilayer = FALSE;
00239     DocFlags.LayerAllVisible = FALSE;
00240     DocFlags.SaveWithUndo = TRUE;
00241 
00242     // Set the times
00243     CreationTime = ::time(NULL);
00244     LastSaveTime = 0;
00245 
00246     // Set up default bleed offset
00247     BleedOffset = DefBleedSize;
00248 
00249     // Set up our array of default colour contexts by copying the 'global' array
00250     ColourContext::GetGlobalDefaults( &DefaultColourContexts );
00251 
00252     // Add this document to the list of all documents in Camelot
00253 #ifdef RALPH
00254     Camelot.Documents.AddHead(this);
00255 #else
00256     if (IsNotAHiddenDoc())
00257     {
00258         Camelot.Documents.AddHead(this);
00259     }
00260 #endif
00261 
00262     // Set this document to be the current one
00263     this->SetCurrent();
00264 
00265     NodesInTree = 0;       
00266                                  
00267     // Initialise pointers to sensible values (they are set up in the Init() function)
00268     OpHistory           = 0;
00269     AttributeMgr        = 0;
00270     m_pSetSentinel      = 0;
00271     pDocUnitList        = 0;
00272     pSelSpread          = 0;
00273 
00274     IsARalph = FALSE;
00275     pRalphDocument =NULL;
00276     Viewmode = DOCUMENT_VIEW;
00277 
00278     // Always keep this flag TRUE except when Loading New Files in
00279     DocIsImporting = TRUE;
00280 
00281     // Always keep this False unless loading a template document
00282     DocTemplateLoading = FALSE;
00283 
00284     // Make sure that the loaded as old version file is set to a known state
00285     LoadedAsVersion1File = FALSE;
00286 
00287     m_docNudge = DEFAULT_NUDGE_SIZE;
00288     SetBitmapSmoothing(TRUE);
00289     m_DuplicationOffset = DocCoord(OpDuplicate::DuplicatePlacementX, OpDuplicate::DuplicatePlacementY);
00290 
00291     // Document is not yet "born and stable".
00292     m_fStable = FALSE;
00293 }

Document::~Document  )  [virtual]
 

Destructor. Deletes the whole document tree of this object, and all memory is returned to the heaps whence it came. The busy cursor is displayed while this is happening.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/5/93

Definition at line 640 of file document.cpp.

00641 {
00642     // Set the busy cursor . . .
00643     BeginSlowJob(-1, FALSE);
00644 
00645 #ifndef RALPH
00646     // Broadcast to everyone that this document is a dead duck.
00647     if (IsNotAHiddenDoc())
00648 #endif
00649     {
00650         // Document no longer stable.
00651         SetStable(FALSE);
00652         BROADCAST_TO_ALL(DocChangingMsg(this, DocChangingMsg::ABOUTTODIE));
00653     }
00654 
00655 
00656 #ifdef _DEBUG
00657         // DocViews should be closed before Documents, so all render regions for this document
00658         // should have been deleted - make sure they have.
00659         Camelot.DeleteRenderRegions(this);
00660 #endif
00661 
00662 #ifndef RALPH
00663     // Remove Document from list of all documents
00664     if (IsNotAHiddenDoc())
00665 #endif
00666     {
00667         Camelot.Documents.RemoveItem(this);
00668 
00669         // Is this the last document in the program?
00670         BOOL ThisIsTheLastDoc = (Camelot.Documents.GetHead() == NULL);
00671 
00672         if (ThisIsTheLastDoc)
00673         {
00674             // There are no more documents, so ensure that the system is in the correct state.
00675 
00676             // If the system is working correctly, then the following should be true:
00677             //   If Current  != NULL, Current  must be this document
00678             //   If Selected != NULL, Selected must be this document
00679             // We will ensure this is the case in debug builds
00680 
00681             ENSURE((Current  == NULL) || (Current  == this),"Current document is garbage");
00682             ENSURE((Selected == NULL) || (Selected == this),"Selected document is garbage");
00683 
00684             // Reset Current and Selected document and DocView
00685             SetNoCurrent();
00686             SetNoSelectedViewAndSpread();
00687 
00688             DocView::SetNoCurrent();
00689     //      DocView::SetNoSelected();   -- now done in SetNoSelectedViewAndSpread(), above
00690 
00691         }
00692         else
00693         {
00694             // Make sure that Current and Selected do not refer to the dying document
00695             if (this == Current)    SetNoCurrent();
00696             if (this == Selected)   SetNoSelectedViewAndSpread();
00697             
00698             // This special test added to fix a problem whereby current doc was being set to null
00699             // above and hence causing unit display problems (ERROR2s) in the selector tool when
00700             // opening a bitmap had been aborted. 18/9/96 Neville
00701             if (Selected != NULL && Current == NULL) Current = Selected; 
00702         }           
00703     }
00704 
00705     // Delete all DocViews attached to document
00706     DocViews.DeleteAll();
00707 
00708 #ifndef RALPH
00709     // Broadcast to everyone that this document is a dead duck.
00710     if (IsNotAHiddenDoc())
00711     {
00712         BROADCAST_TO_ALL(DocChangingMsg(this, DocChangingMsg::KILLED));
00713     }
00714 #endif  
00715     // Destroy the operation history. This must get destroyed before the tree is destroyed
00716     if (OpHistory != NULL)
00717         delete (OpHistory);   
00718 
00719     // Destroy the attribute manager 
00720     if (AttributeMgr != NULL)
00721         delete (AttributeMgr); 
00722 
00723     // Destroy the list of units in this document
00724     if (pDocUnitList != NULL)
00725         delete (pDocUnitList);
00726 
00727     // All done...
00728     EndSlowJob(); 
00729 
00730     // Note that the tree is deleted in the base class destructor
00731 }


Member Function Documentation

BOOL Document::AIExportCharEncoding EPSExportDC pDC  )  [protected]
 

Export an Illustrator compatible character encoding vector but only in EPS format.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/95
Parameters:
pDC - the dc to export to [INPUTS]
Returns:
TRUE

Definition at line 4669 of file document.cpp.

04670 {
04671     // Temporarily output an inline encoding. This should really be read from a file.
04672     pDC->OutputToken(_T("[")); pDC->OutputNewLine();
04673     pDC->OutputToken(_T("39/quotesingle 96/grave 128/Adieresis/Aring/Ccedilla/Eacute/Ntilde/Odieresis")); pDC->OutputNewLine();
04674     pDC->OutputToken(_T("/Udieresis/aacute/agrave/acircumflex/adieresis/atilde/aring/ccedilla/eacute")); pDC->OutputNewLine();
04675     pDC->OutputToken(_T("/egrave/ecircumflex/edieresis/iacute/igrave/icircumflex/idieresis/ntilde")); pDC->OutputNewLine();
04676     pDC->OutputToken(_T("/oacute/ograve/ocircumflex/odieresis/otilde/uacute/ugrave/ucircumflex")); pDC->OutputNewLine();
04677     pDC->OutputToken(_T("/udieresis/dagger/degree/cent/sterling/section/bullet/paragraph/germandbls")); pDC->OutputNewLine();
04678     pDC->OutputToken(_T("/registered/copyright/trademark/acute/dieresis/.notdef/AE/Oslash")); pDC->OutputNewLine();
04679     pDC->OutputToken(_T("/.notdef/plusminus/.notdef/.notdef/yen/mu/.notdef/.notdef")); pDC->OutputNewLine();
04680     pDC->OutputToken(_T("/.notdef/.notdef/.notdef/ordfeminine/ordmasculine/.notdef/ae/oslash")); pDC->OutputNewLine();
04681     pDC->OutputToken(_T("/questiondown/exclamdown/logicalnot/.notdef/florin/.notdef/.notdef")); pDC->OutputNewLine();
04682     pDC->OutputToken(_T("/guillemotleft/guillemotright/ellipsis/.notdef/Agrave/Atilde/Otilde/OE/oe")); pDC->OutputNewLine();
04683     pDC->OutputToken(_T("/endash/emdash/quotedblleft/quotedblright/quoteleft/quoteright/divide")); pDC->OutputNewLine();
04684     pDC->OutputToken(_T("/.notdef/ydieresis/Ydieresis/fraction/currency/guilsinglleft/guilsinglright")); pDC->OutputNewLine();
04685     pDC->OutputToken(_T("/fi/fl/daggerdbl/periodcentered/quotesinglbase/quotedblbase/perthousand")); pDC->OutputNewLine();
04686     pDC->OutputToken(_T("/Acircumflex/Ecircumflex/Aacute/Edieresis/Egrave/Iacute/Icircumflex")); pDC->OutputNewLine();
04687     pDC->OutputToken(_T("/Idieresis/Igrave/Oacute/Ocircumflex/.notdef/Ograve/Uacute/Ucircumflex")); pDC->OutputNewLine();
04688     pDC->OutputToken(_T("/Ugrave/dotlessi/circumflex/tilde/macron/breve/dotaccent/ring/cedilla")); pDC->OutputNewLine();
04689     pDC->OutputToken(_T("/hungarumlaut/ogonek/caron")); pDC->OutputNewLine();
04690     pDC->OutputToken(_T("TE"));
04691     pDC->OutputNewLine();
04692     return TRUE;
04693 }

BOOL Document::AIExportExtras EPSExportDC pDC  ) 
 

Export an Illustrator compatible trailer.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/95
Parameters:
pDC - the dc to export to [INPUTS]
Returns:
TRUE

Definition at line 4791 of file document.cpp.

04792 {
04793     pDC->OutputToken(_T("Adobe_level2_AI5 /initialize get exec"));      pDC->OutputNewLine();
04794     pDC->OutputToken(_T("Adobe_packedarray /initialize get exec"));     pDC->OutputNewLine();
04795     pDC->OutputToken(_T("Adobe_ColorImage_AI6  /initialize get exec")); pDC->OutputNewLine();
04796     pDC->OutputToken(_T("Adobe_cshow /initialize get exec"));           pDC->OutputNewLine();
04797     pDC->OutputToken(_T("Adobe_cmykcolor /initialize get exec"));       pDC->OutputNewLine();
04798     pDC->OutputToken(_T("Adobe_customcolor /initialize get exec"));     pDC->OutputNewLine();
04799     
04800         // ChrisG (31/10/00) Changed typography line to match Illustrator and CorelDraw.
04801         //  This allows photoshop to import the file correctly.
04802     pDC->OutputToken(_T("Adobe_Illustrator_AI5_vars Adobe_Illustrator_AI5"));
04803     pDC->OutputToken(_T("Adobe_typography_AI5 /initialize get exec"));  pDC->OutputNewLine();
04804         // End of typography output.
04805 
04806     pDC->OutputToken(_T("Adobe_pattern_AI3 /initialize get exec"));     pDC->OutputNewLine();
04807     pDC->OutputToken(_T("Adobe_Illustrator_AI5 /initialize get exec")); pDC->OutputNewLine();
04808     return TRUE;
04809 }

BOOL Document::AIExportFontEncoding EPSExportDC pDC,
String_64 FontName,
INT32  Style
[protected]
 

Export an Illustrator compatible font encoding but only in EPS format.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/95
Parameters:
pDC - the dc to export to [INPUTS] FontName - a reference to a font name Style - a font style b0 = 1 bold b1 = 1 italic
Returns:
TRUE

Definition at line 4749 of file document.cpp.

04750 {
04751     String_64 EFont;
04752 
04753     // Graeme (31-3-00) - Map the encoded name onto the PS font name.
04754     FONTMANAGER->EncodeAndMapFontName(FontName, EFont, Style);
04755 
04756     String_256 Line(_T("%AI3_BeginEncoding: _"));
04757 
04758     Line+=(TCHAR*)EFont;
04759     Line+=_T(" ");
04760     Line+=(TCHAR*)EFont;
04761     pDC->OutputToken((TCHAR*)Line);
04762     pDC->OutputNewLine();
04763 
04764     Line=_T("[/_");
04765     Line+=(TCHAR*)EFont;
04766     Line+=_T("/");
04767     Line+=(TCHAR*)EFont;
04768     Line+=_T(" 0 0 1 TZ");
04769     pDC->OutputToken((TCHAR*)Line);
04770     pDC->OutputNewLine();
04771 
04772     Line=_T("%AI3_EndEncoding");
04773     pDC->OutputToken((TCHAR*)Line);
04774     pDC->OutputNewLine();
04775     return TRUE;
04776 }

BOOL Document::AIExportFontEncoding EPSExportDC pDC  )  [protected]
 

Export an Illustrator compatible font encodings but only in EPS format.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/95
Parameters:
pDC - the dc to export to [INPUTS]
Returns:
TRUE

Definition at line 4708 of file document.cpp.

04709 {
04710 #if !defined(EXCLUDE_FROM_RALPH)
04711     // need to enumerate all fonts for this encodeing
04712     String_64 FName;
04713     INT32 Style;
04714     FontList CurFontList;
04715 
04716     if (!CurFontList.Build(this))
04717         return FALSE;
04718 
04719     FontListItem* pItem = CurFontList.GetFirstItem();
04720     while (pItem)
04721     {
04722         FName = pItem->GetFontName();
04723         Style = pItem->GetFontStyle();
04724         AIExportFontEncoding(pDC,FName,Style);
04725         
04726         pItem = CurFontList.GetNextItem(pItem); 
04727     }
04728 #endif
04729     return TRUE;
04730 }

BOOL Document::AIExportProlog EPSExportDC pDC  )  [protected]
 

Export an Illustrator standard prolog.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/95
Parameters:
pDC - the dc to export to [INPUTS]
Returns:
TRUE

Definition at line 4641 of file document.cpp.

04642 {
04643     pDC->OutputToken(_T("%%IncludeResource: procset Adobe_level2_AI5 1.2 0"));          pDC->OutputNewLine();
04644     pDC->OutputToken(_T("%%IncludeResource: procset Adobe_packedarray 2.0 0"));         pDC->OutputNewLine();
04645     pDC->OutputToken(_T("%%IncludeResource: procset Adobe_ColorImage_AI6 1.1 0"));      pDC->OutputNewLine();
04646     pDC->OutputToken(_T("%%IncludeResource: procset Adobe_cshow 2.0 8"));               pDC->OutputNewLine();
04647     pDC->OutputToken(_T("%%IncludeResource: procset Adobe_cmykcolor 1.1 0"));           pDC->OutputNewLine();
04648     pDC->OutputToken(_T("%%IncludeResource: procset Adobe_customcolor 1.0 0"));         pDC->OutputNewLine();
04649     pDC->OutputToken(_T("%%IncludeResource: procset Adobe_typography_AI5 1.1 0"));      pDC->OutputNewLine();
04650     pDC->OutputToken(_T("%%IncludeResource: procset Adobe_pattern_AI3 1.0 1"));         pDC->OutputNewLine();
04651     pDC->OutputToken(_T("%%IncludeResource: procset Adobe_Illustrator_AI5 1.2 0"));     pDC->OutputNewLine();
04652     return TRUE;
04653 }

BOOL Document::AIExportResources EPSExportDC pDC,
BOOL  first
[protected]
 

Export an Illustrator standard needed resources.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/95
Parameters:
pDC - the dc to export to [INPUTS]
Returns:
TRUE

Definition at line 4608 of file document.cpp.

04609 {
04610     if (!first)
04611         pDC->OutputToken(_T("%%+"));
04612 
04613     // Graeme (28-3-00) - I've updated these to bring them in line with the procset
04614     // definitions from Fireworks 3 and CorelDraw 9. These have upgraded the file
04615     // to AI version 7.0, and should hopefully offer gradient fill support.
04616     pDC->OutputToken ( _T("procset Adobe_level2_AI5 1.2 0 ") );         pDC->OutputNewLine ();
04617     pDC->OutputToken ( _T("%%+ procset Adobe_packedarray 2.0 0") );     pDC->OutputNewLine ();
04618     pDC->OutputToken ( _T("%%+ procset Adobe_ColorImage_AI6 1.1 0") );  pDC->OutputNewLine ();
04619     pDC->OutputToken ( _T("%%+ procset Adobe_cshow 2.0 8") );           pDC->OutputNewLine ();
04620     pDC->OutputToken ( _T("%%+ procset Adobe_cmykcolor 1.1 0") );       pDC->OutputNewLine ();
04621     pDC->OutputToken ( _T("%%+ procset Adobe_customcolor 1.0 0") );     pDC->OutputNewLine ();
04622     pDC->OutputToken ( _T("%%+ procset Adobe_typography_AI5 1.0 1") );  pDC->OutputNewLine ();
04623     pDC->OutputToken ( _T("%%+ procset Adobe_pattern_AI3 1.0 1") );     pDC->OutputNewLine ();
04624     pDC->OutputToken ( _T("%%+ procset Adobe_Illustrator_AI5 1.2 0") ); pDC->OutputNewLine (); 
04625     return TRUE;
04626 }

BOOL Document::AIExportTrailer EPSExportDC pDC  )  [protected]
 

Export an Illustrator compatible trailer.

Author:<