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 25 #ifndef _FILEOPEN_DIALOG_HXX_ 26 #define _FILEOPEN_DIALOG_HXX_ 27 28 #include <vector> 29 #include <com/sun/star/beans/StringPair.hpp> 30 #include <com/sun/star/container/XNameAccess.hpp> 31 #include <com/sun/star/ui/dialogs/XFilePicker.hpp> 32 #include <com/sun/star/uno/XComponentContext.hpp> 33 #include <com/sun/star/awt/XWindow.hpp> 34 35 class FileOpenDialog 36 { 37 // a list of filters that are provided within the SaveDialog 38 struct FilterEntry 39 { 40 rtl::OUString maName; 41 rtl::OUString maType; 42 rtl::OUString maUIName; 43 rtl::OUString maFilter; 44 sal_Int32 maFlags; 45 com::sun::star::uno::Sequence< rtl::OUString > maExtensions; 46 FilterEntryFileOpenDialog::FilterEntry47 FilterEntry() : 48 maFlags( 0 ) {} 49 }; 50 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext; 51 com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFilePicker > mxFilePicker; 52 53 std::vector< FilterEntry > aFilterEntryList; 54 55 public : 56 FileOpenDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, 57 const com::sun::star::uno::Reference< com::sun::star::awt::XWindow > &rxParent ); 58 ~FileOpenDialog(); 59 60 sal_Int16 execute(); 61 62 void setDefaultName( const rtl::OUString& ); 63 // void setDefaultDirectory( const rtl::OUString& ); 64 65 ::rtl::OUString getURL() const; 66 ::rtl::OUString getFilterName() const; 67 }; 68 69 #endif // _FILEOPEN_DIALOG_HXX_ 70 71