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 {
66 Any aRet = cppu::queryInterface(
67 rType,
68 SAL_STATIC_CAST( lang::XTypeProvider*, this ),
69 SAL_STATIC_CAST( XInteractionApprove*,this) );
70 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
71 }
72
73
74 //////////////////////////////////////////////////////////////////////////////
75 // XTypeProvider
76 //////////////////////////////////////////////////////////////////////////////
77
XTYPEPROVIDER_IMPL_2(XInteractionApproveImpl,XTypeProvider,XInteractionApprove)78 XTYPEPROVIDER_IMPL_2( XInteractionApproveImpl,
79 XTypeProvider,
80 XInteractionApprove )
81
82
83 void SAL_CALL XInteractionApproveImpl::select()
84 {
85 m_bSelected = true;
86 }
87
88
isSelected() const89 bool XInteractionApproveImpl::isSelected() const
90 {
91 return m_bSelected;
92 }
93
94
95 // XInteractionDisapproveImpl
96
XInteractionDisapproveImpl()97 XInteractionDisapproveImpl::XInteractionDisapproveImpl()
98 : m_bSelected(false)
99 {
100 }
101
102
103 void SAL_CALL
acquire(void)104 XInteractionDisapproveImpl::acquire( void )
105 throw()
106 {
107 OWeakObject::acquire();
108 }
109
110
111 void SAL_CALL
release(void)112 XInteractionDisapproveImpl::release( void )
113 throw()
114 {
115 OWeakObject::release();
116 }
117
118
119
120 Any SAL_CALL
queryInterface(const Type & rType)121 XInteractionDisapproveImpl::queryInterface( const Type& rType )
122 {
123 Any aRet = cppu::queryInterface(
124 rType,
125 SAL_STATIC_CAST( lang::XTypeProvider*, this ),
126 SAL_STATIC_CAST( XInteractionDisapprove*,this) );
127 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
128 }
129
130
131 //////////////////////////////////////////////////////////////////////////////
132 // XTypeProvider
133 //////////////////////////////////////////////////////////////////////////////
134
XTYPEPROVIDER_IMPL_2(XInteractionDisapproveImpl,XTypeProvider,XInteractionDisapprove)135 XTYPEPROVIDER_IMPL_2( XInteractionDisapproveImpl,
136 XTypeProvider,
137 XInteractionDisapprove )
138
139
140 void SAL_CALL XInteractionDisapproveImpl::select()
141
142 {
143 m_bSelected = true;
144 }
145
146
147 // XInteractionRequestImpl
148
XInteractionRequestImpl(const rtl::OUString & aName)149 XInteractionRequestImpl::XInteractionRequestImpl(const rtl::OUString& aName)
150 : p1( new XInteractionApproveImpl ),
151 p2( new XInteractionDisapproveImpl ),
152 m_aName(aName),
153 m_aSeq( 2 )
154 {
155 m_aSeq[0] = Reference<XInteractionContinuation>(p1);
156 m_aSeq[1] = Reference<XInteractionContinuation>(p2);
157 }
158
159
160 void SAL_CALL
acquire(void)161 XInteractionRequestImpl::acquire( void )
162 throw()
163 {
164 OWeakObject::acquire();
165 }
166
167
168
169 void SAL_CALL
release(void)170 XInteractionRequestImpl::release( void )
171 throw()
172 {
173 OWeakObject::release();
174 }
175
176
177
178 Any SAL_CALL
queryInterface(const Type & rType)179 XInteractionRequestImpl::queryInterface( const Type& rType )
180 {
181 Any aRet = cppu::queryInterface(
182 rType,
183 SAL_STATIC_CAST( lang::XTypeProvider*, this ),
184 SAL_STATIC_CAST( XInteractionRequest*,this) );
185 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
186 }
187
188
189 //////////////////////////////////////////////////////////////////////////////
190 // XTypeProvider
191 /////////////////////////////////////////////////////////////////////////////
192
XTYPEPROVIDER_IMPL_2(XInteractionRequestImpl,XTypeProvider,XInteractionRequest)193 XTYPEPROVIDER_IMPL_2( XInteractionRequestImpl,
194 XTypeProvider,
195 XInteractionRequest )
196
197
198 Any SAL_CALL XInteractionRequestImpl::getRequest( )
199 {
200 Any aAny;
201 UnsupportedNameClashException excep;
202 excep.NameClash = NameClash::ERROR;
203 aAny <<= excep;
204 return aAny;
205 }
206
207
208 Sequence<Reference<XInteractionContinuation > > SAL_CALL
getContinuations()209 XInteractionRequestImpl::getContinuations( )
210 {
211 return m_aSeq;
212 }
213
214
approved() const215 bool XInteractionRequestImpl::approved() const
216 {
217 return p1->isSelected();
218 }
219