26#include <wx/clipbrd.h>
27#include <wx/dataobj.h>
31#include <wx/sstream.h>
42 if( wxTheClipboard->Open() )
45 wxTheClipboard->SetData(
46 new wxTextDataObject( wxString( aTextUTF8.c_str(), wxConvUTF8 ) ) );
48 wxTheClipboard->Flush();
49 wxTheClipboard->Close();
64 if( wxTheClipboard->Open() )
66 if( wxTheClipboard->IsSupported( wxDF_TEXT )
67 || wxTheClipboard->IsSupported( wxDF_UNICODETEXT ) )
69 wxTextDataObject data;
70 wxTheClipboard->GetData( data );
74 result = data.GetText().utf8_str();
77 wxTheClipboard->Close();
86 std::unique_ptr<wxImage>
image;
90 if( wxTheClipboard->Open() )
92 if( wxTheClipboard->IsSupported( wxDF_BITMAP ) )
94 wxBitmapDataObject data;
95 if( wxTheClipboard->GetData( data ) )
97 image = std::make_unique<wxImage>( data.GetBitmap().ConvertToImage() );
100 else if( wxTheClipboard->IsSupported( wxDF_FILENAME ) )
102 wxFileDataObject data;
103 if( wxTheClipboard->GetData( data ) && data.GetFilenames().size() == 1 )
105 image = std::make_unique<wxImage>( data.GetFilenames()[0] );
112 wxTheClipboard->Close();
123 if( wxTheClipboard->Open() )
125 wxDataObjectComposite* data =
new wxDataObjectComposite();
129 wxStringOutputStream os;
133 data->Add(
new wxTextDataObject( os.GetString() ),
true );
142 wxTheClipboard->SetData( data );
143 wxTheClipboard->Flush();
144 wxTheClipboard->Close();
161 if( wxTheClipboard->Open() )
163 if( wxTheClipboard->IsSupported( wxDF_TEXT ) )
165 wxTextDataObject data;
166 if( wxTheClipboard->GetData( data ) )
174 wxTheClipboard->Close();
void WriteLines(const std::vector< std::vector< wxString > > &aRows)
Write a vector of rows to the stream.
bool SaveTabularDataToClipboard(const std::vector< std::vector< wxString > > &aData)
Store tabular data to the system clipboard.
bool SaveClipboard(const std::string &aTextUTF8)
Store information to the system clipboard.
std::string GetClipboardUTF8()
Return the information currently stored in the system clipboard.
std::unique_ptr< wxImage > GetImageFromClipboard()
Get image data from the clipboard, if there is any.
bool GetTabularDataFromClipboard(std::vector< std::vector< wxString > > &aData)
Attempt to get tabular data from the clipboard.
bool AutoDecodeCSV(const wxString &aInput, std::vector< std::vector< wxString > > &aData)
Try to guess the format of a T/CSV file and decode it into aData.
wxString result
Test unit parsing edge cases and error handling.