26#include <com/sun/star/datatransfer/UnsupportedFlavorException.hpp>
27#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
28#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
30#include <boost/property_tree/json_parser.hpp>
32#include <LibreOfficeKit/LibreOfficeKitEnums.h>
47 const uno::Reference< datatransfer::clipboard::XClipboard >& rxClipboard,
50 SAL_WARN_IF( !rxClipboard.is(),
"vcl",
"TextDataObject::CopyStringTo: invalid clipboard!" );
51 if ( !rxClipboard.is() )
59 rxClipboard->setContents( pDataObj,
nullptr );
61 uno::Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( rxClipboard, uno::UNO_QUERY );
62 if( xFlushableClipboard.is() )
63 xFlushableClipboard->flushClipboard();
67 boost::property_tree::ptree aTree;
68 aTree.put(
"content", rContent);
69 aTree.put(
"mimeType",
"text/plain");
70 std::stringstream aStream;
71 boost::property_tree::write_json(aStream, aTree);
75 catch(
const uno::Exception& )
83 uno::Any aRet = ::cppu::queryInterface( rType,
static_cast< datatransfer::XTransferable*
>(
this) );
84 return (aRet.
hasValue() ? aRet : OWeakObject::queryInterface( rType ));
91 if ( nT != SotClipboardFormatId::STRING )
93 throw datatransfer::UnsupportedFlavorException();
100 uno::Sequence< datatransfer::DataFlavor > aDataFlavors(1);
108 return ( nT == SotClipboardFormatId::STRING );
A helper class that calls Application::ReleaseSolarMutex() in its constructor and restores the mutex ...
static bool GetFormatDataFlavor(SotClipboardFormatId nFormat, css::datatransfer::DataFlavor &rFlavor)
static SotClipboardFormatId GetFormat(const css::datatransfer::DataFlavor &rFlavor)
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const =0
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
static void CopyStringTo(const OUString &rContent, const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rxClipboard, const vcl::ILibreOfficeKitNotifier *pNotifier=nullptr)
copies a given string to a given clipboard
sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor &aFlavor) override
css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor &aFlavor) override
virtual ~TextDataObject() override
css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() override
TextDataObject(OUString aText)
#define SAL_WARN_IF(condition, area, stream)