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:
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 4823 of file document.cpp.

04824 {
04825     pDC->OutputToken(_T("Adobe_Illustrator_AI5 /terminate get exec"));  pDC->OutputNewLine();
04826     pDC->OutputToken(_T("Adobe_level2_AI5 /terminate get exec"));       pDC->OutputNewLine();
04827     pDC->OutputToken(_T("Adobe_packedarray /terminate get exec"));      pDC->OutputNewLine();
04828     pDC->OutputToken(_T("Adobe_ColorImage_AI6 /terminate get exec"));   pDC->OutputNewLine();
04829     pDC->OutputToken(_T("Adobe_cshow /terminate get exec"));            pDC->OutputNewLine();
04830     pDC->OutputToken(_T("Adobe_cmykcolor /terminate get exec"));        pDC->OutputNewLine();
04831     pDC->OutputToken(_T("Adobe_customcolor /terminate get exec"));      pDC->OutputNewLine();
04832     pDC->OutputToken(_T("Adobe_typography_AI5 /terminate get exec"));   pDC->OutputNewLine();
04833     pDC->OutputToken(_T("Adobe_pattern_AI3 /terminate get exec"));      pDC->OutputNewLine();
04834     return TRUE;
04835 }

Document::CC_DECLARE_DYNAMIC Document   )  [private]
 

BOOL Document::ConnectRalphDocument RalphDocument pDoc  )  [inline]
 

Definition at line 264 of file document.h.

00264 { pRalphDocument = pDoc; return TRUE; }

BOOL Document::CreateDragTargets DragInformation DragInfo  ) 
 

Calls all (OILY) views to create their drag targets.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/1/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
CCamDoc::SetModified

Definition at line 880 of file document.cpp.

00881 {
00882     if (IsNotAClipboard())
00883     {
00884         DocView * Ptr= (DocView*) DocViews.GetHead();
00885         CCamView* TheView;
00886 
00887         while(Ptr)
00888         {
00889             TheView = Ptr->GetConnectionToOilView();
00890             if(TheView)
00891                     TheView->CreateDragTarget(DragInfo);
00892             Ptr= (DocView*) DocViews.GetNext(Ptr);
00893         }
00894     }
00895     return TRUE;
00896 }

void Document::DecCurrentNodeCount  )  [static]
 

Decrements the node counter in the current Document, if there is one. Called by the destructor of class Node.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/11/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
Document::IncCurrentNodeCount; Document::NodesInDocument

Definition at line 2446 of file document.cpp.

02447 {
02448     if (Current) Current->NodesInTree--;
02449 }

void Document::DeleteContents  ) 
 

None. Nothing. Does not do anything. And don't even think about making it do anything!

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/3/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
CCamDoc::DeleteContents

Reimplemented from BaseDocument.

Definition at line 2469 of file document.cpp.

02470 {
02471     // This function does nothing because MFC calls it in a completely brain-damaged way.
02472     // It calls it when the document is about to be destroyed, and ALSO calls it just
02473     // after a new document has just been created. Fabby eh? Those boys from Redmond strike 
02474     // again!  (Tim)
02475 
02476     // DON'T make it do anything!
02477 }

BOOL Document::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.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/95
Returns:
TRUE if the Operation History was empied ok, FALSE if there is a problem

Definition at line 2211 of file document.cpp.

02212 {
02213     // If there was no Operation History in the first place, then there is a problem
02214     if (OpHistory==NULL)
02215         return FALSE;
02216 
02217     // Before we delete th history find out what its maximum size is
02218     UINT32 MaxSize = OpHistory->GetMaxSize();
02219 
02220     // There is an Operation History, so toast it
02221     delete OpHistory;
02222     OpHistory = NULL;
02223 
02224     // Now try and replace it with a new one
02225     OpHistory = new OperationHistory(MaxSize);
02226     
02227     // If we did not get the memory to create a new one, then fail
02228     if (OpHistory==NULL)
02229         return FALSE;
02230 
02231     // We now have a nice new empty operation history, so return happy
02232     return TRUE;
02233 }

void Document::EndOfEPSComment EPSFilter pFilter  )  [virtual]
 

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.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/08/94
Parameters:
pFilter - the EPS filter that is being used to import a file. [INPUTS]
See also:
Document::ProcessEPSComment; Document::WriteEPSProlog; Document::WriteEPSSetup; Document::WriteEPSComments; DocComponent; EPSFilter

Definition at line 3659 of file document.cpp.

03660 {
03661 }

void Document::EPSEndExport EPSFilter pFilter  )  [virtual]
 

Inform the document that an EPS export has just finished.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/08/94
Parameters:
pFilter - the EPS filter that is being used to import a file. [INPUTS]
See also:
DocComponent

Definition at line 2844 of file document.cpp.

02845 {
02846 }

void Document::EPSEndImport EPSFilter pFilter,
BOOL  Success
[virtual]
 

Inform the document that an EPS import has just finished.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/08/94
Parameters:
pFilter - the EPS filter that is being used to import a file. [INPUTS] Success - TRUE => The import was successful; FALSE => The import failed - abandon any changes.
See also:
DocComponent

Definition at line 2809 of file document.cpp.

02810 {
02811 }

BOOL Document::EPSStartExport EPSFilter pFilter  )  [virtual]
 

Inform the document that an EPS export is about to start.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/08/94
Returns:
TRUE if the document was able to prepare for exporting; FALSE if not (e.g. out of memory)
Parameters:
pFilter - the EPS filter that is being used to export a file. [INPUTS]
See also:
DocComponent

Definition at line 2827 of file document.cpp.

02828 {
02829     return TRUE;
02830 }

BOOL Document::EPSStartImport EPSFilter pFilter  )  [virtual]
 

Inform the document that an EPS import is about to start.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/08/94
Parameters:
pFilter - the EPS filter that is being used to import a file. [INPUTS]
Returns:
TRUE if the document was able to prepare for importing; FALSE if not (e.g. out of memory)
See also:
DocComponent

Definition at line 2790 of file document.cpp.

02791 {
02792     return TRUE;
02793 }

BOOL Document::ExportDateInfo EPSExportDC pDC  )  [protected]
 

exports a continuation comment that holds the Last Saved Date and the Creation Date. It takes the follwoing form :- %+d Version(0) CreationDate LastSavedDate

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

Definition at line 4467 of file document.cpp.

04468 {
04469     // A buffer
04470     TCHAR Buffer[256];
04471 
04472     // Set the last saved date to now
04473     SetLastSaveTime();
04474 
04475     // Find out what they are
04476     time_t Creation =  GetCreationTime();
04477     time_t LastSaved = GetLastSaveTime();
04478 
04479     // Make a string out of them
04480     camSprintf(Buffer, _T("%d %ld %ld"), 0, Creation, LastSaved);
04481 
04482     // Export them
04483     pDC->OutputToken(_T("%%+d"));
04484     pDC->OutputToken(Buffer);
04485     pDC->OutputNewLine();
04486     return TRUE;
04487 }

BOOL Document::ExportDefaultUnitsInfo EPSExportDC pDC  )  [protected]
 

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:-.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/9/95
Parameters:
pDC - The DC to export the Units to [INPUTS]
Returns:
TRUE
See also:
ExportUnitInfo;

Definition at line 4414 of file document.cpp.

04415 {
04416 #if !defined(EXCLUDE_FROM_RALPH)
04417     // If there is no valid DocUnit list in this document then give up
04418     if (pDocUnitList != NULL)
04419     {
04420         // A buffer
04421         TCHAR Buffer[256];
04422 
04423         // Now output the default units being used for page and fonts
04424         // We will save all this out as version 1 information, this is deemed to be all
04425         // the standard units info
04426         // Cannot use the units field as on earlier versions of Studio, before 1.00b,
04427         // it will be imported as a new user unit with the default settings.
04428         INT32 Version = 0;
04429 
04430         // Get the current default settings
04431         UnitType PageUnits   = pDocUnitList->GetPageUnits();    // The units used to display page measurements
04432         UnitType FontUnits   = pDocUnitList->GetFontUnits();    // The units to display font measurements
04433 
04434         // Find out the full names for these units
04435         String_32 PageUnitToken = pDocUnitList->GetToken(PageUnits);
04436         String_32 FontUnitToken = pDocUnitList->GetToken(FontUnits);
04437 
04438         // Build the Comment
04439         camSnprintf(Buffer, 256, _T("%d"), Version);
04440 
04441         // Export the font and pages units as a line of info
04442         pDC->OutputToken(_T("%%+U"));
04443         pDC->OutputToken(Buffer);
04444         pDC->OutputString(PageUnitToken);
04445         pDC->OutputString(FontUnitToken);
04446         pDC->OutputNewLine();
04447     }
04448 #endif
04449     return TRUE;
04450 }

BOOL Document::ExportDocumentComment EPSExportDC pDC  )  [protected]
 

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 ^.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
pDC - The DC to render to [INPUTS]
Returns:
TRUE

Definition at line 3843 of file document.cpp.

03844 {
03845 #if !defined(EXCLUDE_FROM_RALPH)
03846     // Save this out in 200 Char lines, using many continuation comments if needed
03847     String_256 Comment = GetComment();
03848     INT32 StrLength = Comment.Length();
03849     
03850     // Go though the string splitting it up as needed
03851     TCHAR OneLine[256];
03852     TCHAR Buffer[256];
03853     camStrcpy(Buffer, (TCHAR*)Comment);
03854 
03855     // vars to keep track of where we are
03856     INT32 Src = 0;
03857     INT32 Dest = 0;
03858     
03859     // Loop through the string they have entered and split it up into lines of text
03860     while (Src<StrLength)
03861     {
03862         // should we write this out (ie have we hit a new line)
03863         if ((Buffer[Src]=='\n') || (Buffer[Src]=='\r') || (Dest>100))
03864         {
03865             // deal with it being the CR.
03866             if ((Buffer[Src]=='\n') || (Buffer[Src]=='\r'))
03867             {
03868                 OneLine[Dest] = '^';
03869                 Dest++;
03870             }
03871 
03872             // Skim till we find something that is not a CR
03873             while ((Buffer[Src]=='\n') || (Buffer[Src]=='\r'))
03874                 Src++;
03875 
03876             // Output the line
03877             if (Dest>0)
03878             {
03879                 OneLine[Dest] = 0;
03880                 pDC->OutputToken(_T("%%+c"));
03881                 pDC->OutputToken(OneLine);
03882                 pDC->OutputNewLine();
03883                 Dest = 0;
03884             }
03885         }
03886 
03887         // Lets have this char
03888         OneLine[Dest] = Buffer[Src];
03889         Dest++;
03890         Src++;
03891     }
03892 
03893     // Output the last line
03894     if (Dest>0)
03895     {
03896         OneLine[Dest] = 0;
03897         pDC->OutputToken(_T("%%+c"));
03898         pDC->OutputToken(OneLine);
03899         pDC->OutputNewLine();
03900         Dest = 0;
03901     }
03902 #endif
03903     return TRUE;
03904 }

BOOL Document::ExportFlagInfo EPSExportDC pDC  )  [protected]
 

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
pDC - The DC to render to [INPUTS]
Returns:
-

Definition at line 4302 of file document.cpp.

04303 {
04304     return TRUE;
04305 }

BOOL Document::ExportGridInfo EPSExportDC pDC  )  [protected]
 

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
pDC - The DC to render to [INPUTS]
Returns:
-

Definition at line 4174 of file document.cpp.

04175 {
04176     // A buffer
04177     TCHAR Buffer[256];
04178 
04179     // Start off from the default spread
04180     // Find the first spread to get the page info from
04181     // Don't use the selected spread as it breaks save all
04182     // do don't do Spread* pSpread = GetSelectedSpread();
04183     Node *pANode = GetFirstNode()->FindNext()->FindFirstChild();
04184     while ((pANode != NULL) && (!pANode->IsKindOf(CC_RUNTIME_CLASS(Chapter))))
04185         pANode = pANode->FindNext();
04186         
04187     ERROR2IF(!pANode->IsKindOf(CC_RUNTIME_CLASS(Chapter)),
04188         FALSE, "Document::Export(something)(): Could not find Chapter");
04189 
04190     Chapter *pChapter = (Chapter *) pANode;
04191     
04192     // pSpread is a child of pChapter
04193     Spread *pSpread = (Spread *) pChapter->FindFirstChild();
04194     ERROR2IF(!pSpread->IsKindOf(CC_RUNTIME_CLASS(Spread)),
04195         FALSE, "Document::Export(something)(): Could not find Spread");
04196 
04197     if (pSpread!=NULL)
04198     {
04199         // Find the first child of the spread
04200         Node* pNode = pSpread->FindFirstChild();
04201         while (pNode!=NULL)
04202         {
04203             // For each of the child nodes of the spread, we will check to see if it is a Node Grid
04204             if (pNode->IS_KIND_OF(NodeGrid))
04205             {
04206                 // Get the Node Grid
04207                 NodeGrid* pGrid = (NodeGrid*) pNode;
04208 
04209                 // Only do this if this is the default Grid.
04210                 // That means that it is the full size grid that is toggled
04211                 // from the Show grid thing.
04212                 if (pGrid->IsDefault())
04213                 {
04214                     // This version of the grid saving info is zero
04215                     INT32 Version = 0;
04216                 
04217                     // Go and get the numbers out of the grid
04218                     // BODGE - old builds (hence docs) save the grid spacing in divisions and units but don't
04219                     // account for unit scaling, so as not to change doc format new docs do the same so we must
04220                     // read the grid 'Divisions' with scaling turned off - yuk!
04221                     BOOL Scale=FALSE;
04222                     double   Divisions    = pGrid->GetDivisions(Scale);
04223                     UnitType Unit         = pGrid->GetUnits(Scale);
04224                     UINT32     SubDivisions = pGrid->GetSubdivisions();
04225                     GridType TypeOfGrid   = pGrid->GetGridType();
04226 
04227                     // Build the Comment
04228                     camSprintf(Buffer, _T("%d %f %d %d %d"), Version, Divisions, SubDivisions, (INT32)Unit, (INT32)TypeOfGrid);
04229 
04230                     // Export it
04231                     pDC->OutputToken(_T("%%+g"));
04232                     pDC->OutputToken(Buffer);
04233                     pDC->OutputNewLine();
04234 
04235                     // once we have found a grid and saved it, then we want to stop.
04236                     // This version only saves the default grid.
04237                     return TRUE;
04238                 }
04239             }
04240 
04241             // Oh well, that node was not a grid, so lets see if the next one is
04242             pNode = pNode->FindNext();
04243         }
04244     }
04245 
04246     // Did not save a grid...
04247     return FALSE;
04248 }

BOOL Document::ExportOriginInfo EPSExportDC pDC  )  [protected]
 

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.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/10/95
Parameters:
pDC - The DC to render to [INPUTS]
Returns:
FALSE if fails

Definition at line 4263 of file document.cpp.

04264 {
04265     // find the first (and currently) only spread
04266 PORTNOTE("spread", "Multi-spread warning!")
04267     Spread* pSpread = FindFirstSpread();
04268     ERROR2IF(pSpread==NULL,FALSE,"Document::ExportOriginInfo() - could not find spread");
04269     NodeGrid* pDefaultGrid = pSpread->FindFirstDefaultGridInSpread();
04270     ERROR2IF(pDefaultGrid==NULL,FALSE,"Document::ExportOriginInfo() - could not find default grid");
04271 
04272     // read the grid (user) origin
04273     DocCoord Origin(0,0);
04274     pDefaultGrid->GetOrigin(&Origin.x, &Origin.y);
04275 
04276     // Build the Comment
04277     TCHAR Buffer[256];  // a buffer
04278     INT32 Version = 0;
04279     camSprintf(Buffer, _T("%d %d %d"), Version, Origin.x, Origin.y);
04280 
04281     // Export it
04282     pDC->OutputToken(_T("%%+o"));
04283     pDC->OutputToken(Buffer);
04284     pDC->OutputNewLine();
04285 
04286     return TRUE;
04287 }

BOOL Document::ExportPageInfo EPSExportDC pDC  )  [protected]
 

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).

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
pDC - The DC to render to [INPUTS]
Returns:
TRUE

Definition at line 3780 of file document.cpp.

03781 {
03782     // Find the first spread to get the page info from
03783     // Don't use the selected spread as it breaks save all
03784     // do don't do Spread* pSpread = GetSelectedSpread();
03785     Node *pANode = GetFirstNode()->FindNext()->FindFirstChild();
03786     while ((pANode != NULL) && (!pANode->IsKindOf(CC_RUNTIME_CLASS(Chapter))))
03787         pANode = pANode->FindNext();
03788         
03789     ERROR2IF(!pANode->IsKindOf(CC_RUNTIME_CLASS(Chapter)),
03790         FALSE, "Document::Export(something)(): Could not find Chapter");
03791 
03792     Chapter *pChapter = (Chapter *) pANode;
03793     
03794     // pSpread is a child of pChapter
03795     Spread *pSpread = (Spread *) pChapter->FindFirstChild();
03796     ERROR2IF(!pSpread->IsKindOf(CC_RUNTIME_CLASS(Spread)),
03797         FALSE, "Document::Export(something)(): Could not find Spread");
03798 
03799     // get something to put all the page info into
03800     TCHAR Buffer[256];
03801     MILLIPOINT Width, Height;
03802     MILLIPOINT Margin, Bleed;
03803     BOOL Dps, ShowDropShadow;
03804     INT32 Version = 0;
03805 
03806     // and go and get all the page info
03807     BOOL Worked = pSpread->GetPageSize(&Width, &Height, &Margin, &Bleed, &Dps, &ShowDropShadow);
03808 
03809     // If it worked, we had better try and output some info
03810     if (Worked)
03811     {
03812         // Build a string with all the data in it
03813         camSprintf(Buffer, _T("%d %d %d %d %d %d %d"), Version, (INT32)Width, (INT32)Height, (INT32)Margin, (INT32)Bleed, Dps, ShowDropShadow);
03814 
03815         // Output the line to the file
03816         pDC->OutputToken(_T("%%+p"));
03817         pDC->OutputToken(Buffer);
03818         pDC->OutputNewLine();
03819     }
03820 
03821     return TRUE;
03822 }

BOOL Document::ExportQualityInfo EPSExportDC pDC  )  [protected]
 

Part of the Document Info comment. It takes the following form :- %+q VersionNum(0) ViewQuality. ViewQuality is the numerical value of the view Quality.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
pDC - The DC to render to [INPUTS]
Returns:
TRUE
See also:
Quality

Definition at line 4133 of file document.cpp.

04134 {
04135     // A buffer
04136     TCHAR Buffer[256];
04137 
04138     // Find the view to get the info from
04139     // don't do DocView* pView = DocView::GetSelected(); as it breaks save all
04140     DocView* pView = GetFirstDocView(); 
04141     if (this==Document::GetSelected()) pView = DocView::GetSelected();
04142 
04143     if (pView!=NULL)
04144     {
04145         // Find out what the View Quality is...
04146         INT32 ViewQuality = pView->RenderQuality.GetQuality();
04147         INT32 Version = 0;
04148 
04149         // Build the Comment
04150         camSprintf(Buffer, _T("%d %d"), Version, ViewQuality);
04151 
04152         // Export it
04153         pDC->OutputToken(_T("%%+q"));
04154         pDC->OutputToken(Buffer);
04155         pDC->OutputNewLine();
04156     }
04157 
04158     return TRUE;
04159 }

BOOL Document::ExportRulerState EPSExportDC pDC  )  [protected]
 

Exports the View Settings continuation comment (part of the Document Info comment). It has the following form %+r VersionNum(0) ScrollersVisible RulersVisible.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
pDC - The DC to render to [INPUTS]
Returns:
TRUE

Definition at line 3921 of file document.cpp.

03922 {
03923     // A buffer
03924 
03925     // Find the view to get the info from
03926     // don't do DocView* pView = DocView::GetSelected(); as it breaks save all
03927     DocView* pView = GetFirstDocView(); 
03928     if (this==Document::GetSelected()) pView = DocView::GetSelected();
03929 
03930     if (pView!=NULL)
03931     {
03932         INT32 Version =0;
03933         // Export it
03934         pDC->OutputToken(_T("%%+r"));
03935         // buffer the version number,ruler and scroller state
03936         TCHAR Buffer[256];
03937         camSprintf(Buffer, _T("%d %ld %ld"), Version, pView->AreScrollersVisible(),pView->AreRulersVisible());
03938         pDC->OutputToken(Buffer);
03939         pDC->OutputNewLine();
03940     }
03941 
03942     return TRUE;
03943 }

BOOL Document::ExportStateInfo EPSExportDC pDC  )  [protected]
 

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.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
pDC - The DC to render to [INPUTS]
Returns:
TRUE

Definition at line 4050 of file document.cpp.

04051 {
04052     // A buffer
04053     TCHAR Buffer[512];
04054 
04055     // Find the view to get the info from
04056     // don't do DocView* pView = DocView::GetSelected(); as it breaks save all
04057     DocView* pView = GetFirstDocView(); 
04058     if (this==Document::GetSelected()) pView = DocView::GetSelected();
04059 
04060     if (pView!=NULL)
04061     {
04062         INT32 Version = 1;
04063 
04064         // Find all the State flags for version 0
04065         BOOL ShowGrid           = pView->GetShowGridState();
04066         BOOL SnapToGrid         = pView->GetSnapToGridState();
04067         BOOL SnapToMagObjects   = pView->GetSnapToMagObjectsState();
04068         BOOL SnapToObjects      = pView->GetSnapToObjectsState();
04069         BOOL ForeBackMode       = pView->GetForeBackMode();
04070 
04071         // Find all the State flags for version 1
04072         BOOL ShowGuides         = pView->GetShowGuidesState();
04073         BOOL SnapToGuides       = pView->GetSnapToGuidesState();
04074         BOOL Multilayer         = IsMultilayer();
04075         BOOL AllLayersVisible   = IsAllVisible();
04076 
04077         // Init the buffer with the version numbet
04078         camSprintf(Buffer,_T("%d "),Version);
04079 
04080         // Build the comment string
04081         switch (Version)
04082         {
04083             case 1:
04084                 // Write verison 1 flags (*Note* the space after the last '%d' - this is important)
04085                 camSprintf( Buffer + camStrlen( Buffer ), _T("%d %d %d %d "), ShowGuides, SnapToGuides, 
04086                     Multilayer, AllLayersVisible);
04087                 // Fall through for version 0 flags
04088 
04089             case 0:
04090                 // Note: There was a bug here - the format string had six %ds but
04091                 // only five parameters. There were only supposed to be five parameters
04092                 // so the sixth %d was a typo, not noticed by the compiler (or anyone
04093                 // who looked at the output and should have wondered what that random
04094                 // number was at the end of the line.
04095 
04096                 // In order to reduce the possibility of bugs, I'm instituting a dummy
04097                 // sixth parameter, and altering the code that reads it in.
04098 
04099                 camSprintf( Buffer + camStrlen( Buffer ), _T("%d %d %d %d %d %d"), ShowGrid, SnapToGrid, 
04100                     SnapToMagObjects, SnapToObjects, ForeBackMode, 0);
04101                 break;  // Stop here. Version 0 was the first
04102         
04103             default:
04104                 ERROR3_PF(("Dont know how to write this version for the state flags %d",Version));
04105                 break;
04106         }
04107 
04108         // Export it
04109         pDC->OutputToken(_T("%%+s"));
04110         pDC->OutputToken(Buffer);
04111         pDC->OutputNewLine();
04112     }
04113 
04114     return TRUE;
04115 }

BOOL Document::ExportTextSetup EPSFilter pFilter  )  [protected]
 

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/95
Parameters:
pFilter - the EPS filter that is being used to export a file. [INPUTS]
Returns:
TRUE if the text setup for this document was written out successfully; FALSE if not (e.g. out of disk space etc)

Definition at line 4502 of file document.cpp.

04503 {
04504     if ( (pFilter->IS_KIND_OF(CamelotNativeEPSFilter)) ||
04505          (pFilter->IS_KIND_OF(AIEPSFilter))
04506        )
04507     {
04508         // Output the colour table in ArtWorks format.
04509         EPSExportDC *pDC = pFilter->GetExportDC();
04510 
04511         String_64 FontName;
04512         String_64 EFont;
04513         INT32 Style;
04514         FontList CurFontList;
04515 
04516         if (!CurFontList.Build(this))
04517             return FALSE;
04518 
04519         FontListItem* pItem = CurFontList.GetFirstItem();
04520         while (pItem)
04521         {
04522             FontName = pItem->GetFontName();
04523             Style = pItem->GetFontStyle();
04524             // Graeme (31-3-00) - Map the encoded name onto the PS font name.
04525             FONTMANAGER->EncodeAndMapFontName(FontName, EFont, Style);
04526 
04527             // The Page List comment:
04528             pDC->OutputToken(_T("%%IncludeFont:"));
04529             pDC->OutputToken((TCHAR*)EFont);
04530             pDC->OutputNewLine();
04531         
04532             pItem = CurFontList.GetNextItem(pItem); 
04533         }
04534     }
04535 
04536     return TRUE;
04537 }

BOOL Document::ExportTextTrailer EPSFilter pFilter  )  [protected]
 

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/95
Parameters:
pFilter - the EPS filter that is being used to export a file. [INPUTS]
Returns:
TRUE if the text trailer for this document was written out successfully; FALSE if not (e.g. out of disk space etc)

Definition at line 4554 of file document.cpp.

04555 {
04556     return TRUE;
04557 }

BOOL Document::ExportUndoInfo EPSExportDC pDC  )  [protected]
 

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).

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/07/95
Parameters:
pDC - The DC to render to [INPUTS]
Returns:
TRUE

Definition at line 4576 of file document.cpp.

04577 {
04578     // Find the size of the operation history
04579     UINT32 Size = GetOpHistory().GetMaxSize();
04580 
04581     // get something to put the operation history size info into
04582     TCHAR Buffer[256];
04583     INT32 Version = 0;
04584 
04585     // Build a string with all the data in it
04586     camSprintf(Buffer, _T("%d %lu"), Version, Size);
04587 
04588     // Output the line to the file
04589     pDC->OutputToken(_T("%%+h"));
04590     pDC->OutputToken(Buffer);
04591     pDC->OutputNewLine();
04592     return TRUE;
04593 }

BOOL Document::ExportUnitInfo EPSExportDC pDC  )  [protected]
 

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:-.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/95
Parameters:
pDC - The DC to export the Units to [INPUTS]
Returns:
TRUE
See also:
ExportDefaultUnitsInfo;

Definition at line 4324 of file document.cpp.

04325 {
04326 #if !defined(EXCLUDE_FROM_RALPH)
04327     // A buffer
04328     #define EUI_BUFFER_SIZE 256
04329     TCHAR Buffer[EUI_BUFFER_SIZE];
04330 
04331     // If there is no valid DocUnit list in this document then give up
04332     if (pDocUnitList==NULL)
04333         return FALSE;
04334 
04335     // Find the first relevant unit in the list
04336     Unit* pUnit = (Unit*)pDocUnitList->GetHead();
04337 
04338     while (pUnit!=NULL)
04339     {
04340         // HACK: Export pixel units for compatibiility with old camelot. 
04341         // Really need version control
04342         // Although somewhat crypticly coded this is handled as PIXELS has a NOTYPE base unit
04343         if (pUnit->IsDefault() && (pUnit->GetUnitType() != PIXELS))
04344         {
04345             // Find the next unit in the list
04346             pUnit = (Unit*)pDocUnitList->GetNext(pUnit);
04347             continue;
04348         }
04349 
04350         // OK, we have a unit, so save out its info
04351         // Extract the values
04352         INT32 Version = 0;
04353         MILLIPOINT Size = (MILLIPOINT) pUnit->GetMillipoints();
04354         UnitType BaseUnit = pUnit->GetBaseUnitType();
04355         double Numerator;
04356         double Denominator;
04357         // default units can have NOTYPE so supply sensible values
04358         if (BaseUnit == NOTYPE)     
04359         {
04360             BaseUnit = MILLIPOINTS; // complains in previous camelots if NOTYPE used...
04361             Numerator = 0.0;        // set gibberish numerator so can be picked up in import
04362             Denominator = 1.2;      // use this for version number in which units first appeared
04363         }
04364         else
04365         {
04366             Numerator = pUnit->GetBaseNumerator();
04367             ERROR3IF(Numerator == 0.0, "Document::ExportUnitInfo() - Numerator == 0.0");
04368             Denominator = pUnit->GetBaseDenominator();
04369         }
04370         BOOL IsPrefix = pUnit->IsPrefix();
04371 
04372         String_32 UnitToken = pUnit->GetToken();
04373         String_32 UnitName = pUnit->GetSpecifier();
04374 
04375         // Build the Comment
04376         INT32 nBytes = camSnprintf(Buffer, EUI_BUFFER_SIZE, _T("%d %ld %d %f %f %d"), Version, Size, (INT32)BaseUnit, Numerator, Denominator, IsPrefix);
04377         if (nBytes > EUI_BUFFER_SIZE - 1)
04378         {
04379             ERROR3("Document::ExportUnitInfo - nBytes > EUI_BUFFER_SIZE - 1");
04380             return FALSE;
04381         }
04382         // Export it
04383         pDC->OutputToken(_T("%%+u"));
04384         pDC->OutputToken(Buffer);
04385         pDC->OutputString(UnitToken);
04386         pDC->OutputString(UnitName);
04387         pDC->OutputNewLine();
04388         // Find the next unit in the list
04389         pUnit = (Unit*)pDocUnitList->GetNext(pUnit);
04390     }
04391 
04392 #endif  
04393     return TRUE;
04394 }

BOOL Document::ExportViewInfo EPSExportDC pDC  )  [protected]
 

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.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
pDC - The DC to render to [INPUTS]
Returns:
TRUE

Definition at line 3966 of file document.cpp.

03967 {
03968     // A buffer
03969     TCHAR Buffer[256];
03970 
03971     // Find the view to get the info from
03972     // don't do DocView* pView = DocView::GetSelected(); as it breaks save all
03973     DocView* pView = GetFirstDocView(); 
03974     if (this==Document::GetSelected()) pView = DocView::GetSelected();
03975 
03976     if (pView!=NULL)
03977     {
03978         // Find out the Scroll Offsets and the Scale Factor
03979         WorkCoord ScrollOffsets = pView->GetScrollOffsets();
03980         INT32 XOffset = ScrollOffsets.x;
03981         INT32 YOffset = ScrollOffsets.y;
03982         double ScaleFactor = pView->GetViewScale().MakeDouble();
03983         INT32 Version = 1;
03984 
03985         // Find the spread that we are saving
03986         // Find the first spread to get the page info from
03987         // Don't use the selected spread as it breaks save all
03988         // do don't do Spread* pSpread = GetSelectedSpread();
03989         Node *pANode = GetFirstNode()->FindNext()->FindFirstChild();
03990         while ((pANode != NULL) && (!pANode->IsKindOf(CC_RUNTIME_CLASS(Chapter))))
03991             pANode = pANode->FindNext();
03992         
03993         ERROR2IF(!pANode->IsKindOf(CC_RUNTIME_CLASS(Chapter)),
03994             FALSE, "Document::Export(something)(): Could not find Chapter");
03995 
03996         Chapter *pChapter = (Chapter *) pANode;
03997     
03998         // pSpread is a child of pChapter
03999         Spread *pSpread = (Spread *) pChapter->FindFirstChild();
04000         ERROR2IF(!pSpread->IsKindOf(CC_RUNTIME_CLASS(Spread)),
04001             FALSE, "Document::Export(something)(): Could not find Spread");
04002 
04003         if (pSpread != NULL)
04004         {
04005             DimScale* pDimScale = pSpread->GetPtrDimScale();
04006             if (pDimScale != NULL)
04007             {
04008                 // Find out if it is active
04009                 BOOL Active = pDimScale->IsActive();
04010 
04011                 // Find out about the scale factor strings
04012                 String_32 DrawingScale = pDimScale->GetDrawingScaleStr();
04013                 String_32 RealScale = pDimScale->GetRealScaleStr();
04014 
04015                 // Build the comment for the scroll offsets etc
04016                 camSprintf(Buffer, _T("%d %d %d %d %d"), Version, XOffset, YOffset, (INT32)(ScaleFactor*1000), Active);
04017 
04018                 // Export it
04019                 pDC->OutputToken(_T("%%+v"));
04020                 pDC->OutputToken(Buffer);
04021                 pDC->OutputString(DrawingScale);
04022                 pDC->OutputString(RealScale);
04023                 pDC->OutputNewLine();
04024             }
04025         }
04026     }
04027 
04028     return TRUE;
04029 }

Spread * Document::FindFirstSpread  ) 
 

Finds the first spread in this document.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The first spread in this document. A document always has at least one spread

Errors: -

See also:
-

Definition at line 2068 of file document.cpp.

02069 {
02070     Node* pNode = GetFirstNode();
02071     ERROR3IF(pNode == NULL,"Document::FindFirstSpread No first node!");
02072     if (pNode == NULL)
02073         return NULL;
02074 
02075     pNode = pNode->FindNext();
02076     if (pNode != NULL)
02077     {
02078         ERROR3IF(pNode->GetRuntimeClass() != CC_RUNTIME_CLASS(NodeDocument),"Next node is not a NodeDocument");
02079         pNode = pNode->FindFirstChild();
02080         if (pNode != NULL)
02081         {
02082             if (pNode->GetRuntimeClass() != CC_RUNTIME_CLASS(Chapter))
02083                 pNode = pNode->FindNext(CC_RUNTIME_CLASS(Chapter));
02084             if (pNode != NULL)
02085             {
02086                 pNode = pNode->FindFirstChild();
02087                 if (pNode != NULL)
02088                 {
02089                     if (pNode->GetRuntimeClass() != CC_RUNTIME_CLASS(Spread))
02090                         pNode = pNode->FindNext(CC_RUNTIME_CLASS(Spread));
02091 
02092                     ERROR3IF(pNode == NULL,"Can't find a spread as a child of Chapter");
02093                 }
02094                 else
02095                     ERROR3("No child of Chapter node");
02096             }
02097             else
02098                 ERROR3("Can't find a chapter as a child of NodeDocument");
02099         }
02100         else
02101             ERROR3("No child of NodeDocument node");
02102     }
02103     else
02104         ERROR3("No next node!");
02105 
02106     return ((Spread*)pNode);
02107 }

void Document::FlushRedraw  ) 
 

Calls DocView::FlushRedraw() for each DocView attached to this Document.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/12/94
See also:
DocView::FlushRedraw

Definition at line 2590 of file document.cpp.

02591 {
02592     ListItem* pItem = DocViews.GetHead();
02593     while (pItem != NULL)
02594     {
02595         ((DocView*) pItem)->FlushRedraw();
02596         pItem = DocViews.GetNext(pItem);
02597     }
02598 }

void Document::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.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/94
Parameters:
A pointer to a spread and the area within that spread to redraw. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DocView::ForceRedraw

Definition at line 2561 of file document.cpp.

02562 {
02563     // If the caller has told us about a node that has become invalid (probably causing this redraw)
02564     // Then make sure it doesn't hold on to any cached rendering before we force the redraw
02565     if (pInvalidNode && bAutoRelease)
02566     {
02567         if (pInvalidNode->IsAnObject()) ((NodeRenderableInk*)pInvalidNode)->ReleaseCached(TRUE, TRUE);
02568     }
02569 
02570     ListItem* pItem = DocViews.GetHead();
02571     while (pItem != NULL)
02572     {
02573         ((DocView*) pItem)->ForceRedraw(pSpread, spreadRect, Accumulate, pInvalidNode);
02574         pItem = DocViews.GetNext(pItem);
02575     }
02576 }

void Document::ForceRedraw WorkRect forceRect  ) 
 

Calls DocView::ForceRedraw(WorkRect&) for each DocView attached to this Document.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/94
Parameters:
A WorkRect bounding the area to be redrawn [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DocView::ForceRedraw

Definition at line 2535 of file document.cpp.

02536 {
02537     ListItem* pItem = DocViews.GetHead();
02538     while (pItem != NULL)
02539     {
02540         ((DocView*) pItem)->ForceRedraw(forceRect);
02541         pItem = DocViews.GetNext(pItem);
02542     }
02543 }

void Document::ForceRedraw FRDocViewFunc  pFunc = 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.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/94
Parameters:
pFunc = ptr to func to equire whether a particular DocView should be redrawn [INPUTS]
See also:
DocView::ForceRedraw

Definition at line 2496 of file document.cpp.

02497 {
02498     ListItem* pItem = DocViews.GetHead();
02499     while (pItem != NULL)
02500     {
02501         BOOL ok = TRUE;
02502         DocView* pDocView = (DocView*)pItem;
02503 
02504         if (pFunc != NULL)
02505             ok = pFunc(pDocView);
02506 
02507         if (ok)
02508         {
02509             // Pass TRUE to DocView::ForceRedraw() so that we force an immediate update of
02510             // the paper, because this function is used when something pretty fundamental has
02511             // changed in the document, quite often related to spreads/pages etc.
02512             ((DocView*) pItem)->ForceRedraw(TRUE);
02513         }
02514 
02515         pItem = DocViews.GetNext(pItem);
02516     }
02517 }

AttributeManager & Document::GetAttributeMgr  )  const
 

For finding the documents operation history.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/7/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A reference to the documents operation history

Errors: -

See also:
-

Definition at line 2252 of file document.cpp.

02253 {
02254     ENSURE(AttributeMgr != NULL,
02255                 "Pointer to Attribute Manager is NULL in Document::GetAttributeMgr()");
02256     return (*AttributeMgr); 
02257 }

BitmapList * Document::GetBitmapList  ) 
 

Gets the bitmap list from this documents doc component.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/8/96
Returns:
Returns this document's bitmap list

Definition at line 6004 of file document.cpp.

06005 {
06006     // Find this documents BitmapListComponent
06007     DocComponent* DocBitmapList = 
06008             GetDocComponent(CC_RUNTIME_CLASS(BitmapListComponent));
06009 
06010     ERROR2IF(DocBitmapList == NULL, FALSE, "Couldn't find document bitmap list");
06011     if (DocBitmapList == NULL)
06012         return NULL;
06013 
06014     // Now get the actual bitmap list
06015     return ((BitmapListComponent*)DocBitmapList)->GetBitmapList();
06016 }

BOOL Document::GetBitmapSmoothing  )  [inline]
 

Definition at line 544 of file document.h.

00544 { return (m_bSmoothBitmaps); }

MILLIPOINT Document::GetBleedOffset  )  const
 

For getting the Document's bleed area size.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The current size in millipoints of this Document's bleed area.

Errors: -

See also:
SetBleedOffset();

Definition at line 3734 of file document.cpp.

03735 {
03736     return BleedOffset;
03737 } 

const String_256 & Document::GetComment  )  const
 

Getting the time the document was created.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/3/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A reference to the (constant) producer's name of this document.

Errors: -

See also:
Document::GetTitle; Document::GetProducer

Definition at line 1028 of file document.cpp.

01029 {
01030     return Comment;
01031 }

const time_t & Document::GetCreationTime  )  const
 

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/08/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A reference to the time of the document's creation.

Errors: -

See also:
Document::GetLastSaveTime

Definition at line 1068 of file document.cpp.

01069 {
01070     return CreationTime;
01071 }

UINT32 Document::GetCreatorSerialNo  ) 
 

Document * Document::GetCurrent  )  [static]
 

Find the current Document object.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/5/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Pointer to the current Document object.

Errors: None.

Definition at line 1438 of file document.cpp.

01439 {
01440 #ifdef RALPH
01441 
01442     if(::GetCurrentThreadId() == RalphDocument::GetImportingThreadID())
01443     {
01444         //TRACEUSER( "Richard", _T("+++++ GetCurrent called from Load Thread\n"));
01445         return RalphDocument::GetImportingDoc();
01446     }
01447 #endif
01448     //TRACEUSER( "Richard", _T(">>> Document::GetCurrent returning Current\n"));
01449     return Current;
01450 }

NodeAttribute * Document::GetDefaultAttr 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.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/10/93
Parameters:
RequiredAttr - the type of attribute to look for. [INPUTS]
Returns:
Pointer to the default attribute node, or NULL if the attribute was not found.
AttrLineWidth *pAttr = pDoc->GetDefaultAttr(CC_RUNTIME_CLASS(AttrLineWidth)); MonoOff

Definition at line 2360 of file document.cpp.

02361 {
02362     // Search for line width attribute as a child of the NodeDocument.
02363     Node *pNode = TreeStart->FindNext();
02364     
02365     if (pNode == NULL)
02366     {
02367         // Error in document tree
02368         return NULL;
02369     }
02370     
02371     if (!pNode->IsKindOf(CC_RUNTIME_CLASS(NodeDocument)))
02372     {
02373         // Error in document tree
02374         return NULL;
02375     }
02376     
02377     // Find the attribute in question
02378     for (pNode = pNode->FindFirstChild();
02379          pNode != NULL;
02380          pNode = pNode->FindNext())
02381     {
02382         if (pNode->IsKindOf(RequiredAttr))
02383             return (NodeAttribute *) pNode;
02384     }
02385     
02386     // Required attribute was not found - just return NULL
02387     return NULL;
02388 }

UnitType Document::GetDocFontUnits  ) 
 

return Font Units for this document default to COMP_POINTS if no unit list available

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/5/95
Returns:
Returns Font UnitType for this document

Definition at line 5984 of file document.cpp.

05985 {   
05986     if(pDocUnitList)
05987         return pDocUnitList->GetFontUnits();
05988     else
05989         return COMP_POINTS;
05990 }

String_256 Document::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)'.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/3/95
Parameters:
IncludeFileType - TRUE if the filetype is required. Defaults to TRUE. [INPUTS]
Returns:
A String_256 that holds the document name
See also:
Document::GetTitle(); CCamDoc::GetKernelTitle(); CCamDoc::GetKernelDocName();

Document::GetProducer; Document::GetComment;

Definition at line 939 of file document.cpp.

00940 {
00941     if (OilDoc)
00942         return OilDoc->GetKernelDocName(IncludeFileType);
00943 
00944     return(ClipboardNameText);
00945 }   

UINT32 Document::GetDocNudge  )  [inline]
 

Definition at line 541 of file document.h.

00541 { return (m_docNudge); }

DocUnitList* Document::GetDocUnitList  )  [inline]
 

Definition at line 527 of file document.h.

00527 { return pDocUnitList; }

DocCoord Document::GetDuplicationOffset  )  [inline]
 

Definition at line 547 of file document.h.

00547 { return (m_DuplicationOffset); }

void Document::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.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/5/93
Parameters:
pView - the View to pixelise the extents to. [INPUTS]
Lo,Hi - the extents of the document. [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2128 of file document.cpp.

02129 {
02130     NodeDocument* DocNode = (NodeDocument*) TreeStart->FindNext();
02131     
02132     // Just to be on the safe side
02133     ENSURE(DocNode->IsKindOf(CC_RUNTIME_CLASS(NodeDocument)),
02134                     "Document.cpp: This node is not a NodeDocument");
02135     
02136     *Lo = DocNode->LoExtent();
02137     *Hi = DocNode->HiExtent();
02138     *Extent = DocNode->GetPasteboardRect(TRUE, pView);
02139 }

DocView* Document::GetFirstDocView  )  const [inline]
 

Definition at line 428 of file document.h.

00429                 { return (DocView*) DocViews.GetHead(); }

InsertionNode * Document::GetInsertionPosition  ) 
 

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.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/7/94
Returns:
The Insertion position. This will be the InsertionNode (Insert as a Previous child of this)
See also:
UndoableOperation::DoInsertNewNode

Definition at line 2644 of file document.cpp.

02645 {
02646     // Is the Insertion node in the corrrect spread ?
02647     Spread* SelSpread = Document::GetSelectedSpread();
02648     ENSURE(SelSpread != NULL, "The selected spread is NULL");
02649     
02650     // I think it's ok to search for the active layer here cos there is not likely
02651     // to be zillions of layers.
02652     Layer* SelActiveLyr = SelSpread->FindActiveLayer(); 
02653     ENSURE(SelActiveLyr != NULL, "Could not find active layer on selected spread"); 
02654     
02655     Node* InsertLyr = NULL;  // The layer containing the InsertionNode. If one
02656                              // exists. See the InsertionNode's destructor.
02657     if (InsertPos)
02658     {
02659         ERROR3IF(InsertPos->FindNext(), "InsertionNode is not the last node on a layer"); 
02660         InsertLyr = InsertPos->FindParent();
02661         // In a retail if the InsertPos' parent is NULL then we will survive this
02662         ERROR3IF(!InsertLyr, "The Insertion node's parent has been deleted"); 
02663         // If the parent of the Insertion node is not a Layer then there is probably
02664         // cause for concern. Not very likely this.
02665         ENSURE(InsertLyr->GetRuntimeClass() == CC_RUNTIME_CLASS(Layer), "Parent of insertion node is not a layer");
02666     }
02667     else
02668     {
02669         // Weve lost our Insertion Node. Create a new one
02670         InsertPos = new InsertionNode(this);
02671         if (!InsertPos)
02672         {
02673             return NULL; // Not v. likely
02674         }
02675     }
02676 
02677     if (SelActiveLyr != ((Layer*)InsertLyr))
02678     {
02679         // The InsertionNode should be moved
02680         // this is the slow bit, but it will only happen when the selected spread 
02681         // changes.
02682         InsertPos->MoveNode(SelActiveLyr, LASTCHILD);   
02683     }
02684     // otherwise the InsertPos is in the correct position
02685     return InsertPos;
02686 } 

const time_t & Document::GetLastSaveTime  )  const
 

Getting the time the document was last saved.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/08/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A reference to the time of the document's creation. Will be 0 if the document is unsaved.

Errors: -

See also:
Document::GetCreationTime

Definition at line 1089 of file document.cpp.

01090 {
01091     return LastSaveTime;
01092 }

UINT32 Document::GetLastSerialNo  ) 
 

String_256 Document::GetLocation UINT32  MaxSize = 0  )  const
 

Returns the location of the document, which is the pathname with no filename.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/3/95
Parameters:
MaxSize - This is the size we have to fit the pathname into. [INPUTS] Defaults to zero , meaning all off the pathname.
Returns:
A String_256 that holds the location for the document.
See also:
CCamDoc::GetKernelLocation; PathName::GetTruncatedLocation;

Document::GetPathName; CCamDoc::GetKernelPathName;

Definition at line 986 of file document.cpp.

00987 {
00988     if (OilDoc)
00989         return OilDoc->GetKernelLocation(MaxSize);
00990 
00991     return(ClipboardNameText);
00992 }

DocView * Document::GetNewDocView  ) 
 

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.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/5/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: None.

Definition at line 1283 of file document.cpp.

01284 {
01285     // Is there a spare view knocking about?
01286     DocView *pDocView = GetSpareDocView();
01287     
01288     if (pDocView != NULL)
01289         // Yes - so return it.
01290         return pDocView;
01291 
01292     if (IsAClipboard())
01293     {
01294         TRACEUSER( "Jason",_T("\n\nXX Attempting to add a DocView to a clipboard!\n") );
01295     }
01296     else
01297     {
01298         // No views spare - create a new one connected to this document...
01299         pDocView = new DocView(this);
01300     
01301         if (pDocView != NULL)
01302         {
01303             if (pDocView->Init())
01304                 DocViews.AddTail(pDocView);     // link it into the DocView list ...
01305             else
01306             {
01307                 delete pDocView;
01308                 pDocView=NULL;
01309             }
01310         }
01311 
01312         // Make it the current DocView
01313         pDocView->SetCurrent();
01314     }
01315 
01316     // ...and return this new view to the caller.       
01317     return pDocView;
01318 }

DocView* Document::GetNextDocView const DocView pView  )  const [inline]
 

Definition at line 431 of file document.h.

00432                 { return (DocView*) DocViews.GetNext((const ListItem*) pView); }

INT32 Document::GetNumLayers  ) 
 

Counts the layers in this document.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/7/97
Returns:
-
This function assumes there is only one spread in the document, so it will fail if we ever implement multiple spread documents (chuckle).

Definition at line 6058 of file document.cpp.

06059 {
06060     //Find the first spread in the document
06061 PORTNOTE("spread", "Multi-spread warning!")
06062     Spread* pSpread = FindFirstSpread();
06063 
06064     //Now find the first layer in that spread
06065     Layer* pLayer = NULL;
06066     if (pSpread != NULL)
06067         pLayer = pSpread->FindFirstLayer();
06068 
06069     //And count the layers
06070     INT32 iCount = 0;
06071 
06072     while (pLayer != NULL)
06073     {
06074         iCount++;
06075         pLayer=pLayer->FindNextLayer();
06076     }
06077 
06078     return iCount;
06079 }

CCamDoc * Document::GetOilDoc  )  const
 

Find the Oil document associated with the Document.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/5/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
NULL or a pointer to the CCamDoc object associated with this object.
Notes: IMPORTANT: Clipboard Documents may NOT have an attached OilDoc -> will return NULL

Returns:
Errors: None.

Definition at line 1414 of file document.cpp.

01415 {
01416     return OilDoc;
01417 }

OperationHistory & Document::GetOpHistory  ) 
 

For finding the documents operation history.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/7/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A reference to the documents operation history

Errors: -

See also:
-

Definition at line 2190 of file document.cpp.

02191 {
02192     return (*OpHistory);
02193 }

String_256 Document::GetPathName UINT32  MaxSize = 0  )  const
 

Returns the pathname of the document.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/3/95
Parameters:
MaxSize - This is the size we have to fit the pathname into. [INPUTS] Defaults to zero , meaning all off the pathname.
Returns:
A String_256 that holds the pathname for the document.
See also:
CCamDoc::GetKernelPathName; PathName::GetTruncatedPathName;

Document::GetLocation; CCamDoc::GetTruncatedLocation;

Definition at line 963 of file document.cpp.

00964 {
00965     if (OilDoc)
00966         return OilDoc->GetKernelPathName(MaxSize);
00967 
00968     return(ClipboardNameText);
00969 }

const String_256 & Document::GetProducer  )  const
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/3/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A reference to the (constant) producer's name of this document.

Errors: -

See also:
Document::GetTitle; Document::GetComment

Definition at line 1008 of file document.cpp.

01009 {
01010     return Producer;
01011 }

RalphDocument* Document::GetRalphDoc  )  [inline]
 

Definition at line 260 of file document.h.

00260 { return pRalphDocument; }

ViewMode Document::GetRalphViewMode  )  [inline]
 

Definition at line 274 of file document.h.

00274 {return Viewmode;};

static BOOL Document::GetRestoreViewOnImport  )  [inline, static]
 

Definition at line 581 of file document.h.

00581 { return fRestoreViewOnImport; }

SafeRenderPointer & Document::GetSafeRenderPointer  ) 
 

Returns a reference to the document's 'Safe render pointer'.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/9/96

Definition at line 6129 of file document.cpp.

06130 {
06131     return TheSafeRenderPointer;
06132 }

Document * Document::GetSelected  )  [static]
 

Find the selected Document object.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/5/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Pointer to the selected Document object.

Errors: None.

Definition at line 1471 of file document.cpp.

01472 {
01473 #ifdef RALPH
01474     // if we are being called from the load thread return the current load thread document
01475     if(::GetCurrentThreadId() == RalphDocument::GetImportingThreadID())
01476     {
01477         //TRACEUSER( "Richard", _T("+++++ GetSelected called from Load Thread\n"));
01478         return RalphDocument::GetImportingDoc();
01479     }
01480 #endif
01481     //TRACEUSER( "Richard", _T(">>> Document::GetSelected returning Selected\n"));
01482     return Selected;
01483 }

Spread * Document::GetSelectedSpread  )  [static]
 

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.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The selected spread in the system

Errors: -

See also:
-

Definition at line 1993 of file document.cpp.

01994 {
01995 #ifdef RALPH
01996     // if we are being called from the load thread return the first spread in the current load
01997     // thread document
01998     if(::GetCurrentThreadId() == RalphDocument::GetImportingThreadID())
01999     {
02000         //TRACEUSER( "Richard", _T("+++++ GetSelectedSpread called from Load Thread\n"));
02001         return RalphDocument::GetImportingDoc()->FindFirstSpread();
02002     }
02003 #endif
02004     //TRACEUSER( "Richard", _T(">>> Document::GetSelectedSpread returning pGlobalSelSpread\n"));
02005     return (pGlobalSelSpread);
02006 }

NodeSetSentinel * Document::GetSetSentinel  )  const
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/11/93
Returns:
A (cached) pointer to the document's NodeSetSentinel node.
See also:
NameGallery; NodeSetSentinel; Document::InitTree

Definition at line 2399 of file document.cpp.

02400 {
02401     ERROR3IF(m_pSetSentinel == 0, "Document::GetSetSentinel: no NodeSetSentinel");
02402     return m_pSetSentinel;
02403 }

INT32 Document::GetSizeOfExport Filter  )  [virtual]
 

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.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/01/95
Parameters:
pFilter - the export filter that will be used. [INPUTS]
Returns:
An approximation of the size of data that will be exported by this document, in terms of nodes. (see NodeRenderable::GetSizeOfExport).
See also:
Node::NeedsToExport; Node::ExportRender; NodeRenderable::GetSizeOfExport

Definition at line 3679 of file document.cpp.

03680 {
03681     // Default value is one node...
03682     return 1;
03683 }

DocView * Document::GetSpareDocView  ) 
 

Looks for a DocView with no attached OilView, so we can recycle it.

DocView *DocumentGetSpareDocView()

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/5/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
NULL, or a spare DocView

Errors: None.

Definition at line 1243 of file document.cpp.

01244 {
01245     if (IsNotAClipboard())
01246     {
01247         DocView *View = (DocView *) DocViews.GetHead();
01248     
01249         while (View != NULL)
01250         {
01251             CCamView *pCamView = View->GetConnectionToOilView();
01252             if (pCamView == NULL) return View;
01253             View = (DocView *) DocViews.GetNext(View);
01254         }
01255     }
01256 
01257     return NULL;        // No free views found
01258 }

String_256 Document::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)'.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/3/94
Returns:
A String_256 that holds the document title
See also:
Document::GetProducer; Document::GetComment; CCamDoc::GetKernelTitle

Definition at line 914 of file document.cpp.

00915 {
00916     if (OilDoc)
00917         return OilDoc->GetKernelTitle();
00918 
00919     return(ClipboardNameText);
00920 }

DocView * Document::GetTopmostView  )  const
 

Finds out which of this Document's DocViews is 'selected'.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/10/96
Returns:
A pointer to the DocView of this Document that is top-most in the Z-order window list. It's the view onto this document that was last worked in by the user. Returns NULL if this document has no visible views.
See also:
CCamDoc::SetPageSize

Definition at line 3697 of file document.cpp.

03698 {
03699     // Search through all the views onto this document.
03700     DocView* pvTop = 0;
03701     INT32 zTop = -1;
03702     for (DocView* pv = GetFirstDocView(); pv; pv = GetNextDocView(pv))
03703     {
03704         // Is this view above our current highest?
03705         if (pv->pVState && pv->pVState->zPos > zTop)
03706         {
03707             // It is, so remember it as the new highest.
03708             zTop = pv->pVState->zPos;
03709             pvTop = pv;
03710         }
03711     }
03712 
03713     // Return the highest, if any.
03714     return pvTop;
03715 }

void Document::HandleNodeDeletion Node pNode  ) 
 

Calls DocView::ForceRedraw(WorkRect&) for each DocView attached to this Document.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/94
Parameters:
A WorkRect bounding the area to be redrawn [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DocView::ForceRedraw

Definition at line 2616 of file document.cpp.

02617 {
02618     ListItem* pItem = DocViews.GetHead();
02619     while (pItem != NULL)
02620     {
02621         ((DocView*) pItem)->HandleNodeDeletion(pNode);
02622 
02623         pItem = DocViews.GetNext(pItem);
02624     }
02625 }

ProcessEPSResult Document::ImportDateInfo TCHAR Comment  )  [protected]
 

Reads in the Last saved Date and Creation Date from the file.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/95
Parameters:
Comment - The Comment that we have to process [INPUTS]
Returns:
EPSCommentOK

Definition at line 5773 of file document.cpp.

05774 {
05775 #if !defined(EXCLUDE_FROM_RALPH)
05776     // The version of the state info and the read position in the string
05777     INT32 Version = -1;
05778     INT32 i = 4;
05779 
05780     // Read in the Version Number
05781     if (!ReadNextNumber(&Version, Comment, &i))
05782         return EPSCommentSyntaxError;
05783 
05784     // Act on the version number
05785     switch (Version)
05786     {
05787         case 0 :
05788         {
05789             INT32 Creation, LastSaved;
05790 
05791             // Read in the Creation Date
05792             if (!ReadNextNumber(&Creation, Comment, &i))
05793                 return EPSCommentSyntaxError;
05794 
05795             // Read in the Last Saved Date
05796             if (!ReadNextNumber(&LastSaved, Comment, &i))
05797                 return EPSCommentSyntaxError;
05798 
05799             // Set the vars in the document
05800             CreationTime = (time_t)Creation;
05801             LastSaveTime = (time_t)LastSaved;
05802             break;
05803         }
05804 
05805         default:
05806         {
05807             break;
05808         }
05809     }
05810 #endif
05811 
05812     return EPSCommentOK;
05813 }

ProcessEPSResult Document::ImportDefaultUnitsInfo TCHAR Comment  )  [protected]
 

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..

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/9/95
Parameters:
Comment - The comment line to process [INPUTS]
Returns:
EPSCommentSyntaxError if there was a systax error in the comment EPSCommentOK if the comment was processed ok

Definition at line 5701 of file document.cpp.

05702 {
05703 // In viewer leave these alone as not useful
05704 #ifndef STANDALONE
05705 
05706     // If there is no valid DocUnit list in this document then give up
05707     ERROR3IF(pDocUnitList==NULL,"Document::ImportDefaultUnitsInfo null pDocUnitList");
05708     if (pDocUnitList==NULL)
05709         return EPSCommentOK;
05710 
05711     // Set up some variables.
05712     // The version of the state info and the read position in the string
05713     INT32 Version = -1;
05714     INT32 i = 4;
05715 
05716     // Read in the Version Number
05717     if (!ReadNextNumber(&Version, Comment, &i))
05718         return EPSCommentSyntaxError;
05719 
05720     // Act on the version number
05721     switch (Version)
05722     {
05723         case 0 :
05724         {
05725             // Read in the string values which define the units to use
05726             // First the page units, the units used to display page measurements
05727             String_64 PageUnitsStr;
05728             if (!ReadNextString(&PageUnitsStr, 32, Comment, &i))
05729                 return EPSCommentSyntaxError;
05730 
05731             // Then the font units, the units to display font measurements
05732             String_64 FontUnitsStr;
05733             if (!ReadNextString(&FontUnitsStr, 32, Comment, &i))
05734                 return EPSCommentSyntaxError;
05735 
05736             // Find the unit in the list, if present, otherwise will return NOTYPE
05737             UnitType PageUnits   = pDocUnitList->FindUnitTypeFromToken(PageUnitsStr);
05738             UnitType FontUnits   = pDocUnitList->FindUnitTypeFromToken(FontUnitsStr);   
05739 
05740             // Set the new current default settings, if valid units were found
05741             if (PageUnits != NOTYPE)
05742                 pDocUnitList->SetPageUnits(PageUnits);
05743             if (FontUnits!= NOTYPE)
05744                 pDocUnitList->SetFontUnits(FontUnits);
05745 
05746             break;
05747         }
05748 
05749         default:
05750         {
05751             // Do nothing with unknown versions as this means info we know nothing about.
05752             // Do not error though as this might be bad.
05753             break;
05754         }
05755     }
05756 #endif
05757 
05758     return EPSCommentOK;
05759 }

ProcessEPSResult Document::ImportDocumentComment TCHAR Comment  )  [protected]
 

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
Comment - The EPS comment that we have to process [INPUTS]
Returns:
ProcessEPSResult - the result of the import - see ProcessEPSComment()

Definition at line 4945 of file document.cpp.

04946 {
04947     // Check that this comment line ended in a CR
04948     size_t  StrLength = camStrlen( Comment );
04949     
04950     // If the string was too long, then mark it as an error
04951     if (StrLength>=254)
04952         return EPSCommentSyntaxError;
04953 
04954     // check to see if this line should have a CR in it
04955     if (Comment[StrLength-1]==_T('^'))
04956     {
04957         Comment[StrLength-1] = _T('\r');
04958         Comment[StrLength] = _T('\n');
04959         Comment[StrLength+1] = 0;
04960     }
04961 
04962     // append this line to the document comment
04963     String_256          DocComment( GetComment() );
04964     String_256          NewComment( Comment + 5 );
04965     DocComment += NewComment;
04966     
04967     // Set the comment back into the document and say that all went well
04968     SetComment(&DocComment);
04969 
04970     return EPSCommentOK;
04971 }

ProcessEPSResult Document::ImportFlagInfo TCHAR Comment  )  [protected]
 

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
Comment - The EPS comment that we have to process [INPUTS]
Returns:
ProcessEPSResult - the result of the import - see ProcessEPSComment()

Definition at line 5568 of file document.cpp.

05569 {
05570     return EPSCommentOK;
05571 }

ProcessEPSResult Document::ImportGridInfo TCHAR Comment  )  [protected]
 

Imports the global grid that covers the whole spread.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
Comment - The EPS comment that we have to process [INPUTS]
Returns:
ProcessEPSResult - the result of the import - see ProcessEPSComment()

Definition at line 5310 of file document.cpp.

05311 {
05312 #if !defined(EXCLUDE_FROM_RALPH)
05313     // The version of the state info and the read position in the string
05314     INT32 Version = -1;
05315     INT32 i = 4;
05316 
05317     // Read in the Version Number
05318     if (!ReadNextNumber(&Version, Comment, &i))
05319         return EPSCommentSyntaxError;
05320 
05321     // Act on the version number
05322     switch (Version)
05323     {
05324         case 0 :
05325         {
05326             double Divisions;
05327             INT32 SubDiv, Units, Type;
05328             UINT32 SubDivisions;
05329             UnitType Unit;
05330             GridType TypeOfGrid;
05331             
05332             // Read in the Divisions
05333             if (!ReadNextNumber(&Divisions, Comment, &i))
05334                 return EPSCommentSyntaxError;
05335 
05336             // read in the sub-divisions
05337             if (!ReadNextNumber(&SubDiv, Comment, &i))
05338                 return EPSCommentSyntaxError;
05339 
05340             // Read in the unit
05341             if (!ReadNextNumber(&Units, Comment, &i))
05342                 return EPSCommentSyntaxError;
05343 
05344             // Read in the type of grid
05345             if (!ReadNextNumber(&Type, Comment, &i))
05346                 return EPSCommentSyntaxError;
05347 
05348             // Put everything into the correct types
05349             SubDivisions = (UINT32)SubDiv;
05350             Unit = (UnitType)Units;
05351             TypeOfGrid = (GridType) Type;           
05352 
05353             // Get rid of the old grid, if there was one
05354             // and find out where the page corner is, so that the origin of the grid can be set
05355             BOOL FoundPage = FALSE;
05356             DocCoord Corner(0,0);
05357             Spread* pSpread = GetSelectedSpread();
05358             if (pSpread!=NULL)
05359             {
05360                 // Find the first child of the spread
05361                 Node* pNode = pSpread->FindFirstChild();
05362                 while (pNode!=NULL)
05363                 {
05364                     // Go find the next node now
05365                     Node* pNext = pNode->FindNext();
05366 
05367                     // For each of the child nodes of the spread, we will check to see if it is a Node Grid
05368                     if (pNode->IS_KIND_OF(NodeGrid))
05369                     {
05370                         // This is a grid all right, so toast it
05371                         pNode->CascadeDelete();
05372                         delete pNode;               
05373                     }
05374 
05375                     // see if it is a page
05376                     if ((!FoundPage) && (pNode->IS_KIND_OF(Page)))
05377                     {
05378                         // We have found one, so stop looking
05379                         FoundPage = TRUE;
05380 
05381                         // Find out the coord of the bottom corner
05382                         DocRect PageRect = ((Page*)pNode)->GetPageRect();
05383                         Corner = PageRect.LowCorner();
05384                     }
05385 
05386                     // Find the next node
05387                     pNode = pNext;
05388                 }
05389 
05390                 // Set all the global variables - What a load of B********
05391                 NodeGrid::SetDefaultDivisions(Divisions);
05392                 NodeGrid::SetDefaultSubdivisions(SubDivisions);
05393                 NodeGrid::SetDefaultUnits(Unit);
05394                 NodeGrid::SetDefaultGridType(TypeOfGrid);
05395 
05396                 // Make a grid
05397                 // BODGE - old builds (hence docs) save the grid spacing in divisions and units but don't
05398                 // account for unit scaling, so as not to change doc format new docs do the same so we must
05399                 // set the grid with scaling turned off - yuk!
05400                 BOOL Scale=FALSE;
05401                 NodeGrid::MakeDefaultGrid(pSpread, Scale);
05402 
05403                 // Set the origin to 0,0 for now
05404                 if (FoundPage)
05405                 {
05406                     // Find the first child of the spread
05407                     Node* pNode = pSpread->FindFirstChild();
05408                     while (pNode!=NULL)
05409                     {
05410                         // For each of the child nodes of the spread, we will check to see if it is a Node Grid
05411                         if (pNode->IS_KIND_OF(NodeGrid))
05412                             // This is a grid all right, so Set its origin
05413                             ((NodeGrid*)pNode)->SetOrigin(Corner.x, Corner.y);
05414 
05415                         // Find the next node
05416                         pNode = pNode->FindNext();
05417                     }
05418                 }
05419             }
05420             break;
05421         }
05422 
05423         default:
05424         {
05425             break;
05426         }
05427     }
05428 #endif  
05429     return EPSCommentOK;
05430 }

ProcessEPSResult Document::ImportOriginInfo TCHAR Comment  )  [protected]
 

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.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/10/95
Parameters:
Comment - The EPS comment that we have to process [INPUTS]
Returns:
ProcessEPSResult - the result of the import

Definition at line 5447 of file document.cpp.

05448 {
05449 #if !defined(EXCLUDE_FROM_RALPH)
05450     // find the selected spread in the doc, and it's default grid
05451     Spread* pSpread = GetSelectedSpread();
05452     ERROR2IF(pSpread==NULL,EPSCommentOK,"Document::ImportOriginInfo() - could not find first spread in doc");
05453     NodeGrid* pDefaultGrid = pSpread->FindFirstDefaultGridInSpread();
05454     ERROR2IF(pDefaultGrid==NULL,EPSCommentOK,"Document::ImportOriginInfo() - could not find default grid");
05455 
05456     // init read position in string - ie after "%%+o"
05457     INT32 i = 4;
05458 
05459     // Read in the Version Number
05460     INT32 Version = -1;
05461     if (!ReadNextNumber(&Version, Comment, &i))
05462         return EPSCommentSyntaxError;
05463 
05464     // Act on the version number
05465     switch (Version)
05466     {
05467         case 0 :
05468         {
05469             // Read in the origin
05470             DocCoord Origin(0,0);
05471             if (!ReadNextNumber(&Origin.x, Comment, &i))
05472                 return EPSCommentSyntaxError;
05473             if (!ReadNextNumber(&Origin.y, Comment, &i))
05474                 return EPSCommentSyntaxError;
05475 
05476             // set the grid (and user) origin
05477             pDefaultGrid->SetOrigin(Origin.x,Origin.y);
05478             break;
05479         }
05480 
05481         default: ERROR2(EPSCommentOK,"Document::ImportOriginInfo() - unknown origin version");
05482     }
05483 #endif
05484     
05485     return EPSCommentOK;
05486 }

ProcessEPSResult Document::ImportPageInfo TCHAR Comment  )  [protected]
 

Tries to import the page info. This function only returns FALSE if there was an actual error in the file that needs reporting.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Returns:
TRUE if the import worked, FALSE means that there was a problem.

Definition at line 4850 of file document.cpp.

04851 {
04852     // Set the default version
04853     INT32 Version = -1;
04854 
04855     // Where in the comment to start looking from (skip over %%+p)
04856     INT32 i = 4;
04857 
04858     // Read in the version number
04859     if (!ReadNextNumber(&Version, Comment, &i))
04860         return EPSCommentSyntaxError;
04861 
04862     // Descide what to do based on the version number
04863     switch (Version)
04864     {
04865         case 0 :
04866         {
04867             // Version 0 expects to find the following infomation
04868             // Width, Height, Margin, Bleed, Dps, ShowDropShadow
04869             // Get something to put all the numbers into
04870             MILLIPOINT Width, Height;
04871             MILLIPOINT Margin, Bleed;
04872             BOOL Dps, ShowDropShadow;
04873             Width = Height = 0;
04874 
04875             // Read in the Width of the page
04876             if (!ReadNextNumber(&Width, Comment, &i))
04877                 return EPSCommentSyntaxError;
04878 
04879             // Read in the Height of the page
04880             if (!ReadNextNumber(&Height, Comment, &i))
04881                 return EPSCommentSyntaxError;
04882 
04883             // Read in the Margin of the page
04884             if (!ReadNextNumber(&Margin, Comment, &i))
04885                 return EPSCommentSyntaxError;
04886 
04887             // Read in the Bleed of the page
04888             if (!ReadNextNumber(&Bleed, Comment, &i))
04889                 return EPSCommentSyntaxError;
04890 
04891             // Read in the DPS of the page
04892             INT32 TempNum;
04893             if (!ReadNextNumber(&TempNum, Comment, &i))
04894                 return EPSCommentSyntaxError;
04895 
04896             // Copy it to the bool
04897             Dps = (BOOL) TempNum;
04898 
04899             // Read in the Drop shadow state of the page
04900             if (!ReadNextNumber(&TempNum, Comment, &i))
04901                 return EPSCommentSyntaxError;
04902 
04903             // Copy it to the bool
04904             ShowDropShadow = (BOOL) TempNum;
04905 
04906             // Find the spread to change
04907             Spread* pSpread = GetSelectedSpread();
04908             if (pSpread == NULL)
04909                 return EPSCommentSystemError;
04910 
04911             // Ask the pages to change themselves
04912             BOOL Worked = FALSE;
04913             if ((Width>0) && (Height>0))
04914             {
04915                 Worked = pSpread->SetPageSize(Width, Height, Margin, Bleed, Dps, ShowDropShadow);
04916             }
04917         }                 
04918 
04919         // Unknown version
04920         default:
04921         {
04922             // Here we have got a version number we do not know how to process
04923             // so just ignore this comment happy. we will say that the comment
04924             // was OK as an error is technically wrong in this case
04925         }
04926     }
04927 
04928     // if we get here, then everything went smoothly so return Happy
04929     return EPSCommentOK;
04930 }

ProcessEPSResult Document::ImportQualityInfo TCHAR Comment  )  [protected]
 

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
Comment - The EPS comment that we have to process [INPUTS]
Returns:
ProcessEPSResult - the result of the import - see ProcessEPSComment()

Definition at line 5253 of file document.cpp.

05254 {
05255 #if !defined(EXCLUDE_FROM_RALPH)
05256     // The version of the state info and the read position in the string
05257     INT32 Version = -1;
05258     INT32 i = 4;
05259 
05260     // Read in the Version Number
05261     if (!ReadNextNumber(&Version, Comment, &i))
05262         return EPSCommentSyntaxError;
05263 
05264     // Act on the version number
05265     switch (Version)
05266     {
05267         case 0 :
05268         {
05269             // The View Quality - default to something sensible
05270             INT32 ViewQuality = 100;
05271 
05272             // Read in the Version Number
05273             if (!ReadNextNumber(&ViewQuality, Comment, &i))
05274                 return EPSCommentSyntaxError;
05275 
05276             // OK, we got the view quality ok, so try and set it
05277 //          DocView* pView = DocView::GetSelected();
05278             DocView* pView = GetFirstDocView();
05279             if (pView!=NULL)
05280             {
05281                 // Actually set the quality in the view
05282                 /*BOOL Worked = */pView->RenderQuality.SetQuality((INT32)ViewQuality);
05283             }
05284 
05285             break;
05286         }
05287 
05288         default:
05289         {
05290             break;
05291         }
05292     }
05293 #endif
05294     return EPSCommentOK;
05295 }

ProcessEPSResult Document::ImportRulerState TCHAR Comment  )  [protected]
 

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
Comment - The EPS comment that we have to process [INPUTS]
Returns:
ProcessEPSResult - the result of the import - see ProcessEPSComment()

Definition at line 5501 of file document.cpp.

05502 {
05503 #if !defined(EXCLUDE_FROM_RALPH)
05504     INT32 Version = -1;
05505     INT32 i = 4;
05506     // Read in the Version Number
05507     if (!ReadNextNumber(&Version, Comment, &i))
05508         return EPSCommentSyntaxError;
05509 
05510     switch (Version)
05511     {
05512         case 0 :
05513         {
05514         
05515             INT32 ScrollerState =1;
05516             INT32 RulerState =0;
05517             // Read in the Version Number
05518             if (!ReadNextNumber(&ScrollerState, Comment, &i))
05519                 return EPSCommentSyntaxError;
05520             if (!ReadNextNumber(&RulerState, Comment, &i))
05521                 return EPSCommentSyntaxError;
05522             
05523             // See if we have a View to change
05524 //          DocView* pView = DocView::GetSelected();
05525             DocView* pView = GetFirstDocView();
05526             
05527             // we use default visibility states if this is a new file
05528             // (ie. we are not opening an existing file )
05529             // this flag is set in CCamDoc::OnNewDocument()
05530             // see also CCamDoc::OnOpenDocument()
05531             if(CCamView::GetUseVisibleDefaults())
05532             {
05533                 ScrollerState = CCamView::GetDefaultScrollersState();
05534                 RulerState = CCamView::GetDefaultRulersState();
05535             }
05536         
05537             if (pView != NULL)
05538             {
05539                 pView->ShowViewScrollers((BOOL)ScrollerState);
05540                 pView->ShowViewRulers((BOOL)RulerState);
05541             }
05542             break;
05543         }
05544 
05545         default :
05546         {
05547             break;
05548         }
05549     }
05550 #endif  
05551 
05552     return EPSCommentOK;
05553 }

ProcessEPSResult Document::ImportStateInfo TCHAR Comment  )  [protected]
 

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.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
Comment - The EPS comment that we have to process [INPUTS]
Returns:
ProcessEPSResult - the result of the import - see ProcessEPSComment()

Definition at line 5118 of file document.cpp.

05119 {
05120 #if !defined(EXCLUDE_FROM_RALPH)
05121     // The version of the state info and the read position in the string
05122     INT32 Version = -1;
05123     INT32 i = 4;
05124 
05125     // Find the first DocView (if there is one)
05126     DocView* pFirstView = GetFirstDocView();
05127 
05128     // Read in the Version Number
05129     if (!ReadNextNumber(&Version, Comment, &i))
05130         return EPSCommentSyntaxError;
05131 
05132     // Act on the version number
05133     switch (Version)
05134     {
05135         case 1 : 
05136         {
05137             INT32 ShowGuides            = TRUE;
05138             INT32 SnapToGuides      = TRUE;
05139             INT32 Multilayer            = FALSE;
05140             INT32 AllLayersVisible  = FALSE;
05141 
05142             // Read the ShowGuides flag
05143             if (!ReadNextNumber(&ShowGuides, Comment, &i))
05144                 return EPSCommentSyntaxError;
05145 
05146             // Read the SnapToGuides flag
05147             if (!ReadNextNumber(&SnapToGuides, Comment, &i))
05148                 return EPSCommentSyntaxError;
05149 
05150             // Read the Multilayer flag
05151             if (!ReadNextNumber(&Multilayer, Comment, &i))
05152                 return EPSCommentSyntaxError;
05153 
05154             // Read the AllLayersVisible flag
05155             if (!ReadNextNumber(&AllLayersVisible, Comment, &i))
05156                 return EPSCommentSyntaxError;
05157 
05158 // In viewer leave these alone
05159 #ifndef STANDALONE
05160             // Now try and set the values in the view
05161             if (pFirstView != NULL)
05162             {
05163                 // Set all the flags to either TRUE or FALSE
05164                 pFirstView->SetShowGuidesState(ShowGuides?TRUE:FALSE);
05165                 pFirstView->SetSnapToGuidesState(SnapToGuides?TRUE:FALSE);
05166 
05167                 SetMultilayer(Multilayer?TRUE:FALSE);
05168                 SetAllVisible(AllLayersVisible?TRUE:FALSE);
05169             }
05170 #endif
05171         }
05172         // Fall through for version 0 flags
05173 
05174         case 0 :
05175         {
05176             INT32 ShowGrid = FALSE;
05177             INT32 SnapToGrid = FALSE;
05178             INT32 SnapToMagObjects = FALSE;
05179             INT32 SnapToObjects = FALSE;
05180             INT32 ForeBackMode = FALSE;
05181 
05182             // Read the Grid visible flag
05183             if (!ReadNextNumber(&ShowGrid, Comment, &i))
05184                 return EPSCommentSyntaxError;
05185 
05186             // Snap to Grids yes/no
05187             if (!ReadNextNumber(&SnapToGrid, Comment, &i))
05188                 return EPSCommentSyntaxError;
05189 
05190             // Snap to Magnetic Objects yes/no
05191             if (!ReadNextNumber(&SnapToMagObjects, Comment, &i))
05192                 return EPSCommentSyntaxError;
05193 
05194             // Snap to Objects yes/no
05195             if (!ReadNextNumber(&SnapToObjects, Comment, &i))
05196                 return EPSCommentSyntaxError;
05197 
05198             // Background rendering yes/no
05199             if (!ReadNextNumber(&ForeBackMode, Comment, &i))
05200                 return EPSCommentSyntaxError;
05201 
05202             // Read in the dummy sixth value. This is necessary because
05203             // a printf function had too many %ds in it for the output
05204             // so the program always outputs a random value after the
05205             // rest of them. We have to skip it, just in case.
05206             // Notice that we ignore any errors - if the dummy value is not there, 
05207             // who cares?
05208             INT32 dummy = 0;
05209             ReadNextNumber(&dummy, Comment, &i);
05210             
05211 // In viewer leave these alone
05212 #ifndef STANDALONE
05213             // Now try and set the values in the view
05214             if (pFirstView != NULL)
05215             {
05216                 // Set all the flags to either TRUE or FALSE
05217                 pFirstView->SetShowGridState(ShowGrid?TRUE:FALSE);
05218                 pFirstView->SetSnapToGridState(SnapToGrid?TRUE:FALSE);
05219                 pFirstView->SetSnapToMagObjectsState(SnapToMagObjects?TRUE:FALSE);
05220                 pFirstView->SetSnapToObjectsState(SnapToObjects?TRUE:FALSE);
05221                 pFirstView->SetForeBackMode(ForeBackMode?TRUE:FALSE);
05222             }
05223 #endif
05224             break;
05225         }
05226 
05227 
05228         // Unknown version number
05229         default:
05230         {
05231             // This is not an error, as this would stop the file from loading.
05232             // We will just ignore this little section of information
05233             break;
05234         }
05235     }
05236 #endif
05237     return EPSCommentOK;
05238 }

ProcessEPSResult Document::ImportUndoInfo TCHAR Comment  )  [protected]
 

Reads in the Last saved operation history size from the file.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/07/95
Parameters:
Comment - The Comment that we have to process [INPUTS]
Returns:
EPSCommentOK

Definition at line 5827 of file document.cpp.

05828 {
05829     // The version of the state info and the read position in the string
05830     INT32 Version = -1;
05831     INT32 i = 4;
05832 
05833     // Read in the Version Number
05834     if (!ReadNextNumber(&Version, Comment, &i))
05835         return EPSCommentSyntaxError;
05836 
05837     // Act on the version number
05838     switch (Version)
05839     {
05840         case 0 :
05841         {
05842             UINT32 UndoSize;
05843 
05844             // Read the size for the operation history
05845             if (!ReadNextNumber(&UndoSize, Comment, &i))
05846                 return EPSCommentSyntaxError;
05847 
05848             // Minimum size = 1K
05849             if (UndoSize < 1024)
05850                 UndoSize = 1024;
05851 
05852             // Set the size of the Operation History in
05853             // the document.
05854             GetOpHistory().SetNewMaxSize(UndoSize);
05855 
05856             break;
05857         }
05858 
05859         default:
05860         {
05861             break;
05862         }
05863     }
05864 
05865     return EPSCommentOK;
05866 }

ProcessEPSResult Document::ImportUnitInfo TCHAR Comment  )  [protected]
 

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.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/95
Parameters:
Comment - The comment line to process [INPUTS]
Returns:
EPSCommentSyntaxError if there was a systax error in the comment EPSCommentOK if the comment was processed ok

Definition at line 5589 of file document.cpp.

05590 {
05591     // If there is no valid DocUnit list in this document then give up
05592     ERROR3IF(pDocUnitList==NULL,"Document::ImportUnitInfo null pDocUnitList");
05593     if (pDocUnitList==NULL)
05594         return EPSCommentOK;
05595 
05596     // Set up some variables.
05597     // The version of the state info and the read position in the string
05598     INT32 Version = -1;
05599     INT32 i = 4;
05600 
05601     // Read in the Version Number
05602     if (!ReadNextNumber(&Version, Comment, &i))
05603         return EPSCommentSyntaxError;
05604 
05605     // Act on the version number
05606     switch (Version)
05607     {
05608         case 0 :
05609         {
05610             // We need to make a new unit
05611             // Older code had this outside the version loop so you cannot use the 'u'
05612             // comment field for other unit field without creating a new unit in older
05613             // versions e.g. viewer 1.00 and Studio 1.00b and before. 
05614 
05615             // Read in values & validate them before creating the unit
05616 
05617             INT32 Size;
05618             INT32 BaseUnit;
05619             double Numerator;
05620             double Denominator;
05621             INT32 IsPrefix;
05622             String_64 TokenStr;
05623             String_64 SpecifierStr;
05624                 
05625             // Read in the Millipoint size of the unit
05626             if (!ReadNextNumber(&Size, Comment, &i))
05627                 return EPSCommentSyntaxError;
05628 
05629             // Read in the base UnitType
05630             if (!ReadNextNumber(&BaseUnit, Comment, &i))
05631                 return EPSCommentSyntaxError;
05632 
05633             // Read in the unit Numerator
05634             if (!ReadNextNumber(&Numerator, Comment, &i))
05635                 return EPSCommentSyntaxError;
05636 
05637             // Read in the unit Denominator
05638             if (!ReadNextNumber(&Denominator, Comment, &i))
05639                 return EPSCommentSyntaxError;
05640 
05641             // Read in whether the  unit specifier is prefixed (0 == FALSE)
05642             if (!ReadNextNumber(&IsPrefix, Comment, &i))
05643                 return EPSCommentSyntaxError;
05644 
05645             // Finally read in the string values
05646             if (!ReadNextString(&TokenStr, 32, Comment, &i))
05647                 return EPSCommentSyntaxError;
05648 
05649             // Read in the specifier string
05650             if (!ReadNextString(&SpecifierStr, 32, Comment, &i))
05651                 return EPSCommentSyntaxError;
05652 
05653             // Throw away units that have been exported for compatibility with older versions (see ExportUnitInfo())
05654             if (Numerator == 0.0 && Denominator <= 2.0) break;
05655 
05656             Unit* pNewUnit = NULL;
05657             if (!pDocUnitList->MakeNewUnit(&pNewUnit, TRUE))
05658                 return EPSCommentSystemError;
05659 
05660             // Set the values in the units up
05661             pNewUnit->SetMillipoints((double)Size);
05662             pNewUnit->SetBaseUnitType((UnitType) BaseUnit);
05663             pNewUnit->SetBaseNumerator(Numerator);
05664             pNewUnit->SetBaseDenominator(Denominator);
05665             pNewUnit->SetPrefixState((BOOL)IsPrefix);
05666             // Set the token
05667             pNewUnit->SetToken(TokenStr);
05668             // Set the Specifier
05669             pNewUnit->SetSpecifier(SpecifierStr);
05670 
05671             break;
05672         }
05673 
05674         default:
05675         {
05676             // Do nothing with unknown versions as this means info we know nothing about.
05677             // Do not error though as this might be bad.
05678             break;
05679         }
05680     }
05681 
05682     return EPSCommentOK;
05683 }

ProcessEPSResult Document::ImportViewInfo TCHAR Comment  )  [protected]
 

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
Comment - The EPS comment that we have to process [INPUTS]
Returns:
ProcessEPSResult - the result of the import - see ProcessEPSComment()

Definition at line 4986 of file document.cpp.

04987 {
04988 #if !defined(EXCLUDE_FROM_RALPH)
04989     INT32 Version = -1;
04990     INT32 i = 4;
04991 
04992     // Read in the Version Number
04993     if (!ReadNextNumber(&Version, Comment, &i))
04994         return EPSCommentSyntaxError;
04995 
04996     // Act on the version number
04997     switch (Version)
04998     {
04999         case 0 :
05000         case 1 :    // Version 1 is the same, only it has some extra info at the end
05001         {
05002             INT32 XOffset = 0;
05003             INT32 YOffset = 0;
05004             INT32 ScaleFactor = 1000;
05005 
05006             // Read in the Version Number
05007             if (!ReadNextNumber(&XOffset, Comment, &i))
05008                 return EPSCommentSyntaxError;
05009 
05010             // Read in the Version Number
05011             if (!ReadNextNumber(&YOffset, Comment, &i))
05012                 return EPSCommentSyntaxError;
05013 
05014             // Read in the Version Number
05015             if (!ReadNextNumber(&ScaleFactor, Comment, &i))
05016                 return EPSCommentSyntaxError;
05017 
05018             // Adjust the scale factor by a factor of 1000
05019             // go via a double to avoid getting negative scales when ScaleFactor > 32k
05020             FIXED16 RealScale = ((double)ScaleFactor) / 1000.0;
05021 
05022             // See if we have a View to change
05023 //          DocView* pView = DocView::GetSelected();
05024             DocView* pView = GetFirstDocView();
05025             if (pView != NULL && fRestoreViewOnImport)
05026             {
05027                 // Set the view for the following code.  The zoom ops work on the current
05028                 // view, as do the coordinate conversion functions.
05029                 ERROR3IF(pView != DocView::GetCurrent(),
05030                             "DocView::Current is screwed in Document::ImportViewInfo");
05031                 pView->SetCurrent();
05032 
05033                 // Change the view scale
05034                 pView->SetViewScale(RealScale);
05035 
05036                 // Change the scroll offsets
05037                 WorkCoord TopCorner(XOffset, YOffset);
05038                 pView->SetScrollOffsets(TopCorner, FALSE);
05039 
05040                 // Update the button bar
05041                 OpZoomComboDescriptor::Update();
05042             }
05043 
05044             // Deal with the Version 1 bits
05045             if (Version==1)
05046             {
05047                 // The params we will read in
05048                 INT32 Active;
05049                 String_32 DrawingScale;
05050                 String_32 RealScale;
05051 
05052                 // Find the DimScale to set
05053                 DimScale* pDimScale = NULL;
05054                 Spread* pSpread = GetSelectedSpread();
05055                 if (pSpread!=NULL)
05056                     pDimScale = pSpread->GetPtrDimScale();
05057                 
05058                 if (pDimScale!=NULL)
05059                 {
05060                     // Read in the Version Number
05061                     if (!ReadNextNumber(&Active, Comment, &i))
05062                         return EPSCommentSyntaxError;
05063 
05064                     // And set the active state of the scaleing
05065                     pDimScale->SetActiveState(Active);
05066 
05067                     // And read in the two scaling strings
05068                     if (!ReadNextString(&DrawingScale, 32, Comment, &i))
05069                         return EPSCommentSyntaxError;
05070 
05071                     // Set the Drawing Scale
05072                     BOOL Worked = pDimScale->SetDrawingScaleStr(DrawingScale);
05073                     
05074                     if (!ReadNextString(&RealScale, 32, Comment, &i))
05075                         return EPSCommentSyntaxError;
05076 
05077                     // Set the real scale
05078                     if (Worked)
05079                         Worked = pDimScale->SetRealScaleStr(RealScale);
05080 
05081                     // Set the scale factor using the new strings
05082                     if (Worked)
05083                         pDimScale->SetScaleFactor();
05084                     // None of the the above functions report errors if there were problems
05085                     // should really inform the user about the problem using _R(IDW_BADDOCUMENTSCALE) in nev.h/rc
05086                 }
05087             }
05088 
05089             break;
05090         }
05091 
05092         default :
05093         {
05094             break;
05095         }
05096     }
05097 #endif  
05098     return EPSCommentOK;
05099 }

void Document::IncCurrentNodeCount  )  [static]
 

Adds one to the NodesInTree counter of the Current Document object, if it exists. Called by the constructors of class Node.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/11/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
Document::DecCurrentNodeCount; Document::NodesInDocument

Definition at line 2423 of file document.cpp.

02424 {
02425     if (Current) Current->NodesInTree++;
02426 }

BOOL Document::Init CCamDoc pOilDoc  )  [virtual]
 

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).

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/7/93
Parameters:
pOilDoc --- the CCamDoc to attach this Document too [INPUTS]
Returns:
TRUE if the document initialised ok, FALSE otherwise.
Notes: This now also sets up the default list of indexed (named) colours which the user can base their document upon [in the BaseDocument Init method]. These should be set up from a default document (or whatever) in future.

Returns:
Errors: Out of memory.
See also:
ReadEPSData; Document::Document; Document::SetSelectedViewAndSpread; Document::SetCurrent

Reimplemented in InternalClipboard.

Definition at line 321 of file document.cpp.

00322 {
00323 // Ralph has a NULL oildoc...
00324 #ifndef RALPH
00325     ERROR2IF(OilDoc, FALSE, "Document already attached to a CCamDoc in Document::Init");
00326 #endif
00327     OilDoc = pOilDoc;
00328 
00329     NodeDocument* Doc;
00330     EndDocument* End;
00331 
00332     // Make this the current document - NOTE! no broadcast as of 22/7/94
00333     SetCurrent();
00334     
00335     // Set the busy cursor . . .
00336     BeginSlowJob(-1, FALSE);
00337 
00338     // First, call the base class Init method to set up for us.
00339     // This creates the StartDocument, NodeDocument, & EndDocument, and sets up
00340     // a default colour list and other doc components.
00341     if (!BaseDocument::Init()) return InitFailed();
00342 
00343     // Check that the document is OK
00344     ERROR3IF(GetFirstNode() == NULL,"StartDoc not found"); 
00345     Doc = (NodeDocument*)GetFirstNode()->FindNext(); 
00346     ERROR3IF(Doc == NULL, "NodeDocument not found"); 
00347     End = (EndDocument*)Doc->FindNext(); 
00348     ERROR3IF(End == NULL, "EndDocument not found"); 
00349 
00350     // Make the doc unit list
00351     pDocUnitList = new DocUnitList;
00352     if (pDocUnitList == NULL || !pDocUnitList->MakeDefaultUnits())
00353         return(InitFailed());
00354 
00355     // Create the Operation history for the document                              
00356     OpHistory = new OperationHistory;
00357     if (OpHistory == NULL)
00358         return(InitFailed());
00359 
00360     // Create the attribute manager for the document 
00361     AttributeMgr = new AttributeManager; 
00362     if (AttributeMgr == NULL || !AttributeMgr->InitInstance())
00363         return(InitFailed());
00364 
00365     // Build the basic tree structure (Chapter, spread, layer)
00366     if (!InitTree(Doc))
00367         return(InitFailed());
00368 
00369     if (IsNotAHiddenDoc())
00370     {
00371         // Broadcast a message to all that there's a new document on the block . . .
00372         BROADCAST_TO_ALL(DocChangingMsg(this, DocChangingMsg::BORN));
00373     }
00374     
00375     // Add the default attributes as Nodes at the start of the tree
00376     // The clipboard document does not need default attributes, as things copied into it
00377     // are always kept attribute complete. But now that we're importing into the clipboard,
00378     // it is a very good idea to have safe defaults lying about.
00379     InitDefaultAttributeNodes(); 
00380 
00381     // Take the hourglass off
00382     EndSlowJob();
00383     
00384     return(TRUE);
00385 }

BOOL Document::InitDefaultAttributeNodes  )  [private]
 

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

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/06/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the default attributes have been added to the tree OK FALSE if we run out of memory.
The Attribute optimisation routines will not work if the document does not contain the default attributes.

Note: This function must be called after the initial document structure has been set up and all default attributes have been registered.

Returns:
Errors: The Out Of Memory Error is set if we run out of memory, FALSE is returned in this situation.

Definition at line 487 of file document.cpp.

00488 {
00489     ENSURE(AttributeMgr != NULL, "Attribute Manager pointer is NULL"); 
00490 
00491     // Find out the number of default attributes
00492     UINT32 NumDefaultAttribs = AttributeMgr->GetNumAttributes();
00493     ENSURE(NumDefaultAttribs != 0, "The document has no default attributes"); 
00494     
00495     AttributeEntry* DefaultAttribs = AttributeMgr->GetDefaultAttributes();
00496     
00497     if (DefaultAttribs == NULL)
00498         return FALSE;
00499     
00500     // ----------------------------------------------------------------------------------------
00501     // Try and find the NodeDocument node - to which the attributes will be added
00502 
00503     Node* TreeRoot; 
00504 
00505     ENSURE(TreeStart != NULL, "The initial tree structure has not been initialised"); 
00506 
00507     TreeRoot = TreeStart->FindNext(); 
00508 
00509     ENSURE(TreeRoot != NULL, "Can't find NodeDocument"); 
00510     ENSURE(TreeRoot->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeDocument), "Alien tree structure"); 
00511 
00512     // ----------------------------------------------------------------------------------------
00513     // Create a NodeAttribute for each of the default attributes and add them into the
00514     // tree as first children of the NodeDocument.
00515 
00516     for(UINT32 i=0; i<NumDefaultAttribs; i++)
00517     {
00518         ENSURE(DefaultAttribs[i].pAttr != NULL, "Default attribute is NULL"); 
00519         
00520         Node* NodeAttr = DefaultAttribs[i].pAttr->MakeNode();
00521 
00522         if (NodeAttr != NULL)
00523         {
00524             // Add the Attribute as a first child of the NodeDocument.  Note that we suppress
00525             // the transparency check for default attributes.
00526             NodeAttr->AttachNode(TreeRoot, FIRSTCHILD, FALSE);
00527 
00528             NodeAttribute* pNa = (NodeAttribute*)NodeAttr;
00529             if(pNa->IsLinkedToNodeGeometry())
00530             {
00531                 pNa->NewlyCreatedDefaultAttr((NodeDocument*)TreeRoot);
00532             }
00533         } 
00534     }
00535 
00536     // ----------------------------------------------------------------------------------------
00537 
00538     // Default attribute array no longer required so we can safely delete it 
00539     CCFree(DefaultAttribs);
00540     return TRUE;
00541 }

BOOL Document::InitFailed void   )  [protected]
 

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.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/12/94
Returns:
FALSE
See also:
Document::Init

Reimplemented in BitmapExportDocument.

Definition at line 595 of file document.cpp.

00596 {
00597     if (TreeStart != 0)
00598     {
00599         TreeStart->CascadeDelete();
00600         delete TreeStart;
00601         m_pSetSentinel = 0;
00602     }
00603 
00604     if (OpHistory != 0)
00605     {
00606         delete OpHistory;
00607         OpHistory = 0;
00608     }
00609     
00610     if (AttributeMgr != 0)
00611     {
00612         delete AttributeMgr;
00613         AttributeMgr = 0;
00614     }
00615 
00616     if (pDocUnitList != 0)
00617     {
00618         delete pDocUnitList;
00619         pDocUnitList = 0;
00620     }
00621     
00622     EndSlowJob();
00623     return(FALSE);
00624 }

BOOL Document::InitTree NodeDocument pRootNode  )  [protected]
 

Called by Document::Init to initialise the document tree structure.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/4/95
Parameters:
RootNode - points at the basic NodeDocument from which the main documet [INPUTS] tree hangs.
Returns:
TRUE if it succeeds, FALSE if it failed (in which case you should call InitFailed() and possibly InformError())
Mainly intended for use by the internal clipboard in order to delete and recreate the standard tree whenever it is wiped - I've done this here dso that any chnages to the normal document layout will also affect the clipboard document in an appropriate manner.

Returns:
Errors: Lack of memory might make 'new' fail
See also:
Document::Init

Definition at line 415 of file document.cpp.

00416 {
00417     if (pRootNode == NULL || !pRootNode->IsNodeDocument())
00418     {
00419         ERROR3("This doc's NodeDocument is NULL or isn't really a NodeDocument");
00420         return(FALSE);
00421     }
00422 
00423     // Temporary bodge to construct example document tree for Target 1.     
00424     Chapter* pChapter = new Chapter(pRootNode, LASTCHILD);
00425     if (pChapter == 0) return FALSE;
00426 
00427     // Create the sentinel node for all object names within the chapter, and a
00428     // child NodeBarProperty.
00429     m_pSetSentinel = new NodeSetSentinel(pChapter, FIRSTCHILD);
00430     if (m_pSetSentinel == 0) return FALSE;
00431     NodeBarProperty* pbp = new NodeBarProperty(m_pSetSentinel, LASTCHILD);
00432     if (pbp == 0) return FALSE;
00433 
00434     // Create a rectangle for the pasteboard
00435     DocRect PasteRect(MinDocCoord + 0x10000,
00436                       MaxDocCoord - 0x10000 - 1 * PasteBoardHeight,
00437                       MinDocCoord + 0x10000 + 2 * PasteBoardWidth,
00438                       MaxDocCoord - 0x10000);
00439 
00440     // Create the spread
00441     Spread *pSpread = new Spread(pChapter, FIRSTCHILD, PasteRect);
00442     if (pSpread == NULL) return FALSE;
00443     
00444     // Create the default page and grid (JustinF says: even if we are a hidden document)
00445     if (!pSpread->CreateDefaultPageAndGrid(TRUE)) return FALSE;
00446 
00447     // Create the Insertion node which must always live as a last child of the selected
00448     // spreads active layer. The Insertion node holds a pointer to this document so that
00449     // if for whatever reason the InsertionNode is destroyed (eg. Delete layer) then 
00450     // we can Inform this document and it can NULLIFY the InsertPos pointer.
00451     InsertPos = new InsertionNode(this);
00452     if (InsertPos == NULL) return FALSE;
00453     InsertPos->AttachNode(pSpread, LASTCHILD);
00454 
00455     return TRUE;
00456 }

void Document::InsertionNodeDying  )  [inline]
 

Definition at line 650 of file document.h.

00650 { InsertPos = 0; }      // Called by ~InsertionNode

void Document::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.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/9/93
Parameters:
NewNode - A Pointer to the New node to be inserted [INPUTS] pDestSpread - pointer to the spread which this new node should be inserted, If this is NULL then the object is inserted on the selected spread.
See also:
Document::FindEnclosingChapter(); Document::FindEnclosingPage()

Definition at line 1188 of file document.cpp.

01189 {
01190     SetCurrent();
01191 
01192     Node *pNode; 
01193 
01194     // Most of the time we will be inserting onto the selected spread
01195     // So find out what this is.
01196     
01197     if ((pDestSpread == NULL) || (pDestSpread == Document::GetSelectedSpread()))
01198     {
01199         // We need to insert the node onto the selected spread. This is very quick because we
01200         // keep an Insertion node there.
01201         pNode = GetInsertionPosition(); 
01202         ENSURE(pNode != NULL, "Could not find insertion position in Document::InsertNewNode()");
01203         // Attach the node to the left of the insertion node
01204         NewNode -> AttachNode( pNode, PREV );
01205 
01206     } 
01207     else
01208     {
01209         // This is assuming that we are inserting into the non-selected spread and so does
01210         // not use the insertion position. Unfortunately, there is a chance that this MAY happen
01211         // as the selected spread may be in a different document and so we are inserting into a
01212         // single spread document with an insertion node. The code below will insert AFTER the
01213         // insertion node and so will be in an illegal position. We really should check this!!!
01214         // As we are close to release I will put an error 3 in just in case. Neville 24/9/96
01215         TRACE( _T("\aDocument::InsertNewNode inserting into the unselected spread. Is this correct?\n") );
01216 
01217         pNode = pDestSpread->FindActiveLayer();
01218         ENSURE(pNode != NULL, "Could not find layer in Document::InsertNewNode()");
01219         // Attach this node to the tree at this point
01220         NewNode -> AttachNode( pNode, LASTCHILD );
01221     }
01222 }

virtual BOOL Document::IsAClipboard  )  const [inline, virtual]
 

Reimplemented in InternalClipboard.

Definition at line 235 of file document.h.

00235 { return FALSE; };

BOOL Document::IsACopy  )  const
 

Tests the "Copy" flag.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Returns TRUE if the document is a copy of another document.

Errors: -

See also:
CCamDoc::IsACopy

Definition at line 794 of file document.cpp.

00795 {
00796     if (OilDoc)
00797         return OilDoc->IsACopy();
00798 
00799     return(FALSE);
00800 }

BOOL Document::IsAllVisible  ) 
 

Interogate the "all visible" status of this document.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the "all visible" flag for the document is set. FALSE otherwise

Errors: -

See also:
-

Definition at line 2297 of file document.cpp.

02298 {
02299     return (DocFlags.LayerAllVisible != 0);
02300 }

BOOL Document::IsAnimated  ) 
 

Finds whether this document is an animation.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/10/97
Returns:
-
We assume the document is an animation if it contains one or more frame layers

Definition at line 6095 of file document.cpp.

06096 {
06097     //Find the first spread in the document
06098 PORTNOTE("spread", "Multi-spread warning!")
06099     Spread* pSpread = FindFirstSpread();
06100 
06101     //Find the first frame layer in that spread
06102     Layer * pFrame = pSpread->FindFirstFrameLayer();
06103 
06104     //If there is one, return TRUE. Otherwise return FALSE
06105     return !(pFrame==NULL);
06106     
06107     
06108 }

BOOL Document::IsARalphDoc void   )  [inline]
 

Definition at line 261 of file document.h.

00261 { return IsARalph; }

BOOL Document::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.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/95
Returns:
TRUE if the document is importing a file as apposed to Opening a file

Definition at line 5884 of file document.cpp.

05885 {
05886     return DocIsImporting;
05887 }

BOOL Document::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.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/7/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 837 of file document.cpp.

00838 {
00839     return LoadedAsVersion1File;
00840 }

BOOL Document::IsModified  )  const
 

Tests the "Modified" flag.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Returns TRUE if the document has been modified since last being saved.

Errors: -

See also:
CCamDoc::IsModified

Definition at line 748 of file document.cpp.

00749 {
00750     if (OilDoc)
00751         return OilDoc->IsModified();
00752 
00753     return(FALSE);
00754 }

BOOL Document::IsMultilayer  ) 
 

Interogate the multilayer status of this document.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the multilayer flag for the document is set. FALSE otherwise

Errors: -

See also:
-

Definition at line 2277 of file document.cpp.

02278 {
02279     return (DocFlags.LayerMultilayer != 0);
02280 }

virtual BOOL Document::IsNotAClipboard  )  const [inline, virtual]
 

Reimplemented in InternalClipboard.

Definition at line 234 of file document.h.

00234 { return TRUE; };

BOOL Document::IsReadOnly  )  const
 

Tests the "Read Only" flag.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Returns TRUE if the document is read-only, ie. cannot be modified.

Errors: -

See also:
CCamDoc::IsReadOnly

Definition at line 771 of file document.cpp.

00772 {
00773     if (OilDoc)
00774         return OilDoc->IsReadOnly();
00775 
00776     return(FALSE);
00777 }

BOOL Document::IsStable  )  const [inline]
 

Definition at line 248 of file document.h.

00248 { return m_fStable; }

BOOL Document::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.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> Humprhys
Date:
6/8/97
Returns:
TRUE if the document is importing a file as apposed to Opening a file
See also:

Definition at line 5925 of file document.cpp.

05926 {
05927     return DocTemplateLoading;
05928 }

void Document::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).

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/5/95
Parameters:
- [INPUTS]
Sets member variables [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1163 of file document.cpp.

01164 {
01165     LastSaveTime = 0;               // Zero means not saved
01166     CreationTime = ::time(NULL);
01167 }

void Document::OnDocViewDying DocView pdv  ) 
 

Definition at line 1322 of file document.cpp.

01323 {
01324     // Look for this DocView in the list
01325     DocView *pDocView = (DocView *) DocViews.GetHead();
01326     
01327     // Traverse List of DocViews 
01328     while (pDocView != NULL)
01329     {
01330         // Is this the DocView that is closing down?
01331         if (pDocView == pDocViewToDelete)
01332         {
01333             // Yes - remove it from the list and return
01334             DocViews.RemoveItem(pDocView);
01335             return;
01336         }
01337 
01338         // Try the next one
01339         pDocView = (DocView *) DocViews.GetNext(pDocView);
01340     }
01341 }

ProcessEPSResult Document::ProcessEPSComment EPSFilter pFilter,
const TCHAR pComment
[virtual]
 

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).

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/08/94
Parameters:
pFilter - the EPS filter that is being used to import a file. [INPUTS] pComment - read only buffer containing - This EPS comment is not recognised by the document. EPSCommentSy the whole EPS comment to parse.
Returns:
EPSCommentUnknown ntaxError - This EPS comment was recognised by this document but it contained an error. EPSCommentSystemError - This EPS comment was recognised by this document but a system error occured that was not caused directly by the comment, e.g. out of memory. EPSCommentOK - This EPS comment was recognised as a legal comment by this document, and was processed successfully.
See also:
Document::EndOfEPSComment; Document::WriteEPSProlog; Document::WriteEPSSetup; Document::WriteEPSComments; DocComponent; ProcessEPSResult; EPSFIlter

Definition at line 3393 of file document.cpp.

03395 {
03396     // OK, to begin with, set the current doc and view to this doc and it's first view.
03397     SetCurrent();
03398     if (GetFirstDocView() != NULL){
03399         GetFirstDocView()->SetCurrent();
03400     }
03401     if ((pFilter->IS_KIND_OF(CamelotNativeEPSFilter)) && !IsImporting())
03402     {
03403         // Take a copy of the comment
03404         TCHAR Comment[256];
03405         camStrcpy(Comment, pComment);
03406 
03407         // Look for Document info
03408         if (camStrncmp(pComment, _T("%%NativePageList"), 16) == 0)
03409         {
03410             // Found the page description table
03411             return EPSCommentOK;
03412         }
03413         else if (camStrncmp(pComment, _T("%%DocumentInfo"), 14) == 0)
03414         {
03415             // Found the page description table
03416             // Set the Documents Comment to nothing
03417             String_256 Empty("");
03418             SetComment(&Empty);
03419 
03420             return EPSCommentOK;
03421         }
03422         else if (camStrncmp(pComment, _T("%%+"), 3) == 0)
03423         {
03424             // Assume we do not know about this comment until we can prove that we do.
03425             //
03426             // NOTE: If you add something new then ensure you export it at the end of the list.
03427             // This is because older versions of the program (1.0b and before) will stop
03428             // processing at unknown comments and can cause immense problems.           
03429 
03430             ProcessEPSResult Result = EPSCommentUnknown;
03431             TCHAR InfoType = pComment[3];
03432             switch (InfoType)
03433             {
03434                 // The Document Info Comment (as seen in the Document Info dialog in the File menu)
03435                 case 'c' :
03436                 {
03437                     Result = ImportDocumentComment(Comment);
03438                     break;
03439                 }
03440 
03441                 // Read in the Creation and Last Saved dates
03442                 case 'd' :
03443                 {
03444                     Result = ImportDateInfo(Comment);
03445                     break;
03446                 }
03447 
03448                 // Read in the View Flags
03449                 case 'f':
03450                 {
03451                     break;
03452                 }
03453 
03454                 // Read in the Grid Settings
03455                 case 'g':
03456                 {
03457                     Result = ImportGridInfo(Comment);
03458                     break;
03459                 }
03460 
03461                 // Read in the Grid Settings
03462                 case 'o':
03463                 {
03464                     Result = ImportOriginInfo(Comment);
03465                     break;
03466                 }
03467 
03468                 // Document history which is the specified undo size
03469                 case 'h':
03470                 {
03471                     Result = ImportUndoInfo(Comment);
03472                     break;
03473                 }
03474 
03475                 // Page Description
03476                 case 'p' :
03477                 {
03478                     // load in the new page layout
03479                     Result = ImportPageInfo(Comment);
03480 
03481                     // adjust the page origin to match the new page.
03482                     pFilter->ResetImportOrigin();
03483                     break;
03484                 }
03485 
03486                 // Read in the View Quality Settings
03487                 case 'q':
03488                 {
03489                     // Load in the new view quality
03490                     Result = ImportQualityInfo(Comment);
03491 
03492 #if !defined(EXCLUDE_FROM_RALPH)
03493                     // update all the view quality sliders
03494                     QualitySliderDescriptor::Update();
03495 #endif
03496                     break;
03497                 }
03498 
03499                 // The DocView State Info (Grid on/off, Snapping on/off etc)
03500                 case 's' :
03501                 {
03502                     Result = ImportStateInfo(Comment);
03503                     break;
03504                 }
03505 
03506                 // The Unit settings
03507                 case 'u' :
03508                 {
03509                     Result = ImportUnitInfo(Comment);
03510                     break;
03511                 }
03512 
03513                 // The default display unit settings
03514                 case 'U' :
03515                 {
03516                     Result = ImportDefaultUnitsInfo(Comment);
03517                     break;
03518                 }
03519                 
03520                 // The Ruler and Scroller visible state
03521                 case 'r' :
03522                 {
03523                     //Result = ImportRulerState(Comment);
03524                     // removed by Chris 27/10/95
03525                     // just ignore this token now
03526                     // Ruler/Scroller state now set only from a global preference
03527                     Result = EPSCommentOK;
03528                     break;
03529                 }
03530             
03531                 // The View Setting (Scale Factor, Scroll offsets etc)
03532                 case 'v' :
03533                 {
03534                     Result = ImportViewInfo(Comment);
03535                     break;
03536                 }
03537 
03538                 default :
03539                 {
03540                     Result = EPSCommentUnknown;
03541                     break;
03542                 }
03543             }
03544 
03545             // Result will hold the result of any processing of this continuation comment
03546             return Result;
03547         }
03548     }
03549     else if (pFilter->IS_KIND_OF(CamelotNativeEPSFilter))
03550     {
03551         // Importing a native file - we need to get the page origin so that the filter
03552         // can position the objects correctly.
03553 
03554         // Take a copy of the comment
03555         TCHAR Comment[256];
03556         camStrcpy(Comment, pComment);
03557 
03558         // Look for Document info
03559         if (camStrncmp(pComment, _T("%%NativePageList"), 16) == 0)
03560         {
03561             // Found the page description table
03562             return EPSCommentOK;
03563         }
03564         else if (camStrncmp(pComment, _T("%%DocumentInfo"), 14) == 0)
03565         {
03566             // Found the page description table
03567             // Set the Documents Comment to nothing
03568             String_256 Empty("");
03569             SetComment(&Empty);
03570 
03571             return EPSCommentOK;
03572         }
03573         else if (camStrncmp(pComment, _T("%%+"), 3) == 0)
03574         {
03575             // Default to recognising this comment - all we care about is extracting the page origin.
03576             ProcessEPSResult Result = EPSCommentOK;
03577             TCHAR InfoType = pComment[3];
03578             if (InfoType == 'p')
03579             {
03580                 // Set the default version
03581                 INT32 Version = -1;
03582 
03583                 // Where in the comment to start looking from (skip over %%+p)
03584                 INT32 i = 4;
03585 
03586                 // Read in the version number
03587                 if (!ReadNextNumber(&Version, Comment, &i))
03588                     return EPSCommentSyntaxError;
03589 
03590                 // Descide what to do based on the version number
03591                 switch (Version)
03592                 {
03593                     case 0 :
03594                     {
03595                         // Version 0 expects to find the following infomation
03596                         // Width, Height, Margin, Bleed, Dps, ShowDropShadow
03597                         // Get something to put all the numbers into
03598                         MILLIPOINT Dummy, Margin;
03599 
03600                         // Read in the Width of the page
03601                         if (!ReadNextNumber(&Dummy, Comment, &i))
03602                             return EPSCommentSyntaxError;
03603 
03604                         // Read in the Height of the page
03605                         if (!ReadNextNumber(&Dummy, Comment, &i))
03606                             return EPSCommentSyntaxError;
03607 
03608                         // Read in the Margin of the page
03609                         if (!ReadNextNumber(&Margin, Comment, &i))
03610                             return EPSCommentSyntaxError;
03611 
03612                         // Ok, we've got the margin, so tell the EPS filter about it.
03613                         DocCoord NewOrigin(Margin, Margin);
03614                         pFilter->ResetImportOrigin(NewOrigin);
03615                     }                 
03616 
03617                     // Unknown version
03618                     default:
03619                     {
03620                         // Here we have got a version number we do not know how to process
03621                         // so just ignore this comment happy. we will say that the comment
03622                         // was OK as an error is technically wrong in this case
03623                     }
03624                 }
03625             }
03626 
03627             // Result will hold the result of any processing of this continuation comment
03628             return Result;
03629         }
03630     }
03631 
03632     return EPSCommentUnknown;
03633 }

BOOL Document::RalphDontShowPaper  )  [inline]
 

Definition at line 277 of file document.h.

00277 {return Viewmode == DRAWING_VIEW;}; 

BOOL Document::ReadPrefs  )  [static]
 

Reads preferences for the Document class from the program's .INI file.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/1/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful.

Errors: -

See also:
InitKernel

Definition at line 2765 of file document.cpp.

02766 {
02767     if (Camelot.DeclareSection(TEXT("Preferences"), 1))
02768     {
02769         Camelot.DeclarePref(TEXT("Preferences"), TEXT("RemoveExistingDocs"),
02770                                &CCamDoc::s_RemoveExistingOnNewDoc, FALSE, TRUE);
02771     }
02772     return TRUE;
02773 }

BOOL Document::ReInit  )  [virtual]
 

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...

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/4/96
Returns:
Init ok

Errors:

Definition at line 559 of file document.cpp.

00560 {
00561     // RALPH
00562     InitFailed();
00563     return Init(OilDoc);
00564 
00565 /* 
00566     TreeStart->CascadeDelete();
00567     ERROR3IF(GetFirstNode() == NULL,"StartDoc not found"); 
00568     NodeDocument *Doc = (NodeDocument*)GetFirstNode()->FindNext(); 
00569     return InitTree(Doc);
00570 */
00571 
00572 //  return TRUE;
00573 
00574 }

void Document::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.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/08/94
See also:
Document::GetInsertionPosition

Definition at line 2705 of file document.cpp.

02706 {
02707     // Is the Insertion node in the correct spread ?
02708     Spread* SelSpread = Document::GetSelectedSpread();
02709     if (SelSpread==NULL)
02710     {
02711         SelSpread = FindFirstSpread();
02712         if (SelSpread==NULL)
02713         {
02714             ERROR3("Fialed to ResetInsertPosition(), unable to find a spread in this document");
02715             return;
02716         }
02717     }
02718     
02719     // I think it's ok to search for the active layer here cos there is not likely
02720     // to be zillions of layers.
02721     Layer* pSelActiveLyr = SelSpread->FindActiveLayer();
02722     if ( pSelActiveLyr )
02723     {
02724         ERROR3IF(pSelActiveLyr == NULL, "Could not find active layer on selected spread"); 
02725 
02726         //Node* InsertLyr = InsertPos->FindParent();
02727 
02728         //ENSURE(InsertLyr->GetRuntimeClass() == CC_RUNTIME_CLASS(Layer), 
02729         //  "Parent of insertion node is not a layer")
02730 
02731         if (InsertPos == NULL)
02732             GetInsertionPosition();
02733 
02734         // The InsertionNode should be moved
02735         if (InsertPos != NULL && pSelActiveLyr != NULL)
02736             InsertPos->MoveNode(pSelActiveLyr, LASTCHILD);
02737 
02738     /*
02739         Node* pInsertPosNode = GetInsertionPosition();
02740 
02741         ERROR3IF(pInsertPosNode == NULL,"Can't get hold of the insert node");
02742 
02743         // The InsertionNode should be moved
02744         if (pInsertPosNode != NULL)
02745             pInsertPosNode->MoveNode(SelActiveLyr, LASTCHILD);
02746     */
02747     }
02748 }

void Document::SetAllVisible BOOL  state  ) 
 

Lets you set the state of the "all visible" document flag.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/8/94
Parameters:
state = TRUE or FALSE [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2337 of file document.cpp.

02338 {
02339     DocFlags.LayerAllVisible = state;
02340 }

void Document::SetBitmapSmoothing BOOL  newVal  )  [inline]
 

Definition at line 545 of file document.h.

00545 { m_bSmoothBitmaps = newVal; }

BOOL Document::SetBleedOffset MILLIPOINT  Bleed  ) 
 

For setting a new value for the Document's bleed area size.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The current size in millipoints of this document's bleed area.

Errors: -

See also:
Document::GetBleedOffset();

Definition at line 3754 of file document.cpp.

03755 {
03756     BleedOffset = Bleed;    // set up new bleed value
03757     
03758     return TRUE;
03759 } 

void Document::SetComment String_256 NewComment  ) 
 

Setting the document's comment string.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/94
Parameters:
A pointer to the new comment string. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
Document::GetComment

Definition at line 1048 of file document.cpp.

01049 {
01050     Comment = *NewComment;
01051 }

void Document::SetCreationTime time_t  NewTime  ) 
 

Allows setting of the document's creation time.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/7/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
Document::GetLastSaveTime

Definition at line 1145 of file document.cpp.

01146 {
01147     CreationTime = NewTime;
01148 }

void Document::SetCurrent  ) 
 

Definition at line 1502 of file document.cpp.

01503 {
01504 #ifdef RALPH
01505     // if we are being called from the load thread just ignore 
01506     if(::GetCurrentThreadId() == RalphDocument::GetImportingThreadID())
01507         return ;
01508 #endif
01509     Current = this;
01510 }

BOOL Document::SetDocNudge UINT32  newVal  ) 
 

Sets the documents nudge size.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/2000
Parameters:
newVal - the new documents nudge size [INPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 6034 of file document.cpp.

06035 {
06036     m_docNudge = newVal;
06037     OpNudge::SetNudgeStep (m_docNudge);     // I need to call this directly to get camelot to
06038                                             // use the new value.
06039     return (TRUE);
06040 }

void Document::SetDuplicationOffset DocCoord  newOffset  )  [inline]
 

Definition at line 548 of file document.h.

00548 { m_DuplicationOffset = newOffset; }

void Document::SetIsImporting BOOL  NewIsImporting  ) 
 

Sets the IsImporting flag for the document.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/95
Parameters:
NewIsImporting - The new state of the importing flag [INPUTS]

Definition at line 5901 of file document.cpp.

05902 {
05903     // Set the flag to either TRUE or FALSE
05904     if (NewIsImporting)
05905         DocIsImporting = TRUE;
05906     else
05907         DocIsImporting = FALSE;
05908 }

void Document::SetLastEditorSerialNo UINT32  sn  ) 
 

void Document::SetLastSaveTime  ) 
 

Call on saving a document. Sets the document's last saved time.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/09/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
Document::GetLastSaveTime

Definition at line 1109 of file document.cpp.

01110 {
01111     LastSaveTime = ::time(NULL);
01112 }

void Document::SetLastSaveTime time_t  NewTime  ) 
 

Allows setting of the document's last saved time.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/7/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
Document::GetLastSaveTime

Definition at line 1127 of file document.cpp.

01128 {
01129     LastSaveTime = NewTime;
01130 }

BOOL Document::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.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/7/96
Parameters:
New state of the flag required [INPUTS]
- [OUTPUTS]
Returns:
Old state of the flag

Definition at line 856 of file document.cpp.

00857 {
00858     BOOL OldState = LoadedAsVersion1File;
00859     LoadedAsVersion1File =  NewState;
00860     return OldState;
00861 }

void Document::SetModified BOOL  fState  ) 
 

Sets (or clears) the "document is modified" flag.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
CCamDoc::SetModified

Definition at line 817 of file document.cpp.

00818 {
00819     if (OilDoc)
00820         OilDoc->SetModified( fState != FALSE );
00821 }

void Document::SetMultilayer BOOL  state  ) 
 

Lets you set the state of the multilayer document flag.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/8/94
Parameters:
state = TRUE or FALSE [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2317 of file document.cpp.

02318 {
02319     DocFlags.LayerMultilayer = state;
02320 }

void Document::SetNoCurrent  )  [static]
 

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.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/5/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: None.

Definition at line 1534 of file document.cpp.

01535 {
01536 #ifdef RALPH
01537     // if we are being called from the load thread just ignore 
01538     if(::GetCurrentThreadId() == RalphDocument::GetImportingThreadID())
01539         return ;
01540 #endif
01541     Current = NULL;
01542 }

void Document::SetNoSelectedViewAndSpread void   )  [static]
 

To set the Selected Document, DocView, and Spread. This sets all three of these entities to NULL - no selected entity.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/2/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
These 3 items are interlinked - changing the spread may mean changing to a different document and view - these changes can cause several messages (DocChangingMsg, SpreadMsg, etc) to be broadcast, so they must be treated as a single indivisble operation, which only broadcasts the necessary messages when the entrie state has been changed.

Notes: If the Selected docuemnt changes, a DocChangingMsg (SELCHANGED) will be broadcast, with pOldDoc == the last selected Doc, and pNewDoc == the new selected document. Either/both of pOldDoc and pNewDoc may be NULL!

If the Selected DocView changes, a DocViewMsg (SELCHANGED) will be broadcast, with the pOldDocView and pNewDocView fields indicating the old and new DocViews.

If the Selected spread changes, a SpreadMsg (SELCHANGED) will be broadcast. pOldSpread and pNewSpread will point at the spreads involved.

This does NOT affect the Current doc.

Definition at line 1580 of file document.cpp.

01581 {
01582     TRACEUSER("Gerry", _T("Document::SetNoSelectedViewAndSpread"));
01583 #ifdef RALPH
01584     // if we are being called from the load thread just ignore 
01585     if(::GetCurrentThreadId() == RalphDocument::GetImportingThreadID())
01586         return ;
01587 #endif
01588     // Remember if each of the selected things has chnaged as a result of this call
01589     Document    *OldSelDocument = Selected;
01590     DocView     *OldSelView     = DocView::GetSelected();
01591     Spread      *OldSelSpread   = pGlobalSelSpread;
01592 
01593     // Tell those that care that the selected view is about to become null.
01594     BROADCAST_TO_ALL(DocViewMsg(OldSelView, NULL, DocViewMsg::SELABOUTTOCHANGE));
01595 
01596     // --- Set no selected spread
01597     pGlobalSelSpread = NULL;
01598     if (Selected != NULL)
01599         Selected->pSelSpread = NULL;
01600 
01601     // --- Set no selected document
01602     Selected = NULL;
01603 
01604     // --- Set no selected docview
01605     DocView::SetSelectedInternal(NULL);
01606 
01607 
01608     // --- And broadcast appropriate message(s)
01609     if (Selected != OldSelDocument)
01610     {
01611         BROADCAST_TO_ALL(DocChangingMsg(OldSelDocument, NULL,
01612                                         DocChangingMsg::SELCHANGED));
01613     }
01614 
01615     if (DocView::GetSelected() != OldSelView)
01616     {
01617         DocView::SendSelectedMessage(OldSelView, DocView::GetSelected());
01618     }
01619 
01620     if (pGlobalSelSpread != OldSelSpread)
01621     {
01622         BROADCAST_TO_ALL(SpreadMsg(OldSelSpread, NULL,
01623                             SpreadMsg::SELCHANGED));
01624     }
01625 
01626     // Ensure any delayed Selection message broadcasts are sent now
01627     GetApplication()->FindSelection()->BroadcastAnyPendingMessages();
01628 }

void Document::SetRalphDoc BOOL  b  )  [inline]
 

Definition at line 262 of file document.h.

00262 { IsARalph = b; }

void Document::SetRalphViewMode ViewMode  Vmode  )  [inline]
 

Definition at line 272 of file document.h.

00272 {Viewmode = Vmode;};

void Document::SetSelectedViewAndSpread Document TheDocument = NULL,
DocView TheView = NULL,
Spread TheSpread = NULL
[static]
 

To set the Selected Document, DocView, and Spread.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/2/95
Parameters:
TheDocument - NULL, or a pointer to the document to make selected [INPUTS] TheView - NULL, or the docview for TheDocument which should be made selected TheSpread - NULL or the Spread in TheDocument which should be made selected
- [OUTPUTS]
Returns:
-
These 3 items are interlinked - changing the spread may mean changing to a different document and view - these changes can cause several messages (DocChangingMsg, SpreadMsg, etc) to be broadcast, so they must be treated as a single indivisble operation, which only broadcasts the necessary messages when the entrie state has been changed.

Notes: If any of the parameters are NULL, sensible defaults (The currently selected document, the currently selected or first docview of that document, and the currently selected or first spread of that document, respectively) will be used.

If the Selected document changes, a DocChangingMsg (SELCHANGED) will be broadcast, with pOldDoc == the last selected Doc, and pNewDoc == the new selected document. Either/both of pOldDoc and pNewDoc may be NULL.

If the Selected DocView changes, a DocViewMsg (SELCHANGED) will be broadcast, with the pOldDocView and pNewDocView fields indicating the old and new DocViews.

If the Selected spread changes, a SpreadMsg (SELCHANGED) will be broadcast. pOldSpread and pNewSpread will point at the spreads involved.

This also sets CurrentDoc to equal the Selected Doc. Ths state should remain true during the broadcast of the DocChanging Message.

Returns:
Errors: ERROR2's will be generated if the parameters are incompatible (TheView must be a view onto TheDocuemnt; TheSpread must lie within TheDocument)

Definition at line 1679 of file document.cpp.

01682 {
01683 //  TRACEUSER("Gerry", _T("Document::SetSelectedViewAndSpread(0x%08x, 0x%08x, 0x%08x)"), TheDocument, TheView, TheSpread);
01684 #ifdef RALPH
01685     // if we are being called from the load thread just ignore 
01686     if(::GetCurrentThreadId() == RalphDocument::GetImportingThreadID())
01687         return ;
01688 #endif
01689     // We must remember if each of the selected things has changed as a result of this call
01690     Document    *OldSelDocument = Selected;
01691     DocView     *OldSelView     = DocView::GetSelected();
01692     Spread      *OldSelSpread   = pGlobalSelSpread;
01693 
01694     // Ensure that all parameters are valid pointers
01695     if (TheDocument == NULL)
01696         TheDocument = Selected;
01697 
01698     if (TheDocument == NULL)
01699     {
01700         // The caller is obviously trying to set the selected spread/view when there is
01701         // no valid document around
01702         ERROR3("Can't set selected spread/view when there is no selected doc!");
01703         return;
01704     }
01705 
01706     if (TheView == NULL)
01707     {
01708         // The caller supplied no docview - try the selected docview, and if that is not
01709         // in the document becoming selected, then use the first view for the sel doc.
01710         TheView = DocView::GetSelected();
01711         if (TheView == NULL || TheView->GetDoc() != TheDocument)
01712             TheView = (DocView *) TheDocument->DocViews.GetHead();
01713     }
01714 
01715     if (TheSpread == NULL)
01716     {
01717         // The caller specified no spread - Try the globally selected spread, then the
01718         // document's memory of the selected spread, and finally, the first spread in the
01719         // document.
01720         if (pGlobalSelSpread != NULL && SpreadBelongsToDoc(TheDocument, pGlobalSelSpread))
01721             TheSpread = pGlobalSelSpread;
01722         else
01723         {
01724             if (TheDocument->pSelSpread != NULL)
01725                 TheSpread = TheDocument->pSelSpread;
01726             else
01727                 TheSpread = TheDocument->FindFirstSpread();
01728         }
01729     }
01730 
01731 
01732     // Tell those that care that the selected view is about to change
01733     if (TheView!=OldSelView)
01734     {
01735         BROADCAST_TO_ALL(DocViewMsg(OldSelView, OldSelView, DocViewMsg::SELABOUTTOCHANGE));
01736     }
01737 
01738     // --- Set the new selected document, and also update CurrentDoc to be this one
01739     // (so that CurrentDoc points at selected while the broadcast goes around)
01740     Selected = TheDocument;
01741     Selected->SetCurrent();
01742 
01743     OpNudge::SetNudgeStep (Selected->GetDocNudge ());   // CGS:  since documents now store the nudge
01744 
01745     // --- Set the new selected DocView
01746     DocView::SetSelectedInternal(TheView);
01747 
01748     // --- Set the new selected spread
01749     ERROR3IF(TheSpread != NULL && !SpreadBelongsToDoc(Selected, TheSpread),
01750                 "Selected spread should be in the Selected Doc!");
01751     pGlobalSelSpread = TheSpread;
01752     if (Selected != NULL)
01753         Selected->pSelSpread = TheSpread;
01754 
01755 
01756     // --- Now, check if any have changed, and broadcast appropriate messages
01757     if (Selected != OldSelDocument)
01758     {
01759         BROADCAST_TO_ALL(DocChangingMsg(OldSelDocument, Selected,
01760                             DocChangingMsg::SELCHANGED));
01761     }
01762 
01763     if (DocView::GetSelected() != OldSelView)
01764     {
01765         DocView::SendSelectedMessage(OldSelView, DocView::GetSelected());
01766     }
01767 
01768     if (pGlobalSelSpread != OldSelSpread)
01769     {
01770         BROADCAST_TO_ALL(SpreadMsg(OldSelSpread, pGlobalSelSpread,
01771                             SpreadMsg::SELCHANGED));
01772     }
01773 
01774     // Ensure any delayed Selection message broadcasts are sent now
01775     GetApplication()->FindSelection()->BroadcastAnyPendingMessages();
01776 }

void Document::SetStable BOOL  fStable  )  [inline]
 

Definition at line 249 of file document.h.

00249 { m_fStable = fStable; }

void Document::SetTemplateLoading BOOL  NewTemplateLoading  ) 
 

Sets the TemplateLoading flag for the document.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> Humprhys
Date:
6/8/97
Parameters:
NewTemplateLoading - The new state of the template loading flag [INPUTS]

Definition at line 5941 of file document.cpp.

05942 {
05943     // Set the flag to either TRUE or FALSE
05944     if (NewTemplateLoading)
05945         DocTemplateLoading = TRUE;
05946     else
05947         DocTemplateLoading = FALSE;
05948 }

void Document::ShouldRestoreViewOnImport BOOL  fNewState  )  [static]
 

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.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/10/95
Parameters:
fNewState new value of the flag [INPUTS]
Returns:
Errors: -
See also:
Document::ImportViewInfo; LoadAppWindowState

Definition at line 5964 of file document.cpp.

05965 {
05966     fRestoreViewOnImport = fNewState;
05967 }

void Document::ShowViewRulers BOOL  fIsVisible  ) 
 

Definition at line 1380 of file document.cpp.

01381 {
01382 #if !defined(EXCLUDE_FROM_RALPH)
01383     if (IsNotAClipboard())
01384     {
01385         DocView* pDocView = (DocView*) DocViews.GetHead();
01386         while (pDocView != NULL)
01387         {
01388             pDocView->ShowViewRulers(fIsVisible);
01389             pDocView = (DocView *) DocViews.GetNext(pDocView);
01390         }
01391     }
01392 #endif
01393 }

void Document::ShowViewScrollers BOOL  fIsVisible  ) 
 

Definition at line 1356 of file document.cpp.

01357 {
01358     if (IsNotAClipboard())
01359     {
01360         DocView* pDocView = (DocView*) DocViews.GetHead();
01361         while (pDocView != NULL)
01362         {
01363             pDocView->ShowViewScrollers(fIsVisible);
01364             pDocView = (DocView *) DocViews.GetNext(pDocView);
01365         }
01366     }
01367 }

BOOL Document::SpreadBelongsToDoc Document pDoc,
Spread pSpread
[static]
 

Tests to see if the spread belongs to the document.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/8/94
Parameters:
pDoc = ptr to a document [INPUTS] pSpread = ptr to a spread
- [OUTPUTS]
Returns:
TRUE if pSpread is a child of the NodeDocument belonging to pDoc FALSE otherwise

Errors: -

See also:
-

Definition at line 2027 of file document.cpp.

02028 {
02029     if (pDoc == NULL) return FALSE;
02030 
02031     // Find pDoc's first node
02032     Node* pNode = pDoc->GetFirstNode();
02033     ENSURE(pNode != NULL,"No first node!");
02034 
02035     // The next node should be the NodeDocument node
02036     pNode = pNode->FindNext();
02037     ENSURE(pNode != NULL,"No next node!");
02038     ENSURE(pNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeDocument),"Next node is not a NodeDocument");
02039 
02040     // pNode should now point to pDoc's NodeDocument node
02041 
02042     // Find pSpread's parent NodeDocument node
02043     Node* pParentNodeDoc = pSpread->FindParent(CC_RUNTIME_CLASS(NodeDocument));
02044     ENSURE(pParentNodeDoc != NULL,"The spread has no NodeDocument parent");
02045 
02046     // Return TRUE if pSpread's parent NodeDocument node == pDoc's NodeDocument node
02047 
02048     return ((pParentNodeDoc == pNode) && (pNode != NULL) && (pParentNodeDoc != NULL));
02049 }

void Document::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.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/5/93
Parameters:
Lo,Hi - the new Extents in document coordinates. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
NodeDocument

GetExtents

Definition at line 2160 of file document.cpp.

02161 {
02162     DocView *pView = (DocView*) DocViews.GetHead();
02163 
02164     // Scan list of all DocView of this Document    
02165     while (pView != NULL)
02166     {
02167         // Inform DocView of the new document extent.
02168         pView->SetExtent(Lo, Hi);
02169         pView = (DocView*) DocViews.GetNext(pView);
02170     }
02171 }   

BOOL Document::WriteEPSComments EPSFilter pFilter  )  [virtual]
 

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).

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/08/94
Parameters:
pFilter - the EPS filter that is being used to export a file. [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the EPS comments for this document were written out successfully; FALSE if not (e.g. out of disk space etc)
See also:
Document::WriteEPSSetup; Document::WriteEPSProlog; Document::ProcessEPSComment; DocComponent; EPSFIlter

Definition at line 3036 of file document.cpp.

03037 {
03038     // only do something if the filter is a Native one
03039     if (pFilter->IS_KIND_OF(CamelotNativeEPSFilter))
03040     {
03041         // NOTE: If you add something new then ensure you export it at the end of the list.
03042         // This is because older versions of the program (1.0b and before) will stop
03043         // processing at unknown comments and can cause immense problems.           
03044 
03045         // Output the colour table in ArtWorks format.
03046         EPSExportDC *pDC = pFilter->GetExportDC();
03047 
03048         // The Page List comment:
03049         pDC->OutputToken(_T("%%DocumentInfo"));
03050         pDC->OutputNewLine();
03051 
03052         // Export the Units. These should really be saved out as early as possible
03053         // as other things (such as the grid settings) can make use of them.
03054         ExportUnitInfo(pDC);
03055 
03056         // Export the page layout
03057         ExportPageInfo(pDC);
03058 
03059         // The Document Comment comment:
03060         ExportDocumentComment(pDC);
03061 
03062         // Now save out the Views ScaleFactor and Scroll Offsets
03063         ExportViewInfo(pDC);
03064 
03065         // Now save out the State vars of the view
03066         ExportStateInfo(pDC);
03067 
03068         // Save out the View Quality
03069         ExportQualityInfo(pDC);
03070 
03071         // Grid settings
03072         ExportGridInfo(pDC);
03073 
03074         // View flags (always on top, maximised etc)
03075         ExportFlagInfo(pDC);
03076 
03077         // Export the date info
03078         ExportDateInfo(pDC);
03079 
03080         // Export the undo info (document history)
03081         ExportUndoInfo(pDC);
03082 
03083         // These were all exported in version 1.00b of Studio 
03084         // These are new ones after the this release version.
03085         
03086         // Export the default units. Must be saved after the user units as we
03087         // might have defined a user unit as the default.
03088         ExportDefaultUnitsInfo(pDC);
03089         
03090         //Export the ruler and scroller visible states
03091         // removed by Chris 27/10/95
03092         // Ruler/Scroller state now set only from a global preference
03093         // see ImportRulerState();
03094         //ExportRulerState(pDC);
03095 
03096         // export the origin info - must be output after grid and page info as they both
03097         // reset the origin so must both be imported before the origin is finally set
03098         ExportOriginInfo(pDC);
03099     }
03100 
03101     return TRUE;
03102 }

BOOL Document::WriteEPSFonts EPSFilter pFilter  )  [virtual]
 

Write out the EPS fonts for this document, using the EPS filter object supplied. (The base class does nothing except return TRUE).

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/95
Parameters:
pFilter - the EPS filter that is being used to export a file. [INPUTS]
Returns:
TRUE if the fonts for this document was written out successfully; FALSE if not (e.g. out of disk space etc)
See also:
Document::WriteEPSProlog; Document::WriteEPSComments; Document::ProcessEPSComment; DocComponent; EPSFilter

Definition at line 2900 of file document.cpp.

02901 {
02902     if ( (pFilter->IS_KIND_OF(CamelotNativeEPSFilter)) ||
02903          (pFilter->IS_KIND_OF(AIEPSFilter))
02904        )
02905     {
02906         EPSExportDC *pDC = pFilter->GetExportDC();
02907 
02908         String_64 FontName;
02909         String_64 EFont;
02910         INT32 Style;
02911         FontList CurFontList;
02912         BOOL first=TRUE;
02913 
02914         if (!CurFontList.Build(this))
02915             return FALSE;
02916 
02917         FontListItem* pItem = CurFontList.GetFirstItem();
02918         while (pItem)
02919         {
02920             FontName = pItem->GetFontName();
02921             Style = pItem->GetFontStyle();
02922             // Graeme (31-3-00) - Map the encoded name onto the PS font name.
02923             FONTMANAGER->EncodeAndMapFontName(FontName, EFont, Style);
02924 
02925             if (first)
02926                 pDC->OutputToken(_T("%%DocumentFonts:"));
02927             else
02928                 pDC->OutputToken(_T("%%+"));    
02929 
02930             pDC->OutputToken((TCHAR*)EFont);
02931             pDC->OutputNewLine();
02932         
02933             first=FALSE;
02934             pItem = CurFontList.GetNextItem(pItem); 
02935         }
02936     }
02937     return TRUE;
02938 }

BOOL Document::WriteEPSProlog EPSFilter pFilter  )  [virtual]
 

Write out the EPS prolog for this document, using the EPS filter object supplied. (The base class does nothing except return TRUE).

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/08/94
Parameters:
pFilter - the EPS filter that is being used to export a file. [INPUTS]
Returns:
TRUE if the Prolog for this document was written out successfully; FALSE if not (e.g. out of disk space etc)
See also:
Document::WriteEPSSetup; Document::WriteEPSComments; Document::ProcessEPSComment; DocComponent; EPSFilter

Definition at line 2870 of file document.cpp.

02871 {
02872     // This function is only called from the AIEPS render region.
02873     EPSExportDC *pDC = pFilter->GetExportDC ();
02874     AIExportProlog ( pDC );
02875 
02876     return TRUE;
02877 }

BOOL Document::WriteEPSResources EPSFilter pFilter  )  [virtual]
 

Write out the EPS resources for this document, using the EPS filter object supplied. (The base class does nothing except return TRUE).

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/95
Parameters:
pFilter - the EPS filter that is being used to export a file. [INPUTS]
Returns:
TRUE if the resources for this document was written out successfully; FALSE if not (e.g. out of disk space etc)
See also:
Document::WriteEPSProlog; Document::WriteEPSComments; Document::ProcessEPSComment; DocComponent; EPSFilter

Definition at line 2961 of file document.cpp.

02962 {
02963     // Graeme (24/3/00) - Removed the IsKindOf ( AIEPSFilter ) calls because this is now
02964     // only called from the AI render region.
02965     EPSExportDC *pDC = pFilter->GetExportDC();
02966 
02967     pDC->OutputToken(_T("%%DocumentNeededResources:"));
02968 
02969     AIExportResources(pDC,TRUE);
02970 
02971     return TRUE;
02972 }

BOOL Document::WriteEPSSetup EPSFilter pFilter  )  [virtual]
 

Write out the EPS setup for this document, using the EPS filter object supplied. (The base class does nothing except return TRUE).

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/08/94
Parameters:
pFilter - the EPS filter that is being used to export a file. [INPUTS]
Returns:
TRUE if the Prolog for this document was written out successfully; FALSE if not (e.g. out of disk space etc)
See also:
Document::WriteEPSProlog; Document::WriteEPSComments; Document::ProcessEPSComment; DocComponent; EPSFilter

Definition at line 2996 of file document.cpp.

02997 {
02998     // only do something if the filter is an Illustrator one
02999     if (pFilter->IS_KIND_OF(AIEPSFilter))
03000     {
03001         EPSExportDC *pDC = pFilter->GetExportDC();
03002 
03003         ExportTextSetup(pFilter);
03004         AIExportExtras(pDC);
03005         AIExportCharEncoding(pDC);
03006         AIExportFontEncoding(pDC);
03007     }
03008     return TRUE;
03009 }

BOOL Document::WriteEPSTrailer EPSFilter pFilter  )  [virtual]
 

Write out the EPS trailer for this document, using the EPS filter object supplied. (The base class does nothing except return TRUE).

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/4/94
Parameters:
pFilter - the EPS filter that is being used to export a file. [INPUTS]
Returns:
TRUE if the Trailer for this document was written out successfully; FALSE if not (e.g. out of disk space etc)
See also:
Document::WriteEPSProlog; Document::WriteEPSComments; Document::ProcessEPSComment; DocComponent; EPSFilter

Definition at line 3125 of file document.cpp.

03126 {
03127     // only do something if the filter is an Illustrator one
03128     if (pFilter->IS_KIND_OF(AIEPSFilter))
03129     {
03130         EPSExportDC *pDC = pFilter->GetExportDC();
03131         AIExportTrailer(pDC);
03132     }   
03133     ExportTextTrailer(pFilter);
03134 
03135     return TRUE;
03136 }


Member Data Documentation

AttributeManager* Document::AttributeMgr [private]
 

Definition at line 497 of file document.h.

MILLIPOINT Document::BleedOffset [private]
 

Definition at line 502 of file document.h.

String_256 Document::Comment [private]
 

Definition at line 331 of file document.h.

time_t Document::CreationTime [private]
 

Definition at line 328 of file document.h.

UINT32 Document::CreatorSerialNo [private]
 

Definition at line 472 of file document.h.

Document * Document::Current = NULL [static, private]
 

Definition at line 385 of file document.h.

struct { ... } Document::DocFlags [private]
 

BOOL Document::DocIsImporting [protected]
 

Definition at line 631 of file document.h.

BOOL Document::DocTemplateLoading [protected]
 

Definition at line 632 of file document.h.

List Document::DocViews [protected]
 

Definition at line 458 of file document.h.

BOOL Document::fRestoreViewOnImport = TRUE [static, protected]
 

Definition at line 633 of file document.h.

InsertionNode* Document::InsertPos [private]
 

Definition at line 641 of file document.h.

BOOL Document::IsARalph [protected]
 

Definition at line 285 of file document.h.

time_t Document::LastSaveTime [private]
 

Definition at line 329 of file document.h.

UINT32 Document::LastSerialNo [private]
 

Definition at line 473 of file document.h.

BOOL Document::LayerAllVisible [private]
 

Definition at line 344 of file document.h.

BOOL Document::LayerMultilayer [private]
 

Definition at line 343 of file document.h.

BOOL Document::LoadedAsVersion1File [private]
 

Definition at line 350 of file document.h.

BOOL Document::m_bSmoothBitmaps [private]
 

Definition at line 537 of file document.h.

UINT32 Document::m_docNudge [private]
 

Definition at line 536 of file document.h.

DocCoord Document::m_DuplicationOffset [private]
 

Definition at line 538 of file document.h.

BOOL Document::m_fStable [private]
 

Definition at line 252 of file document.h.

NodeSetSentinel* Document::m_pSetSentinel [private]
 

Definition at line 498 of file document.h.

CCamDoc* Document::OilDoc [protected]
 

Definition at line 457 of file document.h.

OperationHistory* Document::OpHistory [protected]
 

Definition at line 516 of file document.h.

MILLIPOINT Document::PasteBoardOffsetHeight [private]
 

Definition at line 501 of file document.h.

MILLIPOINT Document::PasteBoardOffsetWidth [private]
 

Definition at line 500 of file document.h.

DocUnitList* Document::pDocUnitList [private]
 

Definition at line 530 of file document.h.

Spread * Document::pGlobalSelSpread = NULL [static, private]
 

Definition at line 383 of file document.h.

RalphDocument* Document::pRalphDocument [protected]
 

Definition at line 287 of file document.h.

String_256 Document::Producer [private]
 

Definition at line 330 of file document.h.

Spread* Document::pSelSpread [private]
 

Definition at line 382 of file document.h.

BOOL Document::SaveWithUndo [private]
 

Definition at line 342 of file document.h.

Document * Document::Selected = NULL [static, private]
 

Definition at line 386 of file document.h.

SafeRenderPointer Document::TheSafeRenderPointer [protected]
 

Definition at line 290 of file document.h.

ViewMode Document::Viewmode [protected]
 

Definition at line 286 of file document.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:53:46 2007 for Camelot by  doxygen 1.4.4