home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 23.6 KB | 783 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWPxyFrm.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWFrameW.hpp"
-
- #ifndef FWPXYFRM_H
- #include "FWPxyFrm.h"
- #endif
-
- #ifndef FWPARTNG_H
- #include "FWPartng.h"
- #endif
-
- #ifndef FWFRMING_H
- #include "FWFrming.h"
- #endif
-
- #ifndef FWPROXY_H
- #include "FWProxy.h"
- #endif
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- #ifndef FWCLNINF_H
- #include "FWClnInf.h"
- #endif
-
- #ifndef FWPXYITE_H
- #include "FWPxyIte.h"
- #endif
-
- // ----- OS Layer -----
-
- #ifndef FWBARRAY_H
- #include "FWBArray.h"
- #endif
-
- #ifndef FWGRUTIL_H
- #include "FWGrUtil.h"
- #endif
-
- #ifndef FWODGEOM_H
- #include "FWODGeom.h"
- #endif
-
- // ----- Foundation Layer -----
-
- #ifndef FWSOMENV_H
- #include "FWSOMEnv.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_ODFrame_xh
- #include <Frame.xh>
- #endif
-
- #ifndef SOM_ODFacet_xh
- #include <Facet.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdProps_defined
- #include <StdProps.xh>
- #endif
-
- #ifndef SOM_ODStorageUnitView_xh
- #include <SUView.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdTypes_defined
- #include <StdTypes.xh>
- #endif
-
- #ifndef SOM_ODEmbeddedFramesIterator_xh
- #include <EmbFrItr.xh>
- #endif
-
- #ifndef SOM_ODTransform_xh
- #include <Trnsform.xh>
- #endif
-
- #ifndef SOM_ODDraft_xh
- #include <Draft.xh>
- #endif
-
- //========================================================================================
- // RunTime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment fw_embedding2
- #endif
-
-
- //========================================================================================
- // Template Instantiations
- //========================================================================================
-
- FW_DEFINE_AUTO_TEMPLATE(FW_TOrderedCollectionIterator, FW_CProxyFrame)
- FW_DEFINE_AUTO_TEMPLATE(FW_TOrderedCollection, FW_CProxyFrame)
-
- #ifdef FW_USE_TEMPLATE_PRAGMAS
-
- #pragma template_access public
- #pragma template FW_TOrderedCollection<FW_CProxyFrame>
- #pragma template FW_TOrderedCollectionIterator<FW_CProxyFrame>
-
- #endif
-
- //========================================================================================
- // class FW_CProxyFrame
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::FW_CProxyFrame
- //----------------------------------------------------------------------------------------
-
- FW_CProxyFrame::FW_CProxyFrame(Environment* ev,
- FW_MProxy* proxy,
- FW_CEmbeddingPart* part) :
- fPart(part),
- fProxy(proxy),
- fFrameID(kODNULLID),
- fContainingFrameID(kODNULLID),
- fEmbeddedFrame(NULL),
- fPurgeable(FALSE),
- fHasBeenInstantiated(FALSE),
- fAttached(TRUE),
- fFrameDraft(NULL),
- fWasInLimbo(FALSE),
- fWasDragged(FALSE),
- fFacetCount(0),
- fHighlight(kODNoHighlight),
- fLinkStatus(kODNotInLink)
- {
- FW_UNUSED(ev);
- FW_ASSERT(fPart != NULL);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::FW_CProxyFrame
- //----------------------------------------------------------------------------------------
-
- FW_CProxyFrame::FW_CProxyFrame(Environment* ev,
- FW_MProxy* proxy,
- FW_CEmbeddingPart* part,
- FW_CEmbeddingFrame* containingFrame,
- ODFrame* embeddedFrame,
- FW_Boolean wasInLimbo) :
- fPart(part),
- fProxy(proxy),
- fFrameID(kODNULLID),
- fContainingFrameID(kODNULLID),
- fEmbeddedFrame(embeddedFrame),
- fPurgeable(FALSE),
- fHasBeenInstantiated(TRUE),
- fAttached(TRUE),
- fFrameDraft(NULL),
- fWasInLimbo(wasInLimbo),
- fWasDragged(FALSE),
- fFacetCount(0),
- fHighlight(kODNoHighlight),
- fLinkStatus(kODNotInLink)
- {
- FW_ASSERT(fPart != NULL);
- FW_ASSERT(fProxy != NULL);
- FW_ASSERT(containingFrame != NULL);
- FW_ASSERT(fEmbeddedFrame != NULL);
- FW_ASSERT(containingFrame->GetPart(ev) == part);
-
- fEmbeddedFrame->Acquire(ev);
- fFrameID = fEmbeddedFrame->GetID(ev);
-
- // ----- Save embedded frame's draft if persistent frame
- ODStorageUnit* frameSU = fEmbeddedFrame->GetStorageUnit(ev);
- if (frameSU != NULL)
- fFrameDraft = frameSU->GetDraft(ev);
-
- fContainingFrameID = containingFrame->GetID(ev);
-
- #ifdef FW_DEBUG
- {
- FW_CAcquiredODFrame aqContainingFrame = embeddedFrame->AcquireContainingFrame(ev);
- FW_ASSERT(aqContainingFrame == containingFrame->GetODFrame(ev));
- }
- #endif
-
- // ----- If the frame was in Limbo -----
- embeddedFrame->SetInLimbo(ev, FALSE);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::~FW_CProxyFrame
- //----------------------------------------------------------------------------------------
-
- FW_CProxyFrame::~FW_CProxyFrame()
- {
- // [HLX] Need a try block
- if (fEmbeddedFrame)
- {
- FW_SOMEnvironment ev;
- if (!FW_IsInLimbo(ev, fEmbeddedFrame)) // [HLX] do not call ODFrame::IsInLimbo. see FW_IsInLimbo
- fEmbeddedFrame->Release(ev);
- else
- {
- // If the embedded frame doesn't have fContainingFrameID as containing frame then
- // doesn't remove
- FW_CAcquiredODFrame embeddingFrame = fEmbeddedFrame->AcquireContainingFrame(ev);
- if (embeddingFrame == NULL || embeddingFrame->GetID(ev) == fContainingFrameID)
- {
- if (fWasInLimbo)
- fEmbeddedFrame->Release(ev);
- else
- fEmbeddedFrame->Remove(ev);
- }
- else
- fEmbeddedFrame->Release(ev);
- }
- }
- FW_ASSERT(fFacetCount == 0);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::GetContainingFrame
- //----------------------------------------------------------------------------------------
- // GetContainingFrame returns null if the containing frame of this proxyframe is not a valid
- // display frame
-
- FW_CEmbeddingFrame* FW_CProxyFrame::GetContainingFrame(Environment* ev) const
- {
- FW_CProxyFrame* self = (FW_CProxyFrame*)this;
-
- if (fPart->IsValidDisplayFrame(ev, fContainingFrameID))
- {
- FW_CAcquiredODFrame aqContainingODFrame = fPart->GetDraft(ev)->AcquireFrame(ev, fContainingFrameID);
-
- FW_CEmbeddingFrame* containingFrame = FW_CEmbeddingFrame::ODtoFWEmbeddingFrame(ev, aqContainingODFrame);
- FW_ASSERT(containingFrame != NULL);
-
- return containingFrame;
- }
-
- return NULL;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::GetFrame
- //----------------------------------------------------------------------------------------
-
- ODFrame* FW_CProxyFrame::GetFrame(Environment* ev) const
- {
- if (fEmbeddedFrame == NULL)
- {
- FW_ASSERT(fFrameDraft != NULL);
-
- FW_CProxyFrame* self = (FW_CProxyFrame*)this;
-
- self->fEmbeddedFrame = fFrameDraft->AcquireFrame(ev, fFrameID);
- self->fHasBeenInstantiated = TRUE;
-
- if (fAttached)
- {
- fEmbeddedFrame->SetInLimbo(ev, FALSE); // Just in case
-
- if (!this->IsOrphan(ev))
- this->PrivChangeLinkStatus(ev);
- }
-
- FW_ASSERT(fEmbeddedFrame != NULL);
- }
-
- return fEmbeddedFrame;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::SetPurgeable
- //----------------------------------------------------------------------------------------
-
- void FW_CProxyFrame::SetPurgeable(Environment* ev, FW_Boolean purgeable)
- {
- if (fPurgeable == purgeable)
- return;
-
- fPurgeable = purgeable;
-
- if (!fPurgeable)
- {
- GetFrame(ev); // to be sure that the frame is in memory
-
- // ----- Create facets for the new frame if they have been purged -----
- FW_ASSERT(fPart->IsValidDisplayFrame(ev, fContainingFrameID));
- CreateAllFacets(ev); // Will test if needs facets
- }
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::PrivClose
- //----------------------------------------------------------------------------------------
-
- void FW_CProxyFrame::PrivClose(Environment* ev)
- {
- if (fHasBeenInstantiated)
- {
- GetFrame(ev); // So we are sure it is in memory
- FW_ASSERT(fEmbeddedFrame);
- fEmbeddedFrame->Close(ev); // Will call release
- }
-
- fEmbeddedFrame = NULL;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::Release
- //----------------------------------------------------------------------------------------
-
- void FW_CProxyFrame::Release(Environment* ev)
- {
- if (fEmbeddedFrame != NULL)
- fEmbeddedFrame->Release(ev);
- fEmbeddedFrame = NULL;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::Purge
- //----------------------------------------------------------------------------------------
-
- ODSize FW_CProxyFrame::Purge(Environment* ev)
- {
- if (!IsFrameInMemory(ev))
- return 0; // already gone
-
- // [HLX] I am not sure about that. If purge is called in a middle of a drag&drop I
- // may not be the owner of this frame anymore ????
- FW_CAcquiredODFrame aqODContainingFrame = fEmbeddedFrame->AcquireContainingFrame(ev);
- FW_CAcquiredODPart aqODContainingPart = aqODContainingFrame->AcquirePart(ev);
- if (aqODContainingPart != fPart->GetODPart(ev))
- fPurgeable = FALSE;
-
- if (fPurgeable)
- {
- // ----- Remove its facets
- FW_ASSERT(fPart->IsValidDisplayFrame(ev, fContainingFrameID));
- this->RemoveAllFacets(ev);
-
- // ----- Now I can release the frame
- Release(ev);
-
- return 1;
- }
-
- return 0;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::InternalizeProxyFrame
- //----------------------------------------------------------------------------------------
- // returns true if valid
-
- FW_Boolean FW_CProxyFrame::InternalizeProxyFrame(Environment* ev, ODStorageUnitView* suView, FW_CCloneInfo* cloneInfo)
- {
- ODStorageUnitRef aSURef;
- FW_CByteArray byteArray;
-
- // ----- Read reference -----
- suView->GetValue(ev, sizeof(ODStorageUnitRef), byteArray);
- byteArray.CopyBuffer(&aSURef, sizeof(ODStorageUnitRef));
-
- if (!suView->IsValidStorageUnitRef(ev, aSURef))
- return FALSE;
-
- ODStorageUnitID fromFrameID = suView->GetIDFromStorageUnitRef(ev, aSURef);
-
- if (cloneInfo != NULL)
- {
- // ----- We are cloning -----
- fFrameID = cloneInfo->Clone(ev, fromFrameID, 0, 0);
- fFrameDraft = cloneInfo->GetToDraft(ev);
-
- fContainingFrameID = cloneInfo->GetScopeFrame(ev)->GetID(ev);
- }
- else
- {
- // ----- Save the frame's draft
- fFrameDraft = suView->GetStorageUnit(ev)->GetDraft(ev);
-
- // ----- Cache the id of the containing frame -----
- FW_CAcquiredODStorageUnit aqFrameSU = fFrameDraft->AcquireStorageUnit(ev, fromFrameID);
- aqFrameSU->Focus(ev, kODPropContainingFrame, kODPosUndefined, kODWeakStorageUnitRef, 0, kODPosUndefined);
-
- aqFrameSU->GetValue(ev, sizeof(ODStorageUnitRef), byteArray);
- byteArray.CopyBuffer(&aSURef, sizeof(ODStorageUnitRef));
-
- if (aqFrameSU->IsValidStorageUnitRef(ev, aSURef))
- fContainingFrameID = aqFrameSU->GetIDFromStorageUnitRef(ev, aSURef);
- else
- fContainingFrameID = kODNULLID;
-
- // ----- Now we can set the frame ID -----
- fFrameID = fromFrameID;
- }
-
- return TRUE;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::ExternalizeProxyFrame
- //----------------------------------------------------------------------------------------
-
- FW_Boolean FW_CProxyFrame::ExternalizeProxyFrame(Environment* ev, ODStorageUnitView* suView, FW_CCloneInfo* cloneInfo)
- {
- FW_ASSERT(fPart->IsValidDisplayFrame(ev, fContainingFrameID));
-
- // We only externalize frame that have a persistent containing Frame
- FW_Boolean externalize = GetContainingFrame(ev)->IsPersistent(ev);
-
- ODStorageUnitID frameID = fFrameID;
-
- if (cloneInfo != NULL)
- {
- if (cloneInfo->GetScopeFrame(ev) != NULL)
- externalize = (cloneInfo->GetScopeFrame(ev)->GetID(ev) == fContainingFrameID);
-
- if (externalize)
- frameID = cloneInfo->Clone(ev, fFrameID, 0, fFrameID);
- }
-
- if (externalize)
- {
- // ----- Write out the embedded frame reference -----
- ODStorageUnitRef aSURef;
- FW_CByteArray byteArray(&aSURef, sizeof(ODStorageUnitRef));
- suView->GetStrongStorageUnitRef(ev, frameID, aSURef);
- suView->SetValue(ev, byteArray);
- }
-
- return externalize;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::SetProxy
- //----------------------------------------------------------------------------------------
-
- void FW_CProxyFrame::SetProxy(Environment* ev, FW_MProxy* proxy)
- {
- FW_UNUSED(ev);
- FW_ASSERT(fProxy == NULL || proxy == NULL || fProxy == proxy);
- fProxy = proxy;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::SetContainingFrame
- //----------------------------------------------------------------------------------------
- // We can't change the containing frame is this proxyframe is not orphaned
-
- void FW_CProxyFrame::SetContainingFrame(Environment* ev, FW_CEmbeddingFrame* containingFrame)
- {
- FW_ASSERT(IsOrphan(ev));
- ODFrame* embeddedFrame = GetFrame(ev); // Need to bring it into memory
-
- embeddedFrame->SetContainingFrame(ev, containingFrame->GetODFrame(ev));
- fContainingFrameID = containingFrame->GetID(ev);
-
-
- // Not safe to set link status before we have a containing frame, so do it now.
- if (this->IsAttached(ev))
- this->PrivChangeLinkStatus(ev);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::PrivAttach
- //----------------------------------------------------------------------------------------
-
- void FW_CProxyFrame::PrivAttach(Environment* ev)
- {
- FW_CEmbeddingFrame* embeddingFrame = GetContainingFrame(ev);
- if (embeddingFrame != NULL && !fAttached)
- {
- // [HLX] I have to load the frame. Is this a problem?
- ODFrame* odEmbeddedFrame = GetFrame(ev);
-
- odEmbeddedFrame->SetContainingFrame(ev, embeddingFrame->GetODFrame(ev));
- odEmbeddedFrame->SetInLimbo(ev, FALSE);
-
- // ----- It is now attached -----
- fAttached = TRUE;
-
- // ----- Create the facets -----
- CreateAllFacets(ev);
-
- // ----- Set link status if frame is not an orphan ----
- if (!this->IsOrphan(ev))
- this->PrivChangeLinkStatus(ev);
-
- }
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::PrivDetach
- //----------------------------------------------------------------------------------------
-
- void FW_CProxyFrame::PrivDetach(Environment* ev)
- {
- FW_CEmbeddingFrame* embeddingFrame = GetContainingFrame(ev);
- if (embeddingFrame != NULL && fAttached)
- {
- this->RemoveAllFacets(ev);
-
- // [HLX] I have to load the frame. Is this a problem?
- ODFrame* odEmbeddedFrame = GetFrame(ev);
-
- // ----- Set the containing frame to null -----
- FW_CAcquiredODFrame aqODContainingFrame = odEmbeddedFrame->AcquireContainingFrame(ev);
- if (aqODContainingFrame == NULL || aqODContainingFrame == embeddingFrame->GetODFrame(ev))
- {
- odEmbeddedFrame->SetInLimbo(ev, TRUE);
- odEmbeddedFrame->SetContainingFrame(ev, NULL);
- }
-
- // ----- It is now detached -----
- fAttached = FALSE;
- }
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::RemoveAllFacets
- //----------------------------------------------------------------------------------------
- // Remove all the facets of this proxyframe
-
- void FW_CProxyFrame::RemoveAllFacets(Environment* ev)
- {
- if (fFacetCount != 0)
- {
- FW_CEmbeddingFrame* embeddingFrame = GetContainingFrame(ev);
-
- if (embeddingFrame && this->IsFrameInMemory(ev))
- {
- FW_CFrameFacetIterator ite(ev, embeddingFrame);
- for (ODFacet* facet = ite.First(ev); ite.IsNotComplete(ev); facet = ite.Next(ev))
- this->RemoveFacets(ev, embeddingFrame, facet);
- }
- }
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::RemoveFacets
- //----------------------------------------------------------------------------------------
- // Remove all the facet embedded in embeddingFacet
-
- void FW_CProxyFrame::RemoveFacets(Environment* ev, FW_CEmbeddingFrame* frame, ODFacet* embeddingFacet)
- {
- #ifndef FW_DEBUG
- FW_UNUSED(frame);
- #endif
-
- FW_ASSERT(frame != NULL);
- FW_ASSERT(embeddingFacet != NULL);
-
- ODFrame* embeddedFrame = this->GetFrame(ev);
-
- FW_TOrderedCollection<ODFacet> tempCollect;
-
- // Attention: Do not try to iterate through all the facets of the embedded frame because
- // if we are in a middle of a drag&drop, the embedded frame may already have been stripped
- // of all its facets (in the case where the frame is reused, SetContainingFrame is called
- // which remove all the facets of the frame). But the hierarchy of facets is still there
- FW_CFacetIterator ite(ev, embeddingFacet, kODChildrenOnly, kODFrontToBack);
- ODFacet* facet;
- for (facet = ite.First(ev); ite.IsNotComplete(ev); facet = ite.Next(ev))
- {
- if (facet->GetFrame(ev) == embeddedFrame)
- tempCollect.AddLast(facet);
- }
-
- FW_TOrderedCollectionIterator<ODFacet> ite2(&tempCollect);
- for (facet = ite2.First(); ite2.IsNotComplete(); facet = ite2.Next())
- {
- fProxy->PrivEmbeddedFacetRemoved(ev); // Notify proxy
-
- embeddingFacet->RemoveFacet(ev, facet);
- fFacetCount--;
- delete facet;
- }
-
- FW_ASSERT(fFacetCount >= 0);
-
- // RemoveAll will be called by the destructor of tempCollect
- // tempCollect.RemoveAll();
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::PrivNeedFacets
- //----------------------------------------------------------------------------------------
-
- FW_Boolean FW_CProxyFrame::PrivNeedFacets(Environment* ev, FW_CEmbeddingFrame* embeddingFrame)
- {
- return fProxy->IsShown(ev) && // Proxy is in shown state
- embeddingFrame->GetViewType(ev) == FW_CPart::fgViewAsFrameToken && // Embedding frame is in frame state
- fProxy->NeedFacets(ev, embeddingFrame); // the proxy is visible
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::CreateAllFacets
- //----------------------------------------------------------------------------------------
-
- FW_DECLARE_THROW_POINT (FW_CProxyFrame_CreateAllFacets);
-
- void FW_CProxyFrame::CreateAllFacets(Environment* ev)
- {
- FW_CEmbeddingFrame* embeddingFrame = GetContainingFrame(ev);
- FW_ASSERT(embeddingFrame);
-
- if ((fFacetCount == 0) && PrivNeedFacets(ev, embeddingFrame))
- {
- FW_CFrameFacetIterator ite(ev, embeddingFrame);
- // Exception Handling: as with all loops, if one pass fails we need to undo the
- // effects of the previous ones.
- FW_TRY
- {
- for (ODFacet* containingFacet = ite.First(ev); ite.IsNotComplete(ev); containingFacet = ite.Next(ev))
- {
- PrivCreateFacets(ev, embeddingFrame, containingFacet);
-
- // Testing: what happens if one facet is created and then we fail? (as
- // if we tried and failed to create two facets?)
- FW_CHECK_THROW_POINT (FW_CProxyFrame_CreateAllFacets);
- }
- }
- FW_CATCH_BEGIN
- FW_CATCH_EVERYTHING ()
- {
- RemoveAllFacets(ev);
- FW_THROW_SAME ();
- }
- FW_CATCH_END
- }
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::CreateFacets
- //----------------------------------------------------------------------------------------
-
- void FW_CProxyFrame::CreateFacets(Environment* ev, FW_CEmbeddingFrame* embeddingFrame, ODFacet* embeddingFacet)
- {
- if (PrivNeedFacets(ev, embeddingFrame))
- PrivCreateFacets(ev, embeddingFrame, embeddingFacet);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::PrivCreateFacets
- //----------------------------------------------------------------------------------------
-
- void FW_CProxyFrame::PrivCreateFacets(Environment* ev, FW_CEmbeddingFrame* embeddingFrame, ODFacet* embeddingFacet)
- {
- FW_ASSERT(embeddingFacet);
-
- ODFrame* embeddedFrame = this->GetFrame(ev);
-
- FW_CAcquiredODShape proposedClipShape = FW_CopyAndRelease(ev, embeddedFrame->AcquireFrameShape(ev, NULL));
-
- #ifdef FW_DEBUG
- unsigned short totalCount =fProxy-> PrivGetEmbeddedFacetCount(ev);
- #endif
-
- unsigned short nbFacet = fProxy->CreateFacets(ev, embeddingFrame, embeddingFacet, embeddedFrame, proposedClipShape);
-
- #ifdef FW_DEBUG
- // I want to make sure that people use FW_MProxy::CreateFacet instead of ODFacet::CreateEmbeddedFacet
- if (totalCount + nbFacet != fProxy->PrivGetEmbeddedFacetCount(ev))
- FW_DEBUG_MESSAGE("FW_MProxy::CreateFacets must call FW_MProxy::CreateFacet not ODFacet::CreateEmbeddedFacet");
- #endif
-
- fFacetCount += nbFacet;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::PrivSetFrameGroup
- //----------------------------------------------------------------------------------------
-
- void FW_CProxyFrame::PrivSetFrameGroup(Environment* ev, ODID frameGroup)
- {
- GetFrame(ev)->SetFrameGroup(ev, frameGroup);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::PrivChangeSequenceNumber
- //----------------------------------------------------------------------------------------
-
- void FW_CProxyFrame::PrivChangeSequenceNumber(Environment* ev, ODID sequenceNumber)
- {
- GetFrame(ev)->ChangeSequenceNumber(ev, sequenceNumber);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::PrivSetDragging
- //----------------------------------------------------------------------------------------
- // call by FW_CEmbeddingFrame::PrivDragging
-
- void FW_CProxyFrame::PrivSetDragging(Environment* ev, FW_EPrivDraggingFlags dragFlags)
- {
- // I only change the dragState of the embedded frame if
- // change to TRUE : I am selected (fProxy->GetSelectState(ev) == TRUE)
- // change to FALSE : I was dragged (fWasDragged == TRUE)
-
- FW_Boolean dragStart = (dragFlags == FW_kStartDrag);
- if (dragStart ? fProxy->GetSelectState(ev) : fWasDragged)
- {
- if (dragStart)
- GetFrame(ev)->SetInLimbo(ev, TRUE); // set the embedded frame to in limbo
- else if (dragFlags == FW_kDragAborted || dragFlags == FW_kDragCopy)
- GetFrame(ev)->SetInLimbo(ev, FALSE); // put back the frame not in limbo
-
- // Change the Drag state of all the proxyframes of fProxy
- FW_CProxyProxyFrameIterator iter(fProxy);
- for (FW_CProxyFrame* proxyFrame = iter.First(); iter.IsNotComplete(); proxyFrame = iter.Next())
- {
- if (proxyFrame->IsFrameInMemory(ev))
- proxyFrame->GetFrame(ev)->SetDragging(ev, dragStart);
- }
-
- fWasDragged = dragStart;
- }
- else
- fWasDragged = FALSE;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::ChangeHighlight
- //----------------------------------------------------------------------------------------
-
- void FW_CProxyFrame::ChangeHighlight(Environment* ev, ODHighlight highlight)
- {
- if (IsFrameInMemory(ev))
- {
- FW_CODFrameFacetIterator ite2(ev, GetFrame(ev));
- for (ODFacet* facet = ite2.First(ev); ite2.IsNotComplete(ev); facet = ite2.Next(ev))
- facet->ChangeHighlight(ev, highlight);
- }
-
- fHighlight = highlight;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::ChangeLinkStatus
- //----------------------------------------------------------------------------------------
-
- void FW_CProxyFrame::ChangeLinkStatus(Environment* ev, ODLinkStatus linkStatus)
- {
- fLinkStatus = linkStatus;
-
- if (this->IsFrameInMemory(ev) && !this->IsOrphan(ev) && this->IsAttached(ev))
- {
- this->PrivChangeLinkStatus(ev);
- }
- }
-
-
- //----------------------------------------------------------------------------------------
- // FW_CProxyFrame::PrivChangeLinkStatus
- //----------------------------------------------------------------------------------------
-
- void FW_CProxyFrame::PrivChangeLinkStatus(Environment* ev) const
- {
- FW_ASSERT(this->IsFrameInMemory(ev));
- FW_ASSERT(this->IsAttached(ev));
- FW_ASSERT(!this->IsOrphan(ev));
-
- ODFrame* embeddedFrame = this->GetFrame(ev);
-
- embeddedFrame->ChangeLinkStatus(ev, fLinkStatus);
-
- }
-
-
-
-