MFC Grid manual

IClipboardFormat Class Reference

Serializes and deserializes handles to lines in CGrid to/from the clipboard. More...

#include <Dapfor/GUI/IClipboardFormat.h>

Inheritance diagram for IClipboardFormat:

CLocalDataFormat CRemoteDataFormat CTextClipboardFormat

List of all members.


Public Types

enum  SourceType { Local, Remote }
 Source type. More...
typedef std::vector
< Common::CDataObject * > 
DataObjects
 Container to store imported (created by Common::CTypeFactory) data objects.

Public Member Functions

virtual ~IClipboardFormat ()
 Virtual destructor.
virtual void Prepare (const Handles &handles, const CHeader &header)=0
 Prepares data for serialization to the clipboard.
virtual long GetSerializationSize () const =0
 Gets the size in bytes needed to store data to a binary buffer.
virtual void Serialize (void *buffer, const CGrid &grid, ContextType contextType, long userData) const =0
 Serializes data to a binary buffer.
virtual void Clear ()=0
 Clears temporary data created during a serialization process.
virtual int GetFormatId () const =0
 Gets clipboard format identifier (CF_TEXT, CF_BITMAP or already registered user-defined format).
virtual bool Deserialize (const void *buffer, long bufSize, const IObjectImporter *importer, RestoredInfo &restoredInfo)=0
 Deserializes data from the clipboard and tries to restore grid handles with their hierarchy.

Static Public Member Functions

static HITEM CreateHandle (Common::CDataObject *pDO, HITEM hParent)
 Creates a new handle that initially is not attached to the grid.

Classes

struct  RestoredInfo
 This structure keeps data with their hierarchy, deserialized from the clipboard. More...

Detailed Description

Serializes and deserializes handles to lines in CGrid to/from the clipboard.

Version:
1.0.0.0 Initial version

Member Enumeration Documentation

enum SourceType

Source type.

Enumerator:
Local  Data has been copied from the same address space.
Remote  Data has been copied to the clipboard by another application. The case of import data.


Member Function Documentation

void Prepare ( const Handles &  handles,
const CHeader header 
) [pure virtual]

Prepares data for serialization to the clipboard.

Parameters:
[in] handles Handles to be serialized.
[in] header CGrid header. Usually a current header is used.

Implemented in CLocalDataFormat, CRemoteDataFormat, and CTextClipboardFormat.

long GetSerializationSize (  )  const [pure virtual]

Gets the size in bytes needed to store data to a binary buffer.

Returns:
Size, needed to store data in bytes.

Implemented in CLocalDataFormat, CRemoteDataFormat, and CTextClipboardFormat.

void Serialize ( void *  buffer,
const CGrid grid,
ContextType  contextType,
long  userData 
) const [pure virtual]

Serializes data to a binary buffer.

Parameters:
[in] buffer Storage to which data is serialized. The buffer must be preliminary allocated with the size, returned by GetSerializationSize() function
[in] grid Reference to the grid
[in] contextType Context from which data is taken.
[in] userData 32-bit user-defined value

Implemented in CLocalDataFormat, CRemoteDataFormat, and CTextClipboardFormat.

int GetFormatId (  )  const [pure virtual]

Gets clipboard format identifier (CF_TEXT, CF_BITMAP or already registered user-defined format).

Returns:
Clipboard format identifier.

Implemented in CLocalDataFormat, CRemoteDataFormat, and CTextClipboardFormat.

bool Deserialize ( const void *  buffer,
long  bufSize,
const IObjectImporter importer,
RestoredInfo restoredInfo 
) [pure virtual]

Deserializes data from the clipboard and tries to restore grid handles with their hierarchy.

Parameters:
[in] buffer The binary buffer, got from the clipboard.
[in] bufSize Buffer size.
[in] importer Pointer to the object that can instantiate objects of specified classes from a binary form. Usually Common::CTypeFactory is used which permits to import data from other applications.
[in,out] restoredInfo Storage, that keeps all restored data with their hierarchy.
Returns:
True if success. Otherwise false.

Implemented in CLocalDataFormat, CRemoteDataFormat, and CTextClipboardFormat.

HITEM CreateHandle ( Common::CDataObject pDO,
HITEM  hParent 
) [static]

Creates a new handle that initially is not attached to the grid.

Parameters:
[in] pDO The data object, a new handle will be associated with.
[in] hParent Parent handle, to which a new handle will be hierarchically added.
Returns:
Handle if it has been successfully created and attached to its parent. Otherwise '0'.