Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright IBM Corporation 2009, 2010.
7 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
8 : : *
9 : : * OpenOffice.org - a multi-platform office productivity suite
10 : : *
11 : : * This file is part of OpenOffice.org.
12 : : *
13 : : * OpenOffice.org is free software: you can redistribute it and/or modify
14 : : * it under the terms of the GNU Lesser General Public License version 3
15 : : * only, as published by the Free Software Foundation.
16 : : *
17 : : * OpenOffice.org is distributed in the hope that it will be useful,
18 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 : : * GNU Lesser General Public License version 3 for more details
21 : : * (a copy is included in the LICENSE file that accompanied this code).
22 : : *
23 : : * You should have received a copy of the GNU Lesser General Public License
24 : : * version 3 along with OpenOffice.org. If not, see
25 : : * <http://www.openoffice.org/license.html>
26 : : * for a copy of the LGPLv3 License.
27 : : *
28 : : ************************************************************************/
29 : :
30 : : #include "vbafoundfiles.hxx"
31 : :
32 [ # # ]: 0 : VbaFoundFilesEnum::VbaFoundFilesEnum( css::uno::Sequence<rtl::OUString>& sFileList ) : m_nIndex(0), m_sFileList(sFileList)
33 : : {
34 : :
35 : 0 : }
36 : :
37 [ # # ]: 0 : VbaFoundFilesEnum::~VbaFoundFilesEnum()
38 : : {
39 : :
40 [ # # ]: 0 : }
41 : :
42 : 0 : sal_Int32 SAL_CALL VbaFoundFilesEnum::getCount() throw (css::uno::RuntimeException)
43 : : {
44 : 0 : return m_sFileList.getLength();
45 : : }
46 : :
47 : 0 : css::uno::Any SAL_CALL VbaFoundFilesEnum::getByIndex( sal_Int32 nIndex )
48 : : throw (css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException)
49 : : {
50 [ # # ]: 0 : if ( nIndex >= getCount() )
51 : : {
52 [ # # ]: 0 : throw css::lang::IndexOutOfBoundsException();
53 : : }
54 : :
55 : 0 : return css::uno::makeAny( m_sFileList[nIndex] );
56 : : }
57 : :
58 : 0 : css::uno::Type SAL_CALL VbaFoundFilesEnum::getElementType() throw (css::uno::RuntimeException)
59 : : {
60 : 0 : return getCppuType((css::uno::Reference< css::container::XIndexAccess >*)0);
61 : : }
62 : :
63 : 0 : sal_Bool SAL_CALL VbaFoundFilesEnum::hasElements() throw (css::uno::RuntimeException)
64 : : {
65 : 0 : return ( getCount() != 0 );
66 : : }
67 : :
68 : 0 : sal_Bool SAL_CALL VbaFoundFilesEnum::hasMoreElements() throw (css::uno::RuntimeException)
69 : : {
70 [ # # ]: 0 : if ( getCount() > m_nIndex )
71 : : {
72 : 0 : return sal_True;
73 : : }
74 : 0 : return false;
75 : : }
76 : :
77 : 0 : css::uno::Any SAL_CALL VbaFoundFilesEnum::nextElement() throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
78 : : {
79 [ # # ]: 0 : if ( !hasMoreElements() )
80 : : {
81 [ # # ]: 0 : throw css::container::NoSuchElementException();
82 : : }
83 : :
84 : 0 : return css::uno::makeAny( m_sFileList[m_nIndex++] );
85 : : }
86 : :
87 : : ////////////////////////////////VbaFoundFiles//////////////////////////////////////////
88 : 0 : VbaFoundFiles::VbaFoundFiles( const css::uno::Reference< ov::XHelperInterface >& xParent,
89 : : const css::uno::Reference< css::uno::XComponentContext >& xContext,
90 : : const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess
91 : 0 : ) : VbaFoundFilesImpl_BASE( xParent, xContext, xIndexAccess )
92 : : {
93 : :
94 : 0 : }
95 : :
96 : 0 : VbaFoundFiles::~VbaFoundFiles()
97 : : {
98 : :
99 [ # # ]: 0 : }
100 : :
101 : 0 : css::uno::Reference< css::container::XEnumeration > VbaFoundFiles::createEnumeration() throw (css::uno::RuntimeException)
102 : : {
103 : 0 : css::uno::Reference< css::container::XEnumeration > xEnumRet( m_xIndexAccess, css::uno::UNO_QUERY );
104 : 0 : return xEnumRet;
105 : : }
106 : :
107 : 0 : css::uno::Any VbaFoundFiles::createCollectionObject( const css::uno::Any& aSource )
108 : : {
109 : 0 : return aSource;
110 : : }
111 : :
112 : 0 : css::uno::Type VbaFoundFiles::getElementType() throw (css::uno::RuntimeException)
113 : : {
114 : 0 : return ov::XFoundFiles::static_type(0);
115 : : }
116 : :
117 : 0 : rtl::OUString VbaFoundFiles::getServiceImplName()
118 : : {
119 : 0 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VbaFoundFiles"));
120 : : }
121 : :
122 : 0 : css::uno::Sequence< rtl::OUString > VbaFoundFiles::getServiceNames()
123 : : {
124 [ # # ][ # # ]: 0 : static css::uno::Sequence< rtl::OUString > aServiceNames;
[ # # ][ # # ]
125 [ # # ]: 0 : if ( aServiceNames.getLength() == 0 )
126 : : {
127 : 0 : aServiceNames.realloc( 1 );
128 [ # # ]: 0 : aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.FoundFiles") );
129 : : }
130 : 0 : return aServiceNames;
131 : : }
132 : :
133 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|