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 #ifndef INCLUDED_SVT_FOLDERPICKER_HXX 24 #define INCLUDED_SVT_FOLDERPICKER_HXX 25 26 #include <cppuhelper/implbase3.hxx> 27 #include <com/sun/star/ui/dialogs/XFolderPicker.hpp> 28 #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> 29 #include <com/sun/star/lang/XServiceInfo.hpp> 30 #include <com/sun/star/lang/XSingleServiceFactory.hpp> 31 #include <com/sun/star/lang/DisposedException.hpp> 32 #include <com/sun/star/uno/XComponentContext.hpp> 33 #include "commonpicker.hxx" 34 35 class Dialog; 36 37 // class SvtFolderPicker --------------------------------------------------- 38 39 typedef ::cppu::ImplHelper3 < ::com::sun::star::ui::dialogs::XFolderPicker 40 , ::com::sun::star::ui::dialogs::XAsynchronousExecutableDialog 41 , ::com::sun::star::lang::XServiceInfo 42 > SvtFolderPicker_Base; 43 44 class SvtFolderPicker :public SvtFolderPicker_Base 45 ,public ::svt::OCommonPicker 46 { 47 private: 48 ::rtl::OUString m_aDescription; 49 50 ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XDialogClosedListener > 51 m_xListener; 52 53 void prepareExecute( ); 54 DECL_LINK( DialogClosedHdl, Dialog* ); 55 56 public: 57 SvtFolderPicker( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); 58 virtual ~SvtFolderPicker(); 59 60 //------------------------------------------------------------------------------------ 61 // disambiguate XInterface 62 //------------------------------------------------------------------------------------ 63 DECLARE_XINTERFACE( ) 64 65 //------------------------------------------------------------------------------------ 66 // disambiguate XTypeProvider 67 //------------------------------------------------------------------------------------ 68 DECLARE_XTYPEPROVIDER( ) 69 70 //------------------------------------------------------------------------------------ 71 // XFolderPicker functions 72 //------------------------------------------------------------------------------------ 73 74 virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString& aDirectory ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); 75 virtual ::rtl::OUString SAL_CALL getDisplayDirectory() throw( ::com::sun::star::uno::RuntimeException ); 76 virtual ::rtl::OUString SAL_CALL getDirectory() throw( ::com::sun::star::uno::RuntimeException ); 77 virtual void SAL_CALL setDescription( const ::rtl::OUString& aDescription ) throw ( ::com::sun::star::uno::RuntimeException ); 78 79 //------------------------------------------------------------------------------------ 80 // XExecutableDialog functions 81 //------------------------------------------------------------------------------------ 82 virtual void SAL_CALL setTitle( const ::rtl::OUString& _rTitle ) throw (::com::sun::star::uno::RuntimeException); 83 virtual sal_Int16 SAL_CALL execute( ) throw (::com::sun::star::uno::RuntimeException); 84 85 //------------------------------------------------------------------------------------ 86 // XAsynchronousExecutableDialog functions 87 //------------------------------------------------------------------------------------ 88 virtual void SAL_CALL setDialogTitle( const ::rtl::OUString& _rTitle ) throw (::com::sun::star::uno::RuntimeException); 89 virtual void SAL_CALL startExecuteModal( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XDialogClosedListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 90 91 //------------------------------------------------------------------------------------ 92 // XServiceInfo functions 93 //------------------------------------------------------------------------------------ 94 95 /* XServiceInfo */ 96 virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); 97 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException ); 98 virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 99 getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); 100 101 /* Helper for XServiceInfo */ 102 static com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames(); 103 static ::rtl::OUString impl_getStaticImplementationName(); 104 105 /* Helper for registry */ 106 static ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL impl_createInstance ( 107 const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ) 108 throw( com::sun::star::uno::Exception ); 109 110 protected: 111 //------------------------------------------------------------------------------------ 112 // OCommonPicker overridables 113 //------------------------------------------------------------------------------------ 114 virtual SvtFileDialog* implCreateDialog( Window* _pParent ); 115 virtual sal_Int16 implExecutePicker( ); 116 }; 117 118 #endif // INCLUDED_SVT_FOLDERPICKER_HXX 119