home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 3.9 KB | 180 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: DrwPrmse.cpp
- // Release Version: $ ODF 2 $
- //
- // Author: Henri Lamiraux
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "ODFDraw.hpp"
-
- #ifndef DRWPRMSE_H
- #include "DrwPrmse.h"
- #endif
-
- #ifndef DRAWCONT_H
- #include "DrawCont.h"
- #endif
-
- #ifndef BINDING_K
- #include "Binding.k"
- #endif
-
- #ifndef DRAWPRXY_H
- #include "DrawPrxy.h"
- #endif
-
- #ifndef DRAWPART_H
- #include "DrawPart.h"
- #endif
-
- #ifndef DRAWSEL_H
- #include "DrawSel.h"
- #endif
-
- #ifndef BASESHP_H
- #include "BaseShp.h"
- #endif
-
- #ifndef BOUNDSHP_H
- #include "BoundShp.h"
- #endif
-
- #ifndef LINESHP_H
- #include "LineShp.h"
- #endif
-
- #ifndef OVALSHP_H
- #include "OvalShp.h"
- #endif
-
- #ifndef RECTSHP_H
- #include "RectShp.h"
- #endif
-
- #ifndef RRECTSHP_H
- #include "RRectShp.h"
- #endif
-
- #ifndef TEXTSHP_H
- #include "TextShp.h"
- #endif
-
- #ifndef UTILS_H
- #include "Utils.h"
- #endif
-
- // ----- OS Layer -----
-
- #ifndef FWSUSINK_H
- #include "FWSUSink.h"
- #endif
-
- #ifndef FWORDCOL_H
- #include "FWOrdCol.h"
- #endif
-
- #ifndef FWPICTUR_H
- #include "FWPictur.h"
- #endif
-
- // ----- Foundation Includes -----
-
- #ifndef FWSTREAM_H
- #include "FWStream.h"
- #endif
-
- #ifndef FWPRISTR_H
- #include "FWPriStr.h"
- #endif
-
- #ifndef FWMEMMGR_H
- #include "FWMemMgr.h"
- #endif
-
- #ifndef FWMEMHLP_H
- #include "FWMemHlp.h"
- #endif
-
- #ifndef FWSOMENV_H
- #include "FWSOMEnv.h"
- #endif
-
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_Module_OpenDoc_StdProps_defined
- #include <StdProps.xh>
- #endif
-
- #ifndef SOM_ODStorageUnitView_xh
- #include <SUView.xh>
- #endif
-
- //========================================================================================
- // RunTime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment odfdraw
- #endif
-
- //========================================================================================
- // class CDrawPromise
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CDrawPromise::CDrawPromise
- //----------------------------------------------------------------------------------------
-
- CDrawPromise::CDrawPromise(Environment*ev,
- FW_StorageKinds storageKind,
- FW_CCloneInfo* cloneInfo,
- CDrawPromiseContent* promisedContent,
- FW_CLinkSource* linkSrc) :
- FW_CPromise(ev, storageKind, cloneInfo, linkSrc),
- fPromisedContent(promisedContent)
- {
- fPromisedContent->PromiseShape(ev, storageKind, TRUE);
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPromise::~CDrawPromise
- //----------------------------------------------------------------------------------------
-
- CDrawPromise::~CDrawPromise()
- {
- FW_SOMEnvironment ev;
-
- fPromisedContent->PromiseShape(ev, GetStorageKind(ev), FALSE);
-
- // Draw links just provide a reference to their own content, so don't delete that!
- if (this->GetStorageKind(ev) != FW_kLinkStorage)
- delete fPromisedContent;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPromise::FulfillPromise
- //----------------------------------------------------------------------------------------
-
- void CDrawPromise::FulfillPromise(Environment *ev,
- FW_CPart* part,
- ODStorageUnitView *promiseSUView,
- ODPropertyName propertyName,
- ODValueType valueType,
- FW_CCloneInfo* cloneInfo)
- {
- #ifndef FW_DEBUG
- FW_UNUSED(propertyName);
- #endif
- FW_ASSERT(FW_PrimitiveStringEqual(propertyName, kODPropContents)); // We only promised the kODPropContents
-
- FW_CKind* kind = part->GetKind(ev, valueType);
- FW_ASSERT(kind);
-
- fPromisedContent->ExternalizeKind(ev, promiseSUView->GetStorageUnit(ev), kind, GetStorageKind(ev), NULL, cloneInfo);
- }
-