1*10ce8018SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*10ce8018SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*10ce8018SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*10ce8018SAndrew Rist * distributed with this work for additional information 6*10ce8018SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*10ce8018SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*10ce8018SAndrew Rist * "License"); you may not use this file except in compliance 9*10ce8018SAndrew Rist * with the License. You may obtain a copy of the License at 10*10ce8018SAndrew Rist * 11*10ce8018SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*10ce8018SAndrew Rist * 13*10ce8018SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*10ce8018SAndrew Rist * software distributed under the License is distributed on an 15*10ce8018SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*10ce8018SAndrew Rist * KIND, either express or implied. See the License for the 17*10ce8018SAndrew Rist * specific language governing permissions and limitations 18*10ce8018SAndrew Rist * under the License. 19*10ce8018SAndrew Rist * 20*10ce8018SAndrew Rist *************************************************************/ 21*10ce8018SAndrew Rist 22*10ce8018SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SVTOOLS_SOURCE_FILEPICKER_ASYNCFILEPICKER_HXX 25cdf0e10cSrcweir #define SVTOOLS_SOURCE_FILEPICKER_ASYNCFILEPICKER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir /** === begin UNO includes === **/ 28cdf0e10cSrcweir /** === end UNO includes === **/ 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <tools/link.hxx> 31cdf0e10cSrcweir #include <tools/string.hxx> 32cdf0e10cSrcweir #include <rtl/ref.hxx> 33cdf0e10cSrcweir #include <rtl/ustring.hxx> 34cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h> 35cdf0e10cSrcweir 36cdf0e10cSrcweir class SvtFileView; 37cdf0e10cSrcweir class SvtFileDialog; 38cdf0e10cSrcweir 39cdf0e10cSrcweir typedef ::com::sun::star::uno::Sequence< ::rtl::OUString > OUStringList; 40cdf0e10cSrcweir 41cdf0e10cSrcweir //........................................................................ 42cdf0e10cSrcweir namespace svt 43cdf0e10cSrcweir { 44cdf0e10cSrcweir //........................................................................ 45cdf0e10cSrcweir 46cdf0e10cSrcweir 47cdf0e10cSrcweir //==================================================================== 48cdf0e10cSrcweir //= AsyncPickerAction 49cdf0e10cSrcweir //==================================================================== 50cdf0e10cSrcweir class AsyncPickerAction : public ::rtl::IReference 51cdf0e10cSrcweir { 52cdf0e10cSrcweir public: 53cdf0e10cSrcweir enum Action 54cdf0e10cSrcweir { 55cdf0e10cSrcweir ePrevLevel, 56cdf0e10cSrcweir eOpenURL, 57cdf0e10cSrcweir eExecuteFilter 58cdf0e10cSrcweir }; 59cdf0e10cSrcweir 60cdf0e10cSrcweir private: 61cdf0e10cSrcweir mutable oslInterlockedCount m_refCount; 62cdf0e10cSrcweir Action m_eAction; 63cdf0e10cSrcweir SvtFileView* m_pView; 64cdf0e10cSrcweir SvtFileDialog* m_pDialog; 65cdf0e10cSrcweir String m_sURL; 66cdf0e10cSrcweir String m_sFileName; 67cdf0e10cSrcweir bool m_bRunning; 68cdf0e10cSrcweir 69cdf0e10cSrcweir public: 70cdf0e10cSrcweir AsyncPickerAction( SvtFileDialog* _pDialog, SvtFileView* _pView, const Action _eAction ); 71cdf0e10cSrcweir 72cdf0e10cSrcweir /** executes the action 73cdf0e10cSrcweir 74cdf0e10cSrcweir @param _nMinTimeout 75cdf0e10cSrcweir the minimum timeout to wait, in milliseconds. If negative, the action will we done 76cdf0e10cSrcweir synchronously. If between 0 and 999, it will be corrected to 1000, means the 77cdf0e10cSrcweir smallest valid value is 1000 (which equals one second). 78cdf0e10cSrcweir @param _nMaxTimeout 79cdf0e10cSrcweir The maximum time to wait for a result, in milliseconds. If there's no result of 80cdf0e10cSrcweir the action within the given time frame, the action will be cancelled. 81cdf0e10cSrcweir If smaller than or equal to <arg>_nMinTimeout</arg>, it will be corrected to 82cdf0e10cSrcweir <arg>_nMinTimeout</arg> + 30000. 83cdf0e10cSrcweir */ 84cdf0e10cSrcweir void execute( 85cdf0e10cSrcweir const String& _rURL, 86cdf0e10cSrcweir const String& _rFilter, 87cdf0e10cSrcweir sal_Int32 _nMinTimeout, 88cdf0e10cSrcweir sal_Int32 _nMaxTimeout, 89cdf0e10cSrcweir const OUStringList& rBlackList = OUStringList() ); 90cdf0e10cSrcweir 91cdf0e10cSrcweir /// cancels the running action 92cdf0e10cSrcweir void cancel(); 93cdf0e10cSrcweir 94cdf0e10cSrcweir // IReference overridables 95cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL acquire(); 96cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL release(); 97cdf0e10cSrcweir 98cdf0e10cSrcweir protected: 99cdf0e10cSrcweir virtual ~AsyncPickerAction(); 100cdf0e10cSrcweir 101cdf0e10cSrcweir private: 102cdf0e10cSrcweir DECL_LINK( OnActionDone, void* ); 103cdf0e10cSrcweir 104cdf0e10cSrcweir AsyncPickerAction(); // never implemented 105cdf0e10cSrcweir AsyncPickerAction( const AsyncPickerAction& ); // never implemented 106cdf0e10cSrcweir AsyncPickerAction& operator=( const AsyncPickerAction& ); // never implemented 107cdf0e10cSrcweir }; 108cdf0e10cSrcweir 109cdf0e10cSrcweir //........................................................................ 110cdf0e10cSrcweir } // namespace svt 111cdf0e10cSrcweir //........................................................................ 112cdf0e10cSrcweir 113cdf0e10cSrcweir #endif // SVTOOLS_SOURCE_FILEPICKER_ASYNCFILEPICKER_HXX 114cdf0e10cSrcweir 115