//
// Copyright � Vector Works, Inc. 2006.
// All Rights Reserved.
// 

#pragma once

#include "FolderSpecifiers.h"
#include "GSGeometry.h"
#include "Filing/IFileIdentifier.h"

using namespace VectorWorks::Filing;

namespace VectorWorks
{
	// ----------------------------------------------------------------------------------------------------
	struct SColorRecord {
		float			fCyan;
		float			fMagenta;
		float			fYellow;
		float			fKey;
		TXString		fColorName;
		Bool8			fbUserColor;
	};	

	// ----------------------------------------------------------------------------------------------------
	enum EColorRecordReceiverResult
	{
		eColorRecordReceiverResult_Continue,
		eColorRecordReceiverResult_StopNoError,
		eColorRecordReceiverResult_StopError,
	};

	// ----------------------------------------------------------------------------------------------------
	class IColorRecordReceiver
	{
	public:
		virtual ~IColorRecordReceiver()	{}

		virtual EColorRecordReceiverResult VCOM_CALLTYPE ReceiveColorRecordCount(Uint32 numRecordsToFollow) = 0;
		virtual EColorRecordReceiverResult VCOM_CALLTYPE ReceiveColorRecord(const SColorRecord& inColorRec) = 0;
	};
	
	// ----------------------------------------------------------------------------------------------------
	// {2d13c2d0-7c96-11db-9fe1-0800200c9a66}
	static const VWIID IID_DocumentColorTable = { 0x2d13c2d0, 0x7c96, 0x11db, { 0x9f, 0xe1, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 } };
	
	class DYNAMIC_ATTRIBUTE IDocumentColorTable : public IVWUnknown
	{
	public:
		virtual VCOMError VCOM_CALLTYPE LoadDocumentColorTableFromDisk(IFileIdentifier *inFileID, IColorRecordReceiver* inpRecReceiver) = 0;

		virtual VCOMError VCOM_CALLTYPE	InsertColor(const SColorRecord& inColorRecord, ColorRef& outColorRef) = 0;			
		virtual VCOMError VCOM_CALLTYPE	GetColorRecord(const ColorRef& inColorRef, SColorRecord& outColorRec) = 0;
		virtual VCOMError VCOM_CALLTYPE	GetNumColorRecords(Uint32& outNumRecords) = 0;
		virtual VCOMError VCOM_CALLTYPE	PurgeUnusedColors() = 0;
		virtual VCOMError VCOM_CALLTYPE ReplaceUserColors( const TGSColorV2 *newColors, const TXString *colorNames, const Sint32 *originalIndices, Uint32 nColors ) = 0;
	};
}


