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 #include "precompiled_basic.hxx"
25 #include "comenumwrapper.hxx"
26 
27 using namespace ::com::sun::star;
28 
hasMoreElements()29 ::sal_Bool SAL_CALL ComEnumerationWrapper::hasMoreElements()
30     throw ( uno::RuntimeException )
31 {
32     sal_Bool bResult = sal_False;
33 
34     try
35     {
36         if ( m_xInvocation.is() )
37         {
38             sal_Int32 nLength = 0;
39             bResult =
40                 ( ( m_xInvocation->getValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "length" ) ) ) >>= nLength )
41                   && nLength > m_nCurInd );
42         }
43     }
44     catch( uno::Exception& )
45     {}
46 
47     return bResult;
48 }
49 
nextElement()50 uno::Any SAL_CALL ComEnumerationWrapper::nextElement()
51     throw ( container::NoSuchElementException,
52             lang::WrappedTargetException,
53             uno::RuntimeException )
54 {
55     try
56     {
57         if ( m_xInvocation.is() )
58         {
59             uno::Sequence< sal_Int16 > aNamedParamIndex;
60             uno::Sequence< uno::Any > aNamedParam;
61             uno::Sequence< uno::Any > aArgs( 1 );
62 
63             aArgs[0] <<= m_nCurInd++;
64 
65             return m_xInvocation->invoke( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "item" ) ),
66                                           aArgs,
67                                           aNamedParamIndex,
68                                           aNamedParam );
69         }
70     }
71     catch( uno::Exception& )
72     {}
73 
74     throw container::NoSuchElementException();
75 }
76 
77 
78