home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 27.2 KB | 885 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: DrawCont.cpp
- // Release Version: $ ODF 1 $
- //
- // Author: Mary Boetcher
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "ODFDraw.hpp"
-
- #ifndef DRAWCONT_H
- #include "DrawCont.h"
- #endif
-
- #ifndef DRAWPART_H
- #include "DrawPart.h"
- #endif
-
- #ifndef DRAWCLIP_H
- #include "DrawClip.h"
- #endif
-
- #ifndef BASESHP_H
- #include "BaseShp.h"
- #endif
-
- #ifndef GROUPSHP_H
- #include "GroupShp.h"
- #endif
-
- #ifndef DRAWPRXY_H
- #include "DrawPrxy.h"
- #endif
-
- #ifndef UTILS_H
- #include "Utils.h"
- #endif
-
- #ifndef DRAWLINK_H
- #include "DrawLink.h"
- #endif
-
- #ifndef DRWPRMSE_H
- #include "DrwPrmse.h"
- #endif
-
- #ifndef DRAWSEL_H
- #include "DrawSel.h"
- #endif
-
- // ----- Part Layer -----
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- #ifndef FWPRESEN_H
- #include "FWPresen.h"
- #endif
-
- // ----- OS Layer -----
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #ifndef FWODGEOM_H
- #include "FWODGeom.h"
- #endif
-
- #ifndef FWSUSINK_H
- #include "FWSUSink.h"
- #endif
-
- #ifndef FWBARRAY_H
- #include "FWBArray.h"
- #endif
-
- #ifndef FWFILEAC_H
- #include "FWFileAc.h"
- #endif
-
- #ifndef SLMixOS_H
- #include "SLMixOS.h"
- #endif
-
- // ----- Foundation Layer -----
-
- #ifndef FWSTREAM_H
- #include "FWStream.h"
- #endif
-
- #ifndef FWSUSINK_H
- #include "FWSUSink.h"
- #endif
-
- #ifndef FWMEMORY_H
- #include "FWMemory.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_Module_OpenDoc_StdProps_defined
- #include <StdProps.xh>
- #endif
-
- #ifndef SOM_ODTranslation_xh
- #include <Translt.xh>
- #endif
-
- #ifndef SOM_ODShape_xh
- #include <Shape.xh>
- #endif
-
- #ifndef SOM_ODStorageUnit_xh
- #include <StorageU.xh>
- #endif
-
- #ifndef SOM_ODSession_xh
- #include <ODSessn.xh>
- #endif
-
- //========================================================================================
- // Runtime Information
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment odfdraw
- #endif
-
- FW_DEFINE_AUTO(CDrawPartContent)
- FW_DEFINE_AUTO(CDrawSelectionContent)
- FW_DEFINE_AUTO(CDrawUndoContent)
- FW_DEFINE_AUTO(CDrawPromiseContent)
- FW_DEFINE_AUTO(CDrawLinkContent)
- FW_DEFINE_AUTO(CDrawLinkSourceContent)
-
- //========================================================================================
- // class CDrawPartContent
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CDrawPartContent::CDrawPartContent
- //----------------------------------------------------------------------------------------
- // CDrawPartContent constructor
-
- CDrawPartContent::CDrawPartContent(Environment* ev, CDrawPart* part) :
- CDrawContent(ev, part)
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPartContent::~CDrawPartContent
- //----------------------------------------------------------------------------------------
- // CDrawPartContent destructor
-
- CDrawPartContent::~CDrawPartContent()
- {
- if (fShapeList)
- {
- CBaseShape* shape;
- while ((shape = fShapeList->First()) != NULL)
- {
- fShapeList->Remove(shape);
- delete shape;
- }
- fProxyShapeCount = 0;
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPartContent::Externalize
- //----------------------------------------------------------------------------------------
-
- void CDrawPartContent::Externalize(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_EStorageKinds storageKind,
- FW_CCloneInfo* cloneInfo)
- {
- ExternalizeShapeList(ev, storageUnit, cloneInfo, FW_kFixed0, FW_kFixed0);
-
- // ----- Write links -----
- CDrawLinkManager* linkMgr = (CDrawLinkManager*) fDrawPart->GetLinkManager(ev);
- linkMgr->ExternalizeLinks(ev, storageUnit, cloneInfo);
-
- // ----- Write general information -----
- fDrawPart->ExternalizeAnnotations(ev, storageUnit);
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPartContent::Internalize
- //----------------------------------------------------------------------------------------
-
- FW_Boolean CDrawPartContent::Internalize(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_EStorageKinds storageKind,
- FW_CCloneInfo* cloneInfo)
- {
- InternalizeShapeList(ev, storageUnit, cloneInfo);
-
- // ----- Read links -----
- CDrawLinkManager* linkMgr = (CDrawLinkManager*) fDrawPart->GetLinkManager(ev);
- linkMgr->InternalizeLinks(ev, storageUnit);
-
- // ----- Read general information -----
- fDrawPart->InternalizeAnnotations(ev, storageUnit);
-
- return true;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPartContent::PostInternalizeShape
- //----------------------------------------------------------------------------------------
-
- void CDrawPartContent::PostInternalizeShape(Environment* ev, const FW_CPoint& offset, CBaseShape* shape, short index)
- {
- shape->OffsetShape(ev, -offset.x, -offset.y);
- shape->SetExternalizationIndex(index); // so links can find their shapes
- }
-
- #if 0
- //----------------------------------------------------------------------------------------
- // CDrawPartContent::SingleEmbeddedFrameInternalized
- //----------------------------------------------------------------------------------------
-
- void CDrawPartContent::SingleEmbeddedFrameInternalized(Environment* ev,
- FW_CEmbeddingFrame* scopeFrame,
- ODPart* embeddedPart,
- ODFrame* embeddedFrame,
- ODShape* suggestedShape,
- ODTypeToken viewType)
- {
- CProxyShape* insertedShape = AddSingleEmbeddedFrame(ev,
- scopeFrame,
- embeddedPart,
- embeddedFrame,
- suggestedShape,
- viewType);
-
- FW_CAcquiredODShape aqTempShape = ::FW_NewODShape(ev);
- insertedShape->GetUpdateBox(ev, aqTempShape);
-
- FW_CPresentation* presentation = fDrawPart->GetMainPresentation();
- CDrawFacetClipper facetClipper(ev, fDrawPart);
- facetClipper.Clip(ev, presentation, aqTempShape);
-
- presentation->Invalidate(ev, aqTempShape);
- }
- #endif
-
- //----------------------------------------------------------------------------------------
- // CDrawPartContent::MoveBackward
- //----------------------------------------------------------------------------------------
-
- FW_Boolean CDrawPartContent::MoveBackward(Environment* ev)
- {
- FW_Boolean didIt = FALSE;
-
- CBaseShape* shape = fShapeList->First();
- CBaseShape* previous = NULL;
- while (shape != NULL)
- {
- if (shape->IsSelectedShape() && previous != NULL && !previous->IsSelectedShape())
- {
- fShapeList->Remove(shape);
- fShapeList->AddBefore(previous, shape);
- shape->MovedBefore(ev, previous);
- shape = previous;
- didIt = TRUE;
- }
- else
- previous = shape;
-
- shape = fShapeList->After(shape);
- }
-
- return didIt;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPartContent::MoveForward
- //----------------------------------------------------------------------------------------
-
- FW_Boolean CDrawPartContent::MoveForward(Environment* ev)
- {
- FW_Boolean didIt = FALSE;
-
- CBaseShape* shape = fShapeList->Last();
- CBaseShape* next = NULL;
- while (shape != NULL)
- {
- if (shape->IsSelectedShape() && next != NULL && !next->IsSelectedShape())
- {
- fShapeList->Remove(shape);
- fShapeList->AddAfter(next, shape);
- shape->MovedAfter(ev, next);
- shape = next;
- didIt = TRUE;
- }
- else
- next = shape;
-
- shape = fShapeList->Before(shape);
- }
-
- return didIt;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPartContent::MoveToBack
- //----------------------------------------------------------------------------------------
-
- void CDrawPartContent::MoveToBack(Environment* ev)
- {
- CShapeCollection extract;
- ExtractSelection(ev, &extract);
-
- CShapeCollectionIterator ite(&extract);
- for (CBaseShape* shape = ite.Last(); ite.IsNotComplete(); shape = ite.Previous())
- {
- fShapeList->AddFirst(shape);
- shape->MovedFirst(ev);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPartContent::MoveToFront
- //----------------------------------------------------------------------------------------
-
- void CDrawPartContent::MoveToFront(Environment* ev)
- {
- CShapeCollection extract;
- ExtractSelection(ev, &extract);
-
- CShapeCollectionIterator ite(&extract);
- for (CBaseShape* shape = ite.First(); ite.IsNotComplete(); shape = ite.Next())
- {
- fShapeList->AddLast(shape);
- shape->MovedLast(ev);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPartContent::ExtractSelection
- //----------------------------------------------------------------------------------------
-
- void CDrawPartContent::ExtractSelection(Environment* ev, CShapeCollection* extract)
- {
- // ----- Create the extract list -----
- CShapeCollectionIterator ite(fShapeList);
- CBaseShape* shape;
- for (shape = ite.First(); ite.IsNotComplete(); shape = ite.Next())
- {
- if (shape->IsSelectedShape())
- extract->AddLast(shape);
- }
-
- // ----- Remove then from the shape list -----
- CShapeCollectionIterator ite2(extract);
- for (shape = ite2.First(); ite2.IsNotComplete(); shape = ite2.Next())
- {
- fShapeList->Remove(shape);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPartContent::NewShape
- //----------------------------------------------------------------------------------------
-
- CBaseShape* CDrawPartContent::NewShape(Environment* ev, unsigned short shapeType)
- {
- CBaseShape *theShape = NULL;
-
- FW_ASSERT(shapeType != kProxyShape); // We should never create a proxyShape this way
-
- switch (shapeType)
- {
- case kLineShape:
- theShape = FW_NEW(CLineShape, ());
- break;
-
- case kTextShape:
- theShape = FW_NEW(CTextShape, ());
- break;
-
- case kRectShape:
- theShape = FW_NEW(CRectShape, ());
- break;
-
- case kOvalShape:
- theShape = FW_NEW(COvalShape, ());
- break;
-
- case kRRectShape:
- theShape = FW_NEW(CRoundRectShape, ());
- break;
- }
-
- return theShape;
- }
-
- //========================================================================================
- // class CDrawSelectionContent
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CDrawSelectionContent::CDrawSelectionContent
- //----------------------------------------------------------------------------------------
- // CDrawSelectionContent constructor
-
- CDrawSelectionContent::CDrawSelectionContent(Environment* ev, CDrawPart* part, CDrawSelection* selection)
- : CDrawContent(ev, part),
- fDrawSelection(selection)
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelectionContent::~CDrawSelectionContent
- //----------------------------------------------------------------------------------------
- // CDrawSelectionContent destructor
-
- CDrawSelectionContent::~CDrawSelectionContent()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelectionContent::Internalize
- //----------------------------------------------------------------------------------------
-
- FW_Boolean CDrawSelectionContent::Internalize(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_EStorageKinds storageKind,
- FW_CCloneInfo* cloneInfo)
- {
- if (!storageUnit->Exists(ev, kODPropContents, fDrawPart->GetPartKind(ev), 0))
- return false;
-
- // ----- [HLX] force promises to be fulfilled, otherwise bug in locks
- storageUnit->Focus(ev, kODPropContents, kODPosUndefined, fDrawPart->GetPartKind(ev), 0, kODPosUndefined);
- storageUnit->GetSize(ev);
-
- // ----- Read in the shapes -----
- InternalizeShapeList(ev, storageUnit, cloneInfo);
-
- return true;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelectionContent::Externalize
- //----------------------------------------------------------------------------------------
-
- void CDrawSelectionContent::Externalize(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_EStorageKinds storageKind,
- FW_CCloneInfo* cloneInfo)
- {
- FW_CRect selectRect;
- fDrawSelection->GetDragRect(selectRect);
-
- // ----- Make a copy of myself -----
- CDrawPromiseContent* promisedContent = FW_NEW(CDrawPromiseContent, (ev, fDrawPart, this, selectRect));
-
- // ----- Create a promise object -----
- CDrawSelectionPromise* promise = new CDrawSelectionPromise(ev, storageKind, cloneInfo, promisedContent);
-
- // ----- Promise my data type and a PICT -----
- promise->Promise(ev, storageUnit, kODPropContents, fDrawPart->GetPartKind(ev));
- #ifdef FW_BUILD_MAC
- promise->Promise(ev, storageUnit, kODPropContents, FW_CPart::gMacPICTDataType);
- #endif
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelectionContent::SingleEmbeddedFrameInternalized
- //----------------------------------------------------------------------------------------
-
- void CDrawSelectionContent::SingleEmbeddedFrameInternalized(Environment* ev,
- FW_CEmbeddingFrame* scopeFrame,
- ODPart* embeddedPart,
- ODFrame* embeddedFrame,
- ODShape* suggestedShape,
- ODTypeToken viewType)
- {
- fDrawSelection->CloseSelection(ev);
- CProxyShape* insertedShape = AddSingleEmbeddedFrame(ev,
- scopeFrame,
- embeddedPart,
- embeddedFrame,
- suggestedShape,
- viewType);
- PostInternalizeShape(ev, FW_kZeroPoint, insertedShape, 1);
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelectionContent::PostInternalizeShape
- //----------------------------------------------------------------------------------------
-
- void CDrawSelectionContent::PostInternalizeShape(Environment* ev, const FW_CPoint& offset, CBaseShape* shape, short index)
- {
- shape->SetExternalizationIndex(index); // so links can find their shapes
-
- // ----- Add the shape to the right places -----
- fDrawPart->AddShapeToPart(ev, shape); // Add to the part data
-
- // ----- Shape has already been added to the selection list (fShapeList)
- fDrawSelection->ShapeAdded(ev, shape);
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelectionContent::CreateDataFrameShape
- //----------------------------------------------------------------------------------------
-
- ODShape* CDrawSelectionContent::CreateDataFrameShape(Environment* ev) const
- {
- FW_CRect selectionRect;
- fDrawSelection->GetDragRect(selectionRect);
- selectionRect.Place(FW_kZeroPoint);
-
- ODShape* selectionShape = ::FW_NewODShape(ev, selectionRect);
- return selectionShape;
- }
-
- //========================================================================================
- // class CDrawUndoContent
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CDrawUndoContent::CDrawUndoContent
- //----------------------------------------------------------------------------------------
- // CDrawUndoContent constructor
-
- CDrawUndoContent::CDrawUndoContent(Environment* ev, CDrawSelection* selection) :
- CDrawContent(ev, selection->GetDrawContent(ev)),
- fDrawSelection(selection)
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawUndoContent::~CDrawUndoContent
- //----------------------------------------------------------------------------------------
- // CDrawUndoContent destructor
-
- CDrawUndoContent::~CDrawUndoContent()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawUndoContent::RemoveShapeSelection
- //----------------------------------------------------------------------------------------
-
- void CDrawUndoContent::RemoveShapeSelection(Environment *ev)
- {
- // Select the saved shapes
- fDrawSelection->SelectContent(ev, this);
-
- // Clear the selected shapes
- fDrawSelection->ClearSelection(ev);
-
- // Notify everybody
- fDrawSelection->SelectionChanged(ev);
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawUndoContent::RestoreShapeSelection
- //----------------------------------------------------------------------------------------
-
- void CDrawUndoContent::RestoreShapeSelection(Environment *ev)
- {
- // Add the saved shapes back into the part
- CDrawContentShapeIterator ite(this);
- for (CBaseShape* shape = ite.First(); ite.IsNotComplete(); shape = ite.Next())
- {
- shape->RestoreShape(ev, fDrawPart);
- }
-
- // Redraw the restored shapes
- RedrawShapes(ev);
-
- // Select the saved shapes
- fDrawSelection->SelectContent(ev, this);
-
- // Notify everybody
- fDrawSelection->SelectionChanged(ev);
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawUndoContent::DeleteSavedShapes
- //----------------------------------------------------------------------------------------
-
- void CDrawUndoContent::DeleteSavedShapes(Environment *ev)
- {
- CBaseShape* shape;
-
- // Before deleting the shapes, make sure they are not promised
- CDrawContentShapeIterator ite(this);
- for (shape = ite.First(); ite.IsNotComplete(); shape = ite.Next())
- {
- shape->CheckPromise(ev, fDrawPart);
- }
-
- // ----- Delete all the saved shapes -----
- while ((shape = GetFirstShape()) != NULL)
- {
- RemoveShape(ev, shape);
- delete shape;
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawUndoContent::RemoveFromLinks
- //----------------------------------------------------------------------------------------
- void CDrawUndoContent::RemoveFromLinks(Environment* ev)
- {
- // Remove the saved shapes from any link sources they're in
- CDrawContentShapeIterator it(this);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- CDrawPublishLink* linkSource = shape->GetPublishLink();
- if (linkSource)
- {
- linkSource->RemoveShape(ev, shape);
- }
- CDrawSubscribeLink* link = shape->GetSubscribeLink();
- if (link)
- {
- fDrawPart->GetLinkManager(ev)->BreakDestinationLink(ev, link);
- }
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawUndoContent::RestoreLinks
- //----------------------------------------------------------------------------------------
- void CDrawUndoContent::RestoreLinks(Environment* ev)
- {
- // Add the saved shapes back into any link sources they were in
- CDrawContentShapeIterator it(this);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- CDrawPublishLink* linkSource = shape->GetPublishLink();
- if (linkSource)
- {
- linkSource->AddShape(ev, shape);
- }
- CDrawSubscribeLink* link = shape->GetSubscribeLink();
- if (link)
- {
- fDrawPart->GetLinkManager(ev)->RestoreDestinationLink(ev, link);
- }
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawUndoContent::DeleteEmptyLinkSources
- //----------------------------------------------------------------------------------------
- void CDrawUndoContent::DeleteEmptyLinkSources(Environment* ev)
- {
- // Check for link sources left empty because all their shapes were removed
- FW_CLinkManager* linkMgr = fDrawPart->GetLinkManager(ev);
-
- CDrawContentShapeIterator it(this);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- CDrawPublishLink* linkSource = shape->GetPublishLink();
- if (linkSource && linkSource->IsEmpty())
- {
- linkMgr->BreakSourceLink(ev, linkSource);
- delete linkSource;
- }
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawUndoContent::DeleteSavedShapesAndLinks
- //----------------------------------------------------------------------------------------
- void CDrawUndoContent::DeleteSavedShapesAndLinks(Environment* ev)
- {
- CBaseShape* shape;
-
- // Before deleting the shapes, make sure they are not promised
- CDrawContentShapeIterator ite(this);
- for (shape = ite.First(); ite.IsNotComplete(); shape = ite.Next())
- {
- shape->CheckPromise(ev, fDrawPart);
- }
-
- // ----- Delete all the saved shapes -----
- while ((shape = GetFirstShape()) != NULL)
- {
- RemoveShape(ev, shape);
- // Check for an orphaned link and delete it
- CDrawSubscribeLink* link = shape->GetSubscribeLink();
- if (link)
- delete link; // deletes the shape
- else
- delete shape;
- }
- }
-
- //========================================================================================
- // class CDrawPromiseContent
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CDrawPromiseContent::CDrawPromiseContent
- //----------------------------------------------------------------------------------------
- // CDrawPromiseContent constructor
-
- CDrawPromiseContent::CDrawPromiseContent(Environment* ev,
- CDrawPart* part,
- CDrawSelectionContent* selectedContent,
- const FW_CRect& selectedRect) :
- CDrawContent(ev, part),
- fSelectedRect(selectedRect)
- {
- CDrawContentShapeIterator ite(selectedContent);
- for (CBaseShape* shape = ite.First(); ite.IsNotComplete(); shape = ite.Next())
- {
- this->AddShape(ev, shape);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPromiseContent::~CDrawPromiseContent
- //----------------------------------------------------------------------------------------
- // CDrawPromiseContent destructor
-
- CDrawPromiseContent::~CDrawPromiseContent()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPromiseContent::Externalize
- //----------------------------------------------------------------------------------------
-
- void CDrawPromiseContent::Externalize(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_EStorageKinds storageKind,
- FW_CCloneInfo* cloneInfo)
- {
- ExternalizeShapeList(ev, storageUnit, cloneInfo, fSelectedRect.left, fSelectedRect.top);
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPromiseContent::IsOKtoWrite
- //----------------------------------------------------------------------------------------
-
- FW_Boolean CDrawPromiseContent::IsOKtoWrite(Environment* ev, CBaseShape* shape)
- {
- return TRUE;
- }
-
- //========================================================================================
- // class CDrawLinkSourceContent
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CDrawLinkSourceContent::CDrawLinkSourceContent
- //----------------------------------------------------------------------------------------
- // CDrawLinkSourceContent constructor
-
- CDrawLinkSourceContent::CDrawLinkSourceContent(Environment* ev, CDrawPart* part, CDrawContent* selectedContent)
- : CDrawContent(ev, part)
- {
- if (selectedContent)
- {
- CDrawContentShapeIterator it(selectedContent);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- this->AddShape(ev, shape); // make sure fProxyShapeCount is incremented appropriately
- }
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawLinkSourceContent::~CDrawLinkSourceContent
- //----------------------------------------------------------------------------------------
- // CDrawLinkSourceContent destructor
-
- CDrawLinkSourceContent::~CDrawLinkSourceContent()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawLinkSourceContent::Externalize
- //----------------------------------------------------------------------------------------
-
- void CDrawLinkSourceContent::Externalize(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_EStorageKinds storageKind,
- FW_CCloneInfo* cloneInfo)
- {
- ExternalizeShapeList(ev, storageUnit, cloneInfo, FW_kFixed0, FW_kFixed0);
- }
-
- //========================================================================================
- // class CDrawLinkContent
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CDrawLinkContent::CDrawLinkContent
- //----------------------------------------------------------------------------------------
- // CDrawLinkContent constructor
-
- CDrawLinkContent::CDrawLinkContent(Environment* ev, CDrawPart* part, CDrawSubscribeLink* link)
- : CDrawContent(ev, part),
- fLink(link)
- {
- // This constructor is called when a new destination link is created
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawLinkContent::CDrawLinkContent
- //----------------------------------------------------------------------------------------
- // CDrawLinkContent constructor
-
- CDrawLinkContent::CDrawLinkContent(Environment* ev, CDrawSubscribeLink* link, CDrawLinkContent* content)
- : CDrawContent(ev, content),
- fLink(link)
- {
- // This constructor is called when a link is updated (not the first time)
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawLinkContent::~CDrawLinkContent
- //----------------------------------------------------------------------------------------
- // CDrawLinkContent destructor
-
- CDrawLinkContent::~CDrawLinkContent()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawLinkContent::GroupShapes
- //----------------------------------------------------------------------------------------
- void CDrawLinkContent::GroupShapes(Environment* ev, CGroupShape* group)
- {
- // Add our shapes to the group shape
- CDrawContentShapeIterator it(this);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- group->AddShape(shape);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawLinkContent::Internalize
- //----------------------------------------------------------------------------------------
- FW_Boolean CDrawLinkContent::Internalize(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_EStorageKinds storageKind,
- FW_CCloneInfo* cloneInfo)
- {
- if (!storageUnit->Exists(ev, kODPropContents, fDrawPart->GetPartKind(ev), 0))
- return false;
-
- // ----- Read in the shapes -----
- InternalizeShapeList(ev, storageUnit, cloneInfo);
- return true;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawLinkContent::SingleEmbeddedFrameInternalized
- //----------------------------------------------------------------------------------------
-
- void CDrawLinkContent::SingleEmbeddedFrameInternalized(Environment* ev,
- FW_CEmbeddingFrame* scopeFrame,
- ODPart* embeddedPart,
- ODFrame* embeddedFrame,
- ODShape* suggestedShape,
- ODTypeToken viewType)
- {
- CProxyShape* newShape = AddSingleEmbeddedFrame(ev,
- scopeFrame,
- embeddedPart,
- embeddedFrame,
- suggestedShape,
- viewType);
- PostInternalizeShape(ev, FW_kZeroPoint, newShape, 1);
- }
-
-