diff options
-rw-r--r-- | dtrans/source/win32/dnd/target.cxx | 29 | ||||
-rw-r--r-- | dtrans/source/win32/dnd/target.hxx | 26 |
2 files changed, 26 insertions, 29 deletions
diff --git a/dtrans/source/win32/dnd/target.cxx b/dtrans/source/win32/dnd/target.cxx index 826b771e6264..46d4ca9a7672 100644 --- a/dtrans/source/win32/dnd/target.cxx +++ b/dtrans/source/win32/dnd/target.cxx @@ -2,9 +2,9 @@ * * $RCSfile: target.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: jl $ $Date: 2001-02-12 11:11:59 $ + * last change: $Author: jl $ $Date: 2001-02-12 11:35:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -233,15 +233,18 @@ STDMETHODIMP DropTarget::DragEnter( IDataObject __RPC_FAR *pDataObj, // the action to COPY or something. Otherwise the source would display a NONE from the beginning. m_nListenerDropAction= getFilteredActions( grfKeyState); m_userAction= m_nListenerDropAction; + + m_currentDragContext= static_cast<XDropTargetDragContext*>( new TargetDragContext( static_cast<DropTarget*>(this), + m_currentEventId )); + m_currentData= static_cast<XTransferable*>( new DNDTransferable( pDataObj) ); + if( m_nListenerDropAction != ACTION_NONE) { - m_currentData= static_cast<XTransferable*>( new DNDTransferable( pDataObj) ); DropTargetDragEnterEvent e; e.SupportedDataFlavors= m_currentData->getTransferDataFlavors(); e.DropAction= m_nListenerDropAction; e.Source= Reference<XInterface>( static_cast<XDropTarget*>(this),UNO_QUERY); - e.Context= static_cast<XDropTargetDragContext*>( new TargetDragContext( static_cast<DropTarget*>(this), - m_currentEventId )); + e.Context= m_currentDragContext; POINT point={ pt.x, pt.y}; ScreenToClient( m_hWnd, &point); e.Location.X= point.x; @@ -251,10 +254,7 @@ STDMETHODIMP DropTarget::DragEnter( IDataObject __RPC_FAR *pDataObj, // The Event contains a XDropTargetDragContext Implementation. A listener is only allowd to call // on it in the same thread and in event handler where it receives that event. - // m_currentEventId is used to verify the callback's validity. fire_dragEnter( e); - m_currentEventId++; - // Check if the action derived from grfKeyState (m_nListenerDropAction) or the action set // by the listener (m_nListenerDropAction) is allowed by the source. Only a allowed action is set // in pdwEffect. @@ -288,8 +288,7 @@ STDMETHODIMP DropTarget::DragOver( DWORD grfKeyState, DropTargetDragEvent e; e.DropAction= m_nListenerDropAction; e.Source= Reference<XInterface>(static_cast<XDropTarget*>(this),UNO_QUERY); - e.Context= static_cast<XDropTargetDragContext*>( new TargetDragContext( static_cast<DropTarget*>(this), - m_currentEventId)); + e.Context= m_currentDragContext; POINT point={ pt.x, pt.y}; ScreenToClient( m_hWnd, &point); e.Location.X= point.x; @@ -308,9 +307,7 @@ STDMETHODIMP DropTarget::DragOver( DWORD grfKeyState, // The Event contains a XDropTargetDragContext Implementation. A listener is only allowd to call // on it in the same thread and in event handler where it receives that envent. - // m_currentEventId is used to verify the callback's validity. fire_dragOver( e); - m_currentEventId++; // Check if the action derived from grfKeyState (m_nListenerDropAction) or the action set // by the listener (m_nListenerDropAction) is allowed by the source. Only a allowed action is set // in pdwEffect. @@ -334,6 +331,9 @@ STDMETHODIMP DropTarget::DragLeave( void) #endif m_currentData=0; + m_currentDragContext= 0; + m_currentDropContext= 0; + if( m_nDefaultActions != ACTION_NONE) { DropTargetEvent e; @@ -356,13 +356,13 @@ STDMETHODIMP DropTarget::Drop( IDataObject *pDataObj, m_bDropComplete= sal_False; m_nListenerDropAction= getFilteredActions( grfKeyState); - + m_currentDropContext= static_cast<XDropTargetDropContext*>( new TargetDropContext( static_cast<DropTarget*>(this )) ); if( m_nListenerDropAction) { DropTargetDropEvent e; e.DropAction= m_nListenerDropAction; e.Source= Reference<XInterface>( static_cast<XDropTarget*>(this), UNO_QUERY); - e.Context= static_cast<XDropTargetDropContext*>( new TargetDropContext( static_cast<DropTarget*>(this ), m_currentEventId) ); + e.Context= m_currentDropContext; POINT point={ pt.x, pt.y}; ScreenToClient( m_hWnd, &point); e.Location.X= point.x; @@ -370,7 +370,6 @@ STDMETHODIMP DropTarget::Drop( IDataObject *pDataObj, e.SourceActions= dndOleDropEffectsToActions( *pdwEffect); e.Transferable= m_currentData; fire_drop( e); - m_currentEventId++; //if fire_drop returns than a listener might have modified m_nListenerDropAction // XDropTargetDropContext::dropComplete or the other functions diff --git a/dtrans/source/win32/dnd/target.hxx b/dtrans/source/win32/dnd/target.hxx index e5a044b197a9..d400d19d30fb 100644 --- a/dtrans/source/win32/dnd/target.hxx +++ b/dtrans/source/win32/dnd/target.hxx @@ -2,9 +2,9 @@ * * $RCSfile: target.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: jl $ $Date: 2001-02-12 11:11:59 $ + * last change: $Author: jl $ $Date: 2001-02-12 11:35:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -120,7 +120,10 @@ private: // Used to find out wheter the listeners callbacks through the Context interfaces // contained in the event objects are valid. - sal_uInt32 m_currentEventId; +// sal_uInt32 m_currentEventId; + + Reference<XDropTargetDragContext> m_currentDragContext; + Reference<XDropTargetDropContext> m_currentDropContext; private: @@ -184,20 +187,15 @@ public: // Non - interface functions -------------------------------------------------- // XDropTargetDropContext delegated from DropContext - // return false signifies the caller to throw a InvalidDNDOperationException - void _acceptDrop( sal_Int8 dropOperation, sal_uInt32 id); - // return false signifies the caller to throw a InvalidDNDOperationException - void _rejectDrop( sal_uInt32 id); - // return false signifies the caller to throw a InvalidDNDOperationException - void _dropComplete( sal_Bool success, sal_uInt32); + void _acceptDrop( sal_Int8 dropOperation, const Reference<XDropTargetDropContext>& context); + void _rejectDrop( const Reference<XDropTargetDropContext>& context); + void _dropComplete( sal_Bool success, const Reference<XDropTargetDropContext>& context); // XDropTargetDragContext delegated from DragContext - // return false signifies the caller to throw a InvalidDNDOperationException - void _acceptDrag( sal_Int8 dragOperation, sal_uInt32); - // return false signifies the caller to throw a InvalidDNDOperationException + void _acceptDrag( sal_Int8 dragOperation, const Reference<XDropTargetDragContext>& context); void _rejectDrag( sal_uInt32); - Sequence<DataFlavor> _getCurrentDataFlavors( sal_uInt32 id); - sal_Bool _isDataFlavorSupported( const DataFlavor& df, sal_uInt32 id); + Sequence<DataFlavor> _getCurrentDataFlavors( const Reference<XDropTargetDragContext>& context); + sal_Bool _isDataFlavorSupported( const DataFlavor& df, const Reference<XDropTargetDragContext>& context); protected: |