1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef SVTOOLS_SOURCE_FILEPICKER_ASYNCFILEPICKER_HXX 29*cdf0e10cSrcweir #define SVTOOLS_SOURCE_FILEPICKER_ASYNCFILEPICKER_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir /** === begin UNO includes === **/ 32*cdf0e10cSrcweir /** === end UNO includes === **/ 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #include <tools/link.hxx> 35*cdf0e10cSrcweir #include <tools/string.hxx> 36*cdf0e10cSrcweir #include <rtl/ref.hxx> 37*cdf0e10cSrcweir #include <rtl/ustring.hxx> 38*cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h> 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir class SvtFileView; 41*cdf0e10cSrcweir class SvtFileDialog; 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir typedef ::com::sun::star::uno::Sequence< ::rtl::OUString > OUStringList; 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir //........................................................................ 46*cdf0e10cSrcweir namespace svt 47*cdf0e10cSrcweir { 48*cdf0e10cSrcweir //........................................................................ 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir //==================================================================== 52*cdf0e10cSrcweir //= AsyncPickerAction 53*cdf0e10cSrcweir //==================================================================== 54*cdf0e10cSrcweir class AsyncPickerAction : public ::rtl::IReference 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir public: 57*cdf0e10cSrcweir enum Action 58*cdf0e10cSrcweir { 59*cdf0e10cSrcweir ePrevLevel, 60*cdf0e10cSrcweir eOpenURL, 61*cdf0e10cSrcweir eExecuteFilter 62*cdf0e10cSrcweir }; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir private: 65*cdf0e10cSrcweir mutable oslInterlockedCount m_refCount; 66*cdf0e10cSrcweir Action m_eAction; 67*cdf0e10cSrcweir SvtFileView* m_pView; 68*cdf0e10cSrcweir SvtFileDialog* m_pDialog; 69*cdf0e10cSrcweir String m_sURL; 70*cdf0e10cSrcweir String m_sFileName; 71*cdf0e10cSrcweir bool m_bRunning; 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir public: 74*cdf0e10cSrcweir AsyncPickerAction( SvtFileDialog* _pDialog, SvtFileView* _pView, const Action _eAction ); 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir /** executes the action 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir @param _nMinTimeout 79*cdf0e10cSrcweir the minimum timeout to wait, in milliseconds. If negative, the action will we done 80*cdf0e10cSrcweir synchronously. If between 0 and 999, it will be corrected to 1000, means the 81*cdf0e10cSrcweir smallest valid value is 1000 (which equals one second). 82*cdf0e10cSrcweir @param _nMaxTimeout 83*cdf0e10cSrcweir The maximum time to wait for a result, in milliseconds. If there's no result of 84*cdf0e10cSrcweir the action within the given time frame, the action will be cancelled. 85*cdf0e10cSrcweir If smaller than or equal to <arg>_nMinTimeout</arg>, it will be corrected to 86*cdf0e10cSrcweir <arg>_nMinTimeout</arg> + 30000. 87*cdf0e10cSrcweir */ 88*cdf0e10cSrcweir void execute( 89*cdf0e10cSrcweir const String& _rURL, 90*cdf0e10cSrcweir const String& _rFilter, 91*cdf0e10cSrcweir sal_Int32 _nMinTimeout, 92*cdf0e10cSrcweir sal_Int32 _nMaxTimeout, 93*cdf0e10cSrcweir const OUStringList& rBlackList = OUStringList() ); 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir /// cancels the running action 96*cdf0e10cSrcweir void cancel(); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir // IReference overridables 99*cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL acquire(); 100*cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL release(); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir protected: 103*cdf0e10cSrcweir virtual ~AsyncPickerAction(); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir private: 106*cdf0e10cSrcweir DECL_LINK( OnActionDone, void* ); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir AsyncPickerAction(); // never implemented 109*cdf0e10cSrcweir AsyncPickerAction( const AsyncPickerAction& ); // never implemented 110*cdf0e10cSrcweir AsyncPickerAction& operator=( const AsyncPickerAction& ); // never implemented 111*cdf0e10cSrcweir }; 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir //........................................................................ 114*cdf0e10cSrcweir } // namespace svt 115*cdf0e10cSrcweir //........................................................................ 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir #endif // SVTOOLS_SOURCE_FILEPICKER_ASYNCFILEPICKER_HXX 118*cdf0e10cSrcweir 119