20#ifndef INCLUDED_VCL_TRANSFER_HXX
21#define INCLUDED_VCL_TRANSFER_HXX
30#include <com/sun/star/frame/XTerminateListener.hpp>
31#include <com/sun/star/lang/XServiceInfo.hpp>
32#include <com/sun/star/datatransfer/XTransferable2.hpp>
33#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
34#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
35#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
36#include <com/sun/star/datatransfer/dnd/XDragGestureListener.hpp>
37#include <com/sun/star/datatransfer/dnd/DropTargetDragEvent.hpp>
38#include <com/sun/star/datatransfer/dnd/DropTargetDropEvent.hpp>
39#include <com/sun/star/datatransfer/dnd/XDragSourceListener.hpp>
40#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
41#include <com/sun/star/embed/Aspects.hpp>
50namespace tools {
template <
typename T>
class SvRef; }
51template <
typename Arg,
typename Ret>
class Link;
66#define DND_ACTION_NONE css::datatransfer::dnd::DNDConstants::ACTION_NONE
67#define DND_ACTION_COPY css::datatransfer::dnd::DNDConstants::ACTION_COPY
68#define DND_ACTION_MOVE css::datatransfer::dnd::DNDConstants::ACTION_MOVE
69#define DND_ACTION_COPYMOVE css::datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE
70#define DND_ACTION_LINK css::datatransfer::dnd::DNDConstants::ACTION_LINK
72#define DND_POINTER_NONE 0
73#define DND_IMAGE_NONE 0
94 const css::datatransfer::dnd::DropTargetDragEvent
maDragEvent;
105 const Point& rPosPixel,
106 css::datatransfer::dnd::DropTargetDragEvent aDragEvent ) :
122 const Point& rPosPixel,
123 css::datatransfer::dnd::DropTargetDropEvent aDropEvent ) :
131 css::datatransfer::clipboard::XClipboardOwner,
132 css::datatransfer::dnd::XDragSourceListener>
146 virtual void SAL_CALL disposing(
const css::lang::EventObject& Source )
override;
149 virtual void SAL_CALL queryTermination(
const css::lang::EventObject& aEvent )
override;
150 virtual void SAL_CALL notifyTermination(
const css::lang::EventObject& aEvent )
override;
169 mutable css::uno::Reference< css::datatransfer::clipboard::XClipboard >
mxClipboard;
172 std::unique_ptr<TransferableObjectDescriptor>
mxObjDesc;
177 const css::uno::Reference< css::datatransfer::clipboard::XClipboard >&
183 virtual css::uno::Any SAL_CALL
getTransferData(
const css::datatransfer::DataFlavor& rFlavor )
override;
189 const css::datatransfer::DataFlavor& rFlavor,
const OUString& rDestDoc )
override;
195 virtual void SAL_CALL
disposing(
const css::lang::EventObject& Source )
override;
198 virtual void SAL_CALL
dragDropEnd(
const css::datatransfer::dnd::DragSourceDropEvent& dsde )
override;
199 virtual void SAL_CALL
dragEnter(
const css::datatransfer::dnd::DragSourceDragEvent& dsde )
override;
200 virtual void SAL_CALL
dragExit(
const css::datatransfer::dnd::DragSourceEvent& dse )
override;
201 virtual void SAL_CALL
dragOver(
const css::datatransfer::dnd::DragSourceDragEvent& dsde )
override;
202 virtual void SAL_CALL
dropActionChanged(
const css::datatransfer::dnd::DragSourceDragEvent& dsde )
override;
205 virtual void SAL_CALL
lostOwnership(
const css::uno::Reference< css::datatransfer::clipboard::XClipboard >& xClipboard,
const css::uno::Reference< css::datatransfer::XTransferable >& xTrans )
override;
212 const css::uno::Reference< css::datatransfer::clipboard::XClipboard >& _rxClipboard,
213 const css::uno::Reference< css::datatransfer::XTransferable >& _rxTrans
227 void AddFormat(
const css::datatransfer::DataFlavor& rFlavor );
233 bool SetAny(
const css::uno::Any& rAny );
234 bool SetString(
const OUString& rString );
242 bool SetObject(
void* pUserObject, sal_uInt32 nUserObjectId,
const css::datatransfer::DataFlavor& rFlavor );
247 virtual bool GetData(
const css::datatransfer::DataFlavor& rFlavor,
const OUString& rDestDoc ) = 0;
252 void CopyToSelection(
const css::uno::Reference<css::datatransfer::clipboard::XClipboard> &rClipboard)
const;
257 void CopyToClipboard(
const css::uno::Reference<css::datatransfer::clipboard::XClipboard> &rClipboard)
const;
272 friend class DropTargetHelper;
274 css::uno::Reference< css::datatransfer::XTransferable >
mxTransfer;
275 css::uno::Reference< css::datatransfer::clipboard::XClipboard >
mxClipboard;
277 std::unique_ptr<TransferableObjectDescriptor>
mxObjDesc;
278 std::unique_ptr<TransferableDataHelper_Impl>
mxImpl;
284 static void FillDataFlavorExVector(
const css::uno::Sequence< css::datatransfer::DataFlavor >& rDataFlavorSeq,
296 const css::uno::Reference< css::datatransfer::XTransferable >&
GetTransferable()
const {
return mxTransfer; }
297 css::uno::Reference< css::datatransfer::XTransferable > GetXTransferable()
const;
300 bool HasFormat(
const css::datatransfer::DataFlavor& rFlavor )
const;
302 sal_uInt32 GetFormatCount()
const;
305 css::datatransfer::DataFlavor GetFormatDataFlavor( sal_uInt32 nFormat )
const;
309 bool StartClipboardListening( );
310 void StopClipboardListening( );
312 void Rebind(
const css::uno::Reference< css::datatransfer::XTransferable >& _rxNewData );
315 css::uno::Any
GetAny(
const css::datatransfer::DataFlavor& rFlavor,
const OUString& rDestDoc )
const;
318 bool GetString(
const css::datatransfer::DataFlavor& rFlavor, OUString& rStr )
const;
335 bool GetGraphic(
const css::datatransfer::DataFlavor& rFlavor,
Graphic& rGraphic )
const;
338 bool GetImageMap(
const css::datatransfer::DataFlavor& rFlavor,
ImageMap& rImap )
const;
344 bool GetINetBookmark(
const css::datatransfer::DataFlavor& rFlavor,
INetBookmark& rBmk )
const;
347 bool GetINetImage(
const css::datatransfer::DataFlavor& rFlavor,
INetImage& rINtImg )
const;
350 bool GetFileList(
FileList& rFileList )
const;
352 css::uno::Sequence<sal_Int8> GetSequence(
SotClipboardFormatId nFormat,
const OUString& rDestDoc )
const;
353 css::uno::Sequence<sal_Int8>
GetSequence(
const css::datatransfer::DataFlavor& rFlavor,
const OUString& rDestDoc )
const;
358 css::uno::Reference<css::io::XInputStream> GetInputStream(
SotClipboardFormatId nFormat,
const OUString& rDestDoc )
const;
359 css::uno::Reference<css::io::XInputStream>
GetInputStream(
const css::datatransfer::DataFlavor& rFlavor,
const OUString& rDestDoc )
const;
361 static TransferableDataHelper CreateFromClipboard(
const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& rClipboard);
364 static bool IsEqual(
const css::datatransfer::DataFlavor& rInternalFlavor,
365 const css::datatransfer::DataFlavor& rRequestFlavor );
373 class SAL_DLLPRIVATE DragGestureListener final :
public cppu::WeakImplHelper< css::datatransfer::dnd::XDragGestureListener >
382 virtual void SAL_CALL disposing(
const css::lang::EventObject&
Source )
override;
385 virtual void SAL_CALL dragGestureRecognized(
const css::datatransfer::dnd::DragGestureEvent& rDGE )
override;
389 DragGestureListener( DragSourceHelper& rDragSourceHelper );
390 virtual ~DragGestureListener()
override;
393 friend class DragSourceHelper::DragGestureListener;
397 css::uno::Reference< css::datatransfer::dnd::XDragGestureRecognizer > mxDragGestureRecognizer;
399 css::uno::Reference< css::datatransfer::dnd::XDragGestureListener > mxDragGestureListener;
401 DragSourceHelper& operator=(
const DragSourceHelper& rDragSourceHelper ) =
delete;
402 bool operator==(
const DragSourceHelper& rDragSourceHelper )
const =
delete;
411 virtual ~DragSourceHelper();
419 class SAL_DLLPRIVATE DropTargetListener final :
public cppu::WeakImplHelper< css::datatransfer::dnd::XDropTargetListener >
424 std::unique_ptr<AcceptDropEvent> mpLastDragOverEvent;
427 virtual void SAL_CALL disposing(
const css::lang::EventObject& Source )
override;
430 virtual void SAL_CALL drop(
const css::datatransfer::dnd::DropTargetDropEvent& dtde )
override;
431 virtual void SAL_CALL dragEnter(
const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee )
override;
432 virtual void SAL_CALL dragExit(
const css::datatransfer::dnd::DropTargetEvent& dte )
override;
433 virtual void SAL_CALL dragOver(
const css::datatransfer::dnd::DropTargetDragEvent& dtde )
override;
434 virtual void SAL_CALL dropActionChanged(
const css::datatransfer::dnd::DropTargetDragEvent& dtde )
override;
438 DropTargetListener( DropTargetHelper& rDropTargetHelper );
439 virtual ~DropTargetListener()
override;
442 friend class DropTargetHelper::DropTargetListener;
446 css::uno::Reference< css::datatransfer::dnd::XDropTarget > mxDropTarget;
448 css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > mxDropTargetListener;
451 DropTargetHelper() =
delete;
452 DropTargetHelper& operator=(
const DropTargetHelper& rDropTargetHelper ) =
delete;
453 bool operator==(
const DropTargetHelper& rDropTargetHelper )
const =
delete;
455 void ImplConstruct();
458 void ImplBeginDrag(
const css::uno::Sequence< css::datatransfer::DataFlavor >& rSupportedDataFlavors );
468 DropTargetHelper(
const css::uno::Reference< css::datatransfer::dnd::XDropTarget >& rxDropTarget );
471 virtual ~DropTargetHelper();
484 std::unique_ptr<TransferDataContainer_Impl>
pImpl;
486 virtual void AddSupportedFormats()
override;
487 virtual bool GetData(
const css::datatransfer::DataFlavor& rFlavor,
const OUString& rDestDoc )
override;
495 void CopyString(
const OUString& rStr );
501 bool HasAnyData()
const;
506 virtual void DragFinished(
sal_Int8 nDropAction )
override;
BaseContainerNodeSharedPtr & mrParent
std::unique_ptr< TransferDataContainer_Impl > pImpl
bool GetGDIMetaFile(const css::datatransfer::DataFlavor &rFlavor, GDIMetaFile &rMtf) const
bool GetString(const css::datatransfer::DataFlavor &rFlavor, OUString &rStr) const
std::unique_ptr< TransferableObjectDescriptor > mxObjDesc
css::uno::Sequence< sal_Int8 > GetSequence(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) const
bool GetSotStorageStream(const css::datatransfer::DataFlavor &rFlavor, tools::SvRef< SotTempStream > &rStreamRef) const
css::uno::Reference< css::io::XInputStream > GetInputStream(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) const
css::uno::Reference< css::datatransfer::XTransferable > mxTransfer
TransferableDataHelper(const css::uno::Reference< css::datatransfer::XTransferable > &rxTransferable)
std::unique_ptr< TransferableDataHelper_Impl > mxImpl
const DataFlavorExVector & GetDataFlavorExVector() const
css::uno::Reference< css::datatransfer::clipboard::XClipboard > mxClipboard
const css::uno::Reference< css::datatransfer::XTransferable > & GetTransferable() const
css::uno::Any GetAny(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) const
DataFlavorExVector maFormats
bool GetBitmapEx(const css::datatransfer::DataFlavor &rFlavor, BitmapEx &rBmp) const
bool HasFormat(const css::datatransfer::DataFlavor &rFlavor) const
TransferableHelper & mrParent
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() override
void StartDrag(vcl::Window *pWindow, sal_Int8 nDragSourceActions)
virtual css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor &rFlavor) override
bool SetGraphic(const Graphic &rGraphic)
virtual void SAL_CALL dragEnter(const css::datatransfer::dnd::DragSourceDragEvent &dsde) override
virtual sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor &rFlavor) override
void CopyToClipboard(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rClipboard) const
bool SetTransferableObjectDescriptor(const TransferableObjectDescriptor &rDesc)
bool SetAny(const css::uno::Any &rAny)
virtual void SAL_CALL dragDropEnd(const css::datatransfer::dnd::DragSourceDropEvent &dsde) override
void CopyToSelection(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rClipboard) const
bool SetObject(void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor)
void RemoveFormat(SotClipboardFormatId nFormat)
bool SetString(const OUString &rString)
virtual void SAL_CALL dragOver(const css::datatransfer::dnd::DragSourceDragEvent &dsde) override
const css::uno::Reference< css::datatransfer::clipboard::XClipboard > & getOwnClipboard() const
virtual bool WriteObject(tools::SvRef< SotTempStream > &rxOStm, void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor)
static void ClearPrimarySelection()
virtual css::uno::Any SAL_CALL getTransferData2(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) override
virtual void SAL_CALL dropActionChanged(const css::datatransfer::dnd::DragSourceDragEvent &dsde) override
virtual void DragFinished(sal_Int8 nDropAction)
void AddFormat(const css::datatransfer::DataFlavor &rFlavor)
void RemoveFormat(const css::datatransfer::DataFlavor &rFlavor)
VCL_DLLPRIVATE void ImplFlush()
bool SetINetImage(const INetImage &rINtImg, const css::datatransfer::DataFlavor &rFlavor)
void CopyToPrimarySelection() const
bool SetBitmapEx(const BitmapEx &rBitmap, const css::datatransfer::DataFlavor &rFlavor)
bool SetINetBookmark(const INetBookmark &rBmk, const css::datatransfer::DataFlavor &rFlavor)
bool HasFormat(SotClipboardFormatId nFormat)
void PrepareOLE(const TransferableObjectDescriptor &rObjDesc)
void AddFormat(SotClipboardFormatId nFormat)
virtual bool GetData(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc)=0
std::unique_ptr< TransferableObjectDescriptor > mxObjDesc
virtual void AddSupportedFormats()=0
virtual sal_Bool SAL_CALL isComplex() override
bool SetImageMap(const ImageMap &rIMap)
css::uno::Reference< css::frame::XTerminateListener > mxTerminateListener
virtual void SAL_CALL dragExit(const css::datatransfer::dnd::DragSourceEvent &dse) override
void implCallOwnLostOwnership(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &_rxClipboard, const css::uno::Reference< css::datatransfer::XTransferable > &_rxTrans)
virtual void ObjectReleased()
bool SetGDIMetaFile(const GDIMetaFile &rMtf)
css::uno::Reference< css::datatransfer::clipboard::XClipboard > mxClipboard
virtual void SAL_CALL lostOwnership(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &xClipboard, const css::uno::Reference< css::datatransfer::XTransferable > &xTrans) override
DataFlavorExVector maFormats
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
::std::vector< DataFlavorEx > DataFlavorExVector
OUString GetString(int nId)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
BitmapEx GetBitmapEx(BitmapEx const &rBitmapEx, DrawModeFlags nDrawMode)
AcceptDropEvent(sal_Int8 nAction, const Point &rPosPixel, css::datatransfer::dnd::DropTargetDragEvent aDragEvent)
const css::datatransfer::dnd::DropTargetDragEvent maDragEvent
ExecuteDropEvent(sal_Int8 nAction, const Point &rPosPixel, css::datatransfer::dnd::DropTargetDropEvent aDropEvent)
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
VCL_DLLPUBLIC friend SvStream & WriteTransferableObjectDescriptor(SvStream &rOStm, const TransferableObjectDescriptor &rObjDesc)
TransferableObjectDescriptor()
css::uno::Reference< css::datatransfer::clipboard::XClipboard > VCL_DLLPUBLIC GetSystemClipboard()
css::uno::Reference< css::datatransfer::clipboard::XClipboard > VCL_DLLPUBLIC GetSystemPrimarySelection()
class VCL_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") DragSourceHelper
bool operator==(const ItalicMatrix &a, const ItalicMatrix &b)