1*e1f63238SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*e1f63238SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*e1f63238SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*e1f63238SAndrew Rist  * distributed with this work for additional information
6*e1f63238SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*e1f63238SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*e1f63238SAndrew Rist  * "License"); you may not use this file except in compliance
9*e1f63238SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*e1f63238SAndrew Rist  *
11*e1f63238SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*e1f63238SAndrew Rist  *
13*e1f63238SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*e1f63238SAndrew Rist  * software distributed under the License is distributed on an
15*e1f63238SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*e1f63238SAndrew Rist  * KIND, either express or implied.  See the License for the
17*e1f63238SAndrew Rist  * specific language governing permissions and limitations
18*e1f63238SAndrew Rist  * under the License.
19*e1f63238SAndrew Rist  *
20*e1f63238SAndrew Rist  *************************************************************/
21*e1f63238SAndrew Rist 
22*e1f63238SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "precompiled_basic.hxx"
25cdf0e10cSrcweir #include "comenumwrapper.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir using namespace ::com::sun::star;
28cdf0e10cSrcweir 
hasMoreElements()29cdf0e10cSrcweir ::sal_Bool SAL_CALL ComEnumerationWrapper::hasMoreElements()
30cdf0e10cSrcweir     throw ( uno::RuntimeException )
31cdf0e10cSrcweir {
32cdf0e10cSrcweir     sal_Bool bResult = sal_False;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir     try
35cdf0e10cSrcweir     {
36cdf0e10cSrcweir         if ( m_xInvocation.is() )
37cdf0e10cSrcweir         {
38cdf0e10cSrcweir             sal_Int32 nLength = 0;
39cdf0e10cSrcweir             bResult =
40cdf0e10cSrcweir                 ( ( m_xInvocation->getValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "length" ) ) ) >>= nLength )
41cdf0e10cSrcweir                   && nLength > m_nCurInd );
42cdf0e10cSrcweir         }
43cdf0e10cSrcweir     }
44cdf0e10cSrcweir     catch( uno::Exception& )
45cdf0e10cSrcweir     {}
46cdf0e10cSrcweir 
47cdf0e10cSrcweir     return bResult;
48cdf0e10cSrcweir }
49cdf0e10cSrcweir 
nextElement()50cdf0e10cSrcweir uno::Any SAL_CALL ComEnumerationWrapper::nextElement()
51cdf0e10cSrcweir     throw ( container::NoSuchElementException,
52cdf0e10cSrcweir             lang::WrappedTargetException,
53cdf0e10cSrcweir             uno::RuntimeException )
54cdf0e10cSrcweir {
55cdf0e10cSrcweir     try
56cdf0e10cSrcweir     {
57cdf0e10cSrcweir         if ( m_xInvocation.is() )
58cdf0e10cSrcweir         {
59cdf0e10cSrcweir             uno::Sequence< sal_Int16 > aNamedParamIndex;
60cdf0e10cSrcweir             uno::Sequence< uno::Any > aNamedParam;
61cdf0e10cSrcweir             uno::Sequence< uno::Any > aArgs( 1 );
62cdf0e10cSrcweir 
63cdf0e10cSrcweir             aArgs[0] <<= m_nCurInd++;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir             return m_xInvocation->invoke( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "item" ) ),
66cdf0e10cSrcweir                                           aArgs,
67cdf0e10cSrcweir                                           aNamedParamIndex,
68cdf0e10cSrcweir                                           aNamedParam );
69cdf0e10cSrcweir         }
70cdf0e10cSrcweir     }
71cdf0e10cSrcweir     catch( uno::Exception& )
72cdf0e10cSrcweir     {}
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     throw container::NoSuchElementException();
75cdf0e10cSrcweir }
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 
78