#ifdef __PRIVATE__
//#
//#     File:           LinkSrc.idl                             ** DO NOT REMERGE WITH APPLE CODE **
//#
//#     Contains:       Interface of ODLinkSource class
//#
//#     Written by:     Craig Carper
//#     Ported by:      Chris Andrew
//#
//#     Copyright:      c 1994 by Apple Computer, Inc., all rights reserved.
//#                     c 1995 by Novell, Inc., all rights reserved.
//#
//#     Change History (most recent first):
//#
//#     To Do:
//#
#else
//#     Copyright:      c 1994 by Apple Computer, Inc., all rights reserved.
//#                     c 1995 by Novell, Inc., all rights reserved.
#endif

#ifndef _LINKSRC_
#define _LINKSRC_

#ifndef _LINKSRCB_
#include "LinkSrcB.idl"
#endif

//==============================================================================
// Theory of Operation
//==============================================================================

/*
  This class is used to represent the source side of OpenDoc links. ODDrafts
  create and own these links. The source ODPart will ask the draft to create
  an ODLinkSource and an ODLink pair, and return the ODLink object to the
  the destination part.  The destination part uses the ODLink object to
  extract the contents of the link.
*/

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

interface  ODLinkSource;

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

interface ODSession;
interface ODStorageUnit;
interface ODPart;
interface ODLink;

#ifdef __PRIVATE__

//==============================================================================
// Implementation types
//==============================================================================

typedef somToken LPVOID;
typedef somToken OLEPromiseKeeper;
typedef somToken DWORD;
typedef somToken BOOL;
typedef somToken time_t;

#endif //# __PRIVATE__

//==============================================================================
// ODLinkSource
//==============================================================================

interface ODLinkSource : ODBaseLinkSource
{
#ifdef __PRIVATE__

	void InitLinkSource(in ODStorageUnit storageUnit,
						in ODPart sourcePart,
						in ODLink link);
	
	void InitLinkSourceFromStorage(in ODStorageUnit storageUnit);

	//# Private to implementation

	void CloneFromMemoryContainer( in ODStorageUnit contentSU, in ODHandle containerHandle );
	
	void SetLocked( in ODBoolean locked );

	ODBoolean GetLocked( );

	ODBoolean KeyValid( in ODLinkKey key );

	ODLinkKey GetCurrentKey( );

	void SetCurrentKey( in ODLinkKey key );

	void ThrowIfInvalidKey( in ODLinkKey key);

	void UseMoniker( in void                *pmkFull,
					 in ODLinkKey   key);

	void ReadMoniker();

	BOOL StoreMoniker( in ODStorageUnit             su,
					   in ODPropertyName    property,
					   in LPVOID                    pmk );

	void RestoreMoniker( in  ODStorageUnit  storageUnit,
						 in  ODPropertyName     property,
						 out LPVOID                     ppmk );

	void OnClose( );

	void OnDataChange( );

	void OnRename( in LPVOID        ppmk );

#endif

	#ifdef __SOMIDL__
	implementation
	{
		override:
			somInit,
			somUninit,
			Release,
			Externalize,
			ReleaseAll,
			CloneInto,
			Clear,
			ContentChanged,
			GetChangeID,
			GetChangeTime,
			GetContentStorageUnit,
			GetLink,
			IsAutoUpdate,
			Lock,
			SetSourcePart,
			SetAutoUpdate,
			Unlock,
			ShowSourceContent,
			ShowLinkSourceInfo;
			
		releaseorder:
			#ifdef __PRIVATE__
				InitLinkSource,
				InitLinkSourceFromStorage,
				SetLocked,
				GetLocked,
				GetCurrentKey,
				SetCurrentKey,
				ThrowIfInvalidKey,
				KeyValid,
				UseMoniker,
				ReadMoniker,
				StoreMoniker,
				RestoreMoniker,
				OnClose,
				OnDataChange,
				OnRename,
				CloneFromMemoryContainer;
			#else
				reserved1,
				reserved2,
				reserved3,
				reserved4,
				reserved5,
				reserved6,
				reserved7,
				reserved8,
				reserved9,
				reserved10,
				reserved11,
				reserved12,
				reserved13,
				reserved14,
				reserved15,
				reserved16;
			#endif
	
		majorversion = 1; minorversion = 0;
			
		#ifdef __PRIVATE__ //bln
		passthru C_xh =
			""
			"#define kODMoniker	\"Ole2Moniker\" "
			"#define kODLinkContent	\"OpenDoc:LinkContent\" "
			"";
		passthru C_h =
			""
			"#define kODMoniker	\"Ole2Moniker\" "
			"#define kODLinkContent	\"OpenDoc:LinkContent\" "
			"";

		ODStorageUnit    fContentSU;     // the storage unit containing the link's content
		ODChangeID               fChangeID;              // change id of current link content
		time_t                   fChangeTime;    // date and time link was last updated
		ODBoolean                fAutoUpdate;    // true if link should be exported on save
		ODLink                   fLink;                  // associated link object
		ODStorageUnit    fSourcePartSU;  // storage unit of source part
		ODBoolean                fLocked;                // TRUE if we are locked
		ODLinkKey                fCurrentKey;    // The current link key
		LPVOID                   fpmkFull;               // Full moniker of this link spec
		LPVOID                   fpmkRelative;   // Relative moniker of the link spec
		LPVOID                   fpDataObj;              // IDataObject for the link source
		LPVOID                   fpAdviseSink;   // Advise sink
		DWORD                    fdwConn;                // Advise holder connection id
		OLEPromiseKeeper *fPromiseKeeper;// Promise keeper object
		ODSession                fSession;
		#endif //bln
	};
	#endif //# __SOMIDL_
};

#endif // _LINKSRC_
