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 throw(Exception, RuntimeException); 78 virtual void SAL_CALL disposing(); 79 80 // XDragSource 81 virtual sal_Bool SAL_CALL isDragImageSupported( ) throw(RuntimeException); 82 virtual sal_Int32 SAL_CALL getDefaultCursor(sal_Int8 dragAction) 83 throw(IllegalArgumentException, RuntimeException); 84 virtual void SAL_CALL startDrag( const DragGestureEvent& trigger, 85 sal_Int8 sourceActions, 86 sal_Int32 cursor, 87 sal_Int32 image, 88 const Reference< XTransferable>& transferable, 89 const Reference< XDragSourceListener>& listener) 90 throw(RuntimeException); 91 92 // XDragSourceContext 93 virtual sal_Int32 SAL_CALL getCurrentCursor() throw( RuntimeException); 94 virtual void SAL_CALL setCursor( sal_Int32) throw( RuntimeException); 95 virtual void SAL_CALL setImage( sal_Int32) throw( RuntimeException); 96 virtual void SAL_CALL transferablesFlavorsChanged() throw( RuntimeException); 97 98 // XServiceInfo 99 virtual rtl::OUString SAL_CALL getImplementationName() throw (RuntimeException); 100 virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw (RuntimeException); 101 virtual Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException); 102 103 // OS/2 window messaging handlers 104 MRESULT render( PDRAGTRANSFER); 105 MRESULT endConversation( ULONG, ULONG); 106 107 }; 108 #endif // _DRAGSOURCE_HXX_ 109