LCOV - code coverage report
Current view: top level - include/svtools - transfer.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 6 19 31.6 %
Date: 2014-11-03 Functions: 5 16 31.2 %
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/XTransferable2.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             : namespace vcl { 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        3770 : 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        3544 :     TransferableObjectDescriptor()
      77             :         : mnViewAspect(::com::sun::star::embed::Aspects::MSOLE_CONTENT)
      78             :         , mnOle2Misc(0)
      79        3544 :         , mbCanLink(false)
      80        3544 :     {}
      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::XTransferable2,
     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             :     // Transferable2
     181             :     virtual css::uno::Any SAL_CALL getTransferData2(
     182             :         const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc )
     183             :             throw (css::datatransfer::UnsupportedFlavorException, css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     184             : 
     185             :     // XEventListener
     186             :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     187             : 
     188             :     // XDragSourceListener
     189             :     virtual void SAL_CALL dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& dsde ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     190             :     virtual void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     191             :     virtual void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DragSourceEvent& dse ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     192             :     virtual void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     193             :     virtual void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     194             : 
     195             : private:
     196             : 
     197             :     // XClipboardOwner
     198             :     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;
     199             : 
     200             : protected:
     201             :     // derivees need to access lostOwnership in case hey override it
     202             :     // on windows, changing the access rights to a method gives unresolved externals, so we introduce
     203             :     // this impl-method here 'til the next incompatible update
     204           0 :     inline  void    implCallOwnLostOwnership(
     205             :                         const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& _rxClipboard,
     206             :                         const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _rxTrans
     207             :                     )
     208             :             {
     209           0 :                 TransferableHelper::lostOwnership( _rxClipboard, _rxTrans );
     210           0 :             }
     211             : 
     212             : 
     213             : private:
     214             : 
     215             :     SVT_DLLPRIVATE void             ImplFlush();
     216             : 
     217             : protected:
     218             : 
     219             :     virtual             ~TransferableHelper();
     220             : 
     221             :     void                AddFormat( SotFormatStringId nFormat );
     222             :     void                AddFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     223             :     void                RemoveFormat( SotFormatStringId nFormat );
     224             :     void                RemoveFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     225             :     bool                HasFormat( SotFormatStringId nFormat );
     226             :     inline bool         HasFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) { return isDataFlavorSupported( rFlavor ); }
     227             :     void                ClearFormats();
     228             : 
     229             :     bool               SetAny( const ::com::sun::star::uno::Any& rAny, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     230             :     bool               SetString( const OUString& rString, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     231             :     bool               SetBitmapEx( const BitmapEx& rBitmap, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     232             :     bool               SetGDIMetaFile( const GDIMetaFile& rMtf, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     233             :     bool               SetGraphic( const Graphic& rGraphic, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     234             :     bool               SetImageMap( const ImageMap& rIMap, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     235             :     bool               SetTransferableObjectDescriptor( const TransferableObjectDescriptor& rDesc, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     236             :     bool               SetINetBookmark( const INetBookmark& rBmk, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     237             :     bool               SetINetImage( const INetImage& rINtImg, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     238             :     bool               SetObject( void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     239             : 
     240             : protected:
     241             : 
     242             :     virtual void        AddSupportedFormats() = 0;
     243             :     virtual bool        GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) = 0;
     244             :     virtual bool        WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     245             :     virtual void        DragFinished( sal_Int8 nDropAction );
     246             :     virtual void        ObjectReleased();
     247             : 
     248             : public:
     249             : 
     250             :                         TransferableHelper();
     251             : 
     252             :     void                PrepareOLE( const TransferableObjectDescriptor& rObjDesc );
     253             : 
     254             :     void                CopyToClipboard( vcl::Window *pWindow ) const;
     255             :     void                CopyToSelection( vcl::Window *pWindow ) const;
     256             :     void                StartDrag( vcl::Window* pWindow, sal_Int8 nDragSourceActions,
     257             :                                    sal_Int32 nDragPointer = DND_POINTER_NONE,
     258             :                                    sal_Int32 nDragImage = DND_IMAGE_NONE );
     259             : 
     260             :     static void         ClearSelection( vcl::Window *pWindow );
     261             : 
     262             :     static ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetSystemClipboard();
     263             :     static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
     264             : 
     265             : public:
     266             : 
     267             :     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;
     268             : };
     269             : 
     270             : struct TransferableDataHelper_Impl;
     271             : 
     272             : class SVT_DLLPUBLIC TransferableDataHelper
     273             : {
     274             :     friend class DropTargetHelper;
     275             : 
     276             : private:
     277             : 
     278             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >           mxTransfer;
     279             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >   mxClipboard;
     280             :     DataFlavorExVector*                                                                         mpFormats;
     281             :     TransferableObjectDescriptor*                                                               mpObjDesc;
     282             :     TransferableDataHelper_Impl*                                                                mpImpl;
     283             : 
     284             : protected:
     285             :     void                        InitFormats();
     286             : 
     287             : public:
     288             : 
     289             :     static void                 FillDataFlavorExVector( const ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >& rDataFlavorSeq,
     290             :                                                         DataFlavorExVector& rDataFlavorExVector );
     291             : 
     292             :                                 TransferableDataHelper();
     293             :                                 TransferableDataHelper( const TransferableDataHelper& rDataHelper );
     294             :                                 TransferableDataHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable );
     295             :                                 ~TransferableDataHelper();
     296             : 
     297             :     TransferableDataHelper&     operator=( const TransferableDataHelper& rDataHelper );
     298             : 
     299        1158 :     const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >&    GetTransferable() const { return mxTransfer; }
     300             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >           GetXTransferable() const;
     301             : 
     302             :     bool                        HasFormat( SotFormatStringId nFormat ) const;
     303             :     bool                        HasFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) const;
     304             : 
     305             :     sal_uInt32                  GetFormatCount() const;
     306             : 
     307             :     SotFormatStringId                           GetFormat( sal_uInt32 nFormat ) const;
     308             :     ::com::sun::star::datatransfer::DataFlavor  GetFormatDataFlavor( sal_uInt32 nFormat ) const;
     309             : 
     310          12 :     DataFlavorExVector&         GetDataFlavorExVector() const {return *mpFormats; }
     311             : 
     312             :     bool                        StartClipboardListening( );
     313             :     void                        StopClipboardListening( );
     314             : 
     315             :     void                        Rebind( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _rxNewData );
     316             : 
     317             : public:
     318             : 
     319             :     css::uno::Any GetAny( SotFormatStringId nFormat, const OUString& rDestDoc ) const;
     320             :     css::uno::Any GetAny( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) const;
     321             : 
     322             :     bool                        GetString( SotFormatStringId nFormat, OUString& rStr );
     323             :     bool                        GetString( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, OUString& rStr );
     324             : 
     325             :     bool                        GetBitmapEx( SotFormatStringId nFormat, BitmapEx& rBmp );
     326             :     bool                        GetBitmapEx( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, BitmapEx& rBmp );
     327             : 
     328             :     /** Return as GDI metafile.
     329             : 
     330             :         @param nMaxAction Allows you to limit the amount of actions; defaults to 0 which means no limit.
     331             : 
     332             :         Whet you eg. Ctrl+a in Excel, you can get the entire sheet as
     333             :         metafile, with over 3 million (!) actions; which is just too large for
     334             :         any reasonable handling - and you need to set a limit.
     335             :     */
     336             :     bool                        GetGDIMetaFile( SotFormatStringId nFormat, GDIMetaFile& rMtf, size_t nMaxActions = 0 );
     337             :     bool                        GetGDIMetaFile( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, GDIMetaFile& rMtf );
     338             : 
     339             :     bool                        GetGraphic( SotFormatStringId nFormat, Graphic& rGraphic );
     340             :     bool                        GetGraphic( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, Graphic& rGraphic );
     341             : 
     342             :     bool                        GetImageMap( SotFormatStringId nFormat, ImageMap& rIMap );
     343             :     bool                        GetImageMap( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ImageMap& rImap );
     344             : 
     345             :     bool                        GetTransferableObjectDescriptor( SotFormatStringId nFormat, TransferableObjectDescriptor& rDesc );
     346             :     bool                        GetTransferableObjectDescriptor( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, TransferableObjectDescriptor& rDesc );
     347             : 
     348             :     bool                        GetINetBookmark( SotFormatStringId nFormat, INetBookmark& rBmk );
     349             :     bool                        GetINetBookmark( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, INetBookmark& rBmk );
     350             : 
     351             :     bool                        GetINetImage( SotFormatStringId nFormat, INetImage& rINtImg );
     352             :     bool                        GetINetImage( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, INetImage& rINtImg );
     353             : 
     354             :     bool                        GetFileList( SotFormatStringId nFormat, FileList& rFileList );
     355             :     bool                        GetFileList( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, FileList& rFileList );
     356             : 
     357             :     css::uno::Sequence<sal_Int8> GetSequence( SotFormatStringId nFormat, const OUString& rDestDoc );
     358             :     css::uno::Sequence<sal_Int8> GetSequence( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
     359             : 
     360             :     bool                        GetSotStorageStream( SotFormatStringId nFormat, SotStorageStreamRef& rStreamRef );
     361             :     bool                        GetSotStorageStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, SotStorageStreamRef& rStreamRef );
     362             : 
     363             :     css::uno::Reference<css::io::XInputStream> GetInputStream( SotFormatStringId nFormat, const OUString& rDestDoc );
     364             :     css::uno::Reference<css::io::XInputStream> GetInputStream( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
     365             : 
     366             :     bool                        GetInterface( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf );
     367             : 
     368             : public:
     369             : 
     370             :     static TransferableDataHelper   CreateFromSystemClipboard( vcl::Window * pWindow );
     371             :     static TransferableDataHelper   CreateFromSelection( vcl::Window * pWindow );
     372             :     static bool                     IsEqual( const ::com::sun::star::datatransfer::DataFlavor& rInternalFlavor,
     373             :                                              const ::com::sun::star::datatransfer::DataFlavor& rRequestFlavor,
     374             :                                              bool bCompareParameters = false );
     375             : };
     376             : 
     377             : class SVT_DLLPUBLIC DragSourceHelper
     378             : {
     379             : private:
     380             : 
     381             :     // nested class to implement the XDragGestureListener interface
     382             :     class DragGestureListener : public ::cppu::WeakImplHelper1< ::com::sun::star::datatransfer::dnd::XDragGestureListener >
     383             :     {
     384             :     private:
     385             : 
     386             :         DragSourceHelper&   mrParent;
     387             : 
     388             :     private:
     389             : 
     390             :         // XEventListener
     391             :         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     392             : 
     393             :         // XDragGestureListener
     394             :         virtual void SAL_CALL dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& rDGE ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     395             : 
     396             :     public:
     397             : 
     398             :         DragGestureListener( DragSourceHelper& rDragSourceHelper );
     399             :         virtual ~DragGestureListener();
     400             :     };
     401             : 
     402             :     friend class DragSourceHelper::DragGestureListener;
     403             : 
     404             : private:
     405             : 
     406             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer > mxDragGestureRecognizer;
     407             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureListener >   mxDragGestureListener;
     408             : 
     409             :                         // not available
     410             :                         DragSourceHelper();
     411             :     DragSourceHelper&   operator=( const DragSourceHelper& rDragSourceHelper );
     412             :     bool                operator==( const DragSourceHelper& rDragSourceHelper ) const;
     413             : 
     414             : public:
     415             : 
     416             :                         // to be overridden by the application
     417             :     virtual void        StartDrag( sal_Int8 nAction, const Point& rPosPixel );
     418             : 
     419             :                         DragSourceHelper( vcl::Window* pWindow );
     420             :     virtual             ~DragSourceHelper();
     421             : };
     422             : 
     423             : class SVT_DLLPUBLIC DropTargetHelper
     424             : {
     425             : private:
     426             : 
     427             :     // nested class to implement the XDropTargetListener interface
     428             :     class DropTargetListener : public ::cppu::WeakImplHelper1< ::com::sun::star::datatransfer::dnd::XDropTargetListener >
     429             :     {
     430             :     private:
     431             : 
     432             :         DropTargetHelper&   mrParent;
     433             :         AcceptDropEvent*    mpLastDragOverEvent;
     434             : 
     435             :     private:
     436             : 
     437             :         // XEventListener
     438             :         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     439             : 
     440             :         // XDropTargetListener
     441             :         virtual void SAL_CALL drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     442             :         virtual void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     443             :         virtual void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     444             :         virtual void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     445             :         virtual void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     446             : 
     447             :     public:
     448             : 
     449             :         DropTargetListener( DropTargetHelper& rDropTargetHelper );
     450             :         virtual ~DropTargetListener();
     451             :     };
     452             : 
     453             :     friend class DropTargetHelper::DropTargetListener;
     454             : 
     455             : private:
     456             : 
     457             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget >            mxDropTarget;
     458             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >    mxDropTargetListener;
     459             :     DataFlavorExVector*                                                                             mpFormats;
     460             : 
     461             :                         // not available
     462             :                         DropTargetHelper();
     463             :     DropTargetHelper&   operator=( const DropTargetHelper& rDropTargetHelper );
     464             :     bool                operator==( const DropTargetHelper& rDropTargetHelper ) const;
     465             : 
     466             :     void                ImplConstruct();
     467             : 
     468             :                         // called by our own implementation of XDropTargetListener (DropTargetListener instance)
     469             :     void                ImplBeginDrag( const ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >& rSupportedDataFlavors );
     470             :     void                ImplEndDrag();
     471             : 
     472             : public:
     473             : 
     474             :                         // to be overridden by the application
     475             :     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt );
     476             :     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
     477             : 
     478             :                         DropTargetHelper( vcl::Window* pWindow );
     479             :                         DropTargetHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget >& rxDropTarget );
     480             : 
     481             :     virtual             ~DropTargetHelper();
     482             : 
     483             :                         // typically called by the application in ::AcceptDrop and ::ExecuteDrop and (see above)
     484             :     bool                IsDropFormatSupported( SotFormatStringId nFormat );
     485             :     bool                IsDropFormatSupported( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     486             : 
     487           0 :     DataFlavorExVector& GetDataFlavorExVector() const {return *mpFormats; }
     488             : 
     489             : };
     490             : 
     491             : struct TransferDataContainer_Impl;
     492             : 
     493             : class SVT_DLLPUBLIC TransferDataContainer : public TransferableHelper
     494             : {
     495             :     TransferDataContainer_Impl* pImpl;
     496             : 
     497             : protected:
     498             : 
     499             :     virtual void        AddSupportedFormats() SAL_OVERRIDE;
     500             :     virtual bool        GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) SAL_OVERRIDE;
     501             :     virtual void        DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE;
     502             : 
     503             : public:
     504             : 
     505             :                         TransferDataContainer();
     506             :                         virtual ~TransferDataContainer();
     507             : 
     508             :     void                CopyINetBookmark( const INetBookmark& rBkmk );
     509             :     void                CopyINetImage( const INetImage& rINtImg );
     510             :     void                CopyImageMap( const ImageMap& rImgMap );
     511             :     void                CopyGraphic( const Graphic& rGrf );
     512             :     void                CopyString( const OUString& rStr );
     513             :     void                CopyString( sal_uInt16 nFmt, const OUString& rStr );
     514             :     void                CopyAny( sal_uInt16 nFmt, const ::com::sun::star::uno::Any& rAny );
     515             : 
     516             :     void                CopyByteString( sal_uLong nFormatId, const OString& rStr );
     517             :     void                CopyAnyData( sal_uLong nFormatId, const sal_Char* pData, sal_uLong nLen );
     518             : 
     519             :     bool                HasAnyData() const;
     520             : 
     521             :     using TransferableHelper::StartDrag;
     522             :     void                StartDrag( vcl::Window* pWindow, sal_Int8 nDragSourceActions,
     523             :                                    const Link& rCallbck,
     524             :                                    sal_Int32 nDragPointer = DND_POINTER_NONE,
     525             :                                    sal_Int32 nDragImage = DND_IMAGE_NONE );
     526             : };
     527             : 
     528             : #endif
     529             : 
     530             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10