KernelBitmapRef Class Reference

A reference to a KernelBitmap object. More...

#include <bitmap.h>

Inheritance diagram for KernelBitmapRef:

CCObject SimpleCCObject List of all members.

Public Member Functions

 KernelBitmapRef ()
 Constructor for kernel bitmap reference.
 ~KernelBitmapRef ()
 Destructor for kernel bitmap reference.
INT32 operator== (const KernelBitmapRef &)
KernelBitmapRefoperator= (KernelBitmapRef &)
 Make one bitmap ref the same as the other.
void Attach (KernelBitmap *, Document *Doc=NULL)
 Sets the bitmap that this object is referencing.
void Detach (BOOL bTryRemoveFromDoc=FALSE)
 Removes the reference to a bitmap.
void DeleteBmp ()
 Deletes the bitmap we are referencing.
void RemoveFromTree ()
 Called when the object containing this reference is removed from the document tree.
void AddtoTree ()
 Called when the object containing this reference is added to the document tree.
BOOL IsHidden ()
KernelBitmapGetBitmap ()
void SetBitmap (KernelBitmap *)
 Sets the reference to a bitmap.

Protected Attributes

KernelBitmapm_pTheBitmap
BOOL m_bHidden

Detailed Description

A reference to a KernelBitmap object.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94

Definition at line 650 of file bitmap.h.


Constructor & Destructor Documentation

KernelBitmapRef::KernelBitmapRef  ) 
 

Constructor for kernel bitmap reference.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Errors: -
See also:
-

Definition at line 3206 of file bitmap.cpp.

03207 {
03208     m_pTheBitmap = NULL;
03209     m_bHidden = FALSE;
03210 }

KernelBitmapRef::~KernelBitmapRef  ) 
 

Destructor for kernel bitmap reference.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Errors: -
See also:
-

Definition at line 3226 of file bitmap.cpp.

03227 {
03228     Detach();
03229 }


Member Function Documentation

void KernelBitmapRef::AddtoTree  ) 
 

Called when the object containing this reference is added to the document tree.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Errors: -
See also:
-

Definition at line 3496 of file bitmap.cpp.

03497 {
03498     if (m_pTheBitmap == NULL)
03499         return;
03500 
03501     TRACEUSER( "Neville", _T("Adding Bitmap Ref to tree\n") );
03502     m_bHidden = FALSE;
03503 
03504     m_pTheBitmap->Attach();
03505     BROADCAST_TO_ALL(BitmapListChangedMsg(m_pTheBitmap->GetParentBitmapList(), m_pTheBitmap));
03506 }

void KernelBitmapRef::Attach KernelBitmap NewBitmap,
Document BitmapDoc = NULL
 

Sets the bitmap that this object is referencing.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
NewBitmap Source kernel bitmap [INPUTS] BitmapDoc Destination document (Defaults to NULL)
- [OUTPUTS]
Returns:
Errors: -
See also:
-

Definition at line 3266 of file bitmap.cpp.

03267 {
03268     if (NewBitmap == NULL)
03269     {
03270         // No bitmap specified, so lets just create a default one.
03271         NewBitmap = KernelBitmap::MakeKernelBitmap();
03272     }
03273 
03274     ERROR3IF(NewBitmap == NULL, "Trying to attach NULL bitmap to bitmap ref");
03275     if (NewBitmap == NULL)
03276         return;
03277 
03278     Detach(TRUE);
03279 
03280     ERROR3IF(IsHidden(), "Attaching a bitmap to a Hidden node, in KernelBitmapRef::Attach");
03281 
03282 #if !defined(EXCLUDE_FROM_RALPH)
03283     if (InternalClipboard::CopyInProgress())
03284     {
03285         // Bit of a bodge this !!
03286         // If there is a clipboard copy op in progress, 
03287         // then we won't try and attach this to any lists.
03288 
03289         // Neville 12/8/97
03290         // Unfortunately, this leads to a memory leak for each bitmap that is copied
03291         // to the clipboard. At this point BitmapDoc is NULL and current doc is set to
03292         // the source doc. Hence, we cannot use the proper code and add it to the clipboard's
03293         // bitmap list.
03294 
03295         NewBitmap = new KernelBitmap(NewBitmap->ActualBitmap);
03296         TRACEUSER( "Neville", _T("ClipBoard Bmp at %x\n"), NewBitmap );
03297         m_pTheBitmap = NewBitmap;
03298         return;
03299     }
03300 #endif
03301 
03302     // Whenever we attach or re-attach to the document bitmap list
03303     // we need to ensure that we have valid bitmap data
03304     NewBitmap->GetActualBitmap()->RebuildXPEBitmap();
03305 
03306     if (BitmapDoc == NULL)
03307         BitmapDoc = Document::GetCurrent();
03308 
03309     if (BitmapDoc == NULL)
03310         BitmapDoc = Document::GetSelected();
03311 
03312     BitmapList* ExistingList = NewBitmap->GetParentBitmapList();
03313 
03314     if (ExistingList == NULL || ExistingList->GetParentDocument() != BitmapDoc)
03315     {
03316         // Either the bitmap is not in a list at all, or it's in a list
03317         // in another document.  So ...
03318 
03319 PORTNOTE("other","Removed IXMLDOMDocumentPtr usage")
03320 #ifndef EXCLUDE_FROM_XARALX
03321         IXMLDOMDocumentPtr pEditInfo = NULL;
03322 //      KernelBitmap* pMasterBitmap = NULL;
03323         KernelBitmap* pNewMasterBitmap = NULL;
03324 //      NewBitmap->GetXPEInfo(pMasterBitmap, pEditInfo);
03325         // Can't call KernelBitmap->GetXPEInfo because it searches for a Master bitmap in the doc list
03326         // that matches the oil master bitmap. But here we know that that will always fail
03327         OILBitmap* pMasterOil = NULL;
03328         NewBitmap->ActualBitmap->GetXPEInfo(pMasterOil, pEditInfo);
03329         if (pMasterOil!=NULL && pEditInfo!=NULL)
03330         {
03331             // Need to copy the Master into the new doc as well!
03332             // ... we'll have to make a copy to attach to this document's list
03333             pNewMasterBitmap = KernelBitmap::MakeKernelBitmap(pMasterOil, BitmapDoc);
03334 
03335             // Get the bitmap list from the document
03336             BitmapList* BmpList = NULL;
03337             if (BitmapDoc)
03338                 BmpList = BitmapDoc->GetBitmapList();
03339 
03340             // and then attach the bitmap (doesn't matter if BmpList is NULL)
03341             pNewMasterBitmap->Attach(BmpList);
03342         }
03343 #endif
03344 
03345         //------------------------------------
03346         // ... we'll have to make a copy to attach to this document's list
03347         NewBitmap = KernelBitmap::MakeKernelBitmap(NewBitmap->ActualBitmap, BitmapDoc);
03348 
03349         // Get the bitmap list from the document
03350         BitmapList* BmpList = NULL;
03351 
03352         if (BitmapDoc)
03353             BmpList = BitmapDoc->GetBitmapList();
03354 
03355         // and then attach the bitmap (doesn't matter if BmpList is NULL)
03356         NewBitmap->Attach(BmpList);
03357         //------------------------------------
03358 
03359 
03360         // Make sure the new bitmap refers to the new master...
03361 PORTNOTE("other","Removed XPEInfo usage")
03362 #ifndef EXCLUDE_FROM_XARALX
03363         if (pNewMasterBitmap)
03364         {
03365             NewBitmap->SetXPEInfo(pNewMasterBitmap, pEditInfo);
03366         }
03367 #endif
03368     }
03369 
03370     // Remember the bitmap pointer
03371     m_pTheBitmap = NewBitmap;
03372 }

void KernelBitmapRef::DeleteBmp  ) 
 

Deletes the bitmap we are referencing.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/01/97
Parameters:
- [INPUTS]
- [OUTPUTS]

Definition at line 3445 of file bitmap.cpp.

03446 {
03447     if (m_pTheBitmap!=NULL)
03448     {
03449         delete m_pTheBitmap;
03450         m_pTheBitmap=NULL;
03451     }
03452 }

void KernelBitmapRef::Detach BOOL  bTryRemoveFromDoc = FALSE  ) 
 

Removes the reference to a bitmap.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Errors: -
See also:
-

Definition at line 3410 of file bitmap.cpp.

03411 {
03412     if (bTryRemoveFromDoc)
03413     {
03414         KernelBitmap* tempBitmap = m_pTheBitmap;
03415         Document* pBitmapDoc = NULL;
03416 
03417         pBitmapDoc = Document::GetCurrent();
03418         if (pBitmapDoc == NULL)
03419             pBitmapDoc = Document::GetSelected();
03420 
03421         m_pTheBitmap = NULL;
03422 
03423         if (tempBitmap && pBitmapDoc && !tempBitmap->IsUsedInDocument(pBitmapDoc))
03424         {
03425             tempBitmap->Detach();
03426             BROADCAST_TO_ALL(BitmapListChangedMsg(tempBitmap->GetParentBitmapList(), tempBitmap));
03427         }
03428     }
03429     else
03430         m_pTheBitmap = NULL;
03431 }

KernelBitmap* KernelBitmapRef::GetBitmap  )  [inline]
 

Definition at line 669 of file bitmap.h.

00669 { return m_pTheBitmap; }

BOOL KernelBitmapRef::IsHidden  )  [inline]
 

Definition at line 667 of file bitmap.h.

00667 { return m_bHidden; }

KernelBitmapRef & KernelBitmapRef::operator= KernelBitmapRef OtherBitmap  ) 
 

Make one bitmap ref the same as the other.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Errors: -
See also:
-

Definition at line 3245 of file bitmap.cpp.

03246 {
03247     Attach(OtherBitmap.GetBitmap());
03248     return (*this);
03249 }

INT32 KernelBitmapRef::operator== const KernelBitmapRef  ) 
 

void KernelBitmapRef::RemoveFromTree  ) 
 

Called when the object containing this reference is removed from the document tree.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Errors: -
See also:
-

Definition at line 3469 of file bitmap.cpp.

03470 {
03471     if (m_pTheBitmap == NULL)
03472         return;
03473 
03474     TRACEUSER( "Neville", _T("Removing Bitmap Ref from tree\n") );
03475     m_bHidden = TRUE;
03476 
03477     m_pTheBitmap->Detach();
03478     BROADCAST_TO_ALL(BitmapListChangedMsg(m_pTheBitmap->GetParentBitmapList(), m_pTheBitmap));
03479 }

void KernelBitmapRef::SetBitmap KernelBitmap NewBmp  ) 
 

Sets the reference to a bitmap.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Errors: -
See also:
-

Definition at line 3388 of file bitmap.cpp.

03389 {
03390 //  ERROR3IF(m_pTheBitmap != NULL, "Warning, overwriting bitmap ref in KernelBitmapRef::SetBitmap");
03391     
03392     // Remember the bitmap pointer
03393     m_pTheBitmap = NewBmp;
03394 }


Member Data Documentation

BOOL KernelBitmapRef::m_bHidden [protected]
 

Definition at line 675 of file bitmap.h.

KernelBitmap* KernelBitmapRef::m_pTheBitmap [protected]
 

Definition at line 673 of file bitmap.h.


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