home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 6.2 KB | 210 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: Proxy.cpp
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "Table.hpp"
-
- // ----- TablePart Includes -----
-
- #ifndef PROXY_H
- #include "Proxy.h"
- #endif
-
- #ifndef FRAME_H
- #include "Frame.h"
- #endif
-
- #ifndef CONTENT_H
- #include "Content.h"
- #endif
-
- // ----- Framework Includes -----
-
- #ifndef FWFRMING_H
- #include "FWFrming.h"
- #endif
-
- #ifndef FWITERS_H
- #include "FWIters.h"
- #endif
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- #ifndef FWFCTCLP_H
- #include "FWFctClp.h"
- #endif
-
- #ifndef FWPXYFRM_H
- #include "FWPxyFrm.h"
- #endif
-
- #ifndef FWTCOLL_H
- #include "FWTColl.h"
- #endif
-
- // ----- OS Includes -----
-
- #ifndef FWODGEOM_H
- #include "FWODGeom.h"
- #endif
-
- #ifndef FWFXMATH_H
- #include "FWFxMath.h"
- #endif
-
- //========================================================================================
- // RunTime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment odfTable
- #endif
-
- //========================================================================================
- // class CShapeCollection
- //========================================================================================
-
- FW_DEFINE_AUTO(CTableProxyCollection)
-
- //========================================================================================
- // class CShapeCollectionIterator
- //========================================================================================
-
- FW_DEFINE_AUTO(CTableProxyCollectionIterator)
-
- //========================================================================================
- // class CTableProxy
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CTableProxy::CTableProxy
- //----------------------------------------------------------------------------------------
-
- CTableProxy::CTableProxy(Environment* ev, CTablePart* tablePart, CTableContent* tableContent, FW_CPresentation* presentation) :
- FW_MProxy(ev, tablePart, presentation),
- fTablePart(tablePart),
- fTableContent(tableContent),
- fCell(0, 0),
- fSelected(FALSE)
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CTableProxy::~CTableProxy
- //----------------------------------------------------------------------------------------
-
- CTableProxy::~CTableProxy()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CTableProxy::UsedShapeChanged
- //----------------------------------------------------------------------------------------
-
- void CTableProxy::UsedShapeChanged(Environment *ev,
- FW_CEmbeddingFrame* embeddingFrame,
- ODFrame* odEmbeddedFrame)
- {
- FW_CRect cellRect;
- fTableContent->FindRect(fCell, cellRect);
- FW_CAcquiredODShape aqInvalidShape = ::FW_NewODShape(ev, cellRect);
-
- FW_CAcquiredODShape aqUsedShape(FW_CopyAndRelease(ev, odEmbeddedFrame->AcquireUsedShape(ev, NULL)));
-
- // ----- For the Table part, all embedded facets have the same externalTransform
- ODFacet *facet;
- {
- FW_CODFrameFacetIterator ite(ev, odEmbeddedFrame);
- facet = ite.First(ev);
- }
- if (facet == NULL)
- return;
-
- {
- FW_CAcquiredODTransform aqExternalTransform(facet->AcquireExternalTransform(ev, NULL));
- aqUsedShape->Transform(ev, aqExternalTransform);
- aqInvalidShape->Subtract(ev, aqUsedShape);
- }
-
- // ----- Invalidate
- embeddingFrame->Invalidate(ev, aqInvalidShape);
-
- // ----- Recalculate the clip
- FW_CFacetClipper facetClipper(ev, fTablePart);
- facetClipper.Clip(ev, GetPresentation(ev), NULL);
- }
-
- //----------------------------------------------------------------------------------------
- // CTableProxy::FrameShapeRequested
- //----------------------------------------------------------------------------------------
-
- ODShape* CTableProxy::FrameShapeRequested(Environment* ev,
- FW_CEmbeddingFrame* embeddingFrame,
- ODFrame* odEmbeddedFrame,
- ODShape* askedFrameShape)
- {
- FW_UNUSED(askedFrameShape);
-
- FW_CRect cellRect;
- fTableContent->FindRect(fCell, cellRect);
-
- cellRect.Place(FW_kZeroPoint);
- ODShape* cellShape = ::FW_NewODShape(ev, cellRect);
-
- return cellShape;
- }
-
- //----------------------------------------------------------------------------------------
- // CTableProxy::MoveEmbeddedFrames
- //----------------------------------------------------------------------------------------
-
- void CTableProxy::MoveEmbeddedFrames(Environment* ev, const CCell& destCell)
- {
- FW_CRect rect;
- fTableContent->FindRect(destCell, rect);
- ChangeFrameShapes(ev, rect.Width(), rect.Height());
- ChangeExternalTransforms(ev, rect.left, rect.top);
-
- // [HLX] because I can't create facets with a NULL clip (bug in OpenDoc???) I have to
- // Clip my embedded facets everytime
- FW_CFacetClipper facetClipper(ev, fTablePart);
- facetClipper.Clip(ev, GetPresentation(ev), NULL);
- }
-
- //----------------------------------------------------------------------------------------
- // CTableProxy::AcquireHiliteShape
- //----------------------------------------------------------------------------------------
-
- ODShape* CTableProxy::AcquireHiliteShape(Environment* ev, const CCell& cell, FW_CEmbeddingFrame* frame)
- {
- FW_CRect rect;
- fTableContent->FindRect(cell, rect);
-
- FW_CAcquiredODFrame embeddedFrame = this->AcquireEmbeddedFrame(ev, frame);
- FW_CAcquiredODShape usedShape = FW_CopyAndRelease(ev, embeddedFrame->AcquireUsedShape(ev, NULL));
- FW_CAcquiredODTransform transform = ::FW_NewODTransform(ev, rect.TopLeft());
- usedShape->Transform(ev, transform);
- ODShape* hiliteShape = ::FW_NewODShape(ev, rect);
- hiliteShape->Subtract(ev, usedShape);
- return hiliteShape;
- }
-
- //----------------------------------------------------------------------------------------
- // CTableProxy::OpenInWindow
- //----------------------------------------------------------------------------------------
- // Because proxys are always all selected I need to only open the one that's really selected
-
- void CTableProxy::OpenInWindow(Environment* ev, FW_CProxyFrame* proxyFrame)
- {
- if (fSelected)
- FW_MProxy::OpenInWindow(ev, proxyFrame);
- }
-
-