/* @(#)Z 1.7 com/src/core/idl/Part.idl, odcore, od96nt, odnt9712d 97/03/21 16:44:26 (96/10/29 09:22:43) */


#ifndef _PART_
#define _PART_

#ifndef _PSTOBJ_
#include "PstObj.idl"
#endif

//==============================================================================
// Classes defined in this interface
//==============================================================================

interface ODPart;
interface M_ODPart;

//==============================================================================
// Classes used by this interface
//==============================================================================

interface ODCanvas;
interface ODDragItemIterator;
interface ODEmbeddedFramesIterator;
interface ODFacet;
interface ODFrame;
interface ODLink;
interface ODLinkSource;
interface ODObjectSpec;
interface ODShape;
interface ODStorageUnit;
interface ODStorageUnitView;
interface ODTypeList;

//==============================================================================
// ODPart
//==============================================================================

interface ODPart : ODPersistentObject
{

	//==========================================================================
	// Required Protocols
	//==========================================================================

	//--------------------------------------------------------------------------
	// Initialization
	//--------------------------------------------------------------------------

	void InitPart(in ODStorageUnit storageUnit,
				  in ODPart partWrapper);

	void InitPartFromStorage(in ODStorageUnit storageUnit,
							 in ODPart partWrapper);

	//--------------------------------------------------------------------------
	// From Layout protocol
	//--------------------------------------------------------------------------

	void DisplayFrameAdded(in ODFrame frame);

	void DisplayFrameRemoved(in ODFrame frame);

	void DisplayFrameConnected(in ODFrame frame);

	void DisplayFrameClosed(in ODFrame frame);

	void AttachSourceFrame(in ODFrame frame,
						   in ODFrame sourceFrame);

	void FrameShapeChanged(in ODFrame frame);

	void ViewTypeChanged(in ODFrame frame);

	void PresentationChanged(in ODFrame frame);

	void SequenceChanged(in ODFrame frame);

	void LinkStatusChanged(in ODFrame frame);

	void ContainingPartPropertiesUpdated(in ODFrame frame,
										 in ODStorageUnit propertyUnit);

	ODInfoType ReadPartInfo(in ODFrame frame,
							in ODStorageUnitView storageUnitView);

	void WritePartInfo(in ODInfoType partInfo,
					   in ODStorageUnitView storageUnitView);

	void ClonePartInfo(in ODDraftKey key,
					   in ODInfoType partInfo,
					   in ODStorageUnitView storageUnitView,
					   in ODFrame scope);

	ODID Open(in ODFrame frame);

	//--------------------------------------------------------------------------
	// From Imaging protocol
	//--------------------------------------------------------------------------

	void Draw(in ODFacet facet,
			  in ODShape invalidShape);

	void FacetAdded(in ODFacet facet);

	void FacetRemoved(in ODFacet facet);

	void GeometryChanged(in ODFacet facet,
						 in ODBoolean clipShapeChanged,
						 in ODBoolean externalTransformChanged);

	void HighlightChanged(in ODFacet facet);

	void CanvasChanged(in ODFacet facet);

	void CanvasUpdated(in ODCanvas canvas);

	ODULong GetPrintResolution(in ODFrame frame);

	//--------------------------------------------------------------------------
	// From Part Activation protocol
	//--------------------------------------------------------------------------

	ODBoolean BeginRelinquishFocus(in ODTypeToken focus,
								   in ODFrame ownerFrame,
								   in ODFrame proposedFrame);

	void CommitRelinquishFocus(in ODTypeToken focus,
							   in ODFrame ownerFrame,
							   in ODFrame proposedFrame);

	void AbortRelinquishFocus(in ODTypeToken focus,
							  in ODFrame ownerFrame,
							  in ODFrame proposedFrame);

	void FocusAcquired(in ODTypeToken focus,
					   in ODFrame ownerFrame);

	void FocusLost(in ODTypeToken focus,
				   in ODFrame ownerFrame);

	//--------------------------------------------------------------------------
	// From Part Persistance protocol
	//--------------------------------------------------------------------------

	void ExternalizeKinds(in ODTypeList kindset);

	void ChangeKind(in ODType kind);

	//--------------------------------------------------------------------------
	// From UI Events protocol
	//--------------------------------------------------------------------------

	ODBoolean HandleEvent(inout ODEventData event,
						  in ODFrame frame,
						  in ODFacet facet,
						  inout ODEventInfo eventInfo);

	void AdjustMenus(in ODFrame frame);

	//==========================================================================
	// Optional Protocols
	//==========================================================================

	//--------------------------------------------------------------------------
	// From Undo protocol
	//--------------------------------------------------------------------------

	void UndoAction(in ODActionData actionState);

	void RedoAction(in ODActionData actionState);

	void DisposeActionState(in ODActionData actionState,
							in ODDoneState doneState);

	void WriteActionState(in ODActionData actionState,
						  in ODStorageUnitView storageUnitView);

	ODActionData ReadActionState(in ODStorageUnitView storageUnitView);

	//--------------------------------------------------------------------------
	// From DragAndDrop protocol
	//--------------------------------------------------------------------------

	void FulfillPromise(in ODStorageUnitView promiseSUView);

	void DropCompleted(in ODPart destPart,
					   in ODDropResult dropResult);

	ODDragResult DragEnter(in ODDragItemIterator dragInfo,
						   in ODFacet facet,
						   in ODPoint where);

	ODDragResult DragWithin(in ODDragItemIterator dragInfo,
							in ODFacet facet,
							in ODPoint where);

	void DragLeave(in ODFacet facet,
				   in ODPoint where);

	ODDropResult Drop(in ODDragItemIterator dropInfo,
					  in ODFacet facet,
					  in ODPoint where);

	//--------------------------------------------------------------------------
	// From Linking protocol
	//--------------------------------------------------------------------------

	ODLinkSource CreateLink(in ODByteArray data);

	void RevealLink(in ODLinkSource linkSource);

	void LinkUpdated(in ODLink updatedLink,
					 in ODUpdateID change);

	// --- for containing parts ---

	void EmbeddedFrameUpdated(in ODFrame frame,
							  in ODUpdateID change);

	ODBoolean EditInLinkAttempted(in ODFrame frame);

	//--------------------------------------------------------------------------
	// From Embedding protocol
	//--------------------------------------------------------------------------

	ODFrame RequestEmbeddedFrame(in ODFrame containingFrame,
								 in ODFrame baseFrame,
								 in ODShape frameShape,
								 in ODPart embedPart,
								 in ODTypeToken viewType,
								 in ODTypeToken presentation,
								 in ODBoolean isOverlaid);

	void RemoveEmbeddedFrame(in ODFrame embeddedFrame);

	ODShape RequestFrameShape(in ODFrame embeddedFrame,
							  in ODShape frameShape);

	void UsedShapeChanged(in ODFrame embeddedFrame);

	ODShape AdjustBorderShape(in ODFacet embeddedFacet,
							  in ODShape shape);

	ODStorageUnit AcquireContainingPartProperties(in ODFrame frame);

	ODBoolean RevealFrame(in ODFrame embeddedFrame,
						  in ODShape revealShape);

	void EmbeddedFrameSpec(in ODFrame embeddedFrame,
						   in ODObjectSpec spec);

	ODEmbeddedFramesIterator CreateEmbeddedFramesIterator(in ODFrame frame);

	//==========================================================================
	// DO NOT OVERRIDE
	//==========================================================================

	//--------------------------------------------------------------------------
	// From Part Wrapping protocol
	//--------------------------------------------------------------------------

	ODBoolean IsRealPart();

	ODPart GetRealPart();

	void ReleaseRealPart();

	//==========================================================================

	#ifdef __SOMIDL__
	implementation
	{
		majorversion = 1; minorversion = 0;

		functionprefix = ODPart;

		override:
			somUninit,
			CloneInto,
			Externalize;

		releaseorder:
	        InitPart,
	        InitPartFromStorage,
	        DisplayFrameAdded,
	        DisplayFrameRemoved,
	        DisplayFrameConnected,
	        DisplayFrameClosed,
	        AttachSourceFrame,
	        FrameShapeChanged,
	        ViewTypeChanged,
	        PresentationChanged,
			SequenceChanged,
	        LinkStatusChanged,
	        ContainingPartPropertiesUpdated,
	        ReadPartInfo,
	        WritePartInfo,
			ClonePartInfo,
	        Open,
	        Draw,
	        FacetAdded,
	        FacetRemoved,
	        GeometryChanged,
	        HighlightChanged,
	        CanvasChanged,
	        CanvasUpdated,
	        GetPrintResolution,
	        BeginRelinquishFocus,
	        CommitRelinquishFocus,
	        AbortRelinquishFocus,
	        FocusAcquired,
	        FocusLost,
	        ExternalizeKinds,
	        ChangeKind,
	        HandleEvent,
	        AdjustMenus,

	        UndoAction,
	        RedoAction,
	        DisposeActionState,
	        WriteActionState,
	        ReadActionState,
	        FulfillPromise,
	        DropCompleted,
	        DragEnter,
	        DragWithin,
	        DragLeave,
	        Drop,
	        CreateLink,
	        RevealLink,
	        LinkUpdated,
	        EmbeddedFrameUpdated,
			EditInLinkAttempted,
	        RequestEmbeddedFrame,
	        RemoveEmbeddedFrame,
	        RequestFrameShape,
	        UsedShapeChanged,
	        AdjustBorderShape,
	        AcquireContainingPartProperties,
	        RevealFrame,
	        EmbeddedFrameSpec,
	        CreateEmbeddedFramesIterator,

			IsRealPart,
			GetRealPart,
			ReleaseRealPart;
	};
	#endif
};

interface M_ODPart : SOMClass
{
        ISOString              clsGetODPartHandlerName();
        string                 clsGetODPartHandlerDisplayName();
        sequence<PartKindInfo> clsGetODPartKinds();
        string                 clsGetOLE2ClassId();
        string                 clsGetWindowsIconFileName();


        #ifdef __SOMIDL__
        implementation
        {
                functionprefix = M_ODPart;

                override:
                  somNew;
                releaseorder:
                  clsGetODPartHandlerName,
                  clsGetODPartHandlerDisplayName,
                  clsGetODPartKinds,
                  clsGetOLE2ClassId,
                  clsGetWindowsIconFileName;

        };
     #endif   // SOMIDL
};

#endif // _PART_
