#define GetTymedName(tymed) wxEmptyString
#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL
+wxDataFormat HtmlFormatFixup(wxDataFormat format)
+{
+ // Since the HTML format is dynamically registered, the wxDF_HTML
+ // format does not match the native constant in the way other formats do,
+ // so for the format checks below to work, we must change the native
+ // id to the wxDF_HTML constant.
+ wxChar s_szBuf[256];
+ if (::GetClipboardFormatName(format, s_szBuf, WXSIZEOF(s_szBuf)))
+ {
+ if (s_szBuf == wxString("HTML Format"))
+ format = wxDF_HTML;
+ }
+ return format;
+}
+
// ----------------------------------------------------------------------------
// wxIEnumFORMATETC interface implementation
// ----------------------------------------------------------------------------
void wxDataFormat::SetId(const wxString& format)
{
- m_format = (wxDataFormat::NativeFormat)::RegisterClipboardFormat(format.wx_str());
+ m_format = (wxDataFormat::NativeFormat)::RegisterClipboardFormat(format.t_str());
if ( !m_format )
{
wxLogError(_("Couldn't register clipboard format '%s'."), format);
m_nCount = nCount;
m_formats = new CLIPFORMAT[nCount];
for ( ULONG n = 0; n < nCount; n++ ) {
- m_formats[n] = formats[n].GetFormatId();
+ if (formats[n].GetFormatId() != wxDF_HTML)
+ m_formats[n] = formats[n].GetFormatId();
+ else
+ m_formats[n] = ::RegisterClipboardFormat(wxT("HTML Format"));
}
}
// for the bitmaps and metafiles we use the handles instead of global memory
// to pass the data
wxDataFormat format = (wxDataFormat::NativeFormat)pformatetcIn->cfFormat;
+ format = HtmlFormatFixup(format);
switch ( format )
{
{
wxDataFormat format = pformatetc->cfFormat;
+ format = HtmlFormatFixup(format);
+
// this is quite weird, but for file drag and drop, explorer
// calls our SetData() with the formats we do *not* support!
//
size_t size;
switch ( format )
{
+ case wxDF_HTML:
case CF_TEXT:
case CF_OEMTEXT:
size = strlen((const char *)pBuf);
break;
#if !(defined(__BORLANDC__) && (__BORLANDC__ < 0x500))
case CF_UNICODETEXT:
-#if ( defined(__BORLANDC__) && (__BORLANDC__ > 0x530) ) \
- || ( defined(__MWERKS__) && defined(__WXMSW__) )
+#if ( defined(__BORLANDC__) && (__BORLANDC__ > 0x530) )
size = std::wcslen((const wchar_t *)pBuf) * sizeof(wchar_t);
#else
size = wxWcslen((const wchar_t *)pBuf) * sizeof(wchar_t);
// and now check the type of data requested
wxDataFormat format = pformatetc->cfFormat;
+ format = HtmlFormatFixup(format);
+
if ( m_pDataObject->IsSupportedFormat(format) ) {
wxLogTrace(wxTRACE_OleCalls, wxT("wxIDataObject::QueryGetData: %s ok"),
wxGetFormatName(format));
#endif // wxUSE_UNICODE_MSLU
{
len = m_filenames[i].length();
- memcpy(pbuf, m_filenames[i].wx_str(), len*sizeOfChar);
+ memcpy(pbuf, m_filenames[i].t_str(), len*sizeOfChar);
}
pbuf += len*sizeOfChar;