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

Generated by: LCOV version 1.10