1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef INCLUDED_SVT_FOLDERPICKER_HXX 28 #define INCLUDED_SVT_FOLDERPICKER_HXX 29 30 #include <cppuhelper/implbase3.hxx> 31 #include <com/sun/star/ui/dialogs/XFolderPicker.hpp> 32 #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> 33 #include <com/sun/star/lang/XServiceInfo.hpp> 34 #include <com/sun/star/lang/XSingleServiceFactory.hpp> 35 #include <com/sun/star/lang/DisposedException.hpp> 36 #include <com/sun/star/uno/XComponentContext.hpp> 37 #include "commonpicker.hxx" 38 39 class Dialog; 40 41 // class SvtFolderPicker --------------------------------------------------- 42 43 typedef ::cppu::ImplHelper3 < ::com::sun::star::ui::dialogs::XFolderPicker 44 , ::com::sun::star::ui::dialogs::XAsynchronousExecutableDialog 45 , ::com::sun::star::lang::XServiceInfo 46 > SvtFolderPicker_Base; 47 48 class SvtFolderPicker :public SvtFolderPicker_Base 49 ,public ::svt::OCommonPicker 50 { 51 private: 52 ::rtl::OUString m_aDescription; 53 54 ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XDialogClosedListener > 55 m_xListener; 56 57 void prepareExecute( ); 58 DECL_LINK( DialogClosedHdl, Dialog* ); 59 60 public: 61 SvtFolderPicker( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); 62 virtual ~SvtFolderPicker(); 63 64 //------------------------------------------------------------------------------------ 65 // disambiguate XInterface 66 //------------------------------------------------------------------------------------ 67 DECLARE_XINTERFACE( ) 68 69 //------------------------------------------------------------------------------------ 70 // disambiguate XTypeProvider 71 //------------------------------------------------------------------------------------ 72 DECLARE_XTYPEPROVIDER( ) 73 74 //------------------------------------------------------------------------------------ 75 // XFolderPicker functions 76 //------------------------------------------------------------------------------------ 77 78 virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString& aDirectory ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); 79 virtual ::rtl::OUString SAL_CALL getDisplayDirectory() throw( ::com::sun::star::uno::RuntimeException ); 80 virtual ::rtl::OUString SAL_CALL getDirectory() throw( ::com::sun::star::uno::RuntimeException ); 81 virtual void SAL_CALL setDescription( const ::rtl::OUString& aDescription ) throw ( ::com::sun::star::uno::RuntimeException ); 82 83 //------------------------------------------------------------------------------------ 84 // XExecutableDialog functions 85 //------------------------------------------------------------------------------------ 86 virtual void SAL_CALL setTitle( const ::rtl::OUString& _rTitle ) throw (::com::sun::star::uno::RuntimeException); 87 virtual sal_Int16 SAL_CALL execute( ) throw (::com::sun::star::uno::RuntimeException); 88 89 //------------------------------------------------------------------------------------ 90 // XAsynchronousExecutableDialog functions 91 //------------------------------------------------------------------------------------ 92 virtual void SAL_CALL setDialogTitle( const ::rtl::OUString& _rTitle ) throw (::com::sun::star::uno::RuntimeException); 93 virtual void SAL_CALL startExecuteModal( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XDialogClosedListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 94 95 //------------------------------------------------------------------------------------ 96 // XServiceInfo functions 97 //------------------------------------------------------------------------------------ 98 99 /* XServiceInfo */ 100 virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); 101 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException ); 102 virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 103 getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); 104 105 /* Helper for XServiceInfo */ 106 static com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames(); 107 static ::rtl::OUString impl_getStaticImplementationName(); 108 109 /* Helper for registry */ 110 static ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL impl_createInstance ( 111 const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ) 112 throw( com::sun::star::uno::Exception ); 113 114 protected: 115 //------------------------------------------------------------------------------------ 116 // OCommonPicker overridables 117 //------------------------------------------------------------------------------------ 118 virtual SvtFileDialog* implCreateDialog( Window* _pParent ); 119 virtual sal_Int16 implExecutePicker( ); 120 }; 121 122 #endif // INCLUDED_SVT_FOLDERPICKER_HXX 123