PrintMarkItem Class Reference

The PrintMarkItem contains details about this print mark. It holds the mark type, formatting information and a pointer to a subtree of objects which represent the mark. It also contains various bits of information used by Camelots UI to present the mark to the user. More...

#include <prnmks.h>

Inheritance diagram for PrintMarkItem:

ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 PrintMarkItem ()
 Construct a new print mark item.
 ~PrintMarkItem ()
 destruct a print mark item
NodeGroupGetMarkGlyph () const
UINT32 GetHandle () const
PrintMarkGetPrintMark ()
INT32 GetWidth () const
INT32 GetHeight () const
DocCoord GetOrigin () const
MarkOrient GetOrient () const
BOOL DefaultsToOn () const
BOOL NeedsSaving () const
BOOL NeedsToRender () const

Private Member Functions

 CC_DECLARE_DYNCREATE (PrintMarkItem)
void RemoveMark ()
 Remove the cached mark from our list structure. This is generally called when the mark item is destroyed.
void SetType (MarkType type)
void SetHandle (UINT32 hndle)
BOOL SetMarkGlyph (NodeGroup *pMark, BOOL MakeCopy=FALSE)
 Cache a print mark in this print mark item. The mark pointer should be a group held in the document tree. As we attempt to make attributes complete on this group, it has to be in the tree. MakeCopy which defaults to FALSE will, when TRUE, copy the entire group and used the copy, hence it will leave the document unaffected. When FALSE the group will be extracted from the tree. This is only acceptable in a few circumstances when undo is not being generated.
void SetSaveable (BOOL state)
void SetRenderable (BOOL state)

Private Attributes

UINT32 Handle
PrintMark Mark
NodeGrouppMarkGlyph
BOOL Saveable
BOOL Renderable

Friends

class PrintMarksCache

Detailed Description

The PrintMarkItem contains details about this print mark. It holds the mark type, formatting information and a pointer to a subtree of objects which represent the mark. It also contains various bits of information used by Camelots UI to present the mark to the user.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/07/96

Definition at line 345 of file prnmks.h.


Constructor & Destructor Documentation

PrintMarkItem::PrintMarkItem  ) 
 

Construct a new print mark item.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/07/96

Definition at line 492 of file prnmks.cpp.

00493 {
00494     pMarkGlyph  = NULL;
00495     Handle      = 0;
00496     Saveable    = TRUE;
00497     Renderable  = TRUE;
00498 }

PrintMarkItem::~PrintMarkItem  ) 
 

destruct a print mark item

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/07/96

Definition at line 511 of file prnmks.cpp.

00512 {
00513     RemoveMark();
00514 }


Member Function Documentation

PrintMarkItem::CC_DECLARE_DYNCREATE PrintMarkItem   )  [private]
 

BOOL PrintMarkItem::DefaultsToOn  )  const
 

Definition at line 671 of file prnmks.cpp.

00672 {
00673     return Mark.DefaultsToOn();
00674 }

UINT32 PrintMarkItem::GetHandle  )  const [inline]
 

Definition at line 356 of file prnmks.h.

00356 { return Handle; }

INT32 PrintMarkItem::GetHeight  )  const
 

Definition at line 644 of file prnmks.cpp.

00645 {
00646     if (pMarkGlyph!=NULL)
00647     {
00648         DocRect bounds = pMarkGlyph->GetBoundingRect();
00649         return bounds.Height();
00650     }
00651     return 0;
00652 }

NodeGroup* PrintMarkItem::GetMarkGlyph  )  const [inline]
 

Definition at line 355 of file prnmks.h.

00355 { return pMarkGlyph; }

MarkOrient PrintMarkItem::GetOrient  )  const
 

Definition at line 665 of file prnmks.cpp.

00666 {
00667     return Mark.GetOrientation();
00668 }

DocCoord PrintMarkItem::GetOrigin  )  const
 

Definition at line 654 of file prnmks.cpp.

00655 {
00656     if (pMarkGlyph!=NULL)
00657     {
00658         DocRect bounds = pMarkGlyph->GetBoundingRect();
00659         return bounds.lo;
00660     }
00661     return DocCoord(0,0);
00662 }

PrintMark* PrintMarkItem::GetPrintMark  )  [inline]
 

Definition at line 357 of file prnmks.h.

00357 { return &Mark; }

INT32 PrintMarkItem::GetWidth  )  const
 

Definition at line 634 of file prnmks.cpp.

00635 {
00636     if (pMarkGlyph!=NULL)
00637     {
00638         DocRect bounds = pMarkGlyph->GetBoundingRect();
00639         return bounds.Width();
00640     }
00641     return 0;
00642 }

BOOL PrintMarkItem::NeedsSaving  )  const
 

Definition at line 677 of file prnmks.cpp.

00678 {
00679     return Saveable;
00680 }

BOOL PrintMarkItem::NeedsToRender  )  const
 

Definition at line 688 of file prnmks.cpp.

00689 {
00690     return Renderable;
00691 }

void PrintMarkItem::RemoveMark  )  [private]
 

Remove the cached mark from our list structure. This is generally called when the mark item is destroyed.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/07/96

Definition at line 620 of file prnmks.cpp.

00621 {
00622     // check to see if we have a sub tree here
00623     if (pMarkGlyph!=NULL)
00624     {
00625         Node* pNode = pMarkGlyph->FindFirstChild();
00626         if (pNode!=NULL)
00627             pMarkGlyph->DeleteChildren(pNode);
00628     }
00629     delete pMarkGlyph;
00630     pMarkGlyph = NULL;
00631 }

void PrintMarkItem::SetHandle UINT32  hndle  )  [inline, private]
 

Definition at line 370 of file prnmks.h.

00370 { Handle=hndle; }

BOOL PrintMarkItem::SetMarkGlyph NodeGroup pNewMark,
BOOL  MakeCopy = FALSE
[private]
 

Cache a print mark in this print mark item. The mark pointer should be a group held in the document tree. As we attempt to make attributes complete on this group, it has to be in the tree. MakeCopy which defaults to FALSE will, when TRUE, copy the entire group and used the copy, hence it will leave the document unaffected. When FALSE the group will be extracted from the tree. This is only acceptable in a few circumstances when undo is not being generated.

BOOL PrintMarkItem::SetMarkGlyph(NodeGroup* pNewMark, BOOL MakeCopy=FALSE)

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/07/96
Parameters:
pNewMark = A pointer to a group node containing the mark. [INPUTS] The node should still be in the tree. MakeCopy = TRUE, the mark will be left where it is and an attribute complete copy will be made. FALSE, the mark will be extracted from the document as is.

Definition at line 540 of file prnmks.cpp.

00541 {
00542     ERROR2IF(pNewMark==NULL,FALSE, "NULL mark pointer passed to SetMark");
00543 
00544     if (MakeCopy)
00545     {
00546         NodeGroup* pNewGroup = new NodeGroup;
00547         if (pNewGroup==NULL)
00548             return FALSE;
00549 
00550         NodeGroup* pNewGroup1 = new NodeGroup;
00551         if (pNewGroup1==NULL)
00552         {
00553             delete pNewGroup;
00554             return FALSE;
00555         }
00556         
00557         // attach this new group to the tree
00558         pNewGroup->AttachNode(pNewMark,NEXT);
00559         pNewGroup1->AttachNode(pNewGroup,FIRSTCHILD);
00560 
00561         // copy the children across to this new group
00562         if (!pNewMark->CopyChildrenTo(pNewGroup1))
00563         {
00564             // CascadeDelete unlinks the node from the tree so don't panic.
00565             pNewGroup->CascadeDelete();
00566             delete pNewGroup;
00567             return FALSE;
00568         }
00569 
00570         // make sure we have all the attributes we're gonna need
00571         if (!pNewGroup->MakeAttributeComplete(NULL,TRUE,NULL,TRUE))
00572         {
00573             pNewGroup->CascadeDelete();
00574             delete pNewGroup;
00575             return FALSE;
00576         }
00577 
00578         // dump the tree out
00579         //TRACEUSER( "Mike", _T("Dumping subtree contents\n\n"));
00580         //DebugTreeDlg::DumpSubTree(pNewGroup);
00581         
00582         // rip the node out of the tree and stick it in our cache.
00583         pNewGroup->UnlinkNodeFromTree();
00584                 
00585         // Make sure we get rid of any previously cached mark
00586         if (pMarkGlyph!=NULL)
00587             RemoveMark();
00588 
00589         pMarkGlyph = pNewGroup;
00590     }
00591     else
00592     {
00593         if (!pNewMark->MakeAttributeComplete(NULL,TRUE,NULL,TRUE))
00594             return FALSE;
00595 
00596         pNewMark->UnlinkNodeFromTree();
00597                 
00598         // Make sure we get rid of any previously cached mark
00599         if (pMarkGlyph!=NULL)
00600             RemoveMark();
00601 
00602         pMarkGlyph = pNewMark;
00603     }
00604 
00605     return TRUE;
00606 }

void PrintMarkItem::SetRenderable BOOL  state  )  [private]
 

Definition at line 693 of file prnmks.cpp.

00694 {
00695     Renderable = renderstate;
00696 }

void PrintMarkItem::SetSaveable BOOL  state  )  [private]
 

Definition at line 683 of file prnmks.cpp.

00684 {
00685     Saveable = savestate;
00686 }

void PrintMarkItem::SetType MarkType  type  )  [inline, private]
 

Definition at line 369 of file prnmks.h.

00369 { Mark.SetType(type); }


Friends And Related Function Documentation

friend class PrintMarksCache [friend]
 

Definition at line 349 of file prnmks.h.


Member Data Documentation

UINT32 PrintMarkItem::Handle [private]
 

Definition at line 376 of file prnmks.h.

PrintMark PrintMarkItem::Mark [private]
 

Definition at line 377 of file prnmks.h.

NodeGroup* PrintMarkItem::pMarkGlyph [private]
 

Definition at line 378 of file prnmks.h.

BOOL PrintMarkItem::Renderable [private]
 

Definition at line 380 of file prnmks.h.

BOOL PrintMarkItem::Saveable [private]
 

Definition at line 379 of file prnmks.h.


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