xref: /aoo41x/main/ucb/source/ucp/ftp/ftpintreq.cxx (revision cdf0e10c)
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 
29 // MARKER(update_precomp.py): autogen include statement, do not remove
30 #include "precompiled_ucb.hxx"
31 #include <com/sun/star/ucb/UnsupportedNameClashException.hpp>
32 #include <com/sun/star/ucb/NameClash.hpp>
33 #include "ftpintreq.hxx"
34 
35 using namespace cppu;
36 using namespace com::sun::star;
37 using namespace com::sun::star::uno;
38 using namespace com::sun::star::lang;
39 using namespace com::sun::star::ucb;
40 using namespace com::sun::star::task;
41 using namespace ftp;
42 
43 
44 XInteractionApproveImpl::XInteractionApproveImpl()
45     : m_bSelected(false)
46 {
47 }
48 
49 
50 void SAL_CALL
51 XInteractionApproveImpl::acquire( void )
52     throw()
53 {
54     OWeakObject::acquire();
55 }
56 
57 
58 void SAL_CALL
59 XInteractionApproveImpl::release( void )
60     throw()
61 {
62     OWeakObject::release();
63 }
64 
65 
66 
67 Any SAL_CALL
68 XInteractionApproveImpl::queryInterface( const Type& rType )
69     throw( RuntimeException )
70 {
71     Any aRet = cppu::queryInterface(
72         rType,
73         SAL_STATIC_CAST( lang::XTypeProvider*, this ),
74         SAL_STATIC_CAST( XInteractionApprove*,this) );
75     return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
76 }
77 
78 
79 //////////////////////////////////////////////////////////////////////////////
80 //  XTypeProvider
81 //////////////////////////////////////////////////////////////////////////////
82 
83 XTYPEPROVIDER_IMPL_2( XInteractionApproveImpl,
84                       XTypeProvider,
85                       XInteractionApprove )
86 
87 
88 void SAL_CALL XInteractionApproveImpl::select()
89     throw (RuntimeException)
90 {
91     m_bSelected = true;
92 }
93 
94 
95 bool XInteractionApproveImpl::isSelected() const
96 {
97     return m_bSelected;
98 }
99 
100 
101 // XInteractionDisapproveImpl
102 
103 XInteractionDisapproveImpl::XInteractionDisapproveImpl()
104     : m_bSelected(false)
105 {
106 }
107 
108 
109 void SAL_CALL
110 XInteractionDisapproveImpl::acquire( void )
111     throw()
112 {
113     OWeakObject::acquire();
114 }
115 
116 
117 void SAL_CALL
118 XInteractionDisapproveImpl::release( void )
119     throw()
120 {
121     OWeakObject::release();
122 }
123 
124 
125 
126 Any SAL_CALL
127 XInteractionDisapproveImpl::queryInterface( const Type& rType )
128     throw( RuntimeException )
129 {
130     Any aRet = cppu::queryInterface(
131         rType,
132         SAL_STATIC_CAST( lang::XTypeProvider*, this ),
133         SAL_STATIC_CAST( XInteractionDisapprove*,this) );
134     return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
135 }
136 
137 
138 //////////////////////////////////////////////////////////////////////////////
139 //  XTypeProvider
140 //////////////////////////////////////////////////////////////////////////////
141 
142 XTYPEPROVIDER_IMPL_2( XInteractionDisapproveImpl,
143                       XTypeProvider,
144                       XInteractionDisapprove )
145 
146 
147 void SAL_CALL XInteractionDisapproveImpl::select()
148     throw (RuntimeException)
149 
150 {
151     m_bSelected = true;
152 }
153 
154 
155 // XInteractionRequestImpl
156 
157 XInteractionRequestImpl::XInteractionRequestImpl(const rtl::OUString& aName)
158     : p1( new XInteractionApproveImpl ),
159       p2( new XInteractionDisapproveImpl ),
160       m_aName(aName),
161       m_aSeq( 2 )
162 {
163     m_aSeq[0] = Reference<XInteractionContinuation>(p1);
164     m_aSeq[1] = Reference<XInteractionContinuation>(p2);
165 }
166 
167 
168 void SAL_CALL
169 XInteractionRequestImpl::acquire( void )
170     throw()
171 {
172     OWeakObject::acquire();
173 }
174 
175 
176 
177 void SAL_CALL
178 XInteractionRequestImpl::release( void )
179     throw()
180 {
181     OWeakObject::release();
182 }
183 
184 
185 
186 Any SAL_CALL
187 XInteractionRequestImpl::queryInterface( const Type& rType )
188     throw( RuntimeException )
189 {
190     Any aRet = cppu::queryInterface(
191         rType,
192         SAL_STATIC_CAST( lang::XTypeProvider*, this ),
193         SAL_STATIC_CAST( XInteractionRequest*,this) );
194     return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
195 }
196 
197 
198 //////////////////////////////////////////////////////////////////////////////
199 //  XTypeProvider
200 /////////////////////////////////////////////////////////////////////////////
201 
202 XTYPEPROVIDER_IMPL_2( XInteractionRequestImpl,
203                       XTypeProvider,
204                       XInteractionRequest )
205 
206 
207 Any SAL_CALL XInteractionRequestImpl::getRequest(  )
208     throw (RuntimeException)
209 {
210     Any aAny;
211     UnsupportedNameClashException excep;
212     excep.NameClash = NameClash::ERROR;
213     aAny <<= excep;
214     return aAny;
215 }
216 
217 
218 Sequence<Reference<XInteractionContinuation > > SAL_CALL
219 XInteractionRequestImpl::getContinuations(  )
220     throw (RuntimeException)
221 {
222     return m_aSeq;
223 }
224 
225 
226 bool XInteractionRequestImpl::approved() const
227 {
228     return p1->isSelected();
229 }
230 
231