1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _DRAGSOURCE_HXX_ 24 #define _DRAGSOURCE_HXX_ 25 26 #include <svpm.h> 27 28 #include <com/sun/star/datatransfer/dnd/XDragSource.hpp> 29 #include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp> 30 #include <com/sun/star/lang/XInitialization.hpp> 31 #include <com/sun/star/lang/XServiceInfo.hpp> 32 33 #include <cppuhelper/basemutex.hxx> 34 #include <cppuhelper/compbase4.hxx> 35 #include <osl/mutex.hxx> 36 37 #include "globals.hxx" 38 39 using namespace cppu; 40 using namespace osl; 41 using namespace rtl; 42 using namespace com::sun::star::datatransfer; 43 using namespace com::sun::star::datatransfer::dnd; 44 using namespace com::sun::star::lang; 45 using namespace com::sun::star::uno; 46 47 48 class DragSource: 49 public cppu::BaseMutex, 50 public WeakComponentImplHelper4<XDragSource, 51 XInitialization, 52 XDragSourceContext, 53 XServiceInfo> 54 { 55 public: 56 // used also in DropTarget in AOO internal d&d 57 static Reference<XTransferable> g_XTransferable; 58 // the handle of the window starting the drag 59 static HWND g_DragSourceHwnd; 60 61 private: 62 Reference<XMultiServiceFactory> m_serviceFactory; 63 // The native window which acts as source. 64 HWND m_hWnd; 65 PDRAGINFO pSourceDraginfo; 66 char *pSharedMem; 67 char *pDTShareMem; 68 69 Reference<XDragSourceListener> dragSourceListener; 70 71 public: 72 DragSource( const Reference<XMultiServiceFactory>& sf); 73 virtual ~DragSource(); 74 75 // XInitialization 76 virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ); 77 virtual void SAL_CALL disposing(); 78 79 // XDragSource 80 virtual sal_Bool SAL_CALL isDragImageSupported( ); 81 virtual sal_Int32 SAL_CALL getDefaultCursor(sal_Int8 dragAction); 82 virtual void SAL_CALL startDrag( const DragGestureEvent& trigger, 83 sal_Int8 sourceActions, 84 sal_Int32 cursor, 85 sal_Int32 image, 86 const Reference< XTransferable>& transferable, 87 const Reference< XDragSourceListener>& listener); 88 89 // XDragSourceContext 90 virtual sal_Int32 SAL_CALL getCurrentCursor(); 91 virtual void SAL_CALL setCursor( sal_Int32); 92 virtual void SAL_CALL setImage( sal_Int32); 93 virtual void SAL_CALL transferablesFlavorsChanged(); 94 95 // XServiceInfo 96 virtual rtl::OUString SAL_CALL getImplementationName(); 97 virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName); 98 virtual Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(); 99 100 // OS/2 window messaging handlers 101 MRESULT render( PDRAGTRANSFER); 102 MRESULT endConversation( ULONG, ULONG); 103 104 }; 105 #endif // _DRAGSOURCE_HXX_ 106