diff options
author | Joachim Lingner <jl@openoffice.org> | 2001-02-08 16:12:56 +0000 |
---|---|---|
committer | Joachim Lingner <jl@openoffice.org> | 2001-02-08 16:12:56 +0000 |
commit | 26e9d31731951d2734b23df3244f5e274897ef7d (patch) | |
tree | 4beac58b3d1e3497a6455b140ba98276e8458afd | |
parent | 8d1fd4c7d1f4619b356606ac29c136fb129272b6 (diff) |
*** empty log message ***
-rw-r--r-- | dtrans/source/win32/dnd/source.cxx | 9 | ||||
-rw-r--r-- | dtrans/source/win32/dnd/sourcecontext.cxx | 40 | ||||
-rw-r--r-- | dtrans/source/win32/dnd/sourcecontext.hxx | 11 | ||||
-rw-r--r-- | dtrans/test/win32/dnd/atlwindow.cxx | 11 | ||||
-rw-r--r-- | dtrans/test/win32/dnd/dndTest.cxx | 8 | ||||
-rw-r--r-- | dtrans/test/win32/dnd/makefile.mk | 7 |
6 files changed, 50 insertions, 36 deletions
diff --git a/dtrans/source/win32/dnd/source.cxx b/dtrans/source/win32/dnd/source.cxx index 0c73f9ec9407..d20412a6b501 100644 --- a/dtrans/source/win32/dnd/source.cxx +++ b/dtrans/source/win32/dnd/source.cxx @@ -2,9 +2,9 @@ * * $RCSfile: source.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $ + * last change: $Author: jl $ $Date: 2001-02-08 17:12:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -248,7 +248,7 @@ void SAL_CALL DragSource::executeDrag( const DragGestureEvent& trigger, //Fire event sal_Int8 action= hrDoDragDrop == DRAGDROP_S_DROP ? dndOleDropEffectsToActions( dropEffect) : ACTION_NONE; m_pcurrentContext_impl->fire_dragDropEnd( hrDoDragDrop == DRAGDROP_S_DROP ? sal_True : sal_False, - ACTION_NONE); + action); // Destroy SourceContextslkfgj m_currentContext= 0; // Destroy the XTransferable wrapper @@ -324,6 +324,9 @@ HRESULT STDMETHODCALLTYPE DragSource::QueryContinueDrag( } } + // fire dropActionChanged event. + // this is actually done by the context, which also detects whether the action + // changed at all sal_Int8 dropAction= fEscapePressed ? ACTION_NONE : ( m_sourceActions & dndOleKeysToAction( grfKeyState)); sal_Int8 userAction= fEscapePressed ? ACTION_NONE : diff --git a/dtrans/source/win32/dnd/sourcecontext.cxx b/dtrans/source/win32/dnd/sourcecontext.cxx index b6833ee9e1ed..dd7614b21d2c 100644 --- a/dtrans/source/win32/dnd/sourcecontext.cxx +++ b/dtrans/source/win32/dnd/sourcecontext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sourcecontext.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $ + * last change: $Author: jl $ $Date: 2001-02-08 17:12:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -158,24 +158,28 @@ void SourceContext::fire_dragDropEnd( sal_Bool success, sal_Int8 effect) void SourceContext::fire_dropActionChanged( sal_Int8 dropAction, sal_Int8 userAction) { - DragSourceDragEvent e; - e.DropAction= dropAction; - e.UserAction= userAction; - e.DragSource= m_dragSource; - e.DragSourceContext= static_cast<XDragSourceContext*>( this); - e.Source= Reference<XInterface>( static_cast<XDragSourceContext*>( this), UNO_QUERY); - - OInterfaceContainerHelper* pContainer= rBHelper.getContainer( - getCppuType( (Reference<XDragSourceListener>* )0 ) ); - - if( pContainer) + if( m_currentAction != dropAction) { - OInterfaceIteratorHelper iter( *pContainer); - while( iter.hasMoreElements()) + m_currentAction= dropAction; + DragSourceDragEvent e; + e.DropAction= dropAction; + e.UserAction= userAction; + e.DragSource= m_dragSource; + e.DragSourceContext= static_cast<XDragSourceContext*>( this); + e.Source= Reference<XInterface>( static_cast<XDragSourceContext*>( this), UNO_QUERY); + + OInterfaceContainerHelper* pContainer= rBHelper.getContainer( + getCppuType( (Reference<XDragSourceListener>* )0 ) ); + + if( pContainer) { - Reference<XDragSourceListener> listener( - static_cast<XDragSourceListener*>( iter.next())); - listener->dropActionChanged( e); + OInterfaceIteratorHelper iter( *pContainer); + while( iter.hasMoreElements()) + { + Reference<XDragSourceListener> listener( + static_cast<XDragSourceListener*>( iter.next())); + listener->dropActionChanged( e); + } } } }
\ No newline at end of file diff --git a/dtrans/source/win32/dnd/sourcecontext.hxx b/dtrans/source/win32/dnd/sourcecontext.hxx index e8d282db61ed..2a19a8bef194 100644 --- a/dtrans/source/win32/dnd/sourcecontext.hxx +++ b/dtrans/source/win32/dnd/sourcecontext.hxx @@ -2,9 +2,9 @@ * * $RCSfile: sourcecontext.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $ + * last change: $Author: jl $ $Date: 2001-02-08 17:12:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,13 +84,16 @@ using namespace ::com::sun::star::lang; // This class fires events to XDragSourceListener implementations. // Of that interface only dragDropEnd and dropActionChanged are called. // The functions dragEnter, dragExit and dragOver are not supported -// currently +// currently. +// An instance of SourceContext only lives as long as the drag and drop +// operation lasts. class SourceContext: public MutexDummy, public WeakComponentImplHelper1<XDragSourceContext> { DragSource* m_pDragSource; Reference<XDragSource> m_dragSource; - + // the action ( copy, move etc) + sal_Int8 m_currentAction; SourceContext(); SourceContext( const SourceContext&); diff --git a/dtrans/test/win32/dnd/atlwindow.cxx b/dtrans/test/win32/dnd/atlwindow.cxx index 6d502165680c..bd2a6803dac4 100644 --- a/dtrans/test/win32/dnd/atlwindow.cxx +++ b/dtrans/test/win32/dnd/atlwindow.cxx @@ -2,9 +2,9 @@ * * $RCSfile: atlwindow.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: jl $ $Date: 2001-02-08 15:09:05 $ + * last change: $Author: jl $ $Date: 2001-02-08 17:12:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,6 +71,7 @@ #include "atlwindow.hxx" #include "targetlistener.hxx" +#include "sourcelistener.hxx" #include "transferable.hxx" #include <map> @@ -119,7 +120,6 @@ LRESULT AWindow::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled LRESULT AWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { // Prepare the EDIT control - m_hwndEdit = CreateWindowA( "EDIT", // predefined class NULL, // no window title @@ -144,7 +144,6 @@ LRESULT AWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandle ::SendMessageA(m_hwndEdit, WM_SETTEXT, 0, (LPARAM) szMTAWin); else ::SendMessageA(m_hwndEdit, WM_SETTEXT, 0, (LPARAM) szSTAWin); -// (LPARAM) lpszTrouble); // create the DragSource @@ -198,12 +197,14 @@ LRESULT AWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled if(m_xDragSource.is()) { + //Get the Text out of the Edit window int length= (int)::SendMessageA( m_hwndEdit, WM_GETTEXTLENGTH, 0, 0); char * pBuffer= new char[length + 1]; ZeroMemory( pBuffer, length + 1); ::SendMessageA( m_hwndEdit, WM_GETTEXT, length, (LPARAM) pBuffer); + // call XDragSource::executeDrag from an MTA if( m_isMTA ) { DWORD mtaThreadId; @@ -226,7 +227,7 @@ LRESULT AWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled 0, 0, data, - Reference<XDragSourceListener>()); + Reference<XDragSourceListener>( static_cast<XDragSourceListener*>(new DragSourceListener() ) ) ); } delete[] pBuffer; diff --git a/dtrans/test/win32/dnd/dndTest.cxx b/dtrans/test/win32/dnd/dndTest.cxx index 4c373d65dd42..075d00ff3fdf 100644 --- a/dtrans/test/win32/dnd/dndTest.cxx +++ b/dtrans/test/win32/dnd/dndTest.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dndTest.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: jl $ $Date: 2001-02-08 15:09:35 $ + * last change: $Author: jl $ $Date: 2001-02-08 17:12:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,6 +76,7 @@ CComModule _Module; #include <com/sun/star/lang/XComponent.hpp> #include <rtl/process.h> #include "transferable.hxx" +#include "sourcelistener.hxx" #include "atlwindow.hxx" @@ -161,7 +162,8 @@ DWORD WINAPI MTAFunc(LPVOID pParams) 0, 0, data.transferable, - Reference<XDragSourceListener>()); + Reference<XDragSourceListener>( static_cast<XDragSourceListener*> + ( new DragSourceListener()))); CoUninitialize(); diff --git a/dtrans/test/win32/dnd/makefile.mk b/dtrans/test/win32/dnd/makefile.mk index bed5e64ed1fc..d1bbbc1bd191 100644 --- a/dtrans/test/win32/dnd/makefile.mk +++ b/dtrans/test/win32/dnd/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: jl $ $Date: 2001-02-08 15:09:52 $ +# last change: $Author: jl $ $Date: 2001-02-08 17:12:03 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -115,7 +115,8 @@ APP1OBJS= $(OBJ)$/dndTest.obj \ $(OBJ)$/atlwindow.obj \ $(OBJ)$/targetlistener.obj \ $(OBJ)$/implhelper.obj \ - $(OBJ)$/transferable.obj + $(OBJ)$/transferable.obj \ + $(OBJ)$/sourcelistener.obj LIBCIMT=msvcrtd.lib |