LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/svtools - transfer.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 16 12.5 %
Date: 2012-08-25 Functions: 4 16 25.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 12 32 37.5 %

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

Generated by: LCOV version 1.10