home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 24.9 KB | 834 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: GroupShp.cpp
- // Release Version: $ ODF 2 $
- //
- // Author: Mary Boetcher
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "ODFDraw.hpp"
-
- #ifndef GROUPSHP_H
- #include "GroupShp.h"
- #endif
-
- #ifndef DRAWPART_H
- #include "DrawPart.h"
- #endif
-
- #ifndef DRAWCLIP_H
- #include "DrawClip.h"
- #endif
-
- #ifndef UTILS_H
- #include "Utils.h"
- #endif
-
- #ifndef CONTENT_H
- #include "Content.h"
- #endif
-
- // ----- Part Layer -----
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- // ----- OS Layer -----
-
- #ifndef FWODGEOM_H
- #include "FWODGeom.h"
- #endif
-
- #ifndef FWGRUTIL_H
- #include "FWGrUtil.h"
- #endif
-
- #ifndef FWACQUIR_H
- #include "FWAcquir.h"
- #endif
-
- #ifndef FWRECSHP_H
- #include "FWRecShp.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_ODTransform_xh
- #include <Trnsform.xh>
- #endif
-
- //========================================================================================
- // Runtime Information
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment odfdrawshapes
- #endif
-
- //========================================================================================
- // class CGroupShape
- //========================================================================================
-
- FW_DEFINE_CLASS_M1(CGroupShape, CBaseShape)
- FW_DEFINE_AUTO(CGroupShape)
-
- const FW_ClassTypeConstant LGroupShape = FW_TYPE_CONSTANT('s','h','g','p');
- FW_REGISTER_ARCHIVABLE_CLASS(LGroupShape, CGroupShape, CGroupShape::Read, 0, 0, CBaseShape::Write)
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::CGroupShape
- //----------------------------------------------------------------------------------------
-
- CGroupShape::CGroupShape(CDrawPart* drawPart) :
- CBaseShape(drawPart, 4, kGroupShape, kFrameOnly),
- fShapeList(NULL)
- {
- fShapeList = FW_NEW(CShapeCollection, ());
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::CGroupShape
- //----------------------------------------------------------------------------------------
-
- CGroupShape::CGroupShape(CDrawPart* drawPart, CShapeCollection* shapeList) :
- CBaseShape(drawPart, 4, kGroupShape, kFrameOnly)
- {
- fShapeList = FW_NEW(CShapeCollection, ());
- CShapeCollectionIterator it(shapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- fShapeList->AddLast(shape);
- }
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::CGroupShape
- //----------------------------------------------------------------------------------------
-
- CGroupShape::CGroupShape(CDrawPart* drawPart, FW_CReadableStream& archive) :
- CBaseShape(drawPart, archive)
- {
- fShapeList = FW_NEW(CShapeCollection, ());
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape destructor
- //----------------------------------------------------------------------------------------
-
- CGroupShape::~CGroupShape()
- {
- FW_START_DESTRUCTOR
-
- this->EmptyShapes(true); // delete shapes
- delete fShapeList;
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::EmptyShapes
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::EmptyShapes(FW_Boolean deleteShapes)
- {
- if (fShapeList)
- {
- CBaseShape* shape;
- while ((shape = fShapeList->First()) != NULL)
- {
- fShapeList->Remove(shape);
- if (deleteShapes)
- {
- FW_SOMEnvironment ev;
- shape->Deleted(ev);
- delete shape;
- }
- }
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::Read
- //----------------------------------------------------------------------------------------
-
- void* CGroupShape::Read(FW_CReadableStream& stream, FW_ClassTypeConstant type)
- {
- FW_UNUSED(type);
- // [HLX] This is a hack until I can register object with the archiver
- CDrawReadableStream *drawArchive = (CDrawReadableStream*)&stream;
- CGroupShape* groupShape = FW_NEW(CGroupShape, (drawArchive->GetDrawPart(), stream));
-
- // Read shapes from the stream and add them to the group
- unsigned long count;
- stream >> count;
- for (short i = 0; i<count; i++)
- {
- CBaseShape* theShape = NULL;
- FW_READ_DYNAMIC_OBJECT(stream, &theShape, CBaseShape);
- FW_ASSERT(theShape);
-
- // ----- Add the shape to the group -----
- groupShape->AddShape(theShape);
- }
-
- return groupShape;
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::Flatten
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::Flatten(FW_CWritableStream& archive)
- {
- CBaseShape::Flatten(archive);
-
- unsigned long count = fShapeList->Count();
- archive << count;
-
- // Write group shapes to the archive
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- FW_WRITE_DYNAMIC_OBJECT(archive, shape, CBaseShape);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::CreateShapeOutline
- //----------------------------------------------------------------------------------------
-
- ODShape* CGroupShape::CreateShapeOutline(Environment* ev)
- {
- FW_CRect bounds = GetRectGeometry();
-
- // We don't acquire it because we return it
- ODShape* outline = ::FW_NewODShape(ev, bounds);
-
- ::FW_OutlineODShape(ev, outline, GetPenSize());
-
- return outline;
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::CalcClipShape
- //----------------------------------------------------------------------------------------
-
- ODShape* CGroupShape::CalcClipShape(Environment* ev)
- {
- FW_CAcquiredODShape clipShape = ::FW_NewODShape(ev);
-
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- FW_CAcquiredODShape tempShape = shape->AcquireClipShape(ev);
- clipShape->Union(ev, tempShape);
- }
-
- return clipShape.Orphan();
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::GetHandleCenter
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::GetHandleCenter(short whichHandle, FW_CPoint& center) const
- {
- FW_CRect bounds = GetRectGeometry();
-
- switch (whichHandle)
- {
- case kInTopLeftCorner:
- center.x = bounds.left;
- center.y = bounds.top;
- break;
- case kInTopRightCorner:
- center.x = bounds.right;
- center.y = bounds.top;
- break;
- case kInBottomLeftCorner:
- center.x = bounds.left;
- center.y = bounds.bottom;
- break;
- case kInBottomRightCorner:
- center.x = bounds.right;
- center.y = bounds.bottom;
- break;
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::GetMapRects
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::GetMapRects(short whichHandle, const FW_CPoint& mouseLoc,
- FW_CRect& srcRect, FW_CRect& dstRect)
- {
- srcRect = GetRectGeometry();
- dstRect = srcRect;
-
- switch (whichHandle)
- {
- case kInTopLeftCorner:
- dstRect.left = mouseLoc.x;
- dstRect.top = mouseLoc.y;
- break;
- case kInTopRightCorner:
- dstRect.right = mouseLoc.x;
- dstRect.top = mouseLoc.y;
- break;
- case kInBottomLeftCorner:
- dstRect.left = mouseLoc.x;
- dstRect.bottom = mouseLoc.y;
- break;
- case kInBottomRightCorner:
- dstRect.right = mouseLoc.x;
- dstRect.bottom = mouseLoc.y;
- break;
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::GetRectGeometry
- //----------------------------------------------------------------------------------------
- // [HLX] should be cached
-
- FW_CRect CGroupShape::GetRectGeometry() const
- {
- // Calculate the boundary rectangle for our shapes
- FW_CRect rect = FW_kZeroRect;
- if (fShapeList->Count() != 0)
- {
- FW_Boolean first = true;
- FW_CRect tempRect;
-
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->GetDragRect(tempRect);
- if (first)
- rect = tempRect;
- else
- rect |= tempRect;
- first = false;
- }
- }
- return rect;
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::HitTest
- //----------------------------------------------------------------------------------------
-
- FW_Boolean CGroupShape::HitTest(Environment* ev, FW_CGraphicContext& gc, const FW_CMouseEvent& theMouseEvent) const
- {
- // Perform HitTest on each shape in this group
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- if (shape->HitTest(ev, gc, theMouseEvent))
- return true;
- }
-
- return false;
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::MapShape
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::MapShape(Environment* ev, const FW_CRect& srcRect, const FW_CRect& dstRect)
- {
- #if 1
- FW_CRect beforeRect = GetRectGeometry();
- FW_CRect afterRect = beforeRect;
- afterRect.Map(srcRect, dstRect);
-
- // Map each shape in this group
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->MapShape(ev, beforeRect, afterRect);
- }
- #else
- // Map each shape in this group
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->MapShape(ev, srcRect, dstRect);
- }
- #endif
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::OffsetShape
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::OffsetShape(Environment* ev, FW_Fixed xDelta, FW_Fixed yDelta)
- {
- // CheckPromise(ev); [HLX] Do not call CheckPromise from OffsetShape or end up in a infinity loop
- // because externalize of a pict calls OffsetShape
- ClearCache(ev);
-
- // Offset each shape in this group
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->OffsetShape(ev, xDelta, yDelta);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::RenderShape
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::RenderShape(Environment* ev, ODFacet* facet, FW_CGraphicContext& gc)
- {
- // Render each shape in this group
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- if (facet != NULL || shape->GetShapeType() != kProxyShape)
- shape->RenderShape(ev, facet, gc);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::ResizeFeedback
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::ResizeFeedback(FW_CGraphicContext& gc, const FW_CInk& ink, const FW_CStyle& style,
- short whichHandle, const FW_CPoint& mouseLoc)
- {
- FW_CRect srcRect, dstRect;
- GetMapRects(whichHandle, mouseLoc, srcRect, dstRect);
- dstRect.Sort();
- OutlineShape(gc, ink, style, dstRect);
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::SetShapeGeometry
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::SetShapeGeometry(const FW_CPoint& anchorPoint, const FW_CPoint& currentPoint)
- {
- FW_CRect rect = GetRectGeometry();
-
- if (anchorPoint.x < currentPoint.x)
- {
- rect.left = anchorPoint.x;
- rect.right = currentPoint.x;
- }
- else
- {
- rect.left = currentPoint.x;
- rect.right = anchorPoint.x;
- }
-
- if (anchorPoint.y < currentPoint.y)
- {
- rect.top = anchorPoint.y;
- rect.bottom = currentPoint.y;
- }
- else
- {
- rect.top = currentPoint.y;
- rect.bottom = anchorPoint.y;
- }
-
- /* How to change group shape's geometry? */
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::OutlineShape
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::OutlineShape(FW_CGraphicContext& gc, const FW_CInk& ink, const FW_CStyle& style, const FW_CRect& rect)
- {
- FW_CRect bounds(rect);
- AdjustRectForPenSize(bounds, style.GetPenSize());
- FW_CRectShape::RenderRect(gc,
- bounds,
- FW_kFrame,
- ink, style);
- }
-
- //------------------------------------------------------------------------------
- // CGroupShape::RestoreShape
- //------------------------------------------------------------------------------
-
- void CGroupShape::RestoreShape(Environment* ev)
- {
- CBaseShape::RestoreShape(ev);
-
- // Call RestoreShape on each shape in this group
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->RestoreShape(ev);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::Removed
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::Removed(Environment* ev)
- {
- CBaseShape::Removed(ev);
-
- // Call Removed on each shape in this group
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->Removed(ev);
- }
- }
-
- //------------------------------------------------------------------------------
- // CGroupShape::Deleted - the shape is going to be deleted
- //------------------------------------------------------------------------------
-
- void CGroupShape::Deleted(Environment* ev)
- {
- CBaseShape::Deleted(ev);
-
- // Call Deleted on each shape in this group
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->Deleted(ev);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::SelectShape
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::SelectShape(Environment* ev, FW_Boolean state)
- {
- CBaseShape::SelectShape(ev, state);
-
- // ----- Select all the shapes in this group ----
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->SelectShape(ev, state);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::SubtractToWorkingClip
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::SubtractToWorkingClip(Environment* ev,
- CDrawFacetClipper* facetClipper,
- ODFacet* containingFacet,
- ODShape* workingClip,
- ODShape* tempShape,
- ODShape* limitShape)
- {
- /* [MEB] kludge - prevent crash on copy/paste a group shape containing proxies */
- if (CountProxyShapes(ev) != 0)
- {
- CBaseShape::SubtractToWorkingClip(ev, facetClipper, containingFacet, workingClip, tempShape, limitShape);
- return;
- }
-
- // Call SubtractToWorkingClip on each shape in this group
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.Last(); it.IsNotComplete(); shape = it.Previous())
- {
- shape->SubtractToWorkingClip(ev, facetClipper, containingFacet, workingClip, tempShape, limitShape);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::AddShape
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::AddShape(CBaseShape* shape)
- {
- fShapeList->AddLast(shape);
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::CountShapes
- //----------------------------------------------------------------------------------------
-
- unsigned long CGroupShape::CountShapes() const
- {
- return fShapeList->Count();
- }
-
- //------------------------------------------------------------------------------
- // CGroupShape::CountProxyShapes
- //------------------------------------------------------------------------------
-
- unsigned long CGroupShape::CountProxyShapes(Environment* ev) const
- {
- unsigned long count = 0;
-
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- if (shape->GetShapeType() == kProxyShape)
- count++;
- else if (shape->GetShapeType() == kGroupShape)
- count += ((CGroupShape*) shape)->CountProxyShapes(ev); // recursive call
- }
-
- return count;
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::GetFirstShape
- //----------------------------------------------------------------------------------------
-
- CBaseShape* CGroupShape::GetFirstShape() const
- {
- return fShapeList->First();
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::RemoveShapes
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::RemoveShapes()
- {
- this->EmptyShapes(false);
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::Remove1Shape
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::Remove1Shape(CBaseShape* shape)
- {
- fShapeList->Remove(shape);
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::ChangeFillColor
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::ChangeFillColor(Environment* ev, const FW_CColor& color)
- {
- CBaseShape::ChangeFillColor(ev, color);
-
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->ChangeFillColor(ev, color);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::ChangeFrameColor
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::ChangeFrameColor(Environment* ev, const FW_CColor& color)
- {
- CBaseShape::ChangeFrameColor(ev, color);
-
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->ChangeFrameColor(ev, color);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::ChangeFillPattern
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::ChangeFillPattern(Environment* ev, const FW_CPattern& pattern)
- {
- CBaseShape::ChangeFillPattern(ev, pattern);
-
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->ChangeFillPattern(ev, pattern);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::ChangeFramePattern
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::ChangeFramePattern(Environment* ev, const FW_CPattern& pattern)
- {
- CBaseShape::ChangeFramePattern(ev, pattern);
-
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->ChangeFramePattern(ev, pattern);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::ChangePenSize
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::ChangePenSize(Environment* ev, FW_Fixed newPenSize)
- {
- CBaseShape::ChangePenSize(ev, newPenSize);
-
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->ChangePenSize(ev, newPenSize);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::ChangeRenderVerb
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::ChangeRenderVerb(Environment* ev, unsigned short renderVerb)
- {
- CBaseShape::ChangeRenderVerb(ev, renderVerb);
-
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->ChangeRenderVerb(ev, renderVerb);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CGroupShape::SetSubscribeLink
- //----------------------------------------------------------------------------------------
-
- void CGroupShape::SetSubscribeLink(Environment* ev, CDrawSubscribeLink* subscribeLink)
- {
- CBaseShape::SetSubscribeLink(ev, subscribeLink);
-
- CShapeCollectionIterator it(fShapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- shape->SetSubscribeLink(ev, subscribeLink);
- }
- }
-
- //========================================================================================
- // class CAllShapeIterator
- //========================================================================================
-
- FW_DEFINE_AUTO(CAllShapeIterator)
-
- //----------------------------------------------------------------------------------------
- // CAllShapeIterator::CAllShapeIterator
- //----------------------------------------------------------------------------------------
-
- CAllShapeIterator::CAllShapeIterator(CShapeCollection* shapeList) :
- fIter(NULL),
- fTempList(NULL)
- {
- fTempList = FW_NEW(CShapeCollection, ());
- PrivFlattenList(shapeList);
- fIter = FW_NEW(CShapeCollectionIterator, (fTempList));
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // CAllShapeIterator::CAllShapeIterator
- //----------------------------------------------------------------------------------------
-
- CAllShapeIterator::CAllShapeIterator(CDrawContent* content) :
- fIter(NULL),
- fTempList(NULL)
- {
- fTempList = FW_NEW(CShapeCollection, ());
- PrivFlattenList(content->fShapeList);
- fIter = FW_NEW(CShapeCollectionIterator, (fTempList));
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // CAllShapeIterator::CAllShapeIterator
- //----------------------------------------------------------------------------------------
-
- CAllShapeIterator::~CAllShapeIterator()
- {
- FW_START_DESTRUCTOR
- delete fTempList;
- delete fIter;
- }
-
- //----------------------------------------------------------------------------------------
- // CAllShapeIterator::First
- //----------------------------------------------------------------------------------------
-
- CBaseShape* CAllShapeIterator::First()
- {
- return fIter->First();
- }
-
- //----------------------------------------------------------------------------------------
- // CAllShapeIterator::Next
- //----------------------------------------------------------------------------------------
-
- CBaseShape* CAllShapeIterator::Next()
- {
- return fIter->Next();
- }
-
- //----------------------------------------------------------------------------------------
- // CAllShapeIterator::IsNotComplete
- //----------------------------------------------------------------------------------------
-
- FW_Boolean CAllShapeIterator::IsNotComplete()
- {
- return fIter->IsNotComplete();
- }
-
- //----------------------------------------------------------------------------------------
- // CAllShapeIterator::Last
- //----------------------------------------------------------------------------------------
-
- CBaseShape* CAllShapeIterator::Last()
- {
- return fIter->Last();
- }
-
- //----------------------------------------------------------------------------------------
- // CAllShapeIterator::Previous
- //----------------------------------------------------------------------------------------
-
- CBaseShape* CAllShapeIterator::Previous()
- {
- return fIter->Previous();
- }
-
- //----------------------------------------------------------------------------------------
- // CAllShapeIterator::PrivFlattenList
- //----------------------------------------------------------------------------------------
-
- void CAllShapeIterator::PrivFlattenList(CShapeCollection* shapeList)
- {
- CShapeCollectionIterator it(shapeList);
- for (CBaseShape* shape = it.First(); it.IsNotComplete(); shape = it.Next())
- {
- if (shape->GetShapeType() == kGroupShape)
- PrivFlattenList(((CGroupShape*)shape)->GetShapeList());
- else
- fTempList->AddLast(shape);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CAllShapeIterator::CountShapes
- //----------------------------------------------------------------------------------------
-
- unsigned long CAllShapeIterator::CountShapes()
- {
- return fTempList->Count();
- }
-