2001-11-19 00:33:36 +00:00
|
|
|
#ifndef CMSWINDOWSCLIPBOARD_H
|
|
|
|
#define CMSWINDOWSCLIPBOARD_H
|
|
|
|
|
|
|
|
#include "IClipboard.h"
|
2002-07-23 15:26:40 +00:00
|
|
|
#include "stdvector.h"
|
2002-06-10 16:49:46 +00:00
|
|
|
#define WIN32_LEAN_AND_MEAN
|
2001-11-25 18:32:41 +00:00
|
|
|
#include <windows.h>
|
2001-11-19 00:33:36 +00:00
|
|
|
|
2002-07-23 15:26:40 +00:00
|
|
|
class IMSWindowsClipboardConverter;
|
|
|
|
|
2002-07-29 17:03:55 +00:00
|
|
|
//! Microsoft windows clipboard implementation
|
2001-11-19 00:33:36 +00:00
|
|
|
class CMSWindowsClipboard : public IClipboard {
|
2002-04-29 14:40:01 +00:00
|
|
|
public:
|
2001-11-25 18:32:41 +00:00
|
|
|
CMSWindowsClipboard(HWND window);
|
2001-11-19 00:33:36 +00:00
|
|
|
virtual ~CMSWindowsClipboard();
|
|
|
|
|
|
|
|
// IClipboard overrides
|
2002-05-27 18:55:51 +00:00
|
|
|
virtual bool empty();
|
2001-11-19 00:33:36 +00:00
|
|
|
virtual void add(EFormat, const CString& data);
|
2002-05-27 18:55:51 +00:00
|
|
|
virtual bool open(Time) const;
|
|
|
|
virtual void close() const;
|
2002-04-30 16:23:03 +00:00
|
|
|
virtual Time getTime() const;
|
2001-11-19 00:33:36 +00:00
|
|
|
virtual bool has(EFormat) const;
|
|
|
|
virtual CString get(EFormat) const;
|
2001-11-25 18:32:41 +00:00
|
|
|
|
2002-04-29 14:40:01 +00:00
|
|
|
private:
|
2002-07-23 15:26:40 +00:00
|
|
|
void clearConverters();
|
|
|
|
|
2001-11-25 18:32:41 +00:00
|
|
|
UINT convertFormatToWin32(EFormat) const;
|
|
|
|
HANDLE convertTextToWin32(const CString& data) const;
|
|
|
|
CString convertTextFromWin32(HANDLE) const;
|
|
|
|
|
2002-04-29 14:40:01 +00:00
|
|
|
private:
|
2002-07-23 15:26:40 +00:00
|
|
|
typedef std::vector<IMSWindowsClipboardConverter*> ConverterList;
|
|
|
|
|
2001-11-25 18:32:41 +00:00
|
|
|
HWND m_window;
|
2002-05-27 18:55:51 +00:00
|
|
|
mutable Time m_time;
|
2002-07-23 15:26:40 +00:00
|
|
|
ConverterList m_converters;
|
|
|
|
};
|
|
|
|
|
2002-07-29 17:03:55 +00:00
|
|
|
//! Clipboard format converter interface
|
|
|
|
/*!
|
|
|
|
This interface defines the methods common to all win32 clipboard format
|
|
|
|
converters.
|
|
|
|
*/
|
2002-07-23 15:26:40 +00:00
|
|
|
class IMSWindowsClipboardConverter : public IInterface {
|
|
|
|
public:
|
|
|
|
// accessors
|
|
|
|
|
|
|
|
// return the clipboard format this object converts from/to
|
|
|
|
virtual IClipboard::EFormat
|
|
|
|
getFormat() const = 0;
|
|
|
|
|
|
|
|
// return the atom representing the win32 clipboard format that
|
|
|
|
// this object converts from/to
|
|
|
|
virtual UINT getWin32Format() const = 0;
|
|
|
|
|
|
|
|
// convert from the IClipboard format to the win32 clipboard format.
|
|
|
|
// the input data must be in the IClipboard format returned by
|
|
|
|
// getFormat(). the return data will be in the win32 clipboard
|
|
|
|
// format returned by getWin32Format(), allocated by GlobalAlloc().
|
|
|
|
virtual HANDLE fromIClipboard(const CString&) const = 0;
|
|
|
|
|
|
|
|
// convert from the win32 clipboard format to the IClipboard format
|
|
|
|
// (i.e., the reverse of fromIClipboard()).
|
|
|
|
virtual CString toIClipboard(HANDLE data) const = 0;
|
2001-11-19 00:33:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|