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