1 /*************************************************************************
9 * The Contents of this file are made available subject to the terms of
10 * either of the following licenses
12 * - GNU Lesser General Public License Version 2.1
13 * - Sun Industry Standards Source License Version 1.1
15 * Sun Microsystems Inc., October, 2000
17 * GNU Lesser General Public License Version 2.1
18 * =============================================
19 * Copyright 2000 by Sun Microsystems, Inc.
20 * 901 San Antonio Road, Palo Alto, CA 94303, USA
22 * This library is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU Lesser General Public
24 * License version 2.1, as published by the Free Software Foundation.
26 * This library is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 * Lesser General Public License for more details.
31 * You should have received a copy of the GNU Lesser General Public
32 * License along with this library; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
37 * Sun Industry Standards Source License Version 1.1
38 * =================================================
39 * The contents of this file are subject to the Sun Industry Standards
40 * Source License Version 1.1 (the "License"); You may not use this file
41 * except in compliance with the License. You may obtain a copy of the
42 * License at http://www.openoffice.org/license.html.
44 * Software provided under this License is provided on an "AS IS" basis,
45 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
46 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
47 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
48 * See the License for the specific provisions governing your rights and
49 * obligations concerning the Software.
51 * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
53 * Copyright: 2000 by Sun Microsystems, Inc.
55 * All Rights Reserved.
57 * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
60 ************************************************************************/
62 #ifndef _UNXCOMMANDTHREAD_HXX_
63 #define _UNXCOMMANDTHREAD_HXX_
65 #ifndef _COM_SUN_STAR_UNO_ANY_HXX_
66 #include <com/sun/star/uno/Any.hxx>
69 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
70 #include <com/sun/star/uno/Sequence.hxx>
73 #ifndef _OSL_CONDITN_HXX_
74 #include <osl/conditn.hxx>
77 #ifndef _OSL_MUTEX_HXX_
78 #include <osl/mutex.hxx>
81 #ifndef _OSL_THREAD_HXX_
82 #include <osl/thread.hxx>
85 #ifndef _RTL_USTRBUF_HXX_
86 #include <rtl/ustring.hxx>
89 #include <vcl/svapp.hxx>
93 class UnxFilePickerNotifyThread
;
95 /** Synchronization for the 'thread-less' version of the fpicker.
97 Something like osl::Condition, but calls Application::Yield() while in
100 class YieldingCondition
102 ::osl::Mutex m_aMutex
;
107 ::osl::MutexGuard
aGuard( m_aMutex
);
112 YieldingCondition() { reset(); }
116 ::osl::MutexGuard
aGuard( m_aMutex
);
122 ::osl::MutexGuard
aGuard( m_aMutex
);
129 Application::Yield();
133 class UnxFilePickerCommandThread
: public ::osl::Thread
136 UnxFilePickerNotifyThread
*m_pNotifyThread
;
139 ::osl::Mutex m_aMutex
;
141 YieldingCondition m_aExecCondition
;
144 ::osl::Condition m_aGetCurrentFilterCondition
;
145 ::rtl::OUString m_aGetCurrentFilter
;
147 ::osl::Condition m_aGetDirectoryCondition
;
148 ::rtl::OUString m_aGetDirectory
;
150 ::osl::Condition m_aGetFilesCondition
;
151 ::std::list
< ::rtl::OUString
> m_aGetFiles
;
153 ::osl::Condition m_aGetValueCondition
;
154 ::com::sun::star::uno::Any m_aGetValue
;
157 UnxFilePickerCommandThread( UnxFilePickerNotifyThread
*pNotifyThread
, int nReadFD
);
158 ~UnxFilePickerCommandThread();
160 YieldingCondition
& SAL_CALL
execCondition() { return m_aExecCondition
; }
161 sal_Bool SAL_CALL
result();
163 ::osl::Condition
& SAL_CALL
getCurrentFilterCondition() { return m_aGetCurrentFilterCondition
; }
164 ::rtl::OUString SAL_CALL
getCurrentFilter();
166 ::osl::Condition
& SAL_CALL
getDirectoryCondition() { return m_aGetDirectoryCondition
; }
167 ::rtl::OUString SAL_CALL
getDirectory();
169 ::osl::Condition
& SAL_CALL
getFilesCondition() { return m_aGetFilesCondition
; }
170 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getFiles();
172 ::osl::Condition
& SAL_CALL
getValueCondition() { return m_aGetValueCondition
; }
173 ::com::sun::star::uno::Any SAL_CALL
getValue();
176 virtual void SAL_CALL
run();
178 virtual void SAL_CALL
handleCommand( const ::rtl::OUString
&rCommand
/*, sal_Bool &rQuit*/ );
179 ::std::list
< ::rtl::OUString
> SAL_CALL
tokenize( const ::rtl::OUString
&rCommand
);
182 #endif // _UNXCOMMANDTHREAD_HXX_