bump product version to 4.2.0.1
[LibreOffice.git] / include / svtools / transfer.hxx
blob2a8ce2950fb4206bceaa2f6e1d1f49bf3a7772d2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <sot/formats.hxx>
27 #include <cppuhelper/implbase1.hxx>
28 #include <cppuhelper/implbase4.hxx>
29 #include <com/sun/star/frame/XTerminateListener.hpp>
30 #include <com/sun/star/lang/XUnoTunnel.hpp>
31 #include <com/sun/star/datatransfer/XTransferable.hpp>
32 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
33 #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
34 #include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp>
35 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
36 #include <com/sun/star/datatransfer/dnd/DropTargetDragEvent.hpp>
37 #include <com/sun/star/datatransfer/dnd/DropTargetDropEvent.hpp>
38 #include <com/sun/star/datatransfer/dnd/XDragSourceListener.hpp>
39 #include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
40 #include <com/sun/star/embed/Aspects.hpp>
41 #include <com/sun/star/io/XInputStream.hpp>
43 class BitmapEx;
44 class GDIMetaFile;
45 class Graphic;
46 class ImageMap;
47 class SotStorageStreamRef;
48 class INetBookmark;
49 class INetImage;
50 class FileList;
51 class Window;
52 class Link;
54 // Drag&Drop defines
56 #define DND_ACTION_NONE ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_NONE
57 #define DND_ACTION_COPY ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_COPY
58 #define DND_ACTION_MOVE ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_MOVE
59 #define DND_ACTION_COPYMOVE ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE
60 #define DND_ACTION_LINK ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_LINK
62 #define DND_POINTER_NONE 0
63 #define DND_IMAGE_NONE 0
65 struct TransferableObjectDescriptor
67 SvGlobalName maClassName;
68 sal_uInt16 mnViewAspect;
69 Point maDragStartPos;
70 Size maSize;
71 sal_uInt32 mnOle2Misc;
72 OUString maTypeName;
73 OUString maDisplayName;
74 sal_Bool mbCanLink;
76 TransferableObjectDescriptor()
77 : mnViewAspect(::com::sun::star::embed::Aspects::MSOLE_CONTENT)
78 , mnOle2Misc(0)
79 , mbCanLink(false)
82 SVT_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStm, TransferableObjectDescriptor& rObjDesc );
83 SVT_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStm, const TransferableObjectDescriptor& rObjDesc );
86 struct AcceptDropEvent
88 sal_Int8 mnAction;
89 Point maPosPixel;
90 const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent maDragEvent;
91 sal_Bool mbLeaving;
92 sal_Bool mbDefault;
94 AcceptDropEvent() :
95 mnAction( DND_ACTION_NONE ),
96 mbLeaving( sal_False ),
97 mbDefault( sal_False ) {}
99 AcceptDropEvent( sal_Int8 nAction,
100 const Point& rPosPixel,
101 const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& rDragEvent,
102 sal_Bool bLeaving = sal_False ) :
103 mnAction( nAction ),
104 maPosPixel( rPosPixel ),
105 maDragEvent( rDragEvent ),
106 mbLeaving( bLeaving ),
107 mbDefault( sal_False ) {}
110 struct ExecuteDropEvent
112 sal_Int8 mnAction;
113 Point maPosPixel;
114 const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent maDropEvent;
115 sal_Bool mbDefault;
117 ExecuteDropEvent() :
118 mnAction( DND_ACTION_NONE ),
119 mbDefault( sal_False ) {}
121 ExecuteDropEvent( sal_Int8 nAction,
122 const Point& rPosPixel,
123 const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& rDropEvent ) :
124 mnAction( nAction ),
125 maPosPixel( rPosPixel ),
126 maDropEvent( rDropEvent ),
127 mbDefault( sal_False ) {}
130 class SVT_DLLPUBLIC TransferableHelper : public ::cppu::WeakImplHelper4< ::com::sun::star::datatransfer::XTransferable,
131 ::com::sun::star::datatransfer::clipboard::XClipboardOwner,
132 ::com::sun::star::datatransfer::dnd::XDragSourceListener,
133 ::com::sun::star::lang::XUnoTunnel >
135 private:
137 // nested class to implement the XTerminateListener interface
138 class TerminateListener : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XTerminateListener >
140 private:
142 TransferableHelper& mrParent;
144 private:
146 // XEventListener
147 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException );
149 // XTerminateListener
150 virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException );
151 virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
153 public:
155 TerminateListener( TransferableHelper& rDropTargetHelper );
156 virtual ~TerminateListener();
159 friend class TransferableHelper::TerminateListener;
161 private:
163 ::com::sun::star::uno::Any maAny;
164 OUString maLastFormat;
165 mutable ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxClipboard;
166 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTerminateListener > mxTerminateListener;
167 DataFlavorExVector* mpFormats;
168 TransferableObjectDescriptor* mpObjDesc;
170 protected:
171 inline const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >&
172 getOwnClipboard() const { return mxClipboard; }
174 private:
176 // XTransferable
177 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);
178 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() throw(::com::sun::star::uno::RuntimeException);
179 virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) throw(::com::sun::star::uno::RuntimeException);
181 // XEventListener
182 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
184 // XDragSourceListener
185 virtual void SAL_CALL dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& dsde ) throw(::com::sun::star::uno::RuntimeException);
186 virtual void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw(::com::sun::star::uno::RuntimeException);
187 virtual void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DragSourceEvent& dse ) throw(::com::sun::star::uno::RuntimeException);
188 virtual void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw(::com::sun::star::uno::RuntimeException);
189 virtual void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw(::com::sun::star::uno::RuntimeException);
191 private:
193 // XClipboardOwner
194 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);
196 protected:
197 // derivees need to access lostOwnership in case hey override it
198 // on windows, changing the access rights to a method gives unresolved externals, so we introduce
199 // this impl-method here 'til the next incompatible update
200 inline void implCallOwnLostOwnership(
201 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& _rxClipboard,
202 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _rxTrans
205 TransferableHelper::lostOwnership( _rxClipboard, _rxTrans );
209 private:
211 SVT_DLLPRIVATE void ImplFlush();
213 protected:
215 virtual ~TransferableHelper();
217 void AddFormat( SotFormatStringId nFormat );
218 void AddFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
219 void RemoveFormat( SotFormatStringId nFormat );
220 void RemoveFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
221 sal_Bool HasFormat( SotFormatStringId nFormat );
222 inline sal_Bool HasFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) { return isDataFlavorSupported( rFlavor ); }
223 void ClearFormats();
225 sal_Bool SetAny( const ::com::sun::star::uno::Any& rAny, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
226 sal_Bool SetString( const OUString& rString, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
227 sal_Bool SetBitmapEx( const BitmapEx& rBitmap, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
228 sal_Bool SetGDIMetaFile( const GDIMetaFile& rMtf, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
229 sal_Bool SetGraphic( const Graphic& rGraphic, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
230 sal_Bool SetImageMap( const ImageMap& rIMap, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
231 sal_Bool SetTransferableObjectDescriptor( const TransferableObjectDescriptor& rDesc, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
232 sal_Bool SetINetBookmark( const INetBookmark& rBmk, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
233 sal_Bool SetINetImage( const INetImage& rINtImg, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
234 sal_Bool SetObject( void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
236 protected:
238 virtual void AddSupportedFormats() = 0;
239 virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) = 0;
240 virtual sal_Bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
241 virtual void DragFinished( sal_Int8 nDropAction );
242 virtual void ObjectReleased();
244 public:
246 TransferableHelper();
248 void PrepareOLE( const TransferableObjectDescriptor& rObjDesc );
250 void CopyToClipboard( Window *pWindow ) const;
251 void CopyToSelection( Window *pWindow ) const;
252 void StartDrag( Window* pWindow, sal_Int8 nDragSourceActions,
253 sal_Int32 nDragPointer = DND_POINTER_NONE,
254 sal_Int32 nDragImage = DND_IMAGE_NONE );
256 static void ClearSelection( Window *pWindow );
258 static ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetSystemClipboard();
259 static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
261 public:
263 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
266 struct TransferableDataHelper_Impl;
268 class SVT_DLLPUBLIC TransferableDataHelper
270 friend class DropTargetHelper;
272 private:
274 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > mxTransfer;
275 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxClipboard;
276 DataFlavorExVector* mpFormats;
277 TransferableObjectDescriptor* mpObjDesc;
278 TransferableDataHelper_Impl* mpImpl;
280 protected:
281 void InitFormats();
283 public:
285 static void FillDataFlavorExVector( const ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >& rDataFlavorSeq,
286 DataFlavorExVector& rDataFlavorExVector );
288 TransferableDataHelper();
289 TransferableDataHelper( const TransferableDataHelper& rDataHelper );
290 TransferableDataHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable );
291 ~TransferableDataHelper();
293 TransferableDataHelper& operator=( const TransferableDataHelper& rDataHelper );
295 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& GetTransferable() const { return mxTransfer; }
296 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > GetXTransferable() const;
298 sal_Bool HasFormat( SotFormatStringId nFormat ) const;
299 sal_Bool HasFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) const;
301 sal_uInt32 GetFormatCount() const;
303 SotFormatStringId GetFormat( sal_uInt32 nFormat ) const;
304 ::com::sun::star::datatransfer::DataFlavor GetFormatDataFlavor( sal_uInt32 nFormat ) const;
306 DataFlavorExVector& GetDataFlavorExVector() const {return *mpFormats; }
308 sal_Bool StartClipboardListening( );
309 void StopClipboardListening( );
311 void Rebind( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _rxNewData );
313 public:
315 ::com::sun::star::uno::Any GetAny( SotFormatStringId nFormat ) const;
316 ::com::sun::star::uno::Any GetAny( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) const;
318 sal_Bool GetString( SotFormatStringId nFormat, OUString& rStr );
319 sal_Bool GetString( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, OUString& rStr );
321 sal_Bool GetBitmapEx( SotFormatStringId nFormat, BitmapEx& rBmp );
322 sal_Bool GetBitmapEx( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, BitmapEx& rBmp );
324 sal_Bool GetGDIMetaFile( SotFormatStringId nFormat, GDIMetaFile& rMtf );
325 sal_Bool GetGDIMetaFile( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, GDIMetaFile& rMtf );
327 sal_Bool GetGraphic( SotFormatStringId nFormat, Graphic& rGraphic );
328 sal_Bool GetGraphic( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, Graphic& rGraphic );
330 sal_Bool GetImageMap( SotFormatStringId nFormat, ImageMap& rIMap );
331 sal_Bool GetImageMap( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ImageMap& rImap );
333 sal_Bool GetTransferableObjectDescriptor( SotFormatStringId nFormat, TransferableObjectDescriptor& rDesc );
334 sal_Bool GetTransferableObjectDescriptor( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, TransferableObjectDescriptor& rDesc );
336 sal_Bool GetINetBookmark( SotFormatStringId nFormat, INetBookmark& rBmk );
337 sal_Bool GetINetBookmark( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, INetBookmark& rBmk );
339 sal_Bool GetINetImage( SotFormatStringId nFormat, INetImage& rINtImg );
340 sal_Bool GetINetImage( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, INetImage& rINtImg );
342 sal_Bool GetFileList( SotFormatStringId nFormat, FileList& rFileList );
343 sal_Bool GetFileList( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, FileList& rFileList );
345 sal_Bool GetSequence( SotFormatStringId nFormat, ::com::sun::star::uno::Sequence< sal_Int8 >& rSeq );
346 sal_Bool GetSequence( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Sequence< sal_Int8 >& rSeq );
348 sal_Bool GetSotStorageStream( SotFormatStringId nFormat, SotStorageStreamRef& rStreamRef );
349 sal_Bool GetSotStorageStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, SotStorageStreamRef& rStreamRef );
351 sal_Bool GetInputStream( SotFormatStringId nFormat, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream );
352 sal_Bool GetInputStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream );
354 sal_Bool GetInterface( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf );
356 public:
358 static TransferableDataHelper CreateFromSystemClipboard( Window * pWindow );
359 static TransferableDataHelper CreateFromSelection( Window * pWindow );
360 static sal_Bool IsEqual( const ::com::sun::star::datatransfer::DataFlavor& rInternalFlavor,
361 const ::com::sun::star::datatransfer::DataFlavor& rRequestFlavor,
362 sal_Bool bCompareParameters = sal_False );
365 class SVT_DLLPUBLIC DragSourceHelper
367 private:
369 // nested class to implement the XDragGestureListener interface
370 class DragGestureListener : public ::cppu::WeakImplHelper1< ::com::sun::star::datatransfer::dnd::XDragGestureListener >
372 private:
374 DragSourceHelper& mrParent;
376 private:
378 // XEventListener
379 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
381 // XDragGestureListener
382 virtual void SAL_CALL dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& rDGE ) throw( ::com::sun::star::uno::RuntimeException );
384 public:
386 DragGestureListener( DragSourceHelper& rDragSourceHelper );
387 ~DragGestureListener();
390 friend class DragSourceHelper::DragGestureListener;
392 private:
394 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer > mxDragGestureRecognizer;
395 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureListener > mxDragGestureListener;
397 // not available
398 DragSourceHelper();
399 DragSourceHelper& operator=( const DragSourceHelper& rDragSourceHelper );
400 sal_Bool operator==( const DragSourceHelper& rDragSourceHelper ) const;
402 public:
404 // to be overridden by the application
405 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
407 DragSourceHelper( Window* pWindow );
408 virtual ~DragSourceHelper();
411 class SVT_DLLPUBLIC DropTargetHelper
413 private:
415 // nested class to implement the XDropTargetListener interface
416 class DropTargetListener : public ::cppu::WeakImplHelper1< ::com::sun::star::datatransfer::dnd::XDropTargetListener >
418 private:
420 DropTargetHelper& mrParent;
421 AcceptDropEvent* mpLastDragOverEvent;
423 private:
425 // XEventListener
426 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
428 // XDropTargetListener
429 virtual void SAL_CALL drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw(::com::sun::star::uno::RuntimeException);
430 virtual void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw(::com::sun::star::uno::RuntimeException);
431 virtual void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw(::com::sun::star::uno::RuntimeException);
432 virtual void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException);
433 virtual void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException);
435 public:
437 DropTargetListener( DropTargetHelper& rDropTargetHelper );
438 ~DropTargetListener();
441 friend class DropTargetHelper::DropTargetListener;
443 private:
445 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > mxDropTarget;
446 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener > mxDropTargetListener;
447 DataFlavorExVector* mpFormats;
449 // not available
450 DropTargetHelper();
451 DropTargetHelper& operator=( const DropTargetHelper& rDropTargetHelper );
452 sal_Bool operator==( const DropTargetHelper& rDropTargetHelper ) const;
454 void ImplConstruct();
456 // called by our own implementation of XDropTargetListener (DropTargetListener instance)
457 void ImplBeginDrag( const ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >& rSupportedDataFlavors );
458 void ImplEndDrag();
460 public:
462 // to be overridden by the application
463 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
464 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
466 DropTargetHelper( Window* pWindow );
467 DropTargetHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget >& rxDropTarget );
469 virtual ~DropTargetHelper();
471 // typically called by the application in ::AcceptDrop and ::ExecuteDrop and (see above)
472 sal_Bool IsDropFormatSupported( SotFormatStringId nFormat );
473 sal_Bool IsDropFormatSupported( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
475 DataFlavorExVector& GetDataFlavorExVector() const {return *mpFormats; }
479 struct TransferDataContainer_Impl;
481 class SVT_DLLPUBLIC TransferDataContainer : public TransferableHelper
483 TransferDataContainer_Impl* pImpl;
485 protected:
487 virtual void AddSupportedFormats();
488 virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
489 virtual void DragFinished( sal_Int8 nDropAction );
491 public:
493 TransferDataContainer();
494 ~TransferDataContainer();
496 void CopyINetBookmark( const INetBookmark& rBkmk );
497 void CopyINetImage( const INetImage& rINtImg );
498 void CopyImageMap( const ImageMap& rImgMap );
499 void CopyGraphic( const Graphic& rGrf );
500 void CopyString( const OUString& rStr );
501 void CopyString( sal_uInt16 nFmt, const OUString& rStr );
502 void CopyAny( sal_uInt16 nFmt, const ::com::sun::star::uno::Any& rAny );
504 void CopyByteString( sal_uLong nFormatId, const OString& rStr );
505 void CopyAnyData( sal_uLong nFormatId, const sal_Char* pData, sal_uLong nLen );
507 sal_Bool HasAnyData() const;
509 using TransferableHelper::StartDrag;
510 void StartDrag( Window* pWindow, sal_Int8 nDragSourceActions,
511 const Link& rCallbck,
512 sal_Int32 nDragPointer = DND_POINTER_NONE,
513 sal_Int32 nDragImage = DND_IMAGE_NONE );
516 #endif
518 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */