diff options
Diffstat (limited to 'dtrans/source/win32/dnd/source.cxx')
-rw-r--r-- | dtrans/source/win32/dnd/source.cxx | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/dtrans/source/win32/dnd/source.cxx b/dtrans/source/win32/dnd/source.cxx index fb5e6c0830fc..7bf94f8b8000 100644 --- a/dtrans/source/win32/dnd/source.cxx +++ b/dtrans/source/win32/dnd/source.cxx @@ -22,6 +22,8 @@ #include <com/sun/star/awt/MouseButton.hpp> #include <com/sun/star/awt/MouseEvent.hpp> #include <cppuhelper/supportsservice.hxx> +#include <o3tl/any.hxx> + #include <process.h> #include <memory> @@ -59,7 +61,7 @@ DragSource::DragSource( const Reference<XComponentContext>& rxContext): WeakComponentImplHelper< XDragSource, XInitialization, XServiceInfo >(m_mutex), m_xContext( rxContext ), // m_pcurrentContext_impl(0), - m_hAppWindow(0), + m_hAppWindow(nullptr), m_MouseButton(0), m_RunningDndOperationCount(0) { @@ -104,7 +106,7 @@ void DragSource::StartDragImpl( // while this function executes). The source context is also used // in DragSource::QueryContinueDrag. m_currentContext= static_cast<XDragSourceContext*>( new SourceContext( - static_cast<DragSource*>(this), listener ) ); + this, listener ) ); // Convert the XTransferable data object into an IDataObject object; @@ -128,7 +130,7 @@ void DragSource::StartDragImpl( // Hopefully this instance is not destroyed before the thread has terminated. unsigned threadId; HANDLE hThread= reinterpret_cast<HANDLE>(_beginthreadex( - 0, 0, DndOleSTAFunc, reinterpret_cast<void*>(this), 0, &threadId)); + nullptr, 0, DndOleSTAFunc, this, 0, &threadId)); // detach from thread CloseHandle(hThread); @@ -140,7 +142,7 @@ void SAL_CALL DragSource::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException) { if( aArguments.getLength() >=2) - m_hAppWindow= *(HWND*)aArguments[1].getValue(); + m_hAppWindow= reinterpret_cast<HWND>(static_cast<sal_uIntPtr>(*o3tl::doAccess<sal_uInt64>(aArguments[1]))); OSL_ASSERT( IsWindow( m_hAppWindow) ); } @@ -148,7 +150,7 @@ void SAL_CALL DragSource::initialize( const Sequence< Any >& aArguments ) sal_Bool SAL_CALL DragSource::isDragImageSupported( ) throw(RuntimeException) { - return 0; + return false; } sal_Int32 SAL_CALL DragSource::getDefaultCursor( sal_Int8 /*dragAction*/ ) @@ -201,7 +203,7 @@ HRESULT STDMETHODCALLTYPE DragSource::QueryInterface( REFIID riid, void **ppvOb { if( !ppvObject) return E_POINTER; - *ppvObject= NULL; + *ppvObject= nullptr; if( riid == __uuidof( IUnknown) ) *ppvObject= static_cast<IUnknown*>( this); @@ -314,17 +316,17 @@ unsigned __stdcall DndOleSTAFunc(LPVOID pParams) osl_setThreadName("DragSource DndOleSTAFunc"); // The structure contains all arguments for DoDragDrop and other - DragSource *pSource= (DragSource*)pParams; + DragSource *pSource= static_cast<DragSource*>(pParams); // Drag and drop only works in a thread in which OleInitialize is called. - HRESULT hr= OleInitialize( NULL); + HRESULT hr= OleInitialize( nullptr); if(SUCCEEDED(hr)) { // We force the creation of a thread message queue. This is necessary // for a later call to AttachThreadInput MSG msgtemp; - PeekMessage( &msgtemp, NULL, WM_USER, WM_USER, PM_NOREMOVE); + PeekMessage( &msgtemp, nullptr, WM_USER, WM_USER, PM_NOREMOVE); DWORD threadId= GetCurrentThreadId(); @@ -356,12 +358,12 @@ unsigned __stdcall DndOleSTAFunc(LPVOID pParams) sal_Int8 action= hr == DRAGDROP_S_DROP ? dndOleDropEffectsToActions( dwEffect) : ACTION_NONE; static_cast<SourceContext*>(pSource->m_currentContext.get())->fire_dragDropEnd( - hr == DRAGDROP_S_DROP ? sal_True : sal_False, action); + hr == DRAGDROP_S_DROP, action); // Destroy SourceContextslkfgj - pSource->m_currentContext= 0; + pSource->m_currentContext= nullptr; // Destroy the XTransferable wrapper - pSource->m_spDataObject=0; + pSource->m_spDataObject=nullptr; OleUninitialize(); } |