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_FILEDIALOG_HXX 23 #define SC_VBA_FILEDIALOG_HXX 24 25 #include <cppuhelper/implbase1.hxx> 26 #include <ooo/vba/XFileDialog.hpp> 27 #include <vbahelper/vbahelperinterface.hxx> 28 #include <com/sun/star/frame/XModel.hpp> 29 #include <com/sun/star/uno/Sequence.hxx> 30 #include "vbafiledialogselecteditems.hxx" 31 32 typedef InheritedHelperInterfaceImpl1< ooo::vba::XFileDialog > ScVbaFileDialog_BASE; 33 34 class ScVbaFileDialog : public ScVbaFileDialog_BASE 35 { 36 public: 37 // MS Excel VBA: Constructs FileDialog with parent, context, and model. 38 // Status: implemented 39 ScVbaFileDialog( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent, 40 const css::uno::Reference< css::uno::XComponentContext >& xContext, 41 const css::uno::Reference< css::frame::XModel >& xModel ); 42 // MS Excel VBA: Factory constructor for service instantiation. 43 // Status: implemented 44 ScVbaFileDialog( const css::uno::Sequence< css::uno::Any >& args, 45 const css::uno::Reference< css::uno::XComponentContext >& xContext ); 46 // MS Excel VBA: Destructor. 47 // Status: implemented 48 virtual ~ScVbaFileDialog(); 49 50 // XHelperInterface 51 // MS Excel VBA: Returns the implementation name for UNO service identification. 52 // Status: implemented - returns "ScVbaFileDialog" 53 virtual rtl::OUString& getServiceImplName(); 54 // MS Excel VBA: Returns the service names this implementation supports. 55 // Status: implemented - returns "ooo.vba.excel.FileDialog" 56 virtual css::uno::Sequence<rtl::OUString> getServiceNames(); 57 58 // XFileDialog 59 // MS Excel VBA: Returns the dialog type (msoFileDialogFilePicker, etc.). 60 // Status: implemented - returns internal dialog type (default 3 = file picker) 61 virtual sal_Int32 SAL_CALL getMsoFileDialogType() throw ( css::uno::RuntimeException ); 62 // MS Excel VBA: Sets the dialog type. 63 // Status: implemented 64 virtual void SAL_CALL setMsoFileDialogType( sal_Int32 nType ) throw ( css::uno::RuntimeException ); 65 // MS Excel VBA: Returns the dialog title. 66 // Status: implemented 67 virtual rtl::OUString SAL_CALL getTitle() throw ( css::uno::RuntimeException ); 68 // MS Excel VBA: Sets the dialog title. 69 // Status: implemented 70 virtual void SAL_CALL setTitle( const rtl::OUString& rTitle ) throw ( css::uno::RuntimeException ); 71 // MS Excel VBA: Gets/sets whether multiple file selection is enabled. 72 // Status: implemented 73 virtual sal_Bool SAL_CALL getAllowMultiSelect() throw ( css::uno::RuntimeException ); 74 virtual void SAL_CALL setAllowMultiSelect( sal_Bool bAllow ) throw ( css::uno::RuntimeException ); 75 // MS Excel VBA: Returns the selected items in the dialog. 76 // Status: implemented - returns SelectedItems collection 77 virtual css::uno::Reference< ooo::vba::XFileDialogSelectedItems > SAL_CALL getSelectedItems() throw ( css::uno::RuntimeException ); 78 // MS Excel VBA: Displays the file dialog and returns user's selection status. 79 // Status: implemented - wraps UNO FilePicker service 80 virtual sal_Int32 SAL_CALL Show() throw ( css::uno::RuntimeException ); 81 82 private: 83 css::uno::Reference< css::frame::XModel > m_xModel; 84 sal_Int32 m_nDialogType; 85 rtl::OUString m_sTitle; 86 sal_Bool m_bAllowMultiSelect; 87 css::uno::Sequence< rtl::OUString > m_sSelectedItems; 88 VbaFileDialogSelectedItems *m_pSelectedItems; 89 VbaFileDialogSelectedObj m_FileDialogSelectedObj; 90 }; 91 92 #endif 93