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

Generated by: LCOV version 1.11