Layer Class Reference

Layers optionally exist on a page, they group together objects which are drawn at a particular level in a document. More...

#include <layer.h>

Inheritance diagram for Layer:

NodeRenderablePaper NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Member Functions

 Layer ()
 This constructor creates a Layer linked to no other nodes, with all status flags false, and NULL bounding and pasteboard rectangles.
 ~Layer ()
 Default destructor.
 Layer (Node *ContextNode, AttachNodeDirection Direction, const String_256 &LayerID, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
 This method initialises the node and links it to ContextNode in the direction specified by Direction. All neccesary tree links are updated.
String Describe (BOOL Plural, BOOL Verbose)
 To return a description of the Node object in either the singular or the plural. This method is called by the DescribeRange method.
virtual SubtreeRenderState RenderSubtree (RenderRegion *pRender, Node **ppNextNode=NULL, BOOL bClip=TRUE)
 Virtual function - this version decides whether or not a layer should be rendered according to the ExcludeLockedLayers flags and the state of the layer itself.
virtual void RenderAfterSubtree (RenderRegion *pRender)
 Capture the group as a cached bitmap.
virtual BOOL NeedsToExport (RenderRegion *pRender, BOOL VisibleLayersOnly=FALSE, BOOL CheckSelected=FALSE)
 Indicate that we want to export layers. Now takes a parameter to say whether we want to take notice of the layers visible status when deciding about exporting it or not.
void PreExportRender (RenderRegion *pRegion)
 Outputs data to mark the beginning of a layer.
BOOL ExportRender (RenderRegion *pRegion)
 Called after all child nodes are asked to export.
BOOL IsLayer () const
 Indicate that we are a layer (overrides function in Node).
DocRect GetPasteboardRect (BOOL Pixelise=TRUE, View *pView=NULL) const
 For obtaining the layer's pasteboard rectangle which is actually the pasteboard rectangle of its parent spread node.
LayerFindNextLayer (BOOL ExcludeInvisible=FALSE, BOOL ExcludeLocked=FALSE)
 To find the next sibling layer.
LayerFindPrevLayer (BOOL ExcludeInvisible=FALSE, BOOL ExcludeLocked=FALSE)
 To find the prev sibling layer.
LayerFindNextFrameLayer ()
 To find the next sibling frame layer.
LayerFindPrevFrameLayer ()
 To find the prev sibling frame layer.
virtual BOOL HidingNode ()
 This virtual function is called whenever the node is hidden. It allows the node do things like 'optimise' itself to use less memory or send a message to let others know it is being hidden etc.
BOOL IsVisible (DocView *pDocView=NULL)
 For finding the layers visible status.
BOOL IsLocked ()
 For finding the layers locked status A layer is locked if the following is true - The layer's locked flag is TRUE AND The layer is NOT active (clause not used in Alpha release 15/8/94) AND The Multilayer flag in the parent document is FALSE.
BOOL IsActive ()
 For finding the layers active status.
BOOL IsPrintable ()
 For finding the layers printable status.
BOOL IsBackground ()
 For finding the layers background status.
BOOL IsOutline ()
 For finding the layers outline status.
BOOL IsGuide ()
 For finding the layers guide status.
BOOL IsPageBackground ()
 For finding the layer's page background status.
String_256GetLayerID ()
 For finding the layers identifier.
BOOL IsOverlay ()
 For finding the frame's/layer's Overlay status.
BOOL IsSolid ()
 For finding the frame's/layer's Solid status.
BOOL IsEdited ()
 For finding the frame's/layer's Edited status.
BOOL IsFrame ()
 For finding the frame's/layer's Frame status.
BOOL IsHiddenFrame ()
 For finding the frame's/layer's Hidden status This marks this frame as a hidden frame layer which will not be saved into the GIF animation but may take part in the rendering process of other frames.
BOOL IsPseudoFrame ()
 For finding out whether this might be regarded as a frame layer without especially having its frame flag set.
BOOL GetVisibleFlagState ()
 Returns the raw state of the layer's visible flag (specialist use only).
BOOL GetLockedFlagState ()
 Returns the raw state of the layer's Locked flag (specialist use only).
BOOL HasLayerGotRenderableChildren ()
 Scans the layer for children that render something on the screen. It ignores attributes, hidden nodes, etc - nodes that don't render anything themselves.
BOOL IncludeLayerInBoundingCalcs ()
 For finding out whether to include the layer in bounding box calcalutions. This may not be a simple IsVisible test as usually you want to exclude the two special layers:- guides and page background. This function should be used when:- Calculating drawing sizes for zooming Calculating drawing sizes for export.
LayerStatusGetLayerStatus ()
 Returns the layers status.
void SetVisible (BOOL Status)
 To set the Layer's visible flag status (TRUE/FALSE).
void SetLocked (BOOL Status)
 To set the Layer's locked flag status (TRUE/FALSE).
void SetActive (BOOL Status)
 To set the Layer's active flag status (TRUE/FALSE).
void SetPrintable (BOOL Status)
 To set the Layer's printable flag status (TRUE/FALSE).
void SetBackground (BOOL Status)
 To set the Layer's background flag status (TRUE/FALSE).
void SetOutline (BOOL Status)
 To set the Layer's outline flag status (TRUE/FALSE).
void SetGuide (BOOL Status)
 To set the Layer's Guide flag status (TRUE/FALSE).
void SetPageBackground (BOOL Status)
 To set the Layer's PageBackground flag status (TRUE/FALSE).
void SetLayerID (String_256 &LayerID)
 For setting the layer's identifier.
void SetLayerStatus (LayerStatus &Status)
 To set the layers status.
void SetSolid (BOOL Status)
 To set the Frame/Layer's Solid flag status (TRUE/FALSE).
void SetOverlay (BOOL Status)
 To set the Frame/Layer's Overlay flag status (TRUE/FALSE).
void SetEdited (BOOL Status)
 To set the Frame/Layer's Edited flag status (TRUE/FALSE).
void SetFrame (BOOL Status)
 To set the Frame/Layer's Frame flag status (TRUE/FALSE).
void SetHiddenFrame (BOOL Status)
 To set the Frame/Layer's Hidden flag status (TRUE/FALSE).
void EnsureUniqueLayerID (void)
 Ensures that the layers ID is unique amoung it's siblings. Call after the node is linked into the document tree.
void GetDebugDetails (StringBase *Str)
 For obtaining debug information about the Node.
virtual UINT32 GetNodeSize () const
 For finding the size of the node.
virtual DocRect GetBlobBoundingRect ()
 Returns the layer's bounding rect inflated by the size of a blob.
BOOL BelongsToDocument (Document *pDoc)
 Checks to see if this layer belongs to the document, i.e. the node is part of the tree that is attached to the given document.
DocumentFindDocument ()
 This should be able to return the document associated with this layer. If not, then this program is a worthless piece of junk and way beyond repair.
virtual BOOL AllowOp (ObjChangeParam *pParam, BOOL SetOpPermissionState=TRUE, BOOL DoPreTriggerEdit=TRUE)
 Layers will allow any op to happen to them, or to their children.
virtual void SetOpPermission (OpPermissionState NewState, BOOL AndParents=FALSE)
 Calls Node::SetOpPermission(NewState,FALSE), i.e. you can set the layer's op permission state, but the 'AndParent' param is ignored.
DocColourGetGuideColour ()
 Returns the DocColour that specifies the colour to render the guide objects in this layer with.
void SetGuideColour (IndexedColour *pIndexedColour)
 Assigns the given indexed colour as the colour to render guide objects in this layer in.
void MakeGuideColourDefault ()
 Makes the current colour the default for all guide layers.
DocColour GetDefaultGuideColour ()
 Makes the current colour the default for all guide layers.
void ColourChanged (IndexedColour *pChangedColour)
 Called when a colour has changed.
void ColourDeleted ()
 Called when a colour may have been deleted.
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes out the layer data suitable for the web format.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)
 Writes out the layer data suitable for the native format.
virtual BOOL WritePostChildrenWeb (BaseCamelotFilter *pFilter)
 Gives the node a change to write data to the filter after its children have been automatically written out.
virtual BOOL WritePostChildrenNative (BaseCamelotFilter *pFilter)
virtual BOOL CanWriteChildrenWeb (BaseCamelotFilter *pFilter)
 Determines if the layer should write out its contents in the web format.
virtual BOOL CanWriteChildrenNative (BaseCamelotFilter *pFilter)
 Determines if the layer should write out its contents in the native format.
virtual BOOL WriteBeginChildRecordsWeb (BaseCamelotFilter *pFilter)
virtual BOOL WriteBeginChildRecordsNative (BaseCamelotFilter *pFilter)
 Begins the child record sequence for layers in the native format.
virtual BOOL WriteEndChildRecordsWeb (BaseCamelotFilter *pFilter)
virtual BOOL WriteEndChildRecordsNative (BaseCamelotFilter *pFilter)
 Ends the child record sequence for layers in the native format.
virtual BOOL ReadPostChildrenWeb (BaseCamelotFilter *pFilter)
 This function is called during the importing of the file.
virtual BOOL ReadPostChildrenNative (BaseCamelotFilter *pFilter)
virtual UINT32 CountNumWritableWebLayers (BaseCamelotFilter *pFilter)
 Counts how many layers are writable, as determined by Layer::CanWriteChildrenWeb().
virtual BOOL WriteAtomicNodesColourRefs (Node *pLayer, BaseCamelotFilter *pFilter)
 All compound nodes (e.g. bevels, contours, shadows, clipview) are now defined as being atomic. This is so that they can be backwards compatible with CX2. This means that colour definitions that occur within these nodes are omitted when CX2 reads the files. The cause access violations when another colour definition references the omitted. Thus, compund atomic nodes MUST write colour definitions BEFORE the node is written. The function scans the document for relevent nodes, and cause them to write out their colour definitions immediately after the layer node. This is only done of compound atomic nodes, since doing it for all would slow down other peoples distributed stuff.
virtual PathName MakeExportLayerName (const PathName &path)
 Make a pathname that's specific to this layer.
virtual BOOL WriteFrameLayerProperties (BaseCamelotFilter *pFilter)
 Exports the delay details for this frame layer to the filter.
DWORD GetFrameDelay ()
void SetFrameDelay (const DWORD &Delay)
Quality GetCaptureQuality ()
void SetCaptureQuality (const Quality &NewQuality)
KernelBitmapGetGeneratedBitmap ()
 To recover the bitmap that has been generated to represent this layer, if any.
BOOL SetGeneratedBitmap (KernelBitmap *pBitmap)
 To set the bitmap that has been generated to represent this layer.
virtual KernelBitmapEnumerateBitmaps (UINT32 Count)
 Find out what bitmaps, if any, are used by this node.
KernelBitmapGetReferencedBitmap ()
 To recover the bitmap that is present on the layer and is of the correct sort so that it can be used to represent this layer.
BOOL SetReferencedBitmap (KernelBitmap *pBitmap)
 To set the bitmap that has been found which is a single bitmap on this layer which is of the correct colour depth and scaling which can be used to directly represent this layer. Usually, the bitmap will be part of an animation that has been loaded in.
virtual ChangeCode OnChildChange (ObjChangeParam *pParam)
 We override the function to mark layers as edited. This should do the same as the baseclass i.e. return ok but should else set the edited flag to true. Composite objects can use this function to respond to one of their children undergoing a change. They should return CC_FAIL whenever they are unable to cope with the change.

Static Public Member Functions

static BOOL Init ()
 Does any layer initialisation necessary. Declares some layer INI settings Creates a layer message handler.
static void Deinit ()
 Deinits the layer system. This deletes the layer message handler.
static LayerCreateGuideLayer ()
 This does everything required in creating a layer fit to be called the guide layer.

Static Public Attributes

static BOOL ActiveLayerVisibleAndEditable = FALSE
 Dictates whether the active layer is automatically made visible and editable or whether it is left in its last state which might include it being invisible. Defaults to the old system (FALSE).
static INT32 EnableLayerCacheing = 1
 Control whether layers are cached or not.

Protected Member Functions

virtual NodeSimpleCopy ()
 This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.
void CopyNodeContents (Layer *NodeCopy)
 This method copies the node's contents to the node pointed to by NodeCopy.

Private Attributes

LayerStatus LayerSt
BOOL Active
BOOL Visible
BOOL Locked
BOOL Printable
BOOL Background
BOOL Outline
BOOL Guide
BOOL m_PageBackground
BOOL m_Overlay
BOOL m_Solid
BOOL m_Edited
BOOL m_Frame
BOOL m_HiddenFrame
DWORD m_FrameDelay
Quality m_CaptureQuality
KernelBitmapRef m_GeneratedBitmap
KernelBitmapm_pReferencedBitmap
DocColourpGuideColour
IndexedColourpIndexedGuideColour

Static Private Attributes

static INT32 GuideLayerRed = 255
static INT32 GuideLayerGreen = 0
static INT32 GuideLayerBlue = 0
static LayerMsgHandlerpLayerMsgHandler = NULL

Detailed Description

Layers optionally exist on a page, they group together objects which are drawn at a particular level in a document.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/4/93
See also:
NodeRenderablePaper

Chapter

Spread

Page

Definition at line 158 of file layer.h.


Constructor & Destructor Documentation

Layer::Layer  ) 
 

This constructor creates a Layer linked to no other nodes, with all status flags false, and NULL bounding and pasteboard rectangles.

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

Errors:

Definition at line 275 of file layer.cpp.

00275             : NodeRenderablePaper()
00276 { 
00277     // Set all layer flags to their defaults 
00278     Visible     = TRUE; 
00279     Locked      = FALSE; 
00280     Printable   = TRUE; 
00281     Background  = FALSE; 
00282     Outline     = FALSE;
00283     Guide       = FALSE;
00284     Active      = FALSE; 
00285 
00286     pGuideColour= NULL;
00287     pIndexedGuideColour = NULL;
00288 
00289     m_PageBackground = FALSE;
00290 
00291     // Frame related items
00292     m_Solid      = FALSE;
00293     m_Overlay    = FALSE;
00294     m_Edited     = FALSE;
00295     m_Frame      = FALSE;
00296     m_HiddenFrame   = FALSE;
00297     m_FrameDelay = 10;
00298 
00299     m_pReferencedBitmap = NULL; // DO NOT DELETE as it is a reference
00300 }                    

Layer::~Layer  ) 
 

Default destructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/10/95
Returns:
Errors:

Definition at line 313 of file layer.cpp.

00314 { 
00315     if (pGuideColour != NULL)
00316         delete pGuideColour;
00317 
00318     if (pIndexedGuideColour != NULL)
00319         delete pIndexedGuideColour;
00320 
00321     m_pReferencedBitmap = NULL; // DO NOT DELETE as it is a reference
00322 }                    

Layer::Layer Node ContextNode,
AttachNodeDirection  Direction,
const String_256 LayerID,
BOOL  NodeLocked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE
 

This method initialises the node and links it to ContextNode in the direction specified by Direction. All neccesary tree links are updated.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
Parameters:
ContextNode,: Pointer to a node which this node is to be attached to. [INPUTS]
Direction:

Specifies the direction in which this node is to be attached to the ContextNode. The values this variable can take are as follows:

PREV : Attach node as a previous sibling of the context node NEXT : Attach node as a next sibling of the context node FIRSTCHILD: Attach node as the first child of the context node LASTCHILD : Attach node as a last child of the context node

LayerID: String which uniquely identifies layer within the spread

The remaining inputs specify the status of the node:

Locked: Is node locked ? Mangled: Is node mangled ? Marked: Is node marked ? Selected: Is node selected ?

Parameters:
- [OUTPUTS]
Returns:
-

Errors: An assertion error will occur if ContextNode is NULL

Definition at line 373 of file layer.cpp.

00380                     : NodeRenderablePaper(ContextNode, Direction, NodeLocked, Mangled, 
00381                                     Marked, Selected)
00382 { 
00383     // Set all layer flags to their defaults 
00384     Visible     = TRUE; 
00385     Locked      = FALSE; 
00386     Printable   = TRUE; 
00387     Background  = FALSE; 
00388     Outline     = FALSE;
00389     Guide       = FALSE;
00390     Active      = FALSE; 
00391 
00392     m_PageBackground = FALSE;
00393 
00394     // Frame related flags
00395     m_Overlay       = FALSE;
00396     m_Solid         = FALSE;
00397     m_Edited        = FALSE;
00398     m_Frame         = FALSE;
00399     m_HiddenFrame   = FALSE;
00400     m_FrameDelay    = 10;
00401 
00402     m_pReferencedBitmap = NULL; // DO NOT DELETE as it is a reference
00403 
00404     pGuideColour    = NULL;
00405     pIndexedGuideColour = NULL;
00406 
00407     LayerSt.StringLayerID = LayerID; 
00408 }     


Member Function Documentation

BOOL Layer::AllowOp ObjChangeParam pParam,
BOOL  SetOpPermissionState = TRUE,
BOOL  DoPreTriggerEdit = TRUE
[virtual]
 

Layers will allow any op to happen to them, or to their children.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 20/01/2000
Date:
6/02/95
Parameters:
pParam = describes the way an op wants to change the node [INPUTS] SetOpPermissionState = if TRUE the Op permission state of this node will be set according to the outcome of the call DoPreTriggerEdit = layers and the nodes above them are not part of the stretching mechanism, and hence do not use this flag at all.
- [OUTPUTS]
Returns:
TRUE always!!
The main purpose for layers overriding this func is to ensure that layers become the top level node in the tree for the op permission mechanism, i.e. parents of layers (spreads, etc) shouldn't play a part.

This func will always return TRUE, and if 'SetOpPermissionState' is TRUE, the layer's op permission state will be set to PERMISSION_ALLOWED.

See also:
Node::AllowOp(),Node::GetOpPermission(),Node::SetOpPermission(),Layer::SetOpPermission()

Reimplemented from Node.

Definition at line 2554 of file layer.cpp.

02555 {
02556     if (SetOpPermissionState)
02557         SetOpPermission(PERMISSION_ALLOWED);
02558 
02559     return TRUE;
02560 }

BOOL Layer::BelongsToDocument Document pDoc  ) 
 

Checks to see if this layer belongs to the document, i.e. the node is part of the tree that is attached to the given document.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/8/94
Parameters:
pDoc = ptr to the document [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the layer belongs to the current document

Errors: -

See also:
-

Definition at line 1198 of file layer.cpp.

01199 {
01200     ENSURE(pDoc != NULL,"Get a NULL pDoc");
01201     if (pDoc == NULL) return FALSE;
01202 
01203     Node* pTreeStart = pDoc->GetFirstNode();
01204 
01205     ENSURE(pTreeStart != NULL,"This doc doesn't have a tree start node");
01206 
01207     Node* pNodeDoc     = pTreeStart->FindNext(CC_RUNTIME_CLASS(NodeDocument));
01208     Node* pThisNodeDoc = FindParent(CC_RUNTIME_CLASS(NodeDocument));
01209 
01210     ENSURE(pNodeDoc     != NULL,"This doc has no NodeDocument node");
01211     ENSURE(pThisNodeDoc != NULL,"This layer has no NodeDocument parent node");
01212 
01213     BOOL ok = ((pNodeDoc != NULL) && (pThisNodeDoc != NULL) && (pNodeDoc == pThisNodeDoc));
01214 
01215     if( !ok )
01216     {
01217         TRACEUSER( "MarkN", _T("-------\n"));
01218         TRACEUSER( "MarkN", _T("pDoc            = %ld 0x%p\n"),pDoc,pDoc);
01219         TRACEUSER( "MarkN", _T("pLayer          = %ld 0x%p\n"),this,this);
01220         TRACEUSER( "MarkN", _T("Layer's NodeDoc = %ld 0x%p\n"),pThisNodeDoc,pThisNodeDoc);
01221         TRACEUSER( "MarkN", _T("pDoc's  NodeDoc = %ld 0x%p\n"),pNodeDoc,pNodeDoc);
01222     }
01223 
01224     return (ok);
01225 }

BOOL Layer::CanWriteChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Determines if the layer should write out its contents in the native format.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/7/96
Parameters:
pFilter = ptr to the filter to write to [INPUTS]
- [OUTPUTS]
Returns:
TRUE if it's ok to write out the layer's children FALSE otherwise
Native files will not write out layers when: It's actually the cack compact format AND The user has selected "Remove invisible layers" AND The layer is invisible The layer is NOT a frame layer

See also:
WritePreChildrenNative()

Reimplemented from Node.

Definition at line 2884 of file layer.cpp.

02885 {
02886 #ifdef DO_EXPORT
02887 
02888     // if we are saving in the compact format, and
02889     // the user has selected to remove invisible layers & the layer is invisible,
02890     // then don't let the children go out
02891     if (pFilter->IsCompactNativeFilter())
02892     {
02893         // If user doesn't want visible layers, and it's not visible and it's not a animated GIF frame layer, don't bother
02894         if (pFilter->GetRemoveInvisibleLayers() && !IsVisible() && !IsFrame())
02895             return FALSE;
02896     }
02897 
02898     return Node::CanWriteChildrenNative(pFilter);
02899 #else
02900     return FALSE;
02901 #endif
02902 }

BOOL Layer::CanWriteChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Determines if the layer should write out its contents in the web format.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/7/96
Parameters:
pFilter = ptr to the filter to write to [INPUTS]
- [OUTPUTS]
Returns:
TRUE if it's ok to write out the layer's children FALSE otherwise
Web files will not write out the following types of layer: Invisible layers Layers than contain no renderable objects Guide layers

See also:
WritePreChildrenNative()

Reimplemented from Node.

Definition at line 2837 of file layer.cpp.

02838 {
02839 #ifdef DO_EXPORT
02840     // If not visible and not a animated GIF frame layer, don't bother
02841     if (!IsVisible() && !IsFrame())
02842         return FALSE;
02843 
02844     // If a guide layer, don't bother
02845     if (IsGuide())
02846         return FALSE;
02847 
02848     // If no renderable objects on the layer and not a animated GIF frame layer, don't bother
02849     if (!IsFrame())
02850     {
02851         DocRect Rect = GetBoundingRect();
02852         if (Rect.IsEmpty())
02853             return FALSE;
02854     }
02855 
02856     return TRUE;
02857 #else
02858     return FALSE;
02859 #endif
02860 }

void Layer::ColourChanged IndexedColour pChangedColour  ) 
 

Called when a colour has changed.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/10/95
Parameters:
pChangedColour = ptr to the colour that's just changed [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
ColourDeleted()

Definition at line 3218 of file layer.cpp.

03219 {
03220 // WEBSTER - markn 15/1/97
03221 // Don't need this in Webster
03222 #ifndef WEBSTER
03223 #if !defined(EXCLUDE_FROM_RALPH)
03224     if (pChangedColour == NULL || pGuideColour == NULL)
03225         return;
03226 
03227     IndexedColour* pColour = pGuideColour->FindParentIndexedColour();
03228 
03229     if (pChangedColour == pColour)
03230     {
03231         Document* pDoc = Document::GetCurrent();
03232         if (pDoc != NULL)
03233             LayerSGallery::ForceRedrawLayer(pDoc,this);
03234     }
03235 #endif
03236 #endif // WEBSTER
03237 }

void Layer::ColourDeleted  ) 
 

Called when a colour may have been deleted.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/10/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
ColourChanged()

Definition at line 3253 of file layer.cpp.

03254 {
03255 #if !defined(EXCLUDE_FROM_RALPH)
03256     if (pGuideColour != NULL)
03257     {
03258         IndexedColour* pIndexedColour = pGuideColour->FindParentIndexedColour();
03259 
03260         if (pIndexedColour != NULL && pIndexedColour->IsDeleted())
03261         {
03262             ColourGeneric ColGen;
03263             pIndexedColour->GetSourceColour(&ColGen);
03264             ColourModel Model = pIndexedColour->GetColourModel();
03265 
03266             IndexedColour* pNewColour = new IndexedColour(Model,&ColGen);
03267 
03268             SetGuideColour(pNewColour);
03269 //          Document* pDoc = Document::GetCurrent();
03270 //          if (pDoc != NULL)
03271 //              LayerSGallery::ForceRedrawLayer(pDoc,this);
03272         }
03273     }
03274 #endif
03275 }

void Layer::CopyNodeContents Layer NodeCopy  )  [protected]
 

This method copies the node's contents to the node pointed to by NodeCopy.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/8/94
Parameters:
NodeCopy = ptr to the layer node that needs to become a copy of this layer [INPUTS]
The layer at *NodeCopy is a identical copy of this layer [OUTPUTS]
Returns:
-

Errors: An assertion failure will occur if NodeCopy is NULL Scope: protected

Definition at line 737 of file layer.cpp.

00738 {
00739     // Ensure the pointer's not null
00740     ENSURE(NodeCopy != NULL,"Trying to copy a node's contents into a NULL node");  
00741 
00742     // Get immediate base class to copy its bits
00743     NodeRenderablePaper::CopyNodeContents(NodeCopy); 
00744 
00745     // Copy layer-specific stuff now.
00746     NodeCopy->LayerSt = LayerSt;
00747 
00748     NodeCopy->Active = Active;
00749     NodeCopy->Visible = Visible;
00750     NodeCopy->Locked = Locked;
00751     NodeCopy->Printable = Printable;
00752     NodeCopy->Background = Background;
00753     NodeCopy->Outline = Outline;
00754     NodeCopy->Guide = Guide;
00755 
00756     NodeCopy->Active = Active;
00757     NodeCopy->Visible = Visible;
00758     NodeCopy->Locked = Locked;
00759     NodeCopy->Printable = Printable;
00760     NodeCopy->Background = Background;
00761     NodeCopy->Outline = Outline;
00762     NodeCopy->Guide = Guide;
00763 
00764     // Copy across the useful frame related information
00765     NodeCopy->m_FrameDelay      = m_FrameDelay;
00766     NodeCopy->m_Overlay         = m_Overlay;
00767     NodeCopy->m_Solid           = m_Solid;
00768     NodeCopy->m_Frame           = m_Frame;
00769     NodeCopy->m_HiddenFrame     = m_HiddenFrame;
00770     NodeCopy->m_Edited          = m_Edited;
00771     NodeCopy->m_PageBackground  = m_PageBackground;
00772 }       

UINT32 Layer::CountNumWritableWebLayers BaseCamelotFilter pFilter  )  [virtual]
 

Counts how many layers are writable, as determined by Layer::CanWriteChildrenWeb().

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/8/96
Parameters:
pFilter = ptr to the filter to write to [INPUTS]
- [OUTPUTS]
Returns:
The number of layers that will be written in the web file
The count looks at all layers, including this one, in the spread to which this layer belongs

See also:
CanWriteChildrenWeb()

Definition at line 2696 of file layer.cpp.

02697 {
02698 #ifdef DO_EXPORT
02699 /*****************************************************
02700 See note in BOOL Layer::WritePreChildrenWeb(BaseCamelotFilter* pFilter) for 
02701 a reason why this code is commented out
02702 (markn 12/8/96)
02703 
02704     UINT32 WritableLayerCount = 0;
02705     Spread* pSpread = (Spread*)FindParent(CC_RUNTIME_CLASS(Spread));
02706     if (pSpread != NULL)
02707     {
02708         Layer* pLayer = pSpread->FindFirstLayer();
02709         while (pLayer != NULL)
02710         {
02711             if (pLayer->CanWriteChildrenWeb(pFilter))
02712                 WritableLayerCount++;
02713             pLayer = pLayer->FindNextLayer();
02714         }
02715     }
02716 
02717     return WritableLayerCount;
02718 ******************************************************/
02719 
02720     return 0;
02721 #else
02722     return 0;
02723 #endif
02724 }

Layer * Layer::CreateGuideLayer  )  [static]
 

This does everything required in creating a layer fit to be called the guide layer.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Ptr to a guide layer that's ready to be inserted into the tree
WEBSTER - markn - 15/1/97 Moved from OpGuideLine for WEBSTER purposes, but it should be in this class anyway
See also:
-

Definition at line 3294 of file layer.cpp.

03295 {
03296     Layer* pNewLayer = new Layer;
03297     if (pNewLayer != NULL)
03298     {
03299         String_256 LayerName(_R(IDS_GUIDESLAYERNAME));
03300 
03301         pNewLayer->SetVisible(TRUE); 
03302         pNewLayer->SetLocked(FALSE); 
03303         pNewLayer->SetPrintable(FALSE); 
03304 //      pNewLayer->SetBackground(TRUE);
03305         pNewLayer->SetBackground(FALSE);    // make sure Guides are in the "normal" foreground section
03306         pNewLayer->SetOutline(FALSE);
03307         pNewLayer->SetGuide(TRUE);
03308         pNewLayer->SetLayerID(LayerName); 
03309 
03310         Quality Qual;
03311         Qual.SetQuality(-1);
03312         QualityAttribute QualAttr(Qual);
03313         NodeAttribute* pNodeAttr = QualAttr.MakeNode();
03314         pNodeAttr->AttachNode(pNewLayer,FIRSTCHILD);
03315     }
03316 
03317     return pNewLayer;
03318 }

void Layer::Deinit void   )  [static]
 

Deinits the layer system. This deletes the layer message handler.

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

Errors:

Definition at line 248 of file layer.cpp.

00249 {
00250     if (pLayerMsgHandler != NULL)
00251     {
00252         delete pLayerMsgHandler;
00253         pLayerMsgHandler = NULL;
00254     }
00255 } 

String Layer::Describe BOOL  Plural,
BOOL  Verbose
[virtual]
 

To return a description of the Node object in either the singular or the plural. This method is called by the DescribeRange method.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/6/93
Parameters:
Plural,: Flag indicating if the string description should be plural or [INPUTS] singular.
- [OUTPUTS] Retuns: Description of the object
The description will always begin with a lower case letter.

Returns:
Errors: A resource exception will be thrown if a problem occurs when loading the string resource.
See also:
-

Reimplemented from Node.

Definition at line 644 of file layer.cpp.

00645 {     
00646     if (Plural)
00647         return(String(_R(IDS_LAYER_DESCRP)));  
00648     else
00649         return(String(_R(IDS_LAYER_DESCRS))); 
00650 }; 

void Layer::EnsureUniqueLayerID void   ) 
 

Ensures that the layers ID is unique amoung it's siblings. Call after the node is linked into the document tree.

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/04/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
Layer::SetLayerID

Definition at line 2603 of file layer.cpp.

02604 {
02605     // first, find the first sibling of this node
02606     Layer *pFirstSibling = this;
02607     Layer *pPrevious = NULL;
02608 
02609     while ((pPrevious = pFirstSibling->FindPrevLayer()) != NULL)
02610         pFirstSibling = pPrevious;
02611 
02612     // then run though checking to see if the name is unqiue.
02613     String_256 ID   = GetLayerID();
02614     INT32 Count     = 1;            // the count of the extra number to give the layer
02615     Layer *pExamine = NULL;
02616     BOOL Unique     = FALSE;
02617     BOOL Changed    = FALSE;        // whether the ID got changed
02618 
02619     do
02620     {
02621         // run through the siblings to find out if their ID match this one
02622         pExamine = pFirstSibling;
02623         Unique = TRUE;
02624         
02625         while (pExamine != NULL)
02626         {
02627             // don't fiddle with this layer
02628             if (pExamine != this)
02629             {
02630                 // OK, does it match?
02631                 Layer *pLayer = pExamine;
02632                 if (pLayer->GetLayerID() == ID)
02633                 {
02634                     // nope
02635                     Unique = FALSE;
02636                     break;
02637                 }
02638             }
02639 
02640             // next thing to look at...
02641             pExamine = pExamine->FindNextLayer();
02642         }
02643 
02644         // right then, is it unique?
02645         if (Unique == FALSE)
02646         {
02647             // munge up a new layer name
02648             Count++;
02649 
02650 // there is a problem here..
02651 // a) ralph has no string resources
02652 // b) MakeMsg has been bodged so that it never fails
02653 // the result is that ralph sits in this loop forever
02654 // ralph doesn't give a fig about layer names so just get out of here 
02655 #ifdef RALPH
02656             return;
02657 #endif
02658             UINT32 format_id = _R(IDT_LAYERNAMEUNIQUEFORM); // "#1%s (#2%d)" 
02659             // If its a frame then use a different form of unique formatter without the brackets
02660             if (IsFrame())
02661                 format_id = _R(IDS_FRAMENAMEUNIQUEFORM);            // "#1%s #2%d"
02662             
02663             if (ID.MakeMsg(format_id, (TCHAR *)GetLayerID(), Count) == 0)
02664                 return;     // error getting a string -- give up! (doesn't really matter as the only problem will be the user seeing two layers with the same name)
02665 
02666             Changed = TRUE;
02667 
02668             // and then try again...
02669         }
02670     
02671     } while (Unique == FALSE);
02672     
02673     // and if it needs to be changed, change it
02674     if (Changed)
02675         SetLayerID(ID);
02676 }

KernelBitmap * Layer::EnumerateBitmaps UINT32  Count  )  [virtual]
 

Find out what bitmaps, if any, are used by this node.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> based on Will code
Date:
7/5/97
Parameters:
Count - the bitmap to get (see Purpose). [INPUTS]
Returns:
The KernelBitmap in use by the node, or NULL if no more are used.
The base class returns NULL always, so you over-ride this in any node classes that use bitmaps.

This function supports nodes that use more than one bitmap - you call this function repeatedly and keep incrementing the Count parameter that you pass in each time by 1. You should stop calling it when it returns NULL, as this indicates that no more bitmaps are used by this node. Count should start off as 0 for the first call. Note that this function can (and often will) return NULL for the first call, as many nodes don't use bitmaps, obviously.

See also:
KernelBitmap

Reimplemented from Node.

Definition at line 2133 of file layer.cpp.

02134 {
02135     if (Count == 0) 
02136         return GetGeneratedBitmap();
02137 
02138     return NULL;
02139 }

BOOL Layer::ExportRender RenderRegion pRegion  )  [virtual]
 

Called after all child nodes are asked to export.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/10/95
Parameters:
pRegion = the render region to export to [INPUTS]
- [OUTPUTS]
Returns:
-

Reimplemented from Node.

Definition at line 2487 of file layer.cpp.

02488 {
02489 #ifdef DO_EXPORT
02490     // Can only export guide layers in Native format
02491     if (Guide && pRegion->IS_KIND_OF(NativeRenderRegion))
02492     {
02493         EPSExportDC *pDC = (EPSExportDC *) pRegion->GetRenderDC();
02494 
02495         pDC->OutputToken(_T("ceo"));
02496         pDC->OutputNewLine();
02497     }
02498 PORTNOTE("cmx", "Disabled CMXRenderRegion")
02499 #ifndef EXCLUDE_FROM_XARALX
02500     else if(pRegion->IsKindOf(CC_RUNTIME_CLASS(CMXRenderRegion)))
02501     {
02502         // mark start of a group...
02503         CMXExportDC *pDC = (CMXExportDC *) pRegion->GetRenderDC();
02504         pDC->EndLayer();
02505 
02506         return TRUE;
02507     }
02508 #endif
02509     // Graeme (11-4-00) - Added call to AIEPSRenderRegion to export layers in that format.
02510     else if ( pRegion->IsKindOf ( CC_RUNTIME_CLASS ( AIEPSRenderRegion ) ) )
02511     {
02512         // Cast the render region to get a reference to an AIEPSRenderRegion.
02513         AIEPSRenderRegion   *pAIEPS = static_cast<AIEPSRenderRegion*> ( pRegion );
02514 
02515         // Call the export method.
02516         pAIEPS->ExportLayer ( this );
02517 
02518         // Return TRUE to avoid calling the standard exporter code.
02519         return TRUE;
02520     }
02521 #endif
02522 
02523     return FALSE;
02524 }