LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/svtools - transfer.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 19 26.3 %
Date: 2013-07-09 Functions: 4 16 25.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef _TRANSFER_HXX
      21             : #define _TRANSFER_HXX
      22             : 
      23             : #include "svtools/svtdllapi.h"
      24             : #include <tools/globname.hxx>
      25             : #include <tools/gen.hxx>
      26             : #include <tools/string.hxx>
      27             : #include <sot/formats.hxx>
      28             : #include <cppuhelper/implbase1.hxx>
      29             : #include <cppuhelper/implbase4.hxx>
      30             : #include <com/sun/star/frame/XTerminateListener.hpp>
      31             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      32             : #include <com/sun/star/datatransfer/XTransferable.hpp>
      33             : #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
      34             : #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
      35             : #include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp>
      36             : #include <com/sun/star/datatransfer/dnd/XDropTarget.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>
      42             : #include <com/sun/star/io/XInputStream.hpp>
      43             : 
      44             : class BitmapEx;
      45             : class GDIMetaFile;
      46             : class Graphic;
      47             : class ImageMap;
      48             : class SotStorageStreamRef;
      49             : class INetBookmark;
      50             : class INetImage;
      51             : class FileList;
      52             : class Window;
      53             : class Link;
      54             : 
      55             : // Drag&Drop defines
      56             : 
      57             : #define DND_ACTION_NONE     ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_NONE
      58             : #define DND_ACTION_COPY     ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_COPY
      59             : #define DND_ACTION_MOVE     ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_MOVE
      60             : #define DND_ACTION_COPYMOVE ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE
      61             : #define DND_ACTION_LINK     ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_LINK
      62             : 
      63             : #define DND_POINTER_NONE    0
      64             : #define DND_IMAGE_NONE      0
      65             : 
      66        3061 : struct TransferableObjectDescriptor
      67             : {
      68             :     SvGlobalName        maClassName;
      69             :     sal_uInt16          mnViewAspect;
      70             :     Point               maDragStartPos;
      71             :     Size                maSize;
      72             :     sal_uInt32          mnOle2Misc;
      73             :     OUString            maTypeName;
      74             :     OUString            maDisplayName;
      75             :     sal_Bool            mbCanLink;
      76             : 
      77        2991 :     TransferableObjectDescriptor()
      78             :         : mnViewAspect(::com::sun::star::embed::Aspects::MSOLE_CONTENT)
      79             :         , mnOle2Misc(0)
      80        2991 :         , mbCanLink(false)
      81        2991 :     {}
      82             : 
      83             :     SVT_DLLPUBLIC friend SvStream&  operator>>( SvStream& rIStm, TransferableObjectDescriptor& rObjDesc );
      84             :     SVT_DLLPUBLIC friend SvStream&  operator<<( SvStream& rOStm, const TransferableObjectDescriptor& rObjDesc );
      85             : };
      86             : 
      87           0 : struct AcceptDropEvent
      88             : {
      89             :     sal_Int8                                                        mnAction;
      90             :     Point                                                           maPosPixel;
      91             :     const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent  maDragEvent;
      92             :     sal_Bool                                                        mbLeaving;
      93             :     sal_Bool                                                        mbDefault;
      94             : 
      95           0 :     AcceptDropEvent() :
      96             :         mnAction( DND_ACTION_NONE ),
      97             :         mbLeaving( sal_False ),
      98           0 :         mbDefault( sal_False ) {}
      99             : 
     100           0 :     AcceptDropEvent( sal_Int8 nAction,
     101             :                      const Point& rPosPixel,
     102             :                      const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& rDragEvent,
     103             :                      sal_Bool bLeaving = sal_False ) :
     104             :         mnAction( nAction ),
     105             :         maPosPixel( rPosPixel ),
     106             :         maDragEvent( rDragEvent ),
     107             :         mbLeaving( bLeaving ),
     108           0 :         mbDefault( sal_False ) {}
     109             : };
     110             : 
     111           0 : struct ExecuteDropEvent
     112             : {
     113             :     sal_Int8                                                        mnAction;
     114             :     Point                                                           maPosPixel;
     115             :     const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent  maDropEvent;
     116             :     sal_Bool                                                        mbDefault;
     117             : 
     118             :     ExecuteDropEvent() :
     119             :         mnAction( DND_ACTION_NONE ),
     120             :         mbDefault( sal_False ) {}
     121             : 
     122           0 :     ExecuteDropEvent( sal_Int8 nAction,
     123             :                       const Point& rPosPixel,
     124             :                       const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& rDropEvent ) :
     125             :         mnAction( nAction ),
     126             :         maPosPixel( rPosPixel ),
     127             :         maDropEvent( rDropEvent ),
     128           0 :         mbDefault( sal_False ) {}
     129             : };
     130             : 
     131             : class SVT_DLLPUBLIC TransferableHelper : public ::cppu::WeakImplHelper4< ::com::sun::star::datatransfer::XTransferable,
     132             :                                                            ::com::sun::star::datatransfer::clipboard::XClipboardOwner,
     133             :                                                            ::com::sun::star::datatransfer::dnd::XDragSourceListener,
     134             :                                                            ::com::sun::star::lang::XUnoTunnel >
     135             : {
     136             : private:
     137             : 
     138             :     // nested class to implement the XTerminateListener interface
     139             :     class TerminateListener : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XTerminateListener >
     140             :     {
     141             :     private:
     142             : 
     143             :         TransferableHelper& mrParent;
     144             : 
     145             :     private:
     146             : 
     147             :         // XEventListener
     148             :         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException );
     149             : 
     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 );
     152             :         virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
     153             : 
     154             :     public:
     155             : 
     156             :                               TerminateListener( TransferableHelper& rDropTargetHelper );
     157             :         virtual               ~TerminateListener();
     158             :     };
     159             : 
     160             :     friend class TransferableHelper::TerminateListener;
     161             : 
     162             : private:
     163             : 
     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;
     170             : 
     171             : protected:
     172             :     inline const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >&
     173           0 :         getOwnClipboard() const { return mxClipboard; }
     174             : 
     175             : private:
     176             : 
     177             :     // XTransferable
     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);
     179             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() throw(::com::sun::star::uno::RuntimeException);
     180             :     virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) throw(::com::sun::star::uno::RuntimeException);
     181             : 
     182             :     // XEventListener
     183             :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
     184             : 
     185             :     // XDragSourceListener
     186             :     virtual void SAL_CALL dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& dsde ) throw(::com::sun::star::uno::RuntimeException);
     187             :     virtual void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw(::com::sun::star::uno::RuntimeException);
     188             :     virtual void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DragSourceEvent& dse ) throw(::com::sun::star::uno::RuntimeException);
     189             :     virtual void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw(::com::sun::star::uno::RuntimeException);
     190             :     virtual void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw(::com::sun::star::uno::RuntimeException);
     191             : 
     192             : private:
     193             : 
     194             :     // XClipboardOwner
     195             :     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             : 
     197             : protected:
     198             :     // derivees need to access lostOwnership in case hey override it
     199             :     // on windows, changing the access rights to a method gives unresolved externals, so we introduce
     200             :     // this impl-method here 'til the next incompatible update
     201           0 :     inline  void    implCallOwnLostOwnership(
     202             :                         const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& _rxClipboard,
     203             :                         const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _rxTrans
     204             :                     )
     205             :             {
     206           0 :                 TransferableHelper::lostOwnership( _rxClipboard, _rxTrans );
     207           0 :             }
     208             : 
     209             : 
     210             : private:
     211             : 
     212             :     SVT_DLLPRIVATE void             ImplFlush();
     213             : 
     214             : protected:
     215             : 
     216             :     virtual             ~TransferableHelper();
     217             : 
     218             :     void                AddFormat( SotFormatStringId nFormat );
     219             :     void                AddFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     220             :     void                RemoveFormat( SotFormatStringId nFormat );
     221             :     void                RemoveFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     222             :     sal_Bool            HasFormat( SotFormatStringId nFormat );
     223             :     inline sal_Bool     HasFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) { return isDataFlavorSupported( rFlavor ); }
     224             :     void                ClearFormats();
     225             : 
     226             :     sal_Bool            SetAny( const ::com::sun::star::uno::Any& rAny, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     227             :     sal_Bool            SetString( const OUString& rString, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     228             :     sal_Bool            SetBitmapEx( const BitmapEx& rBitmap, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     229             :     sal_Bool            SetGDIMetaFile( const GDIMetaFile& rMtf, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     230             :     sal_Bool            SetGraphic( const Graphic& rGraphic, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     231             :     sal_Bool            SetImageMap( const ImageMap& rIMap, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     232             :     sal_Bool            SetTransferableObjectDescriptor( const TransferableObjectDescriptor& rDesc, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     233             :     sal_Bool            SetINetBookmark( const INetBookmark& rBmk, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     234             :     sal_Bool            SetINetImage( const INetImage& rINtImg, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     235             :     sal_Bool            SetObject( void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     236             : 
     237             : protected:
     238             : 
     239             :     virtual void        AddSupportedFormats() = 0;
     240             :     virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) = 0;
     241             :     virtual sal_Bool    WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     242             :     virtual void        DragFinished( sal_Int8 nDropAction );
     243             :     virtual void        ObjectReleased();
     244             : 
     245             : public:
     246             : 
     247             :                         TransferableHelper();
     248             : 
     249             :     void                PrepareOLE( const TransferableObjectDescriptor& rObjDesc );
     250             : 
     251             :     void                CopyToClipboard( Window *pWindow ) const;
     252             :     void                CopyToSelection( Window *pWindow ) const;
     253             :     void                StartDrag( Window* pWindow, sal_Int8 nDragSourceActions,
     254             :                                    sal_Int32 nDragPointer = DND_POINTER_NONE,
     255             :                                    sal_Int32 nDragImage = DND_IMAGE_NONE );
     256             : 
     257             :     static void         ClearSelection( Window *pWindow );
     258             : 
     259             :     static ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetSystemClipboard();
     260             :     static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
     261             : 
     262             : public:
     263             : 
     264             :     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
     265             : };
     266             : 
     267             : struct TransferableDataHelper_Impl;
     268             : 
     269             : class SVT_DLLPUBLIC TransferableDataHelper
     270             : {
     271             :     friend class DropTargetHelper;
     272             : 
     273             : private:
     274             : 
     275             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >           mxTransfer;
     276             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >   mxClipboard;
     277             :     DataFlavorExVector*                                                                         mpFormats;
     278             :     TransferableObjectDescriptor*                                                               mpObjDesc;
     279             :     TransferableDataHelper_Impl*                                                                mpImpl;
     280             : 
     281             : protected:
     282             :     void                        InitFormats();
     283             : 
     284             : public:
     285             : 
     286             :     static void                 FillDataFlavorExVector( const ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >& rDataFlavorSeq,
     287             :                                                         DataFlavorExVector& rDataFlavorExVector );
     288             : 
     289             :                                 TransferableDataHelper();
     290             :                                 TransferableDataHelper( const TransferableDataHelper& rDataHelper );
     291             :                                 TransferableDataHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable );
     292             :                                 ~TransferableDataHelper();
     293             : 
     294             :     TransferableDataHelper&     operator=( const TransferableDataHelper& rDataHelper );
     295             : 
     296        1187 :     const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >&    GetTransferable() const { return mxTransfer; }
     297             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >           GetXTransferable() const;
     298             : 
     299             :     sal_Bool                    HasFormat( SotFormatStringId nFormat ) const;
     300             :     sal_Bool                    HasFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) const;
     301             : 
     302             :     sal_uInt32                  GetFormatCount() const;
     303             : 
     304             :     SotFormatStringId                           GetFormat( sal_uInt32 nFormat ) const;
     305             :     ::com::sun::star::datatransfer::DataFlavor  GetFormatDataFlavor( sal_uInt32 nFormat ) const;
     306             : 
     307           0 :     DataFlavorExVector&         GetDataFlavorExVector() const {return *mpFormats; }
     308             : 
     309             :     sal_Bool                    StartClipboardListening( );
     310             :     void                        StopClipboardListening( );
     311             : 
     312             :     void                        Rebind( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _rxNewData );
     313             : 
     314             : public:
     315             : 
     316             :     ::com::sun::star::uno::Any  GetAny( SotFormatStringId nFormat ) const;
     317             :     ::com::sun::star::uno::Any  GetAny( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) const;
     318             : 
     319             :     sal_Bool                    GetString( SotFormatStringId nFormat, String& rStr );
     320             :     sal_Bool                    GetString( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, String& rStr );
     321             : 
     322             :     sal_Bool                    GetString( SotFormatStringId nFormat, OUString& rStr );
     323             :     sal_Bool                    GetString( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, OUString& rStr );
     324             : 
     325             :     sal_Bool                    GetBitmapEx( SotFormatStringId nFormat, BitmapEx& rBmp );
     326             :     sal_Bool                    GetBitmapEx( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, BitmapEx& rBmp );
     327             : 
     328             :     sal_Bool                    GetGDIMetaFile( SotFormatStringId nFormat, GDIMetaFile& rMtf );
     329             :     sal_Bool                    GetGDIMetaFile( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, GDIMetaFile& rMtf );
     330             : 
     331             :     sal_Bool                    GetGraphic( SotFormatStringId nFormat, Graphic& rGraphic );
     332             :     sal_Bool                    GetGraphic( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, Graphic& rGraphic );
     333             : 
     334             :     sal_Bool                    GetImageMap( SotFormatStringId nFormat, ImageMap& rIMap );
     335             :     sal_Bool                    GetImageMap( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ImageMap& rImap );
     336             : 
     337             :     sal_Bool                    GetTransferableObjectDescriptor( SotFormatStringId nFormat, TransferableObjectDescriptor& rDesc );
     338             :     sal_Bool                    GetTransferableObjectDescriptor( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, TransferableObjectDescriptor& rDesc );
     339             : 
     340             :     sal_Bool                    GetINetBookmark( SotFormatStringId nFormat, INetBookmark& rBmk );
     341             :     sal_Bool                    GetINetBookmark( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, INetBookmark& rBmk );
     342             : 
     343             :     sal_Bool                    GetINetImage( SotFormatStringId nFormat, INetImage& rINtImg );
     344             :     sal_Bool                    GetINetImage( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, INetImage& rINtImg );
     345             : 
     346             :     sal_Bool                    GetFileList( SotFormatStringId nFormat, FileList& rFileList );
     347             :     sal_Bool                    GetFileList( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, FileList& rFileList );
     348             : 
     349             :     sal_Bool                    GetSequence( SotFormatStringId nFormat, ::com::sun::star::uno::Sequence< sal_Int8 >& rSeq );
     350             :     sal_Bool                    GetSequence( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Sequence< sal_Int8 >& rSeq );
     351             : 
     352             :     sal_Bool                    GetSotStorageStream( SotFormatStringId nFormat, SotStorageStreamRef& rStreamRef );
     353             :     sal_Bool                    GetSotStorageStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, SotStorageStreamRef& rStreamRef );
     354             : 
     355             :     sal_Bool                    GetInputStream( SotFormatStringId nFormat, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream );
     356             :     sal_Bool                    GetInputStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream );
     357             : 
     358             :     sal_Bool                    GetInterface( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf );
     359             : 
     360             : public:
     361             : 
     362             :     static TransferableDataHelper   CreateFromSystemClipboard( Window * pWindow );
     363             :     static TransferableDataHelper   CreateFromSelection( Window * pWindow );
     364             :     static sal_Bool                 IsEqual( const ::com::sun::star::datatransfer::DataFlavor& rInternalFlavor,
     365             :                                              const ::com::sun::star::datatransfer::DataFlavor& rRequestFlavor,
     366             :                                              sal_Bool bCompareParameters = sal_False );
     367             : };
     368             : 
     369             : class SVT_DLLPUBLIC DragSourceHelper
     370             : {
     371             : private:
     372             : 
     373             :     // nested class to implement the XDragGestureListener interface
     374             :     class DragGestureListener : public ::cppu::WeakImplHelper1< ::com::sun::star::datatransfer::dnd::XDragGestureListener >
     375             :     {
     376             :     private:
     377             : 
     378             :         DragSourceHelper&   mrParent;
     379             : 
     380             :     private:
     381             : 
     382             :         // XEventListener
     383             :         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
     384             : 
     385             :         // XDragGestureListener
     386             :         virtual void SAL_CALL dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& rDGE ) throw( ::com::sun::star::uno::RuntimeException );
     387             : 
     388             :     public:
     389             : 
     390             :         DragGestureListener( DragSourceHelper& rDragSourceHelper );
     391             :         ~DragGestureListener();
     392             :     };
     393             : 
     394             :     friend class DragSourceHelper::DragGestureListener;
     395             : 
     396             : private:
     397             : 
     398             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer > mxDragGestureRecognizer;
     399             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureListener >   mxDragGestureListener;
     400             : 
     401             :                         // not available
     402             :                         DragSourceHelper();
     403             :     DragSourceHelper&   operator=( const DragSourceHelper& rDragSourceHelper );
     404             :     sal_Bool            operator==( const DragSourceHelper& rDragSourceHelper ) const;
     405             : 
     406             : public:
     407             : 
     408             :                         // to be overridden by the application
     409             :     virtual void        StartDrag( sal_Int8 nAction, const Point& rPosPixel );
     410             : 
     411             :                         DragSourceHelper( Window* pWindow );
     412             :     virtual             ~DragSourceHelper();
     413             : };
     414             : 
     415             : class SVT_DLLPUBLIC DropTargetHelper
     416             : {
     417             : private:
     418             : 
     419             :     // nested class to implement the XDropTargetListener interface
     420             :     class DropTargetListener : public ::cppu::WeakImplHelper1< ::com::sun::star::datatransfer::dnd::XDropTargetListener >
     421             :     {
     422             :     private:
     423             : 
     424             :         DropTargetHelper&   mrParent;
     425             :         AcceptDropEvent*    mpLastDragOverEvent;
     426             : 
     427             :     private:
     428             : 
     429             :         // XEventListener
     430             :         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
     431             : 
     432             :         // XDropTargetListener
     433             :         virtual void SAL_CALL drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw(::com::sun::star::uno::RuntimeException);
     434             :         virtual void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw(::com::sun::star::uno::RuntimeException);
     435             :         virtual void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw(::com::sun::star::uno::RuntimeException);
     436             :         virtual void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException);
     437             :         virtual void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException);
     438             : 
     439             :     public:
     440             : 
     441             :         DropTargetListener( DropTargetHelper& rDropTargetHelper );
     442             :         ~DropTargetListener();
     443             :     };
     444             : 
     445             :     friend class DropTargetHelper::DropTargetListener;
     446             : 
     447             : private:
     448             : 
     449             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget >            mxDropTarget;
     450             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >    mxDropTargetListener;
     451             :     DataFlavorExVector*                                                                             mpFormats;
     452             : 
     453             :                         // not available
     454             :                         DropTargetHelper();
     455             :     DropTargetHelper&   operator=( const DropTargetHelper& rDropTargetHelper );
     456             :     sal_Bool            operator==( const DropTargetHelper& rDropTargetHelper ) const;
     457             : 
     458             :     void                ImplConstruct();
     459             : 
     460             :                         // called by our own implementation of XDropTargetListener (DropTargetListener instance)
     461             :     void                ImplBeginDrag( const ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >& rSupportedDataFlavors );
     462             :     void                ImplEndDrag();
     463             : 
     464             : public:
     465             : 
     466             :                         // to be overridden by the application
     467             :     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt );
     468             :     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
     469             : 
     470             :                         DropTargetHelper( Window* pWindow );
     471             :                         DropTargetHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget >& rxDropTarget );
     472             : 
     473             :     virtual             ~DropTargetHelper();
     474             : 
     475             :                         // typically called by the application in ::AcceptDrop and ::ExecuteDrop and (see above)
     476             :     sal_Bool            IsDropFormatSupported( SotFormatStringId nFormat );
     477             :     sal_Bool            IsDropFormatSupported( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     478             : 
     479           0 :     DataFlavorExVector& GetDataFlavorExVector() const {return *mpFormats; }
     480             : 
     481             : };
     482             : 
     483             : struct TransferDataContainer_Impl;
     484             : 
     485             : class SVT_DLLPUBLIC TransferDataContainer : public TransferableHelper
     486             : {
     487             :     TransferDataContainer_Impl* pImpl;
     488             : 
     489             : protected:
     490             : 
     491             :     virtual void        AddSupportedFormats();
     492             :     virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     493             :     virtual void        DragFinished( sal_Int8 nDropAction );
     494             : 
     495             : public:
     496             : 
     497             :                         TransferDataContainer();
     498             :                         ~TransferDataContainer();
     499             : 
     500             :     void                CopyINetBookmark( const INetBookmark& rBkmk );
     501             :     void                CopyINetImage( const INetImage& rINtImg );
     502             :     void                CopyImageMap( const ImageMap& rImgMap );
     503             :     void                CopyGraphic( const Graphic& rGrf );
     504             :     void                CopyString( const String& rStr );
     505             :     void                CopyString( sal_uInt16 nFmt, const String& rStr );
     506             :     void                CopyAny( sal_uInt16 nFmt, const ::com::sun::star::uno::Any& rAny );
     507             : 
     508             :     void                CopyByteString( sal_uLong nFormatId, const OString& rStr );
     509             :     void                CopyAnyData( sal_uLong nFormatId, const sal_Char* pData, sal_uLong nLen );
     510             : 
     511             :     sal_Bool            HasAnyData() const;
     512             : 
     513             :     using TransferableHelper::StartDrag;
     514             :     void                StartDrag( Window* pWindow, sal_Int8 nDragSourceActions,
     515             :                                    const Link& rCallbck,
     516             :                                    sal_Int32 nDragPointer = DND_POINTER_NONE,
     517             :                                    sal_Int32 nDragImage = DND_IMAGE_NONE );
     518             : };
     519             : 
     520             : #endif
     521             : 
     522             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10