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 #ifndef SC_VBA_FILEDIALOGSELECTEDITEMS_HXX 23 #define SC_VBA_FILEDIALOGSELECTEDITEMS_HXX 24 25 #include <ooo/vba/XFileDialogSelectedItems.hpp> 26 #include <vbahelper/vbacollectionimpl.hxx> 27 #include <cppuhelper/implbase2.hxx> 28 #include <com/sun/star/container/XIndexAccess.hpp> 29 30 typedef CollTestImplHelper< ooo::vba::XFileDialogSelectedItems > FileDialogSelectedItems_BASE; 31 32 class VbaFileDialogSelectedItems : public FileDialogSelectedItems_BASE 33 { 34 public: 35 VbaFileDialogSelectedItems( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent, 36 const css::uno::Reference< css::uno::XComponentContext >& xContext, 37 const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ); 38 39 virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 40 virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); 41 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); 42 43 protected: 44 virtual rtl::OUString& getServiceImplName(); 45 virtual css::uno::Sequence< rtl::OUString > getServiceNames(); 46 }; 47 48 49 class VbaFileDialogSelectedObj : public cppu::WeakImplHelper2< css::container::XIndexAccess, css::container::XEnumeration > 50 { 51 public: 52 VbaFileDialogSelectedObj(); 53 sal_Bool SetSelectedFile( css::uno::Sequence< rtl::OUString > &sFList ); 54 // XIndexAccess 55 virtual sal_Int32 SAL_CALL getCount() throw ( css::uno::RuntimeException ); 56 57 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex ) 58 throw ( css::lang::IndexOutOfBoundsException, 59 css::lang::WrappedTargetException, 60 css::uno::RuntimeException ); 61 62 // XElementAccess 63 virtual css::uno::Type SAL_CALL getElementType() 64 throw ( css::uno::RuntimeException ); 65 66 virtual sal_Bool SAL_CALL hasElements() throw ( css::uno::RuntimeException ); 67 68 // XEnumeration 69 virtual sal_Bool SAL_CALL hasMoreElements() throw ( css::uno::RuntimeException ); 70 virtual css::uno::Any SAL_CALL nextElement() 71 throw ( css::container::NoSuchElementException, 72 css::lang::WrappedTargetException, 73 css::uno::RuntimeException ); 74 75 protected: 76 private: 77 css::uno::Sequence< rtl::OUString > m_sFileList; 78 sal_Int32 m_nIndex; 79 }; 80 81 #endif 82