2001-11-19 03:33:36 +03:00
|
|
|
#ifndef CMSWINDOWSCLIPBOARD_H
|
|
|
|
#define CMSWINDOWSCLIPBOARD_H
|
|
|
|
|
|
|
|
#include "IClipboard.h"
|
2002-07-23 19:26:40 +04:00
|
|
|
#include "stdvector.h"
|
2002-06-10 20:49:46 +04:00
|
|
|
#define WIN32_LEAN_AND_MEAN
|
2001-11-25 21:32:41 +03:00
|
|
|
#include <windows.h>
|
2001-11-19 03:33:36 +03:00
|
|
|
|
2002-07-23 19:26:40 +04:00
|
|
|
class IMSWindowsClipboardConverter;
|
|
|
|
|
2002-07-29 21:03:55 +04:00
|
|
|
//! Microsoft windows clipboard implementation
|
2001-11-19 03:33:36 +03:00
|
|
|
class CMSWindowsClipboard : public IClipboard {
|
2002-04-29 18:40:01 +04:00
|
|
|
public:
|
2001-11-25 21:32:41 +03:00
|
|
|
CMSWindowsClipboard(HWND window);
|
2001-11-19 03:33:36 +03:00
|
|
|
virtual ~CMSWindowsClipboard();
|
|
|
|
|
|
|
|
// IClipboard overrides
|
2002-05-27 22:55:51 +04:00
|
|
|
virtual bool empty();
|
2001-11-19 03:33:36 +03:00
|
|
|
virtual void add(EFormat, const CString& data);
|
2002-05-27 22:55:51 +04:00
|
|
|
virtual bool open(Time) const;
|
|
|
|
virtual void close() const;
|
2002-04-30 20:23:03 +04:00
|
|
|
virtual Time getTime() const;
|
2001-11-19 03:33:36 +03:00
|
|
|
virtual bool has(EFormat) const;
|
|
|
|
virtual CString get(EFormat) const;
|
2001-11-25 21:32:41 +03:00
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2002-07-23 19:26:40 +04:00
|
|
|
void clearConverters();
|
|
|
|
|
2001-11-25 21:32:41 +03:00
|
|
|
UINT convertFormatToWin32(EFormat) const;
|
|
|
|
HANDLE convertTextToWin32(const CString& data) const;
|
|
|
|
CString convertTextFromWin32(HANDLE) const;
|
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2002-07-23 19:26:40 +04:00
|
|
|
typedef std::vector<IMSWindowsClipboardConverter*> ConverterList;
|
|
|
|
|
2001-11-25 21:32:41 +03:00
|
|
|
HWND m_window;
|
2002-05-27 22:55:51 +04:00
|
|
|
mutable Time m_time;
|
2002-07-23 19:26:40 +04:00
|
|
|
ConverterList m_converters;
|
|
|
|
};
|
|
|
|
|
2002-07-29 21:03:55 +04:00
|
|
|
//! Clipboard format converter interface
|
|
|
|
/*!
|
|
|
|
This interface defines the methods common to all win32 clipboard format
|
|
|
|
converters.
|
|
|
|
*/
|
2002-07-23 19:26:40 +04: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 03:33:36 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|