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