#ifdef __PRIVATE__
//#
//#     File:           Metafilp.idl
//#
//#     Contains:       IDL description of MetaFilePart
//#
//#     Written by:     Jean Yan
//#
//#     Copyright:      c 1994 by Novell Inc., all rights reserved.
//#
//#     Change History (most recent first):
//#
//#
#else
//#     Copyright:      c 1993-1994 by Novell Inc., all rights reserved.
#endif


#ifndef _MetaFilePart_
#define _MetaFilePart_

#ifndef _PART_
#include "Part.idl"
#endif

interface ODWindow;
interface ODFocusSet;
interface ODFrame;
interface ODMenuBar;
interface ODSession;


#ifdef __PRIVATE__
//=====================================================================================
// Implementation Types
//=====================================================================================

typedef somToken OrderedCollection;
typedef somToken HWND;
typedef somToken HDC;
typedef somToken LPSTR;
typedef somToken HBITMAP;
typedef somToken RgnHandle;
typedef somToken BITMAPINFO;
typedef somToken HMETAFILE;
typedef somToken UINT;
typedef somToken Proxy;
typedef somToken COLORREF;

#endif


interface MetaFilePart : ODPart
{

#ifdef __PRIVATE__
	
	void CommonInitMetaFilePart(in ODPartWrapper partWrapper) ;
	
	HBITMAP GetBitmapFromMemory(in HGLOBAL hGlobal, in HDC hdc);
	ODWindow MetaFileCreateWindow(in ODFrame sourceFrame);
	void ActivateFrame(in ODFrame frame);
		
	void DeActivateFrame(in ODFrame frame);
	void ActivatingWindow(in ODFrame frame);
	void DeActivatingWindow(in ODFrame frame);
	void InstallMenus(in ODFrame frame);
	void RemoveMenus(in ODFrame frame);
	HWND CreateShadowWindow(in ODFrame frame, in HWND hParent);
	void MoveSizeShadowWindow(in ODFrame frame);
	OrderedCollection *GetDisplayFrames(); 

	// -UI Events-
	ODBoolean HandleMouseDown(in ODFacet facet, in ODPoint where, in ODEventData event);
	ODBoolean HandleMenuEvent(in ODFrame focusFrame, in ODEventData event);
	ODBoolean HandleLoadEvent(in ODFrame focusFrame, in ODEventData event);

	ODBoolean LoadMetaFile(in LPSTR lpFileName, in ODFrame focusFrame);
	ODBoolean LoadBMPFile(in LPSTR lpFileName, in ODFrame focusFrame);


#endif

#ifdef __SOMIDL__
	implementation
	{
		majorversion = 1;
		minorversion = 0;
		
	releaseorder:
	#ifdef __PRIVATE__
		CommonInitMetaFilePart,
		GetBitmapFromMemory,
		MetaFileCreateWindow,
		CreateShadowWindow,
		MoveSizeShadowWindow,		
		ActivateFrame,
		DeActivateFrame,
		ActivatingWindow,
		DeActivatingWindow,
		InstallMenus,
		RemoveMenus,
		GetDisplayFrames,
		HandleMouseDown,
		HandleMenuEvent,
		HandleLoadEvent,
		LoadMetaFile,
		LoadBMPFile;
	#else
		reserved1
		,reserved2
		,reserved3
		,reserved4
		,reserved5
		,reserved6
		,reserved7
		,reserved8
		,reserved9
		,reserved10
		,reserved11
		,reserved12
		,reserved13
		,reserved14
		,reserved15
		,reserved16,
		,reserved17;
	#endif

	override:
		somInit,
		somUninit,
		InitPart,
		InitPartFromStorage,
		FulfillPromise,
		DropCompleted,
		DragEnter,
		DragWithin,
		DragLeave,
		Drop,
		ContainingPartPropertiesChanged,
		GetContainingPartProperties,
		RevealFrame,
		EmbeddedFrameSpec,
		CreateEmbeddedFramesIterator,
		DisplayFrameAdded,
		DisplayFrameRemoved,
		DisplayFrameConnected,
		DisplayFrameClosed,
		AttachSourceFrame,
		FrameShapeChanged,
		ViewTypeChanged,
		PresentationChanged,
		SequenceChanged,
		WritePartInfo,
		ReadPartInfo,
		Open,
		RequestEmbeddedFrame,
		RemoveEmbeddedFrame,
		RequestFrameShape,
		UsedShapeChanged,
		AdjustBorderShape,
		FacetAdded,
		FacetRemoved,
		CanvasChanged,
		GeometryChanged,
		Draw,
		CanvasUpdated,
		HighlightChanged,
		GetPrintResolution,
		CreateLink,
		LinkUpdated,
		RevealLink,
		EmbeddedFrameChanged,
		LinkStatusChanged,
		BeginRelinquishFocus,
		CommitRelinquishFocus,
		AbortRelinquishFocus,
		FocusAcquired,
		FocusLost,
		CloneInto,
		ExternalizeKinds,
		Externalize,
		ChangeKind,
		HandleEvent,
		HandleEventInEmbedded,
		MouseEnter,
		MouseWithin,
		MouseLeave,
		AdjustMenus,
		UndoAction,
		RedoAction,
		DisposeActionState,
		WriteActionState,
		ReadActionState,
		HasExtension,
		GetExtension,
		Release;

    #ifdef __PRIVATE__
		passthru C_xh = ""
			"class ODFrame ;"
			"class OrderedCollection ;"
			"class ODTransform ;"
			""
			"typedef struct {"
			"	DWORD   	key;"
			"	WORD		hmf;"
			"	SMALL_RECT	bbox;"
			"	WORD		inch;"
			"	DWORD		reserved;"
			"	WORD		checksum;"
			"} ALDUSMFHEADER;" 
			""
			"struct Proxy {"
			"	HRGN region;"
			"	ODFrame* frame;"
			"	ODTransform* transform;"
			"	Proxy(ODRgnHandle r, ODFrame* f, ODTransform* t) {region = r; frame = f; transform = t; }"
			"};"
			""
			"class PartInfoRec"
			"{"
			"public:"
			"	PartInfoRec() { fIsActive = kODFalse; fNeedsActivating = kODFalse; }"
			"	virtual ~PartInfoRec() { }"
			"	COLORREF	bgColor;"
			"	ODRgnHandle	bgClipRegion;"
			"	ODBoolean	fIsActive;"
			"	ODBoolean	fNeedsActivating;"
			"};"

		;

	#endif

	// instance variables
		
		ODPartWrapper       fPartWrapper;

		ODSession			fSession;
		ODPlatformMenu		fMetafileMenu;
		ODStorageUnit		fMetaFileSU;
		OrderedCollection	*fDisplayFrames;
		OrderedCollection	*fEmbeddedFrames;
		OrderedCollection	*fContents;
		OrderedCollection	*fSelection;
		ODMenuBar			fMenuBar;
		ODTypeToken			fSelectionFocus;
		ODTypeToken			fMenuFocus;
		ODTypeToken			fKeyFocus;
		ODFocusSet 			fFocusSet;
		HMETAFILE			fhmf;
		ODBoolean			fIsAldusMeta;
		RECT				fAldusBox;
		HGLOBAL				hBitmap;
		ODBoolean			FitToFrame;
		int					biWidth;
		int					biHeight;
		BITMAPINFO			*lpBitsInfo;
		int					fh;
		HWND				fShadowWindow;
		ODID				fWindowID;
		int					fShadowUsage;
		char				FileName[180];

	

	};
#endif
};


#endif  // _MetaFilePart_
