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 { 31 sal_Bool bResult = sal_False; 32 33 try 34 { 35 if ( m_xInvocation.is() ) 36 { 37 sal_Int32 nLength = 0; 38 bResult = 39 ( ( m_xInvocation->getValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "length" ) ) ) >>= nLength ) 40 && nLength > m_nCurInd ); 41 } 42 } 43 catch( uno::Exception& ) 44 {} 45 46 return bResult; 47 } 48 nextElement()49uno::Any SAL_CALL ComEnumerationWrapper::nextElement() 50 { 51 try 52 { 53 if ( m_xInvocation.is() ) 54 { 55 uno::Sequence< sal_Int16 > aNamedParamIndex; 56 uno::Sequence< uno::Any > aNamedParam; 57 uno::Sequence< uno::Any > aArgs( 1 ); 58 59 aArgs[0] <<= m_nCurInd++; 60 61 return m_xInvocation->invoke( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "item" ) ), 62 aArgs, 63 aNamedParamIndex, 64 aNamedParam ); 65 } 66 } 67 catch( uno::Exception& ) 68 {} 69 70 throw container::NoSuchElementException(); 71 } 72