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 28 #ifndef SVTOOLS_SOURCE_FILEPICKER_ASYNCFILEPICKER_HXX 29 #define SVTOOLS_SOURCE_FILEPICKER_ASYNCFILEPICKER_HXX 30 31 /** === begin UNO includes === **/ 32 /** === end UNO includes === **/ 33 34 #include <tools/link.hxx> 35 #include <tools/string.hxx> 36 #include <rtl/ref.hxx> 37 #include <rtl/ustring.hxx> 38 #include <com/sun/star/uno/Sequence.h> 39 40 class SvtFileView; 41 class SvtFileDialog; 42 43 typedef ::com::sun::star::uno::Sequence< ::rtl::OUString > OUStringList; 44 45 //........................................................................ 46 namespace svt 47 { 48 //........................................................................ 49 50 51 //==================================================================== 52 //= AsyncPickerAction 53 //==================================================================== 54 class AsyncPickerAction : public ::rtl::IReference 55 { 56 public: 57 enum Action 58 { 59 ePrevLevel, 60 eOpenURL, 61 eExecuteFilter 62 }; 63 64 private: 65 mutable oslInterlockedCount m_refCount; 66 Action m_eAction; 67 SvtFileView* m_pView; 68 SvtFileDialog* m_pDialog; 69 String m_sURL; 70 String m_sFileName; 71 bool m_bRunning; 72 73 public: 74 AsyncPickerAction( SvtFileDialog* _pDialog, SvtFileView* _pView, const Action _eAction ); 75 76 /** executes the action 77 78 @param _nMinTimeout 79 the minimum timeout to wait, in milliseconds. If negative, the action will we done 80 synchronously. If between 0 and 999, it will be corrected to 1000, means the 81 smallest valid value is 1000 (which equals one second). 82 @param _nMaxTimeout 83 The maximum time to wait for a result, in milliseconds. If there's no result of 84 the action within the given time frame, the action will be cancelled. 85 If smaller than or equal to <arg>_nMinTimeout</arg>, it will be corrected to 86 <arg>_nMinTimeout</arg> + 30000. 87 */ 88 void execute( 89 const String& _rURL, 90 const String& _rFilter, 91 sal_Int32 _nMinTimeout, 92 sal_Int32 _nMaxTimeout, 93 const OUStringList& rBlackList = OUStringList() ); 94 95 /// cancels the running action 96 void cancel(); 97 98 // IReference overridables 99 virtual oslInterlockedCount SAL_CALL acquire(); 100 virtual oslInterlockedCount SAL_CALL release(); 101 102 protected: 103 virtual ~AsyncPickerAction(); 104 105 private: 106 DECL_LINK( OnActionDone, void* ); 107 108 AsyncPickerAction(); // never implemented 109 AsyncPickerAction( const AsyncPickerAction& ); // never implemented 110 AsyncPickerAction& operator=( const AsyncPickerAction& ); // never implemented 111 }; 112 113 //........................................................................ 114 } // namespace svt 115 //........................................................................ 116 117 #endif // SVTOOLS_SOURCE_FILEPICKER_ASYNCFILEPICKER_HXX 118 119