diff options
author | Joachim Lingner <jl@openoffice.org> | 2001-03-02 12:15:15 +0000 |
---|---|---|
committer | Joachim Lingner <jl@openoffice.org> | 2001-03-02 12:15:15 +0000 |
commit | 2aeaad0e5e0e275d53d60e2dbfaa9cfa7732c645 (patch) | |
tree | ccf674c502074a7af40f58d7e02c6831269cc450 | |
parent | d6ad279e6047009b3d15cf3fb1eb2ec214e66465 (diff) |
Converter for IDataObject and XTransferable added
-rw-r--r-- | dtrans/source/win32/dnd/makefile.mk | 27 | ||||
-rw-r--r-- | dtrans/source/win32/dnd/source.cxx | 19 | ||||
-rw-r--r-- | dtrans/source/win32/dnd/source.hxx | 20 | ||||
-rw-r--r-- | dtrans/source/win32/dnd/target.cxx | 10 | ||||
-rw-r--r-- | dtrans/source/win32/dnd/target.hxx | 11 |
5 files changed, 37 insertions, 50 deletions
diff --git a/dtrans/source/win32/dnd/makefile.mk b/dtrans/source/win32/dnd/makefile.mk index 4d0e5bb652df..a2c92ecba88a 100644 --- a/dtrans/source/win32/dnd/makefile.mk +++ b/dtrans/source/win32/dnd/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.5 $ +# $Revision: 1.6 $ # -# last change: $Author: jl $ $Date: 2001-02-26 16:01:58 $ +# last change: $Author: jl $ $Date: 2001-03-02 13:15:15 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -88,7 +88,8 @@ stoponerror=tr #DBG_CONSOLE_OUT: when IDropTarget or IDropSource are called we write to a console #DBG_CLIPBOARD_DATA: To provide DoDragDrop with an data object we call OleGetClipboard -#CFLAGS+= -DDBG_CONSOLE_OUT +#CFLAGS+= -DDBG_CONSOLE_OUT -DDBG_CLIPBOARD_DATA + SLOFILES= $(SLO)$/dndentry.obj \ $(SLO)$/target.obj \ @@ -97,16 +98,10 @@ SLOFILES= $(SLO)$/dndentry.obj \ $(SLO)$/globals.obj \ $(SLO)$/targetdropcontext.obj \ $(SLO)$/targetdragcontext.obj \ - $(SLO)$/sourcecontext.obj \ - $(SLO)$/TransferableWrapper.obj \ - $(SLO)$/TxtConvertHelper.obj \ - $(SLO)$/DataObjectWrapper.obj \ - $(SLO)$/ImplHelper.obj \ - $(SLO)$/DTransHelper.obj \ + $(SLO)$/sourcecontext.obj + -# DataObjectWrapper.obj, ImplHelper.obj, DTransHelper.obj, TransferableWrapper.obj have to be removed when Transferables are available as service - #$(SLO)$/mimehlp.obj @@ -118,7 +113,8 @@ SHL1STDLIBS= \ $(CPPUHELPERLIB) \ ole32.lib\ comsupp.lib\ - oleaut32.lib + oleaut32.lib\ + gdi32.lib SHL1DEPN= SHL1IMPLIB=i$(SHL1TARGET) @@ -127,12 +123,9 @@ SHL1IMPLIB=i$(SHL1TARGET) # for src614 SHL1LIBS= \ - $(SOLARLIBDIR)$/imtaolecb.lib\ - $(SOLARLIBDIR)$/user9x.lib\ - $(SOLARLIBDIR)$/tools32.lib \ - $(LB)$/dtutils.lib + $(SLB)$/dtobjfact.lib\ + $(SLB)$/dtutils.lib -#dtutils.lib is build in source/misc SHL1OBJS= $(SLOFILES) SHL1DEF= $(MISC)$/$(SHL1TARGET).def diff --git a/dtrans/source/win32/dnd/source.cxx b/dtrans/source/win32/dnd/source.cxx index d6248d5b0d6e..b4f947de79aa 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.5 $ + * $Revision: 1.6 $ * - * last change: $Author: jl $ $Date: 2001-02-13 10:41:48 $ + * last change: $Author: jl $ $Date: 2001-03-02 13:15:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,7 +76,7 @@ #include "source.hxx" #include "globals.hxx" #include "sourcecontext.hxx" -#include "TransferableWrapper.hxx" +#include "../../inc/DtObjFactory.hxx" #include <rtl/ustring.h> #include <comdef.h> #include <process.h> @@ -164,9 +164,8 @@ void SAL_CALL DragSource::startDrag( const DragGestureEvent& trigger, static_cast<DragSource*>(this), listener ) ); // Convert the XTransferable data object into an IDataObject object; - - m_pDataObject= static_cast<IDataObject*>( new CXTDataObject( trans)); - m_pDataObject->AddRef(); + m_spDataObject= m_aDataConverter.createDataObjFromTransferable( + m_serviceFactory, trans); // Obtain the id of the thread that created the window DWORD processId; @@ -299,12 +298,12 @@ DWORD WINAPI DndOleSTAFunc(LPVOID pParams) AttachThreadInput( threadId , pSource->m_threadIdWindow, TRUE ); #ifdef DBG_CLIPBOARD_DATA - m_pDataObject->release(); - OleGetClipboard( &pSource->m_pDataObject); + m_spDataObject->release(); + OleGetClipboard( &pSource->m_spDataObject); #endif DWORD dwEffect= 0; hr= DoDragDrop( - pSource->m_pDataObject, + pSource->m_spDataObject, static_cast<IDropSource*>(pSource), dndActionsToDropEffects( pSource->m_sourceActions), &dwEffect); @@ -319,7 +318,7 @@ DWORD WINAPI DndOleSTAFunc(LPVOID pParams) // Destroy SourceContextslkfgj pSource->m_currentContext= 0; // Destroy the XTransferable wrapper - pSource->m_pDataObject->Release(); + pSource->m_spDataObject=0; // Detach this thread from the window thread AttachThreadInput( threadId, pSource->m_threadIdWindow, FALSE); diff --git a/dtrans/source/win32/dnd/source.hxx b/dtrans/source/win32/dnd/source.hxx index fc351410bd20..0a83d7c2ee47 100644 --- a/dtrans/source/win32/dnd/source.hxx +++ b/dtrans/source/win32/dnd/source.hxx @@ -2,9 +2,9 @@ * * $RCSfile: source.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: jl $ $Date: 2001-02-13 12:52:33 $ + * last change: $Author: jl $ $Date: 2001-03-02 13:15:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,8 +78,10 @@ #include <cppuhelper/compbase2.hxx> #endif +#include "../../inc/DtObjFactory.hxx" #include "globals.hxx" #include <oleidl.h> +#include <comdef.h> using namespace ::com::sun::star::lang; @@ -89,14 +91,7 @@ using namespace osl; using namespace ::com::sun::star::datatransfer; using namespace ::com::sun::star::datatransfer::dnd; -/* -struct DndParams -{ - IDataObject* data; - DWORD dwOkEffects; - DWORD threadIdCreator; -}; -*/ + class SourceContext; // RIGHT MOUSE BUTTON drag and drop not supportet currently. @@ -112,7 +107,8 @@ class DragSource: // The mouse button that set off the drag and drop operation short m_MouseButton; - + // Converts XTransferable objects to IDataObject objects. + CDTransObjFactory m_aDataConverter; DragSource(); DragSource(const DragSource&); @@ -126,7 +122,7 @@ public: Reference<XDragSourceContext> m_currentContext; // the wrapper for the Transferable ( startDrag) - IDataObject* m_pDataObject; + IDataObjectPtr m_spDataObject; sal_Int8 m_sourceActions; diff --git a/dtrans/source/win32/dnd/target.cxx b/dtrans/source/win32/dnd/target.cxx index d71d0f632a29..df0c0f3f6657 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.9 $ + * $Revision: 1.10 $ * - * last change: $Author: jl $ $Date: 2001-02-26 15:58:39 $ + * last change: $Author: jl $ $Date: 2001-03-02 13:15:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,7 +72,6 @@ #include "globals.hxx" #include "targetdropcontext.hxx" #include "targetdragcontext.hxx" -#include "DataObjectWrapper.hxx" #include <rtl/ustring.h> using namespace rtl; using namespace cppu; @@ -240,8 +239,9 @@ HRESULT DropTarget::DragEnter( IDataObject *pDataObj, m_currentDragContext= static_cast<XDropTargetDragContext*>( new TargetDragContext( static_cast<DropTarget*>(this) ) ); - m_currentData= static_cast<XTransferable*>( new DNDTransferable( pDataObj) ); - + // Convert the IDataObject to a XTransferable + m_currentData= m_aDataConverter.createTransferableFromDataObj( + m_serviceFactory, pDataObj); if( m_nListenerDropAction != ACTION_NONE) { DropTargetDragEnterEvent e; diff --git a/dtrans/source/win32/dnd/target.hxx b/dtrans/source/win32/dnd/target.hxx index 3da7342fb3ad..a9c7d8472e2c 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.8 $ + * $Revision: 1.9 $ * - * last change: $Author: jl $ $Date: 2001-02-26 15:33:29 $ + * last change: $Author: jl $ $Date: 2001-03-02 13:15:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,6 +83,7 @@ #include <oleidl.h> #include "globals.hxx" +#include "../../inc/DtObjFactory.hxx" using namespace ::com::sun::star::lang; @@ -134,10 +135,8 @@ private: sal_Int8 m_userAction; // Set by listeners when they call XDropTargetDropContext::dropComplete sal_Bool m_bDropComplete; - - // Used to find out wheter the listeners callbacks through the Context interfaces - // contained in the event objects are valid. - + // converts IDataObject objects to XTransferable objects. + CDTransObjFactory m_aDataConverter; Reference<XDropTargetDragContext> m_currentDragContext; Reference<XDropTargetDropContext> m_currentDropContext; |