LCOV - code coverage report
Current view: top level - vcl/unx/generic/dtrans - X11_selection.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 17 0.0 %
Date: 2012-08-25 Functions: 0 13 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _DTRANS_X11_SELECTION_HXX_
      30                 :            : #define _DTRANS_X11_SELECTION_HXX_
      31                 :            : 
      32                 :            : #include <cppuhelper/compbase3.hxx>
      33                 :            : #include <cppuhelper/compbase4.hxx>
      34                 :            : #include <com/sun/star/datatransfer/XTransferable.hpp>
      35                 :            : #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
      36                 :            : #include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
      37                 :            : #include <com/sun/star/awt/XDisplayConnection.hpp>
      38                 :            : #include <com/sun/star/lang/XInitialization.hpp>
      39                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      40                 :            : #include <com/sun/star/script/XInvocation.hpp>
      41                 :            : #include <com/sun/star/frame/XDesktop.hpp>
      42                 :            : #include <osl/thread.h>
      43                 :            : 
      44                 :            : #include <osl/conditn.hxx>
      45                 :            : 
      46                 :            : #include <boost/unordered_map.hpp>
      47                 :            : #include <list>
      48                 :            : 
      49                 :            : #include "tools/prex.h"
      50                 :            : #include <X11/Xlib.h>
      51                 :            : #include "tools/postx.h"
      52                 :            : 
      53                 :            : #define XDND_IMPLEMENTATION_NAME "com.sun.star.datatransfer.dnd.XdndSupport"
      54                 :            : #define XDND_DROPTARGET_IMPLEMENTATION_NAME "com.sun.star.datatransfer.dnd.XdndDropTarget"
      55                 :            : 
      56                 :            : using namespace ::com::sun::star::uno;
      57                 :            : 
      58                 :            : namespace x11 {
      59                 :            : 
      60                 :            :     class PixmapHolder; // in bmp.hxx
      61                 :            : 
      62                 :            : // ------------------------------------------------------------------------
      63                 :            :     rtl_TextEncoding getTextPlainEncoding( const ::rtl::OUString& rMimeType );
      64                 :            : 
      65                 :          0 :     class SelectionAdaptor
      66                 :            :     {
      67                 :            :     public:
      68                 :            :         virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable() = 0;
      69                 :            :         virtual void clearTransferable() = 0;
      70                 :            :         virtual void fireContentsChanged() = 0;
      71                 :            :         virtual com::sun::star::uno::Reference< XInterface > getReference() = 0;
      72                 :            :         // returns a reference that will keep the SelectionAdaptor alive until the
      73                 :            :         // refernce is released
      74                 :            : 
      75                 :            :     protected:
      76                 :          0 :         ~SelectionAdaptor() {}
      77                 :            :     };
      78                 :            : 
      79                 :            :     class DropTarget :
      80                 :            :         public ::cppu::WeakComponentImplHelper3<
      81                 :            :             ::com::sun::star::datatransfer::dnd::XDropTarget,
      82                 :            :             ::com::sun::star::lang::XInitialization,
      83                 :            :             ::com::sun::star::lang::XServiceInfo
      84                 :            :         >
      85                 :            :     {
      86                 :            :     public:
      87                 :            :         ::osl::Mutex                m_aMutex;
      88                 :            :         bool                        m_bActive;
      89                 :            :         sal_Int8                    m_nDefaultActions;
      90                 :            :         XLIB_Window                 m_aTargetWindow;
      91                 :            :         class SelectionManager*     m_pSelectionManager;
      92                 :            :         com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >
      93                 :            :                                     m_xSelectionManager;
      94                 :            :         ::std::list< com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener > >
      95                 :            :                             m_aListeners;
      96                 :            : 
      97                 :            :         DropTarget();
      98                 :            :         virtual ~DropTarget();
      99                 :            : 
     100                 :            :         // convenience functions that loop over listeners
     101                 :            :         void dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtde ) throw();
     102                 :            :         void dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw();
     103                 :            :         void dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw();
     104                 :            :         void drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw();
     105                 :            : 
     106                 :            :         // XInitialization
     107                 :            :         virtual void        SAL_CALL initialize( const Sequence< Any >& args ) throw ( ::com::sun::star::uno::Exception );
     108                 :            : 
     109                 :            :         // XDropTarget
     110                 :            :         virtual void        SAL_CALL addDropTargetListener( const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw();
     111                 :            :         virtual void        SAL_CALL removeDropTargetListener( const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw();
     112                 :            :         virtual sal_Bool    SAL_CALL isActive() throw();
     113                 :            :         virtual void        SAL_CALL setActive( sal_Bool active ) throw();
     114                 :            :         virtual sal_Int8    SAL_CALL getDefaultActions() throw();
     115                 :            :         virtual void        SAL_CALL setDefaultActions( sal_Int8 actions ) throw();
     116                 :            : 
     117                 :            :         // XServiceInfo
     118                 :            :         virtual ::rtl::OUString SAL_CALL getImplementationName() throw();
     119                 :            :         virtual sal_Bool    SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw();
     120                 :            :         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
     121                 :            :                             SAL_CALL getSupportedServiceNames() throw();
     122                 :            :     };
     123                 :            : 
     124                 :            :     class SelectionManagerHolder :
     125                 :            :         public ::cppu::WeakComponentImplHelper3<
     126                 :            :             ::com::sun::star::datatransfer::dnd::XDragSource,
     127                 :            :             ::com::sun::star::lang::XInitialization,
     128                 :            :             ::com::sun::star::lang::XServiceInfo
     129                 :            :         >
     130                 :            :     {
     131                 :            :         ::osl::Mutex m_aMutex;
     132                 :            :         com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >
     133                 :            :             m_xRealDragSource;
     134                 :            :     public:
     135                 :            :         SelectionManagerHolder();
     136                 :            :         virtual ~SelectionManagerHolder();
     137                 :            : 
     138                 :            :         // XServiceInfo
     139                 :            :         virtual ::rtl::OUString SAL_CALL getImplementationName() throw();
     140                 :            :         virtual sal_Bool    SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw();
     141                 :            :         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
     142                 :            :                             SAL_CALL getSupportedServiceNames() throw();
     143                 :            : 
     144                 :            :         // XInitialization
     145                 :            :         virtual void        SAL_CALL initialize( const Sequence< Any >& arguments ) throw( ::com::sun::star::uno::Exception );
     146                 :            : 
     147                 :            :         // XDragSource
     148                 :            :         virtual sal_Bool    SAL_CALL isDragImageSupported() throw();
     149                 :            :         virtual sal_Int32   SAL_CALL getDefaultCursor( sal_Int8 dragAction ) throw();
     150                 :            :         virtual void        SAL_CALL startDrag(
     151                 :            :             const ::com::sun::star::datatransfer::dnd::DragGestureEvent& trigger,
     152                 :            :             sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image,
     153                 :            :             const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& transferable,
     154                 :            :             const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener
     155                 :            :             ) throw();
     156                 :            : 
     157                 :            :     };
     158                 :            : 
     159                 :            : 
     160                 :            :     class SelectionManager :
     161                 :            :         public ::cppu::WeakImplHelper4<
     162                 :            :             ::com::sun::star::datatransfer::dnd::XDragSource,
     163                 :            :             ::com::sun::star::lang::XInitialization,
     164                 :            :             ::com::sun::star::awt::XEventHandler,
     165                 :            :             ::com::sun::star::frame::XTerminateListener
     166                 :            :         >,
     167                 :            :         public SelectionAdaptor
     168                 :            :     {
     169                 :            :         static ::boost::unordered_map< ::rtl::OUString, SelectionManager*, ::rtl::OUStringHash >& getInstances();
     170                 :            : 
     171                 :            :         // for INCR type selection transfer
     172                 :            :         // INCR protocol is used if the data cannot
     173                 :            :         // be transported at once but in parts
     174                 :            :         // IncrementalTransfer holds the bytes to be transmitted
     175                 :            :         // as well a the current position
     176                 :            :         // INCR triggers the delivery of the next part by deleting the
     177                 :            :         // property used to transfer the data
     178                 :          0 :         struct IncrementalTransfer
     179                 :            :         {
     180                 :            :             Sequence< sal_Int8 >            m_aData;
     181                 :            :             int                             m_nBufferPos;
     182                 :            :             XLIB_Window                         m_aRequestor;
     183                 :            :             Atom                            m_aProperty;
     184                 :            :             Atom                            m_aTarget;
     185                 :            :             int                             m_nFormat;
     186                 :            :             int                             m_nTransferStartTime;
     187                 :            :         };
     188                 :            :         int m_nIncrementalThreshold;
     189                 :            : 
     190                 :            :         // a struct to hold the data associated with a selection
     191                 :          0 :         struct Selection
     192                 :            :         {
     193                 :            :             enum State
     194                 :            :             {
     195                 :            :                 Inactive, WaitingForResponse, WaitingForData, IncrementalTransfer
     196                 :            :             };
     197                 :            : 
     198                 :            :             State                       m_eState;
     199                 :            :             SelectionAdaptor*           m_pAdaptor;
     200                 :            :             Atom                        m_aAtom;
     201                 :            :             ::osl::Condition            m_aDataArrived;
     202                 :            :             Sequence< sal_Int8 >        m_aData;
     203                 :            :             Sequence< ::com::sun::star::datatransfer::DataFlavor >
     204                 :            :                                         m_aTypes;
     205                 :            :             std::vector< Atom >         m_aNativeTypes;
     206                 :            :             // this is used for caching
     207                 :            :             // m_aTypes is invalid after 2 seconds
     208                 :            :             // m_aNativeTypes contains the corresponding original atom
     209                 :            :             Atom                        m_aRequestedType;
     210                 :            :             // m_aRequestedType is only valid while WaitingForResponse and WaitingFotData
     211                 :            :             int                         m_nLastTimestamp;
     212                 :            :             bool                        m_bHaveUTF16;
     213                 :            :             Atom                        m_aUTF8Type;
     214                 :            :             bool                        m_bHaveCompound;
     215                 :            :             bool                        m_bOwner;
     216                 :            :             XLIB_Window                 m_aLastOwner;
     217                 :            :             PixmapHolder*               m_pPixmap;
     218                 :            :             // m_nOrigXLIB_Timestamp contains the XLIB_Timestamp at which the seclection
     219                 :            :             // was acquired; needed for XLIB_TimeSTAMP target
     220                 :            :             XLIB_Time                        m_nOrigTimestamp;
     221                 :            : 
     222                 :          0 :             Selection() : m_eState( Inactive ),
     223                 :            :                           m_pAdaptor( NULL ),
     224                 :            :                           m_aAtom( None ),
     225                 :            :                           m_aRequestedType( None ),
     226                 :            :                           m_nLastTimestamp( 0 ),
     227                 :            :                           m_bHaveUTF16( false ),
     228                 :            :                           m_aUTF8Type( None ),
     229                 :            :                           m_bHaveCompound( false ),
     230                 :            :                           m_bOwner( false ),
     231                 :            :                           m_aLastOwner( None ),
     232                 :            :                           m_pPixmap( NULL ),
     233                 :          0 :                           m_nOrigTimestamp( CurrentTime )
     234                 :          0 :                 {}
     235                 :            :         };
     236                 :            : 
     237                 :            :         // a struct to hold data associated with a XDropTarget
     238                 :            :         struct DropTargetEntry
     239                 :            :         {
     240                 :            :             DropTarget*     m_pTarget;
     241                 :            :             XLIB_Window     m_aRootWindow;
     242                 :            : 
     243                 :          0 :             DropTargetEntry() : m_pTarget( NULL ), m_aRootWindow( None ) {}
     244                 :          0 :             DropTargetEntry( DropTarget* pTarget ) :
     245                 :            :                     m_pTarget( pTarget ),
     246                 :          0 :                     m_aRootWindow( None )
     247                 :          0 :                 {}
     248                 :            :             DropTargetEntry( const DropTargetEntry& rEntry ) :
     249                 :            :                     m_pTarget( rEntry.m_pTarget ),
     250                 :            :                     m_aRootWindow( rEntry.m_aRootWindow )
     251                 :            :                 {}
     252                 :          0 :             ~DropTargetEntry() {}
     253                 :            : 
     254                 :          0 :             DropTarget* operator->() const { return m_pTarget; }
     255                 :          0 :             DropTargetEntry& operator=(const DropTargetEntry& rEntry)
     256                 :          0 :                 { m_pTarget = rEntry.m_pTarget; m_aRootWindow = rEntry.m_aRootWindow; return *this; }
     257                 :            :         };
     258                 :            : 
     259                 :            :         // internal data
     260                 :            :         Display*                    m_pDisplay;
     261                 :            :         oslThread                   m_aThread;
     262                 :            :         oslThread                   m_aDragExecuteThread;
     263                 :            :         ::osl::Condition            m_aDragRunning;
     264                 :            :         XLIB_Window                 m_aWindow;
     265                 :            :         com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > m_xDesktop;
     266                 :            :         com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayConnection >
     267                 :            :                                     m_xDisplayConnection;
     268                 :            :         com::sun::star::uno::Reference< com::sun::star::script::XInvocation >
     269                 :            :                                     m_xBitmapConverter;
     270                 :            :         sal_Int32                   m_nSelectionTimeout;
     271                 :            :         XLIB_Time                   m_nSelectionTimestamp;
     272                 :            : 
     273                 :            : 
     274                 :            :         // members used for Xdnd
     275                 :            : 
     276                 :            :         // drop only
     277                 :            : 
     278                 :            :         // contains the XdndEnterEvent of a drop action running
     279                 :            :         // with one of our targets. The data.l[0] member
     280                 :            :         // (conatining the drag source XLIB_Window) is set
     281                 :            :         // to None while that is not the case
     282                 :            :         XClientMessageEvent         m_aDropEnterEvent;
     283                 :            :         // set to false on XdndEnter
     284                 :            :         // set to true on first XdndPosition or XdndLeave
     285                 :            :         bool                        m_bDropEnterSent;
     286                 :            :         XLIB_Window                 m_aCurrentDropWindow;
     287                 :            :         // XLIB_Time code of XdndDrop
     288                 :            :         XLIB_Time                   m_nDropTime;
     289                 :            :         sal_Int8                    m_nLastDropAction;
     290                 :            :         // XTransferable for Xdnd with foreign drag source
     291                 :            :         com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >
     292                 :            :                                     m_xDropTransferable;
     293                 :            :         int                         m_nLastX, m_nLastY;
     294                 :            :         XLIB_Time                   m_nDropTimestamp;
     295                 :            :         // set to true when calling drop()
     296                 :            :         // if another XdndEnter is received this shows that
     297                 :            :         // someone forgot to call dropComplete - we should reset
     298                 :            :         // and react to the new drop
     299                 :            :         bool                        m_bDropWaitingForCompletion;
     300                 :            : 
     301                 :            :         // drag only
     302                 :            : 
     303                 :            :         // None if no Dnd action is running with us as source
     304                 :            :         XLIB_Window                 m_aDropWindow;
     305                 :            :         // either m_aDropXLIB_Window or its XdndProxy
     306                 :            :         XLIB_Window                 m_aDropProxy;
     307                 :            :         XLIB_Window                 m_aDragSourceWindow;
     308                 :            :         // XTransferable for Xdnd when we are drag source
     309                 :            :         com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >
     310                 :            :                                     m_xDragSourceTransferable;
     311                 :            :         com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >
     312                 :            :                                     m_xDragSourceListener;
     313                 :            :         // root coordinates
     314                 :            :         int                         m_nLastDragX, m_nLastDragY;
     315                 :            :         Sequence< ::com::sun::star::datatransfer::DataFlavor >
     316                 :            :                                     m_aDragFlavors;
     317                 :            :         // the rectangle the pointer must leave until a new XdndPosition should
     318                 :            :         // be sent. empty unless the drop target told to fill
     319                 :            :         int                         m_nNoPosX, m_nNoPosY, m_nNoPosWidth, m_nNoPosHeight;
     320                 :            :         unsigned int                m_nDragButton;
     321                 :            :         sal_Int8                    m_nUserDragAction;
     322                 :            :         sal_Int8                    m_nTargetAcceptAction;
     323                 :            :         sal_Int8                    m_nSourceActions;
     324                 :            :         bool                        m_bLastDropAccepted;
     325                 :            :         bool                        m_bDropSuccess;
     326                 :            :         bool                        m_bDropSent;
     327                 :            :         time_t                      m_nDropTimeout;
     328                 :            :         bool                        m_bWaitingForPrimaryConversion;
     329                 :            :         XLIB_Time                   m_nDragTimestamp;
     330                 :            : 
     331                 :            :         // drag cursors
     332                 :            :         XLIB_Cursor                 m_aMoveCursor;
     333                 :            :         XLIB_Cursor                 m_aCopyCursor;
     334                 :            :         XLIB_Cursor                 m_aLinkCursor;
     335                 :            :         XLIB_Cursor                 m_aNoneCursor;
     336                 :            :         XLIB_Cursor                 m_aCurrentCursor;
     337                 :            : 
     338                 :            : 
     339                 :            :         // drag and drop
     340                 :            : 
     341                 :            :         int                         m_nCurrentProtocolVersion;
     342                 :            :         ::boost::unordered_map< XLIB_Window, DropTargetEntry >
     343                 :            :                                     m_aDropTargets;
     344                 :            : 
     345                 :            : 
     346                 :            :         // some special atoms that are needed often
     347                 :            :         Atom                        m_nCLIPBOARDAtom;
     348                 :            :         Atom                        m_nTARGETSAtom;
     349                 :            :         Atom                        m_nTIMESTAMPAtom;
     350                 :            :         Atom                        m_nTEXTAtom;
     351                 :            :         Atom                        m_nINCRAtom;
     352                 :            :         Atom                        m_nCOMPOUNDAtom;
     353                 :            :         Atom                        m_nMULTIPLEAtom;
     354                 :            :         Atom                        m_nUTF16Atom;
     355                 :            :         Atom                        m_nImageBmpAtom;
     356                 :            :         Atom                        m_nXdndAware;
     357                 :            :         Atom                        m_nXdndEnter;
     358                 :            :         Atom                        m_nXdndLeave;
     359                 :            :         Atom                        m_nXdndPosition;
     360                 :            :         Atom                        m_nXdndStatus;
     361                 :            :         Atom                        m_nXdndDrop;
     362                 :            :         Atom                        m_nXdndFinished;
     363                 :            :         Atom                        m_nXdndSelection;
     364                 :            :         Atom                        m_nXdndTypeList;
     365                 :            :         Atom                        m_nXdndProxy;
     366                 :            :         Atom                        m_nXdndActionCopy;
     367                 :            :         Atom                        m_nXdndActionMove;
     368                 :            :         Atom                        m_nXdndActionLink;
     369                 :            :         Atom                        m_nXdndActionAsk;
     370                 :            :         Atom                        m_nXdndActionPrivate;
     371                 :            : 
     372                 :            :         // caching for atoms
     373                 :            :         ::boost::unordered_map< Atom, ::rtl::OUString >
     374                 :            :                                     m_aAtomToString;
     375                 :            :         ::boost::unordered_map< ::rtl::OUString, Atom, ::rtl::OUStringHash >
     376                 :            :                                     m_aStringToAtom;
     377                 :            : 
     378                 :            :         // the registered selections
     379                 :            :         ::boost::unordered_map< Atom, Selection* >
     380                 :            :                                     m_aSelections;
     381                 :            :         // IncrementalTransfers in progress
     382                 :            :         boost::unordered_map< XLIB_Window, boost::unordered_map< Atom, IncrementalTransfer > >
     383                 :            :                                     m_aIncrementals;
     384                 :            : 
     385                 :            :         // do not use X11 multithreading capabilities
     386                 :            :         // since this leads to deadlocks in different Xlib implentations
     387                 :            :         // (XFree as well as Xsun) use an own mutex instead
     388                 :            :         ::osl::Mutex                m_aMutex;
     389                 :            :         bool                        m_bShutDown;
     390                 :            : 
     391                 :            :         SelectionManager();
     392                 :            :         ~SelectionManager();
     393                 :            : 
     394                 :            :         SelectionAdaptor* getAdaptor( Atom selection );
     395                 :            :         PixmapHolder* getPixmapHolder( Atom selection );
     396                 :            : 
     397                 :            :         // handle various events
     398                 :            :         bool handleSelectionRequest( XSelectionRequestEvent& rRequest );
     399                 :            :         bool handleSendPropertyNotify( XPropertyEvent& rNotify );
     400                 :            :         bool handleReceivePropertyNotify( XPropertyEvent& rNotify );
     401                 :            :         bool handleSelectionNotify( XSelectionEvent& rNotify );
     402                 :            :         bool handleDragEvent( XEvent& rMessage );
     403                 :            :         bool handleDropEvent( XClientMessageEvent& rMessage );
     404                 :            : 
     405                 :            :         // dnd helpers
     406                 :            :         void sendDragStatus( Atom nDropAction );
     407                 :            :         void sendDropPosition( bool bForce, XLIB_Time eventXLIB_Time );
     408                 :            :         bool updateDragAction( int modifierState );
     409                 :            :         int getXdndVersion( XLIB_Window aXLIB_Window, XLIB_Window& rProxy );
     410                 :            :         XLIB_Cursor createCursor( const unsigned char* pPointerData, const unsigned char* pMaskData, int width, int height, int hotX, int hotY );
     411                 :            :         // coordinates on root XLIB_Window
     412                 :            :         void updateDragWindow( int nX, int nY, XLIB_Window aRoot );
     413                 :            : 
     414                 :            :         bool getPasteData( Atom selection, Atom type, Sequence< sal_Int8 >& rData );
     415                 :            :         // returns true if conversion was successful
     416                 :            :         bool convertData( const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable,
     417                 :            :                           Atom nType,
     418                 :            :                           Atom nSelection,
     419                 :            :                           int & rFormat,
     420                 :            :                           Sequence< sal_Int8 >& rData );
     421                 :            :         bool sendData( SelectionAdaptor* pAdaptor, XLIB_Window requestor, Atom target, Atom property, Atom selection );
     422                 :            : 
     423                 :            :         // thread dispatch loop
     424                 :            :         public:
     425                 :            :         // public for extern "C" stub
     426                 :            :         static void run( void* );
     427                 :            :         private:
     428                 :            :         void dispatchEvent( int millisec );
     429                 :            :         // drag thread dispatch
     430                 :            :         public:
     431                 :            :         // public for extern "C" stub
     432                 :            :         static void runDragExecute( void* );
     433                 :            :         private:
     434                 :            :         void dragDoDispatch();
     435                 :            :         bool handleXEvent( XEvent& rEvent );
     436                 :            : 
     437                 :            :         // compound text conversion
     438                 :            :         ::rtl::OString convertToCompound( const ::rtl::OUString& rText );
     439                 :            :         ::rtl::OUString convertFromCompound( const char* pText, int nLen = -1 );
     440                 :            : 
     441                 :            :         sal_Int8 getUserDragAction() const;
     442                 :            :         sal_Int32 getSelectionTimeout();
     443                 :            :     public:
     444                 :            :         static SelectionManager& get( const ::rtl::OUString& rDisplayName = ::rtl::OUString() );
     445                 :            : 
     446                 :          0 :         Display * getDisplay() { return m_pDisplay; };
     447                 :            :         XLIB_Window getWindow() { return m_aWindow; };
     448                 :            : 
     449                 :            : 
     450                 :            :         void registerHandler( Atom selection, SelectionAdaptor& rAdaptor );
     451                 :            :         void deregisterHandler( Atom selection );
     452                 :            :         bool requestOwnership( Atom selection );
     453                 :            : 
     454                 :            :         // allow for synchronization over one mutex for XClipboard
     455                 :          0 :         osl::Mutex& getMutex() { return m_aMutex; }
     456                 :            : 
     457                 :            : 
     458                 :            :         Atom getAtom( const ::rtl::OUString& rString );
     459                 :            :         const ::rtl::OUString& getString( Atom nAtom );
     460                 :            : 
     461                 :            :         // type conversion
     462                 :            :         // note: convertTypeToNative does NOT clear the list, so you can append
     463                 :            :         // multiple types to the same list
     464                 :            :         void convertTypeToNative( const ::rtl::OUString& rType, Atom selection, int& rFormat, ::std::list< Atom >& rConversions, bool bPushFront = false );
     465                 :            :         ::rtl::OUString convertTypeFromNative( Atom nType, Atom selection, int& rFormat );
     466                 :            :         void getNativeTypeList( const Sequence< com::sun::star::datatransfer::DataFlavor >& rTypes, std::list< Atom >& rOutTypeList, Atom targetselection );
     467                 :            : 
     468                 :            :         // methods for transferable
     469                 :            :         bool getPasteDataTypes( Atom selection, Sequence< ::com::sun::star::datatransfer::DataFlavor >& rTypes );
     470                 :            :         bool getPasteData( Atom selection, const ::rtl::OUString& rType, Sequence< sal_Int8 >& rData );
     471                 :            : 
     472                 :            :         // for XDropTarget to register/deregister itself
     473                 :            :         void registerDropTarget( XLIB_Window aXLIB_Window, DropTarget* pTarget );
     474                 :            :         void deregisterDropTarget( XLIB_Window aXLIB_Window );
     475                 :            : 
     476                 :            :         // for XDropTarget{Drag|Drop}Context
     477                 :            :         void accept( sal_Int8 dragOperation, XLIB_Window aDropXLIB_Window, XLIB_Time aXLIB_Timestamp );
     478                 :            :         void reject( XLIB_Window aDropXLIB_Window, XLIB_Time aXLIB_Timestamp );
     479                 :            :         void dropComplete( sal_Bool success, XLIB_Window aDropXLIB_Window, XLIB_Time aXLIB_Timestamp );
     480                 :            : 
     481                 :            :         // for XDragSourceContext
     482                 :            :         sal_Int32 getCurrentCursor();
     483                 :            :         void setCursor( sal_Int32 cursor, XLIB_Window aDropXLIB_Window, XLIB_Time aXLIB_Timestamp );
     484                 :            :         void setImage( sal_Int32 image, XLIB_Window aDropXLIB_Window, XLIB_Time aXLIB_Timestamp );
     485                 :            :         void transferablesFlavorsChanged();
     486                 :            : 
     487                 :            :         void shutdown() throw();
     488                 :            : 
     489                 :            :         // XInitialization
     490                 :            :         virtual void        SAL_CALL initialize( const Sequence< Any >& arguments ) throw( ::com::sun::star::uno::Exception );
     491                 :            : 
     492                 :            :         // XEventHandler
     493                 :            :         virtual sal_Bool    SAL_CALL handleEvent( const Any& event ) throw();
     494                 :            : 
     495                 :            :         // XDragSource
     496                 :            :         virtual sal_Bool    SAL_CALL isDragImageSupported() throw();
     497                 :            :         virtual sal_Int32   SAL_CALL getDefaultCursor( sal_Int8 dragAction ) throw();
     498                 :            :         virtual void        SAL_CALL startDrag(
     499                 :            :             const ::com::sun::star::datatransfer::dnd::DragGestureEvent& trigger,
     500                 :            :             sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image,
     501                 :            :             const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& transferable,
     502                 :            :             const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener
     503                 :            :             ) throw();
     504                 :            : 
     505                 :            :         // SelectionAdaptor for XdndSelection Drag (we are drag source)
     506                 :            :         virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable() throw();
     507                 :            :         virtual void clearTransferable() throw();
     508                 :            :         virtual void fireContentsChanged() throw();
     509                 :            :         virtual com::sun::star::uno::Reference< XInterface > getReference() throw();
     510                 :            : 
     511                 :            :         // XEventListener
     512                 :            :         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException );
     513                 :            : 
     514                 :            :         // XTerminateListener
     515                 :            :         virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent )
     516                 :            :                 throw( ::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException );
     517                 :            :         virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent )
     518                 :            :                 throw( ::com::sun::star::uno::RuntimeException );
     519                 :            :     };
     520                 :            : 
     521                 :            : // ------------------------------------------------------------------------
     522                 :            : 
     523                 :            :     ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL Xdnd_getSupportedServiceNames();
     524                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Xdnd_createInstance(
     525                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory);
     526                 :            : 
     527                 :            :     ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL Xdnd_dropTarget_getSupportedServiceNames();
     528                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Xdnd_dropTarget_createInstance(
     529                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory);
     530                 :            : 
     531                 :            : // ------------------------------------------------------------------------
     532                 :            : 
     533                 :            : }
     534                 :            : 
     535                 :            : #endif
     536                 :            : 
     537                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10