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 "vbafiledialogselecteditems.hxx"
31 : :
32 : : using namespace ::com::sun::star;
33 : :
34 : 0 : VbaFileDialogSelectedItems::VbaFileDialogSelectedItems( const css::uno::Reference< ov::XHelperInterface >& xParent,
35 : : const css::uno::Reference< css::uno::XComponentContext >& xContext,
36 : : const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess
37 : : )
38 : 0 : : FileDialogSelectedItems_BASE( xParent, xContext, xIndexAccess )
39 : : {
40 : 0 : }
41 : :
42 : :
43 : 0 : rtl::OUString VbaFileDialogSelectedItems::getServiceImplName()
44 : : {
45 : 0 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VbaFileDialogSelectedItems"));
46 : : }
47 : :
48 : 0 : css::uno::Sequence<rtl::OUString> VbaFileDialogSelectedItems::getServiceNames()
49 : : {
50 [ # # ][ # # ]: 0 : static uno::Sequence< rtl::OUString > aServiceNames;
[ # # ][ # # ]
51 [ # # ]: 0 : if ( aServiceNames.getLength() == 0 )
52 : : {
53 : 0 : aServiceNames.realloc( 1 );
54 [ # # ]: 0 : aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.FileDialogSelectedItems" ) );
55 : : }
56 : 0 : return aServiceNames;
57 : :
58 : : }
59 : :
60 : 0 : css::uno::Any VbaFileDialogSelectedItems::createCollectionObject( const css::uno::Any& aSource )
61 : : {
62 : 0 : css::uno::Any aRet;
63 : 0 : aRet = aSource;
64 : 0 : return aRet;
65 : : }
66 : :
67 : :
68 : : css::uno::Type SAL_CALL
69 : 0 : VbaFileDialogSelectedItems::getElementType() throw (css::uno::RuntimeException)
70 : : {
71 : 0 : return ooo::vba::XFileDialogSelectedItems::static_type(0);
72 : : }
73 : :
74 : : css::uno::Reference< css::container::XEnumeration > SAL_CALL
75 : 0 : VbaFileDialogSelectedItems::createEnumeration() throw (css::uno::RuntimeException)
76 : : {
77 : 0 : css::uno::Reference< css::container::XEnumeration > xEnumRet(m_xIndexAccess, css::uno::UNO_QUERY);
78 : 0 : return xEnumRet;
79 : : }
80 : :
81 : :
82 : : //VbaFileDialogSelectedObj
83 : : //////////////////////////////////////////////////////////////////////////
84 : :
85 [ # # ]: 0 : VbaFileDialogSelectedObj::VbaFileDialogSelectedObj()
86 : : {
87 : 0 : m_nIndex = 0;
88 : 0 : }
89 : :
90 : :
91 : : sal_Bool
92 : 0 : VbaFileDialogSelectedObj::SetSelectedFile(css::uno::Sequence<rtl::OUString> &sFList)
93 : : {
94 : 0 : m_sFileList = sFList;
95 : 0 : return sal_True;
96 : : }
97 : :
98 : : sal_Int32 SAL_CALL
99 : 0 : VbaFileDialogSelectedObj::getCount() throw(::com::sun::star::uno::RuntimeException)
100 : : {
101 : 0 : sal_Int32 nListCnt = m_sFileList.getLength();
102 : 0 : return nListCnt;
103 : : }
104 : :
105 : 0 : ::com::sun::star::uno::Any SAL_CALL VbaFileDialogSelectedObj::getByIndex( sal_Int32 nIndex )
106 : : throw(::com::sun::star::lang::IndexOutOfBoundsException,
107 : : ::com::sun::star::lang::WrappedTargetException,
108 : : ::com::sun::star::uno::RuntimeException)
109 : : {
110 : 0 : css::uno::Any aRet;
111 : :
112 [ # # ][ # # ]: 0 : if ( nIndex >= getCount() )
113 : : {
114 [ # # ]: 0 : throw css::lang::IndexOutOfBoundsException();
115 : : }
116 : :
117 [ # # ][ # # ]: 0 : return uno::makeAny(m_sFileList[nIndex]);
118 : : }
119 : :
120 : : ::com::sun::star::uno::Type SAL_CALL
121 : 0 : VbaFileDialogSelectedObj::getElementType()
122 : : throw(::com::sun::star::uno::RuntimeException)
123 : : {
124 : 0 : return getCppuType((uno::Reference<com::sun::star::container::XIndexAccess>*)0);
125 : : }
126 : :
127 : 0 : sal_Bool SAL_CALL VbaFileDialogSelectedObj::hasElements()
128 : : throw(::com::sun::star::uno::RuntimeException)
129 : : {
130 : 0 : return ( getCount() != 0 );
131 : : }
132 : :
133 : : ::sal_Bool SAL_CALL
134 : 0 : VbaFileDialogSelectedObj::hasMoreElements( )
135 : : throw (uno::RuntimeException)
136 : : {
137 [ # # ]: 0 : if (getCount() > m_nIndex)
138 : : {
139 : 0 : return sal_True;
140 : : }
141 : 0 : return false;
142 : : }
143 : :
144 : : uno::Any SAL_CALL
145 : 0 : VbaFileDialogSelectedObj::nextElement( )
146 : : throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
147 : : {
148 [ # # ]: 0 : if (!hasMoreElements())
149 : : {
150 [ # # ]: 0 : throw container::NoSuchElementException();
151 : : }
152 : :
153 : 0 : return uno::makeAny(m_sFileList[m_nIndex++]);
154 : : }
155 : :
156 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|