+ if ( IsUsingPrimarySelection() )
+ return false;
+
+ wxCHECK_MSG( m_open, false, wxT("clipboard not open") );
+
+ size_t formatcount = data.GetFormatCount() + 1;
+ wxDataFormat *array = new wxDataFormat[ formatcount ];
+ array[0] = data.GetPreferredFormat();
+ data.GetAllFormats( &array[1] );
+
+ bool transferred = false;
+
+ if ( M_CLIPBOARD->m_trueData )
+ {
+ for (size_t i = 0; !transferred && i < formatcount; i++)
+ {
+ wxDataFormat format = array[ i ];
+ if ( M_CLIPBOARD->m_trueData->IsSupported( format ) )
+ {
+ int dataSize = M_CLIPBOARD->m_trueData->GetDataSize( format );
+ transferred = true;
+
+ if (dataSize == 0)
+ {
+ data.SetData( format, 0, 0 );
+ }
+ else
+ {
+ char *d = new char[ dataSize ];
+ M_CLIPBOARD->m_trueData->GetDataHere( format, (void*)d );
+ data.SetData( format, dataSize, d );
+ delete [] d;
+ }
+ }
+ }
+ }