A patch adding wxHTMLDataObject which can be used for handling the standard platform formats for transfering HTML formatted text.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71610 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -79,6 +79,7 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
static bool gs_wxClipboardIsOpen = false;
|
||||
static int gs_htmlcfid = 0;
|
||||
|
||||
bool wxOpenClipboard()
|
||||
{
|
||||
@@ -139,7 +140,9 @@ bool wxIsClipboardOpened()
|
||||
|
||||
bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat)
|
||||
{
|
||||
wxDataFormat::NativeFormat cf = dataFormat.GetFormatId();
|
||||
wxDataFormat::NativeFormat cf = dataFormat.GetFormatId();
|
||||
if (cf == wxDF_HTML)
|
||||
cf = gs_htmlcfid;
|
||||
|
||||
if ( ::IsClipboardFormatAvailable(cf) )
|
||||
{
|
||||
@@ -304,10 +307,6 @@ bool wxSetClipboardData(wxDataFormat dataFormat,
|
||||
char *buf = new char [400 + strlen(html)];
|
||||
if(!buf) return false;
|
||||
|
||||
// Get clipboard id for HTML format...
|
||||
static int cfid = 0;
|
||||
if(!cfid) cfid = RegisterClipboardFormat(wxT("HTML Format"));
|
||||
|
||||
// Create a template string for the HTML header...
|
||||
strcpy(buf,
|
||||
"Version:0.9\r\n"
|
||||
@@ -358,7 +357,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat,
|
||||
strcpy(ptr, buf);
|
||||
GlobalUnlock(hText);
|
||||
|
||||
handle = ::SetClipboardData(cfid, hText);
|
||||
handle = ::SetClipboardData(gs_htmlcfid, hText);
|
||||
|
||||
// Free memory...
|
||||
GlobalFree(hText);
|
||||
@@ -598,6 +597,10 @@ bool wxClipboard::Flush()
|
||||
|
||||
bool wxClipboard::Open()
|
||||
{
|
||||
// Get clipboard id for HTML format...
|
||||
if(!gs_htmlcfid)
|
||||
gs_htmlcfid = RegisterClipboardFormat(wxT("HTML Format"));
|
||||
|
||||
// OLE opens clipboard for us
|
||||
m_isOpened = true;
|
||||
#if wxUSE_OLE_CLIPBOARD
|
||||
@@ -814,6 +817,8 @@ bool wxClipboard::GetData( wxDataObject& data )
|
||||
// convert to NativeFormat Id
|
||||
cf = formats[n].GetFormatId();
|
||||
|
||||
if (cf == wxDF_HTML)
|
||||
cf = gs_htmlcfid;
|
||||
// if the format is not available, try the next one
|
||||
// this test includes implicit / sythetic formats
|
||||
if ( !::IsClipboardFormatAvailable(cf) )
|
||||
|
Reference in New Issue
Block a user