1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_vcl.hxx"
30 
31 #include <X11_dndcontext.hxx>
32 #include <X11_selection.hxx>
33 
34 using namespace cppu;
35 using namespace x11;
36 
37 /*
38  *	DropTargetDropContext
39  */
40 
41 DropTargetDropContext::DropTargetDropContext(
42 	XLIB_Window aDropWindow,
43 	XLIB_Time aTimestamp,
44 	SelectionManager& rManager ) :
45 		m_aDropWindow( aDropWindow ),
46 		m_nTimestamp( aTimestamp ),
47 		m_rManager( rManager ),
48 		m_xManagerRef( static_cast< OWeakObject* >(&rManager) )
49 {
50 }
51 
52 DropTargetDropContext::~DropTargetDropContext()
53 {
54 }
55 
56 void DropTargetDropContext::acceptDrop( sal_Int8 dragOperation ) throw()
57 {
58 	m_rManager.accept( dragOperation, m_aDropWindow, m_nTimestamp );
59 }
60 
61 void DropTargetDropContext::rejectDrop() throw()
62 {
63 	m_rManager.reject( m_aDropWindow, m_nTimestamp );
64 }
65 
66 void DropTargetDropContext::dropComplete( sal_Bool success ) throw()
67 {
68 	m_rManager.dropComplete( success, m_aDropWindow, m_nTimestamp );
69 }
70 
71 
72 /*
73  *	DropTargetDragContext
74  */
75 
76 DropTargetDragContext::DropTargetDragContext(
77 	XLIB_Window aDropWindow,
78     XLIB_Time aTimestamp,
79 	SelectionManager& rManager ) :
80 		m_aDropWindow( aDropWindow ),
81 		m_nTimestamp( aTimestamp ),
82 		m_rManager( rManager ),
83 		m_xManagerRef( static_cast< OWeakObject* >(&rManager) )
84 {
85 }
86 
87 DropTargetDragContext::~DropTargetDragContext()
88 {
89 }
90 
91 void DropTargetDragContext::acceptDrag( sal_Int8 dragOperation ) throw()
92 {
93 	m_rManager.accept( dragOperation, m_aDropWindow, m_nTimestamp );
94 }
95 
96 void DropTargetDragContext::rejectDrag() throw()
97 {
98 	m_rManager.reject( m_aDropWindow, m_nTimestamp );
99 }
100 
101 /*
102  *	DragSourceContext
103  */
104 
105 DragSourceContext::DragSourceContext(
106 	XLIB_Window aDropWindow,
107 	XLIB_Time aTimestamp,
108 	SelectionManager& rManager ) :
109 		m_aDropWindow( aDropWindow ),
110 		m_nTimestamp( aTimestamp ),
111 		m_rManager( rManager ),
112 		m_xManagerRef( static_cast< OWeakObject* >(&rManager) )
113 {
114 }
115 
116 DragSourceContext::~DragSourceContext()
117 {
118 }
119 
120 sal_Int32 DragSourceContext::getCurrentCursor() throw()
121 {
122 	return m_rManager.getCurrentCursor();
123 }
124 
125 void DragSourceContext::setCursor( sal_Int32 cursorId ) throw()
126 {
127 	m_rManager.setCursor( cursorId, m_aDropWindow, m_nTimestamp );
128 }
129 
130 void DragSourceContext::setImage( sal_Int32 imageId ) throw()
131 {
132 	m_rManager.setImage( imageId, m_aDropWindow, m_nTimestamp );
133 }
134 
135 void DragSourceContext::transferablesFlavorsChanged() throw()
136 {
137 	m_rManager.transferablesFlavorsChanged();
138 }
139