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 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_vcl.hxx"
26 
27 #include <X11_dndcontext.hxx>
28 #include <X11_selection.hxx>
29 
30 using namespace cppu;
31 using namespace x11;
32 
33 /*
34  *	DropTargetDropContext
35  */
36 
DropTargetDropContext(XLIB_Window aDropWindow,XLIB_Time aTimestamp,SelectionManager & rManager)37 DropTargetDropContext::DropTargetDropContext(
38 	XLIB_Window aDropWindow,
39 	XLIB_Time aTimestamp,
40 	SelectionManager& rManager ) :
41 		m_aDropWindow( aDropWindow ),
42 		m_nTimestamp( aTimestamp ),
43 		m_rManager( rManager ),
44 		m_xManagerRef( static_cast< OWeakObject* >(&rManager) )
45 {
46 }
47 
~DropTargetDropContext()48 DropTargetDropContext::~DropTargetDropContext()
49 {
50 }
51 
acceptDrop(sal_Int8 dragOperation)52 void DropTargetDropContext::acceptDrop( sal_Int8 dragOperation ) throw()
53 {
54 	m_rManager.accept( dragOperation, m_aDropWindow, m_nTimestamp );
55 }
56 
rejectDrop()57 void DropTargetDropContext::rejectDrop() throw()
58 {
59 	m_rManager.reject( m_aDropWindow, m_nTimestamp );
60 }
61 
dropComplete(sal_Bool success)62 void DropTargetDropContext::dropComplete( sal_Bool success ) throw()
63 {
64 	m_rManager.dropComplete( success, m_aDropWindow, m_nTimestamp );
65 }
66 
67 
68 /*
69  *	DropTargetDragContext
70  */
71 
DropTargetDragContext(XLIB_Window aDropWindow,XLIB_Time aTimestamp,SelectionManager & rManager)72 DropTargetDragContext::DropTargetDragContext(
73 	XLIB_Window aDropWindow,
74     XLIB_Time aTimestamp,
75 	SelectionManager& rManager ) :
76 		m_aDropWindow( aDropWindow ),
77 		m_nTimestamp( aTimestamp ),
78 		m_rManager( rManager ),
79 		m_xManagerRef( static_cast< OWeakObject* >(&rManager) )
80 {
81 }
82 
~DropTargetDragContext()83 DropTargetDragContext::~DropTargetDragContext()
84 {
85 }
86 
acceptDrag(sal_Int8 dragOperation)87 void DropTargetDragContext::acceptDrag( sal_Int8 dragOperation ) throw()
88 {
89 	m_rManager.accept( dragOperation, m_aDropWindow, m_nTimestamp );
90 }
91 
rejectDrag()92 void DropTargetDragContext::rejectDrag() throw()
93 {
94 	m_rManager.reject( m_aDropWindow, m_nTimestamp );
95 }
96 
97 /*
98  *	DragSourceContext
99  */
100 
DragSourceContext(XLIB_Window aDropWindow,XLIB_Time aTimestamp,SelectionManager & rManager)101 DragSourceContext::DragSourceContext(
102 	XLIB_Window aDropWindow,
103 	XLIB_Time aTimestamp,
104 	SelectionManager& rManager ) :
105 		m_aDropWindow( aDropWindow ),
106 		m_nTimestamp( aTimestamp ),
107 		m_rManager( rManager ),
108 		m_xManagerRef( static_cast< OWeakObject* >(&rManager) )
109 {
110 }
111 
~DragSourceContext()112 DragSourceContext::~DragSourceContext()
113 {
114 }
115 
getCurrentCursor()116 sal_Int32 DragSourceContext::getCurrentCursor() throw()
117 {
118 	return m_rManager.getCurrentCursor();
119 }
120 
setCursor(sal_Int32 cursorId)121 void DragSourceContext::setCursor( sal_Int32 cursorId ) throw()
122 {
123 	m_rManager.setCursor( cursorId, m_aDropWindow, m_nTimestamp );
124 }
125 
setImage(sal_Int32 imageId)126 void DragSourceContext::setImage( sal_Int32 imageId ) throw()
127 {
128 	m_rManager.setImage( imageId, m_aDropWindow, m_nTimestamp );
129 }
130 
transferablesFlavorsChanged()131 void DragSourceContext::transferablesFlavorsChanged() throw()
132 {
133 	m_rManager.transferablesFlavorsChanged();
134 }
135