summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2001-07-20 11:41:38 +0000
committerJoachim Lingner <jl@openoffice.org>2001-07-20 11:41:38 +0000
commitfc1657b4734a4a106cf0e3712ca87a5ec0bac092 (patch)
tree589237977c72f7e02c9a9c9fd6a43221d7ba8ad7
parent0f2d7dba2f6552cd911343f4045c79abd1c34c7b (diff)
#89819#
-rw-r--r--dtrans/source/win32/dnd/dndentry.cxx13
-rw-r--r--dtrans/source/win32/dnd/idroptarget.cxx9
-rw-r--r--dtrans/source/win32/dnd/source.cxx21
-rw-r--r--dtrans/source/win32/dnd/sourcecontext.cxx13
-rw-r--r--dtrans/source/win32/dnd/target.cxx72
-rw-r--r--dtrans/source/win32/dnd/targetdragcontext.cxx11
-rw-r--r--dtrans/source/win32/dnd/targetdropcontext.cxx10
7 files changed, 98 insertions, 51 deletions
diff --git a/dtrans/source/win32/dnd/dndentry.cxx b/dtrans/source/win32/dnd/dndentry.cxx
index 6b5ecaec7492..09b0c3de825b 100644
--- a/dtrans/source/win32/dnd/dndentry.cxx
+++ b/dtrans/source/win32/dnd/dndentry.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dndentry.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jl $ $Date: 2001-03-12 16:35:40 $
+ * last change: $Author: jl $ $Date: 2001-07-20 12:41:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,7 +80,7 @@ using namespace ::com::sun::star::registry ;
using namespace ::cppu ;
using namespace ::com::sun::star::lang;
-
+rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
Reference< XInterface > SAL_CALL createDragSource( const Reference< XMultiServiceFactory >& rServiceManager )
{
@@ -97,6 +97,10 @@ Reference< XInterface > SAL_CALL createDropTarget( const Reference< XMultiServic
extern "C"
{
+sal_Bool SAL_CALL component_canUnload( TimeValue *pTime )
+{
+ return g_moduleCount.canUnload( &g_moduleCount , pTime );
+}
//----------------------------------------------------------------------
// component_getImplementationEnvironment
@@ -160,7 +164,8 @@ void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* p
reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
OUString::createFromAscii( pImplName ),
createDragSource,
- aSNS);
+ aSNS,
+ &g_moduleCount.modCnt);
}
else if( pSrvManager && ( 0 == rtl_str_compare( pImplName, DNDTARGET_IMPL_NAME ) ) )
diff --git a/dtrans/source/win32/dnd/idroptarget.cxx b/dtrans/source/win32/dnd/idroptarget.cxx
index 760d909ecc7e..95da464f2bba 100644
--- a/dtrans/source/win32/dnd/idroptarget.cxx
+++ b/dtrans/source/win32/dnd/idroptarget.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: idroptarget.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: jl $ $Date: 2001-02-26 16:00:53 $
+ * last change: $Author: jl $ $Date: 2001-07-20 12:41:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -60,15 +60,18 @@
************************************************************************/
#include "idroptarget.hxx"
#include <oleidl.h>
-
+#include <rtl/unload.h>
+extern rtl_StandardModuleCount g_moduleCount;
IDropTargetImpl::IDropTargetImpl( DropTarget& pTarget): m_nRefCount( 0),
m_rDropTarget( pTarget)
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
}
IDropTargetImpl::~IDropTargetImpl()
{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
diff --git a/dtrans/source/win32/dnd/source.cxx b/dtrans/source/win32/dnd/source.cxx
index f90815c5c83c..4053dfd2d952 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.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: jl $ $Date: 2001-07-19 11:16:52 $
+ * last change: $Author: jl $ $Date: 2001-07-20 12:41:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,7 +71,9 @@
#ifndef _COM_SUN_STAR_AWT_MOUSEEVENT_HPP_
#include <com/sun/star/awt/MouseEvent.hpp>
#endif
-
+#ifndef _RTL_UNLOAD_H_
+#include <rtl/unload.h>
+#endif
#include "source.hxx"
#include "globals.hxx"
@@ -94,6 +96,7 @@ using namespace com::sun::star::awt::MouseButton;
using namespace com::sun::star::awt;
using namespace com::sun::star::lang;
+extern rtl_StandardModuleCount g_moduleCount;
//--> TRA
@@ -111,10 +114,12 @@ DragSource::DragSource( const Reference<XMultiServiceFactory>& sf):
m_hAppWindow(0),
m_MouseButton(0)
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
}
DragSource::~DragSource()
{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
// XInitialization
@@ -242,6 +247,10 @@ HRESULT STDMETHODCALLTYPE DragSource::QueryContinueDrag(
/* [in] */ BOOL fEscapePressed,
/* [in] */ DWORD grfKeyState)
{
+#if DBG_CONSOLE_OUT
+ printf("\nDragSource::QueryContinueDrag");
+#endif
+
HRESULT retVal= S_OK; // default continue DnD
if (fEscapePressed)
@@ -266,9 +275,7 @@ HRESULT STDMETHODCALLTYPE DragSource::QueryContinueDrag(
sal_Int8 userAction= fEscapePressed ? ACTION_NONE : dndOleKeysToAction( grfKeyState, -1 );
static_cast<SourceContext*>(m_currentContext.get())->fire_dropActionChanged( dropAction, userAction);
-#if DBG_CONSOLE_OUT
- printf("\nDragSource::QueryContinueDrag");
-#endif
+
return retVal;
}
@@ -276,7 +283,7 @@ HRESULT STDMETHODCALLTYPE DragSource::GiveFeedback(
/* [in] */ DWORD dwEffect)
{
#if DBG_CONSOLE_OUT
- printf("\nDragSource::GiveFeedback");
+ printf("\nDragSource::GiveFeedback %d", dwEffect);
#endif
return DRAGDROP_S_USEDEFAULTCURSORS;
diff --git a/dtrans/source/win32/dnd/sourcecontext.cxx b/dtrans/source/win32/dnd/sourcecontext.cxx
index dd7614b21d2c..b7d31ab2e0e2 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.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jl $ $Date: 2001-02-08 17:12:56 $
+ * last change: $Author: jl $ $Date: 2001-07-20 12:41:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,8 +66,13 @@
#include "sourcecontext.hxx"
+#ifndef _RTL_UNLOAD_H_
+#include <rtl/unload.h>
+#endif
+
using namespace com::sun::star::datatransfer::dnd;
using namespace com::sun::star::datatransfer::dnd::DNDConstants;
+extern rtl_StandardModuleCount g_moduleCount;
SourceContext::SourceContext( DragSource* pSource,
const Reference<XDragSourceListener>& listener):
@@ -75,6 +80,7 @@ SourceContext::SourceContext( DragSource* pSource,
m_pDragSource( pSource),
m_dragSource( static_cast<XDragSource*>( m_pDragSource) )
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
#ifdef DEBUG
if( listener.is())
#endif
@@ -83,6 +89,7 @@ SourceContext::SourceContext( DragSource* pSource,
SourceContext::~SourceContext()
{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
void SAL_CALL SourceContext::addDragSourceListener(
@@ -182,4 +189,4 @@ void SourceContext::fire_dropActionChanged( sal_Int8 dropAction, sal_Int8 userAc
}
}
}
-} \ No newline at end of file
+}
diff --git a/dtrans/source/win32/dnd/target.cxx b/dtrans/source/win32/dnd/target.cxx
index 075ee429f577..2e2e72cc7267 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.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: jl $ $Date: 2001-07-19 11:16:52 $
+ * last change: $Author: jl $ $Date: 2001-07-20 12:41:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,6 +65,9 @@
#ifndef _COM_SUN_STAR_DATATRANSFER_XTRANSFERABLE_HPP_
#include <com/sun/star/datatransfer/XTransferable.hpp>
#endif
+#ifndef _RTL_UNLOAD_H_
+#include <rtl/unload.h>
+#endif
#include <stdio.h>
#include "target.hxx"
@@ -87,7 +90,7 @@ extern Reference< XTransferable > g_XTransferable;
//<-- TRA
-
+extern rtl_StandardModuleCount g_moduleCount;
DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams);
DropTarget::DropTarget( const Reference<XMultiServiceFactory>& sf):
@@ -102,20 +105,17 @@ DropTarget::DropTarget( const Reference<XMultiServiceFactory>& sf):
m_threadIdWindow(0),
m_threadIdTarget(0),
m_hOleThread(0),
- m_nLastDropAction()
+ m_nLastDropAction(0)
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
}
DropTarget::~DropTarget()
{
- if( m_oleThreadId)
- {
- if( m_oleThreadId == CoGetCurrentProcess() )
- OleUninitialize();
- }
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
// called from WeakComponentImplHelperX::dispose
@@ -127,17 +127,32 @@ DropTarget::~DropTarget()
// the IDropTarget object will live on. MEMORY LEAK
void SAL_CALL DropTarget::disposing()
{
- // Call RevokeDragDrop and wait for the OLE thread to die;
- PostThreadMessage( m_threadIdTarget, WM_REVOKEDRAGDROP, (WPARAM)this, 0);
- WaitForSingleObject( m_hOleThread, INFINITE);
- CloseHandle( m_hOleThread);
- //OSL_ENSURE( SUCCEEDED( hr), "HWND not valid!" );
- m_hWnd= NULL;
+ HRESULT hr= S_OK;
+ if( m_threadIdTarget)
+ {
+ // Call RevokeDragDrop and wait for the OLE thread to die;
+ PostThreadMessage( m_threadIdTarget, WM_REVOKEDRAGDROP, (WPARAM)this, 0);
+ WaitForSingleObject( m_hOleThread, INFINITE);
+ CloseHandle( m_hOleThread);
+ //OSL_ENSURE( SUCCEEDED( hr), "HWND not valid!" );
+ }
+ else
+ {
+ hr= RevokeDragDrop( m_hWnd);
+ m_hWnd= 0;
+ }
if( m_pDropTarget)
{
CoLockObjectExternal( m_pDropTarget, FALSE, TRUE);
m_pDropTarget->Release();
}
+
+ if( m_oleThreadId)
+ {
+ if( m_oleThreadId == CoGetCurrentProcess() )
+ OleUninitialize();
+ }
+
}
#ifdef DEBUG
@@ -187,7 +202,7 @@ void SAL_CALL DropTarget::initialize( const Sequence< Any >& aArguments )
&m_evtThreadReady, 0, &m_threadIdTarget);
WaitForSingleObject( m_evtThreadReady, INFINITE);
CloseHandle( m_evtThreadReady);
- PostThreadMessage( m_threadIdTarget, WM_REGISTERDRAGDROP, (WPARAM)this, 0);
+ PostThreadMessage( m_threadIdTarget, WM_REGISTERDRAGDROP, (WPARAM)static_cast<DropTarget*>(this), 0);
}
}
@@ -274,6 +289,7 @@ DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams)
RevokeDragDrop( pTarget-> m_hWnd);
// Detach this thread from the window thread
BOOL bSuccess= AttachThreadInput( threadId, pTarget->m_threadIdWindow, FALSE);
+ pTarget->m_hWnd= 0;
break;
}
TranslateMessage( &msg);
@@ -339,8 +355,10 @@ HRESULT DropTarget::DragEnter( IDataObject *pDataObj,
{
// Intersection of pdwEffect and the allowed actions ( setDefaultActions)
m_nCurrentDropAction= getFilteredActions( grfKeyState, *pdwEffect);
-// m_userAction= m_nCurrentDropAction;
- m_nLastDropAction= m_nCurrentDropAction;
+ // m_nLastDropAction has to be set by a listener. If no listener calls
+ //XDropTargetDragContext::acceptDrag and specifies an action then pdwEffect
+ // will be DROPEFFECT_NONE throughout
+ m_nLastDropAction= ACTION_NONE;
m_currentDragContext= static_cast<XDropTargetDragContext*>( new TargetDragContext(
static_cast<DropTarget*>(this) ) );
@@ -395,13 +413,8 @@ HRESULT DropTarget::DragOver( DWORD grfKeyState,
POINTL pt,
DWORD *pdwEffect)
{
-#if DBG_CONSOLE_OUT
- printf("\nDropTarget::DragOver");
-#endif
if( m_bActive)
{
-
- // A listener can change this value during fire_dragOver
m_nCurrentDropAction= getFilteredActions( grfKeyState, *pdwEffect);
if( m_nCurrentDropAction)
@@ -421,7 +434,6 @@ HRESULT DropTarget::DragOver( DWORD grfKeyState,
// XDropTargetDragContext::acceptDrag function. But this is not important
// because in the afterwards fired dragOver event the action reflects
// grgKeyState again.
- sal_Int8 tmpAction= m_nLastDropAction;
if( m_nLastDropAction != m_nCurrentDropAction)
fire_dropActionChanged( e);
@@ -436,8 +448,6 @@ HRESULT DropTarget::DragOver( DWORD grfKeyState,
// On drop the target should present the user a dialog from which the user may change the action.
sal_Int8 allowedActions= dndOleDropEffectsToActions( *pdwEffect);
// set the last action to the current if listener has not changed the value yet
- if( tmpAction == m_nLastDropAction)
- m_nLastDropAction= m_nCurrentDropAction;
*pdwEffect= dndActionsToSingleDropEffect( m_nLastDropAction & allowedActions);
}
else
@@ -445,6 +455,9 @@ HRESULT DropTarget::DragOver( DWORD grfKeyState,
*pdwEffect= DROPEFFECT_NONE;
}
}
+#if DBG_CONSOLE_OUT
+ printf("\nDropTarget::DragOver %d", *pdwEffect );
+#endif
return S_OK;
}
@@ -459,7 +472,7 @@ HRESULT DropTarget::DragLeave( void)
m_currentData=0;
m_currentDragContext= 0;
m_currentDropContext= 0;
- m_nLastDropAction= -1;
+ m_nLastDropAction= 0;
if( m_nDefaultActions != ACTION_NONE)
{
@@ -514,6 +527,9 @@ HRESULT DropTarget::Drop( IDataObject *pDataObj,
*pdwEffect= DROPEFFECT_NONE;
m_currentData= 0;
+ m_currentDragContext= 0;
+ m_currentDropContext= 0;
+ m_nLastDropAction= 0;
}
return S_OK;
}
@@ -636,7 +652,6 @@ void DropTarget::_acceptDrag( sal_Int8 dragOperation, const Reference<XDropTarge
{
if( context == m_currentDragContext)
{
-// m_nCurrentDropAction= dragOperation;
m_nLastDropAction= dragOperation;
}
}
@@ -645,7 +660,6 @@ void DropTarget::_rejectDrag( const Reference<XDropTargetDragContext>& context)
{
if(context == m_currentDragContext)
{
-// m_nCurrentDropAction= ACTION_NONE;
m_nLastDropAction= ACTION_NONE;
}
}
diff --git a/dtrans/source/win32/dnd/targetdragcontext.cxx b/dtrans/source/win32/dnd/targetdragcontext.cxx
index 3a480758d768..a6f3c4777795 100644
--- a/dtrans/source/win32/dnd/targetdragcontext.cxx
+++ b/dtrans/source/win32/dnd/targetdragcontext.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: targetdragcontext.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jl $ $Date: 2001-02-12 12:35:19 $
+ * last change: $Author: jl $ $Date: 2001-07-20 12:41:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,12 +59,16 @@
*
************************************************************************/
+#ifndef _RTL_UNLOAD_H_
+#include <rtl/unload.h>
+#endif
#include "targetdragcontext.hxx"
-
+extern rtl_StandardModuleCount g_moduleCount;
TargetDragContext::TargetDragContext( DropTarget* p)
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
m_pDropTarget= p;
p->acquire();
}
@@ -72,6 +76,7 @@ TargetDragContext::TargetDragContext( DropTarget* p)
TargetDragContext::~TargetDragContext()
{
m_pDropTarget->release();
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
void SAL_CALL TargetDragContext::acceptDrag( sal_Int8 dragOperation )
diff --git a/dtrans/source/win32/dnd/targetdropcontext.cxx b/dtrans/source/win32/dnd/targetdropcontext.cxx
index 7a625bfb835f..9e072f08c0d1 100644
--- a/dtrans/source/win32/dnd/targetdropcontext.cxx
+++ b/dtrans/source/win32/dnd/targetdropcontext.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: targetdropcontext.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jl $ $Date: 2001-02-12 12:35:19 $
+ * last change: $Author: jl $ $Date: 2001-07-20 12:41:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -58,6 +58,9 @@
*
*
************************************************************************/
+#ifndef _RTL_UNLOAD_H_
+#include <rtl/unload.h>
+#endif
#include "targetdropcontext.hxx"
@@ -66,8 +69,10 @@ using namespace ::cppu;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
+extern rtl_StandardModuleCount g_moduleCount;
TargetDropContext::TargetDropContext( DropTarget* p)
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
m_pDropTarget= p;
p->acquire();
}
@@ -75,6 +80,7 @@ TargetDropContext::TargetDropContext( DropTarget* p)
TargetDropContext::~TargetDropContext()
{
m_pDropTarget->release();
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
void SAL_CALL TargetDropContext::acceptDrop( sal_Int8 dropOperation )