1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVTOOLS_TRANSFER_HXX
21 #define INCLUDED_SVTOOLS_TRANSFER_HXX
23 #include <svtools/svtdllapi.h>
24 #include <tools/globname.hxx>
25 #include <tools/gen.hxx>
26 #include <tools/link.hxx>
27 #include <tools/ref.hxx>
28 #include <sot/formats.hxx>
29 #include <cppuhelper/implbase1.hxx>
30 #include <cppuhelper/implbase4.hxx>
31 #include <com/sun/star/frame/XTerminateListener.hpp>
32 #include <com/sun/star/lang/XUnoTunnel.hpp>
33 #include <com/sun/star/datatransfer/XTransferable2.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/XDragGestureRecognizer.hpp>
37 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
38 #include <com/sun/star/datatransfer/dnd/DropTargetDragEvent.hpp>
39 #include <com/sun/star/datatransfer/dnd/DropTargetDropEvent.hpp>
40 #include <com/sun/star/datatransfer/dnd/XDragSourceListener.hpp>
41 #include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
42 #include <com/sun/star/embed/Aspects.hpp>
43 #include <com/sun/star/io/XInputStream.hpp>
52 class SotStorageStream
;
53 struct DataFlavorExVector
;
54 namespace vcl
{ class Window
; }
58 #define DND_ACTION_NONE ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_NONE
59 #define DND_ACTION_COPY ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_COPY
60 #define DND_ACTION_MOVE ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_MOVE
61 #define DND_ACTION_COPYMOVE ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE
62 #define DND_ACTION_LINK ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_LINK
64 #define DND_POINTER_NONE 0
65 #define DND_IMAGE_NONE 0
67 struct TransferableObjectDescriptor
69 SvGlobalName maClassName
;
70 sal_uInt16 mnViewAspect
;
73 sal_uInt32 mnOle2Misc
;
75 OUString maDisplayName
;
78 TransferableObjectDescriptor()
79 : mnViewAspect(::com::sun::star::embed::Aspects::MSOLE_CONTENT
)
84 SVT_DLLPUBLIC
friend SvStream
& WriteTransferableObjectDescriptor( SvStream
& rOStm
, const TransferableObjectDescriptor
& rObjDesc
);
87 struct AcceptDropEvent
91 const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent maDragEvent
;
96 mnAction( DND_ACTION_NONE
),
100 AcceptDropEvent( sal_Int8 nAction
,
101 const Point
& rPosPixel
,
102 const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent
& rDragEvent
,
103 bool bLeaving
= false ) :
105 maPosPixel( rPosPixel
),
106 maDragEvent( rDragEvent
),
107 mbLeaving( bLeaving
),
108 mbDefault( false ) {}
111 struct ExecuteDropEvent
115 const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent maDropEvent
;
119 mnAction( DND_ACTION_NONE
),
120 mbDefault( false ) {}
122 ExecuteDropEvent( sal_Int8 nAction
,
123 const Point
& rPosPixel
,
124 const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent
& rDropEvent
) :
126 maPosPixel( rPosPixel
),
127 maDropEvent( rDropEvent
),
128 mbDefault( false ) {}
131 class SVT_DLLPUBLIC TransferableHelper
: public ::cppu::WeakImplHelper4
< ::com::sun::star::datatransfer::XTransferable2
,
132 ::com::sun::star::datatransfer::clipboard::XClipboardOwner
,
133 ::com::sun::star::datatransfer::dnd::XDragSourceListener
,
134 ::com::sun::star::lang::XUnoTunnel
>
138 // nested class to implement the XTerminateListener interface
139 class TerminateListener
: public ::cppu::WeakImplHelper1
< ::com::sun::star::frame::XTerminateListener
>
143 TransferableHelper
& mrParent
;
148 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
150 // XTerminateListener
151 virtual void SAL_CALL
queryTermination( const ::com::sun::star::lang::EventObject
& aEvent
) throw( ::com::sun::star::frame::TerminationVetoException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
152 virtual void SAL_CALL
notifyTermination( const ::com::sun::star::lang::EventObject
& aEvent
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
156 TerminateListener( TransferableHelper
& rDropTargetHelper
);
157 virtual ~TerminateListener();
160 friend class TransferableHelper::TerminateListener
;
164 ::com::sun::star::uno::Any maAny
;
165 OUString maLastFormat
;
166 mutable ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboard
> mxClipboard
;
167 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XTerminateListener
> mxTerminateListener
;
168 DataFlavorExVector
* mpFormats
;
169 TransferableObjectDescriptor
* mpObjDesc
;
172 inline const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboard
>&
173 getOwnClipboard() const { return mxClipboard
; }
178 virtual ::com::sun::star::uno::Any SAL_CALL
getTransferData( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
) throw(::com::sun::star::datatransfer::UnsupportedFlavorException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
179 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::datatransfer::DataFlavor
> SAL_CALL
getTransferDataFlavors() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
180 virtual sal_Bool SAL_CALL
isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
183 virtual css::uno::Any SAL_CALL
getTransferData2(
184 const css::datatransfer::DataFlavor
& rFlavor
, const OUString
& rDestDoc
)
185 throw (css::datatransfer::UnsupportedFlavorException
, css::io::IOException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
188 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
190 // XDragSourceListener
191 virtual void SAL_CALL
dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent
& dsde
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
192 virtual void SAL_CALL
dragEnter( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent
& dsde
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
193 virtual void SAL_CALL
dragExit( const ::com::sun::star::datatransfer::dnd::DragSourceEvent
& dse
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
194 virtual void SAL_CALL
dragOver( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent
& dsde
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
195 virtual void SAL_CALL
dropActionChanged( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent
& dsde
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
200 virtual void SAL_CALL
lostOwnership( const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboard
>& xClipboard
, const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
>& xTrans
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
203 // derivees need to access lostOwnership in case hey override it
204 // on windows, changing the access rights to a method gives unresolved externals, so we introduce
205 // this impl-method here 'til the next incompatible update
206 inline void implCallOwnLostOwnership(
207 const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboard
>& _rxClipboard
,
208 const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
>& _rxTrans
211 TransferableHelper::lostOwnership( _rxClipboard
, _rxTrans
);
217 SVT_DLLPRIVATE
void ImplFlush();
221 virtual ~TransferableHelper();
223 void AddFormat( SotClipboardFormatId nFormat
);
224 void AddFormat( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
225 void RemoveFormat( SotClipboardFormatId nFormat
);
226 void RemoveFormat( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
227 bool HasFormat( SotClipboardFormatId nFormat
);
228 inline bool HasFormat( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
) { return isDataFlavorSupported( rFlavor
); }
231 bool SetAny( const ::com::sun::star::uno::Any
& rAny
, const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
232 bool SetString( const OUString
& rString
, const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
233 bool SetBitmapEx( const BitmapEx
& rBitmap
, const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
234 bool SetGDIMetaFile( const GDIMetaFile
& rMtf
, const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
235 bool SetGraphic( const Graphic
& rGraphic
, const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
236 bool SetImageMap( const ImageMap
& rIMap
, const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
237 bool SetTransferableObjectDescriptor( const TransferableObjectDescriptor
& rDesc
, const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
238 bool SetINetBookmark( const INetBookmark
& rBmk
, const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
239 bool SetINetImage( const INetImage
& rINtImg
, const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
240 bool SetObject( void* pUserObject
, SotClipboardFormatId nUserObjectId
, const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
244 virtual void AddSupportedFormats() = 0;
245 virtual bool GetData( const css::datatransfer::DataFlavor
& rFlavor
, const OUString
& rDestDoc
) = 0;
246 virtual bool WriteObject( tools::SvRef
<SotStorageStream
>& rxOStm
, void* pUserObject
, SotClipboardFormatId nUserObjectId
, const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
247 virtual void DragFinished( sal_Int8 nDropAction
);
248 virtual void ObjectReleased();
252 TransferableHelper();
254 void PrepareOLE( const TransferableObjectDescriptor
& rObjDesc
);
256 void CopyToClipboard( vcl::Window
*pWindow
) const;
257 void CopyToSelection( vcl::Window
*pWindow
) const;
258 void StartDrag( vcl::Window
* pWindow
, sal_Int8 nDragSourceActions
,
259 sal_Int32 nDragPointer
= DND_POINTER_NONE
,
260 sal_Int32 nDragImage
= DND_IMAGE_NONE
);
262 static void ClearSelection( vcl::Window
*pWindow
);
264 static ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboard
> GetSystemClipboard();
265 static const ::com::sun::star::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
269 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rId
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
272 struct TransferableDataHelper_Impl
;
274 class SVT_DLLPUBLIC TransferableDataHelper
276 friend class DropTargetHelper
;
280 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
> mxTransfer
;
281 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboard
> mxClipboard
;
282 DataFlavorExVector
* mpFormats
;
283 TransferableObjectDescriptor
* mpObjDesc
;
284 TransferableDataHelper_Impl
* mpImpl
;
291 static void FillDataFlavorExVector( const ::com::sun::star::uno::Sequence
< ::com::sun::star::datatransfer::DataFlavor
>& rDataFlavorSeq
,
292 DataFlavorExVector
& rDataFlavorExVector
);
294 TransferableDataHelper();
295 TransferableDataHelper( const TransferableDataHelper
& rDataHelper
);
296 TransferableDataHelper( const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
>& rxTransferable
);
297 ~TransferableDataHelper();
299 TransferableDataHelper
& operator=( const TransferableDataHelper
& rDataHelper
);
301 const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
>& GetTransferable() const { return mxTransfer
; }
302 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
> GetXTransferable() const;
304 bool HasFormat( SotClipboardFormatId nFormat
) const;
305 bool HasFormat( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
) const;
307 sal_uInt32
GetFormatCount() const;
309 SotClipboardFormatId
GetFormat( sal_uInt32 nFormat
) const;
310 ::com::sun::star::datatransfer::DataFlavor
GetFormatDataFlavor( sal_uInt32 nFormat
) const;
312 DataFlavorExVector
& GetDataFlavorExVector() const {return *mpFormats
; }
314 bool StartClipboardListening( );
315 void StopClipboardListening( );
317 void Rebind( const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
>& _rxNewData
);
321 css::uno::Any
GetAny( SotClipboardFormatId nFormat
, const OUString
& rDestDoc
) const;
322 css::uno::Any
GetAny( const css::datatransfer::DataFlavor
& rFlavor
, const OUString
& rDestDoc
) const;
324 bool GetString( SotClipboardFormatId nFormat
, OUString
& rStr
);
325 bool GetString( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
, OUString
& rStr
);
327 bool GetBitmapEx( SotClipboardFormatId nFormat
, BitmapEx
& rBmp
);
328 bool GetBitmapEx( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
, BitmapEx
& rBmp
);
330 /** Return as GDI metafile.
332 @param nMaxAction Allows you to limit the amount of actions; defaults to 0 which means no limit.
334 Whet you eg. Ctrl+a in Excel, you can get the entire sheet as
335 metafile, with over 3 million (!) actions; which is just too large for
336 any reasonable handling - and you need to set a limit.
338 bool GetGDIMetaFile( SotClipboardFormatId nFormat
, GDIMetaFile
& rMtf
, size_t nMaxActions
= 0 );
339 bool GetGDIMetaFile( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
, GDIMetaFile
& rMtf
);
341 bool GetGraphic( SotClipboardFormatId nFormat
, Graphic
& rGraphic
);
342 bool GetGraphic( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
, Graphic
& rGraphic
);
344 bool GetImageMap( SotClipboardFormatId nFormat
, ImageMap
& rIMap
);
345 bool GetImageMap( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
, ImageMap
& rImap
);
347 bool GetTransferableObjectDescriptor( SotClipboardFormatId nFormat
, TransferableObjectDescriptor
& rDesc
);
348 bool GetTransferableObjectDescriptor( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
, TransferableObjectDescriptor
& rDesc
);
350 bool GetINetBookmark( SotClipboardFormatId nFormat
, INetBookmark
& rBmk
);
351 bool GetINetBookmark( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
, INetBookmark
& rBmk
);
353 bool GetINetImage( SotClipboardFormatId nFormat
, INetImage
& rINtImg
);
354 bool GetINetImage( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
, INetImage
& rINtImg
);
356 bool GetFileList( SotClipboardFormatId nFormat
, FileList
& rFileList
);
357 bool GetFileList( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
, FileList
& rFileList
);
359 css::uno::Sequence
<sal_Int8
> GetSequence( SotClipboardFormatId nFormat
, const OUString
& rDestDoc
);
360 css::uno::Sequence
<sal_Int8
> GetSequence( const css::datatransfer::DataFlavor
& rFlavor
, const OUString
& rDestDoc
);
362 bool GetSotStorageStream( SotClipboardFormatId nFormat
, tools::SvRef
<SotStorageStream
>& rStreamRef
);
363 bool GetSotStorageStream( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
, tools::SvRef
<SotStorageStream
>& rStreamRef
);
365 css::uno::Reference
<css::io::XInputStream
> GetInputStream( SotClipboardFormatId nFormat
, const OUString
& rDestDoc
);
366 css::uno::Reference
<css::io::XInputStream
> GetInputStream( const css::datatransfer::DataFlavor
& rFlavor
, const OUString
& rDestDoc
);
368 bool GetInterface( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
, ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& rIf
);
372 static TransferableDataHelper
CreateFromSystemClipboard( vcl::Window
* pWindow
);
373 static TransferableDataHelper
CreateFromSelection( vcl::Window
* pWindow
);
374 static bool IsEqual( const ::com::sun::star::datatransfer::DataFlavor
& rInternalFlavor
,
375 const ::com::sun::star::datatransfer::DataFlavor
& rRequestFlavor
,
376 bool bCompareParameters
= false );
379 class SVT_DLLPUBLIC DragSourceHelper
383 // nested class to implement the XDragGestureListener interface
384 class DragGestureListener
: public ::cppu::WeakImplHelper1
< ::com::sun::star::datatransfer::dnd::XDragGestureListener
>
388 DragSourceHelper
& mrParent
;
393 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
395 // XDragGestureListener
396 virtual void SAL_CALL
dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent
& rDGE
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
400 DragGestureListener( DragSourceHelper
& rDragSourceHelper
);
401 virtual ~DragGestureListener();
404 friend class DragSourceHelper::DragGestureListener
;
408 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer
> mxDragGestureRecognizer
;
409 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDragGestureListener
> mxDragGestureListener
;
411 DragSourceHelper
& operator=( const DragSourceHelper
& rDragSourceHelper
) SAL_DELETED_FUNCTION
;
412 bool operator==( const DragSourceHelper
& rDragSourceHelper
) const SAL_DELETED_FUNCTION
;
416 // to be overridden by the application
417 virtual void StartDrag( sal_Int8 nAction
, const Point
& rPosPixel
);
419 DragSourceHelper( vcl::Window
* pWindow
);
420 virtual ~DragSourceHelper();
423 class SVT_DLLPUBLIC DropTargetHelper
427 // nested class to implement the XDropTargetListener interface
428 class DropTargetListener
: public ::cppu::WeakImplHelper1
< ::com::sun::star::datatransfer::dnd::XDropTargetListener
>
432 DropTargetHelper
& mrParent
;
433 AcceptDropEvent
* mpLastDragOverEvent
;
438 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
440 // XDropTargetListener
441 virtual void SAL_CALL
drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent
& dtde
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
442 virtual void SAL_CALL
dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent
& dtdee
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
443 virtual void SAL_CALL
dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent
& dte
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
444 virtual void SAL_CALL
dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent
& dtde
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
445 virtual void SAL_CALL
dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent
& dtde
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
449 DropTargetListener( DropTargetHelper
& rDropTargetHelper
);
450 virtual ~DropTargetListener();
453 friend class DropTargetHelper::DropTargetListener
;
457 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDropTarget
> mxDropTarget
;
458 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDropTargetListener
> mxDropTargetListener
;
459 DataFlavorExVector
* mpFormats
;
461 DropTargetHelper() SAL_DELETED_FUNCTION
;
462 DropTargetHelper
& operator=( const DropTargetHelper
& rDropTargetHelper
) SAL_DELETED_FUNCTION
;
463 bool operator==( const DropTargetHelper
& rDropTargetHelper
) const SAL_DELETED_FUNCTION
;
465 void ImplConstruct();
467 // called by our own implementation of XDropTargetListener (DropTargetListener instance)
468 void ImplBeginDrag( const ::com::sun::star::uno::Sequence
< ::com::sun::star::datatransfer::DataFlavor
>& rSupportedDataFlavors
);
473 // to be overridden by the application
474 virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
);
475 virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
);
477 DropTargetHelper( vcl::Window
* pWindow
);
478 DropTargetHelper( const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDropTarget
>& rxDropTarget
);
480 virtual ~DropTargetHelper();
482 // typically called by the application in ::AcceptDrop and ::ExecuteDrop and (see above)
483 bool IsDropFormatSupported( SotClipboardFormatId nFormat
);
484 bool IsDropFormatSupported( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
486 DataFlavorExVector
& GetDataFlavorExVector() const {return *mpFormats
; }
490 struct TransferDataContainer_Impl
;
492 class SVT_DLLPUBLIC TransferDataContainer
: public TransferableHelper
494 TransferDataContainer_Impl
* pImpl
;
498 virtual void AddSupportedFormats() SAL_OVERRIDE
;
499 virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
, const OUString
& rDestDoc
) SAL_OVERRIDE
;
500 virtual void DragFinished( sal_Int8 nDropAction
) SAL_OVERRIDE
;
504 TransferDataContainer();
505 virtual ~TransferDataContainer();
507 void CopyINetBookmark( const INetBookmark
& rBkmk
);
508 void CopyINetImage( const INetImage
& rINtImg
);
509 void CopyImageMap( const ImageMap
& rImgMap
);
510 void CopyGraphic( const Graphic
& rGrf
);
511 void CopyString( const OUString
& rStr
);
512 void CopyString( SotClipboardFormatId nFmt
, const OUString
& rStr
);
513 void CopyAny( SotClipboardFormatId nFmt
, const ::com::sun::star::uno::Any
& rAny
);
515 void CopyByteString( SotClipboardFormatId nFormatId
, const OString
& rStr
);
516 void CopyAnyData( SotClipboardFormatId nFormatId
, const sal_Char
* pData
, sal_uLong nLen
);
518 bool HasAnyData() const;
520 using TransferableHelper::StartDrag
;
521 void StartDrag( vcl::Window
* pWindow
, sal_Int8 nDragSourceActions
,
522 const Link
<>& rCallbck
,
523 sal_Int32 nDragPointer
= DND_POINTER_NONE
,
524 sal_Int32 nDragImage
= DND_IMAGE_NONE
);
529 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */