update dev300-m58
[ooovba.git] / applied_patches / 0282-fpicker-kde-service.diff
blob508d37340d7b1be62a8a412d780ad3dbcf0836d4
1 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
2 +++ fpicker/source/unx/kde_unx/UnxFPentry.cxx 2004-06-14 14:08:19.923932848 +0200
3 @@ -0,0 +1,169 @@
4 +/*************************************************************************
5 + *
6 + *
7 + *
8 + *
9 + *
10 + *
11 + *
12 + * The Contents of this file are made available subject to the terms of
13 + * either of the following licenses
14 + *
15 + * - GNU Lesser General Public License Version 2.1
16 + * - Sun Industry Standards Source License Version 1.1
17 + *
18 + * Sun Microsystems Inc., October, 2000
19 + *
20 + * GNU Lesser General Public License Version 2.1
21 + * =============================================
22 + * Copyright 2000 by Sun Microsystems, Inc.
23 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
24 + *
25 + * This library is free software; you can redistribute it and/or
26 + * modify it under the terms of the GNU Lesser General Public
27 + * License version 2.1, as published by the Free Software Foundation.
28 + *
29 + * This library is distributed in the hope that it will be useful,
30 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32 + * Lesser General Public License for more details.
33 + *
34 + * You should have received a copy of the GNU Lesser General Public
35 + * License along with this library; if not, write to the Free Software
36 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
37 + * MA 02111-1307 USA
38 + *
39 + *
40 + * Sun Industry Standards Source License Version 1.1
41 + * =================================================
42 + * The contents of this file are subject to the Sun Industry Standards
43 + * Source License Version 1.1 (the "License"); You may not use this file
44 + * except in compliance with the License. You may obtain a copy of the
45 + * License at http://www.openoffice.org/license.html.
46 + *
47 + * Software provided under this License is provided on an "AS IS" basis,
48 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
49 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
50 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
51 + * See the License for the specific provisions governing your rights and
52 + * obligations concerning the Software.
53 + *
54 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
55 + *
56 + * Copyright: 2000 by Sun Microsystems, Inc.
57 + *
58 + * All Rights Reserved.
59 + *
60 + * Contributor(s): _______________________________________
61 + *
62 + *
63 + ************************************************************************/
65 +#ifndef _CPPUHELPER_FACTORY_HXX_
66 +#include <cppuhelper/factory.hxx>
67 +#endif
69 +#ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
70 +#include <com/sun/star/container/XSet.hpp>
71 +#endif
73 +#ifndef _OSL_DIAGNOSE_H_
74 +#include <osl/diagnose.h>
75 +#endif
77 +#ifndef _UNXFILEPICKER_HXX_
78 +#include "UnxFilePicker.hxx"
79 +#endif
81 +#ifndef _FPSERVICEINFO_HXX_
82 +#include "FPServiceInfo.hxx"
83 +#endif
85 +using namespace ::rtl;
86 +using namespace ::com::sun::star::uno;
87 +using namespace ::com::sun::star::container;
88 +using namespace ::com::sun::star::lang;
89 +using namespace ::com::sun::star::registry;
90 +using namespace ::cppu;
91 +using ::com::sun::star::ui::dialogs::XFilePicker;
93 +//////////////////////////////////////////////////////////////////////////
94 +//
95 +//////////////////////////////////////////////////////////////////////////
97 +static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager )
99 + return Reference< XInterface >(
100 + static_cast< XFilePicker* >( new UnxFilePicker( rServiceManager ) ) );
103 +//////////////////////////////////////////////////////////////////////////
104 +// the three uno functions that will be exported
105 +//////////////////////////////////////////////////////////////////////////
107 +extern "C"
110 +//////////////////////////////////////////////////////////////////////////
111 +// component_getImplementationEnvironment
112 +//////////////////////////////////////////////////////////////////////////
114 +void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
116 + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
119 +//////////////////////////////////////////////////////////////////////////
121 +//////////////////////////////////////////////////////////////////////////
123 +sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey )
125 + sal_Bool bRetVal = sal_True;
127 + if ( pRegistryKey )
129 + try
131 + Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) );
132 + pXNewKey->createKey( OUString::createFromAscii( FILE_PICKER_REGKEY_NAME ) );
134 + catch( InvalidRegistryException& )
135 + {
136 + OSL_ENSURE( sal_False, "InvalidRegistryException caught" );
137 + bRetVal = sal_False;
141 + return bRetVal;
144 +//////////////////////////////////////////////////////////////////////////
146 +//////////////////////////////////////////////////////////////////////////
148 +void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* pRegistryKey )
150 + void* pRet = 0;
152 + if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FILE_PICKER_IMPL_NAME ) ) )
154 + Sequence< OUString > aSNS( 1 );
155 + aSNS.getArray( )[0] = OUString::createFromAscii( FILE_PICKER_SERVICE_NAME );
157 + Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
158 + reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
159 + OUString::createFromAscii( pImplName ),
160 + createInstance,
161 + aSNS ) );
162 + if ( xFactory.is() )
164 + xFactory->acquire();
165 + pRet = xFactory.get();
166 + }
169 + return pRet;
172 +} // extern "C"
173 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
174 +++ fpicker/source/unx/kde_unx/FPServiceInfo.hxx 2004-06-14 14:09:17.226221576 +0200
175 @@ -0,0 +1,77 @@
176 +/*************************************************************************
184 + * The Contents of this file are made available subject to the terms of
185 + * either of the following licenses
187 + * - GNU Lesser General Public License Version 2.1
188 + * - Sun Industry Standards Source License Version 1.1
190 + * Sun Microsystems Inc., October, 2000
192 + * GNU Lesser General Public License Version 2.1
193 + * =============================================
194 + * Copyright 2000 by Sun Microsystems, Inc.
195 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
197 + * This library is free software; you can redistribute it and/or
198 + * modify it under the terms of the GNU Lesser General Public
199 + * License version 2.1, as published by the Free Software Foundation.
201 + * This library is distributed in the hope that it will be useful,
202 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
203 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
204 + * Lesser General Public License for more details.
206 + * You should have received a copy of the GNU Lesser General Public
207 + * License along with this library; if not, write to the Free Software
208 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
209 + * MA 02111-1307 USA
212 + * Sun Industry Standards Source License Version 1.1
213 + * =================================================
214 + * The contents of this file are subject to the Sun Industry Standards
215 + * Source License Version 1.1 (the "License"); You may not use this file
216 + * except in compliance with the License. You may obtain a copy of the
217 + * License at http://www.openoffice.org/license.html.
219 + * Software provided under this License is provided on an "AS IS" basis,
220 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
221 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
222 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
223 + * See the License for the specific provisions governing your rights and
224 + * obligations concerning the Software.
226 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
228 + * Copyright: 2000 by Sun Microsystems, Inc.
230 + * All Rights Reserved.
232 + * Contributor(s): _______________________________________
235 + ************************************************************************/
237 +#ifndef _FPSERVICEINFO_HXX_
238 +#define _FPSERVICEINFO_HXX_
240 +// the service names
241 +#define FILE_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.KDEFilePicker"
243 +// the implementation names
244 +#define FILE_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.UnxFilePicker"
246 +// the registry key names
247 +// a key under which this service will be registered,
248 +// Format: -> "/ImplName/UNO/SERVICES/ServiceName"
249 +// <Implementation-Name></UNO/SERVICES/><Service-Name>
250 +#define FILE_PICKER_REGKEY_NAME "/com.sun.star.ui.dialogs.UnxFilePicker/UNO/SERVICES/com.sun.star.ui.dialogs.KDEFilePicker"
252 +#endif
253 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
254 +++ fpicker/source/unx/kde_unx/fps_kde.xml 2004-06-21 17:30:23.370313432 +0200
255 @@ -0,0 +1,51 @@
256 +<?xml version="1.0" encoding="UTF-8"?>
257 +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
258 +<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
259 + <module-name>fps_kde</module-name>
260 + <component-description>
261 + <author> Jan Holesovsky </author>
262 + <name> com.sun.star.comp.ui.dialogs.FilePicker </name>
263 + <description>
264 + The KDE implementation of the FilePicker service.
265 + </description>
266 + <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
267 + <language> c++ </language>
268 + <status value="beta"/>
269 + <supported-service> com.sun.star.ui.dialogs.FilePicker </supported-service>
270 + <service-dependency>...</service-dependency>
271 + <type> com.sun.star.ui.dialogs.XExecutableDialog </type>
272 + <type> com.sun.star.ui.dialogs.XFilePicker </type>
273 + <type> com.sun.star.ui.dialogs.XFilterManager </type>
274 + <type> com.sun.star.ui.dialogs.XFilterGroupManager </type>
275 + <type> com.sun.star.ui.dialogs.XFilePickerListener </type>
276 + <type> com.sun.star.ui.dialogs.ExecutableDialogException </type>
277 + <type> com.sun.star.ui.dialogs.XFilePickerNotifier </type>
278 + <type> com.sun.star.ui.dialogs.XFilePickerControlAccess </type>
279 + <type> com.sun.star.ui.dialogs.XFilePreview </type>
280 + <type> com.sun.star.ui.dialogs.ExtendedFilePickerElementIds </type>
281 + <type> com.sun.star.ui.dialogs.ExecutableDialogResults </type>
282 + <type> com.sun.star.ui.dialogs.FilePickerEvent </type>
283 + <type> com.sun.star.ui.dialogs.CommonFilePickerElementIds </type>
284 + <type> com.sun.star.ui.dialogs.ListboxControlActions </type>
285 + <type> com.sun.star.ui.dialogs.TemplateDescription </type>
286 + <type> com.sun.star.ui.dialogs.FilePreviewImageFormats </type>
287 + <type> com.sun.star.util.XCancellable </type>
288 + <type> com.sun.star.lang.XComponent </type>
289 + <type> com.sun.star.lang.XMultiServiceFactory </type>
290 + <type> com.sun.star.lang.XSingleServiceFactory </type>
291 + <type> com.sun.star.lang.XServiceInfo </type>
292 + <type> com.sun.star.lang.XTypeProvider </type>
293 + <type> com.sun.star.lang.IllegalArgumentException </type>
294 + <type> com.sun.star.uno.TypeClass </type>
295 + <type> com.sun.star.uno.XWeak </type>
296 + <type> com.sun.star.uno.XAggregation </type>
297 + <type> com.sun.star.registry.XRegistryKey </type>
298 + <type> com.sun.star.container.XSet </type>
299 + </component-description>
300 + <project-build-dependency> cppuhelper </project-build-dependency>
301 + <project-build-dependency> cppu </project-build-dependency>
302 + <project-build-dependency> sal </project-build-dependency>
303 + <runtime-module-dependency> cppuhelper </runtime-module-dependency>
304 + <runtime-module-dependency> cppu2 </runtime-module-dependency>
305 + <runtime-module-dependency> sal2 </runtime-module-dependency>
306 +</module-description>
309 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
310 +++ fpicker/source/unx/kde_unx/makefile.mk 2004-06-15 10:52:55.099580592 +0200
311 @@ -0,0 +1,112 @@
312 +#*************************************************************************
320 +# The Contents of this file are made available subject to the terms of
321 +# either of the following licenses
323 +# - GNU Lesser General Public License Version 2.1
324 +# - Sun Industry Standards Source License Version 1.1
326 +# Sun Microsystems Inc., October, 2000
328 +# GNU Lesser General Public License Version 2.1
329 +# =============================================
330 +# Copyright 2000 by Sun Microsystems, Inc.
331 +# 901 San Antonio Road, Palo Alto, CA 94303, USA
333 +# This library is free software; you can redistribute it and/or
334 +# modify it under the terms of the GNU Lesser General Public
335 +# License version 2.1, as published by the Free Software Foundation.
337 +# This library is distributed in the hope that it will be useful,
338 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
339 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
340 +# Lesser General Public License for more details.
342 +# You should have received a copy of the GNU Lesser General Public
343 +# License along with this library; if not, write to the Free Software
344 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
345 +# MA 02111-1307 USA
348 +# Sun Industry Standards Source License Version 1.1
349 +# =================================================
350 +# The contents of this file are subject to the Sun Industry Standards
351 +# Source License Version 1.1 (the "License"); You may not use this file
352 +# except in compliance with the License. You may obtain a copy of the
353 +# License at http://www.openoffice.org/license.html.
355 +# Software provided under this License is provided on an "AS IS" basis,
356 +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
357 +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
358 +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
359 +# See the License for the specific provisions governing your rights and
360 +# obligations concerning the Software.
362 +# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
364 +# Copyright: 2000 by Sun Microsystems, Inc.
366 +# All Rights Reserved.
368 +# Contributor(s): _______________________________________
372 +#*************************************************************************
374 +PRJ=..$/..$/..
376 +PRJNAME=fpicker
377 +TARGET=fps_kde.uno
378 +LIBTARGET=NO
379 +ENABLE_EXCEPTIONS=TRUE
381 +# --- Settings -----------------------------------------------------
383 +.INCLUDE : settings.mk
384 +DLLPRE=
386 +# ------------------------------------------------------------------
388 +# Currently just KDE is supported...
389 +.IF "$(GUIBASE)" != "unx" || "$(ENABLE_KDE)" != "TRUE"
391 +dummy:
392 + @echo "Nothing to build. GUIBASE == $(GUIBASE), ENABLE_KDE is not set"
394 +.ELSE # we build for KDE
396 +# --- Files --------------------------------------------------------
398 +SLOFILES =\
399 + $(SLO)$/UnxCommandThread.obj \
400 + $(SLO)$/UnxFilePicker.obj \
401 + $(SLO)$/UnxNotifyThread.obj \
402 + $(SLO)$/UnxFPentry.obj
404 +SHL1NOCHECK=TRUE
405 +SHL1TARGET=fps_kde.uno
406 +SHL1STDLIBS=$(CPPULIB)\
407 + $(CPPUHELPERLIB)\
408 + $(SALLIB)\
409 + $(VCLLIB)\
410 + $(TOOLSLIB)\
411 + $(SVTOOLLIB)
413 +SHL1OBJS=$(SLOFILES)
414 +SHL1DEF=$(MISC)$/$(SHL1TARGET).def
416 +DEF1NAME=$(SHL1TARGET)
417 +DEF1VERSIONMAP=exports.map
419 +.ENDIF # "$(GUIBASE)" != "unx" || "$(ENABLE_KDE)" != "TRUE"
421 +# --- Targets ------------------------------------------------------
423 +.INCLUDE : target.mk
424 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
425 +++ fpicker/source/unx/kde_unx/UnxCommandThread.cxx 2004-06-21 17:39:06.421797520 +0200
426 @@ -0,0 +1,355 @@
427 +/*************************************************************************
435 + * The Contents of this file are made available subject to the terms of
436 + * either of the following licenses
438 + * - GNU Lesser General Public License Version 2.1
439 + * - Sun Industry Standards Source License Version 1.1
441 + * Sun Microsystems Inc., October, 2000
443 + * GNU Lesser General Public License Version 2.1
444 + * =============================================
445 + * Copyright 2000 by Sun Microsystems, Inc.
446 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
448 + * This library is free software; you can redistribute it and/or
449 + * modify it under the terms of the GNU Lesser General Public
450 + * License version 2.1, as published by the Free Software Foundation.
452 + * This library is distributed in the hope that it will be useful,
453 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
454 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
455 + * Lesser General Public License for more details.
457 + * You should have received a copy of the GNU Lesser General Public
458 + * License along with this library; if not, write to the Free Software
459 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
460 + * MA 02111-1307 USA
463 + * Sun Industry Standards Source License Version 1.1
464 + * =================================================
465 + * The contents of this file are subject to the Sun Industry Standards
466 + * Source License Version 1.1 (the "License"); You may not use this file
467 + * except in compliance with the License. You may obtain a copy of the
468 + * License at http://www.openoffice.org/license.html.
470 + * Software provided under this License is provided on an "AS IS" basis,
471 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
472 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
473 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
474 + * See the License for the specific provisions governing your rights and
475 + * obligations concerning the Software.
477 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
479 + * Copyright: 2000 by Sun Microsystems, Inc.
481 + * All Rights Reserved.
483 + * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
486 + ************************************************************************/
488 +#ifndef _UNXCOMMANDTHREAD_HXX_
489 +#include <UnxCommandThread.hxx>
490 +#endif
492 +#ifndef _UNXNOTIFYTHREAD_HXX_
493 +#include <UnxNotifyThread.hxx>
494 +#endif
496 +#ifndef _RTL_USTRING_H_
497 +#include <rtl/ustring.hxx>
498 +#endif
500 +#ifndef _RTL_USTRBUF_HXX_
501 +#include <rtl/ustrbuf.hxx>
502 +#endif
504 +#include <unistd.h>
505 +#include <string.h>
506 +#include <iostream>
508 +using namespace ::com::sun::star;
510 +//////////////////////////////////////////////////////////////////////////
511 +// UnxFilePickerCommandThread
512 +//////////////////////////////////////////////////////////////////////////
514 +UnxFilePickerCommandThread::UnxFilePickerCommandThread( UnxFilePickerNotifyThread *pNotifyThread, int nReadFD )
515 + : m_pNotifyThread( pNotifyThread ),
516 + m_nReadFD( nReadFD )
520 +UnxFilePickerCommandThread::~UnxFilePickerCommandThread()
524 +sal_Bool SAL_CALL UnxFilePickerCommandThread::result()
526 + ::osl::MutexGuard aGuard( m_aMutex );
528 + return m_aResult;
531 +::rtl::OUString SAL_CALL UnxFilePickerCommandThread::getCurrentFilter()
533 + ::osl::MutexGuard aGuard( m_aMutex );
535 + return m_aGetCurrentFilter;
538 +::rtl::OUString SAL_CALL UnxFilePickerCommandThread::getDirectory()
540 + ::osl::MutexGuard aGuard( m_aMutex );
542 + return m_aGetDirectory;
545 +uno::Sequence< ::rtl::OUString > SAL_CALL UnxFilePickerCommandThread::getFiles()
547 + ::osl::MutexGuard aGuard( m_aMutex );
549 + sal_Int32 nSize = m_aGetFiles.size();
550 + uno::Sequence< ::rtl::OUString > aFiles( ( nSize > 1 )? nSize + 1: nSize );
552 + if ( nSize == 1 )
553 + aFiles[0] = m_aGetFiles.front();
554 + else if ( nSize > 1 )
556 + // First entry in the sequence must be the dirname, the others are the
557 + // filenames, so we have to rearrange the list...
559 + ::rtl::OUString aFront = m_aGetFiles.front();
560 + sal_Int32 nLastSlash = aFront.lastIndexOf( '/' );
562 + aFiles[0] = ( nLastSlash >= 0 )? aFront.copy( 0, nLastSlash ): ::rtl::OUString();
563 + ++nLastSlash;
565 + sal_Int32 nIdx = 1;
566 + for ( ::std::list< ::rtl::OUString >::const_iterator it = m_aGetFiles.begin();
567 + it != m_aGetFiles.end(); ++it, ++nIdx )
569 + sal_Int32 nLength = (*it).getLength() - nLastSlash;
570 + aFiles[nIdx] = ( nLength >= 0 )? (*it).copy( nLastSlash, nLength ): ::rtl::OUString();
574 + return aFiles;
577 +uno::Any SAL_CALL UnxFilePickerCommandThread::getValue()
579 + ::osl::MutexGuard aGuard( m_aMutex );
581 + return m_aGetValue;
584 +void SAL_CALL UnxFilePickerCommandThread::run()
586 + if ( m_nReadFD < 0 )
587 + return;
589 + sal_Int32 nBufferSize = 1024; // 1 is for testing, 1024 for real use
590 + sal_Char *pBuffer = new sal_Char[nBufferSize];
591 + sal_Char *pBufferEnd = pBuffer + nBufferSize;
593 + sal_Char *pWhereToRead = pBuffer;
594 + sal_Char *pEntryBegin = pBuffer;
595 + sal_Int32 nBytesRead = 0;
596 + sal_Bool bShouldExit = sal_False;
597 + while ( !bShouldExit && ( nBytesRead = read( m_nReadFD, pWhereToRead, pBufferEnd - pWhereToRead ) ) > 0 )
599 + sal_Bool bFoundNL = sal_False;
600 + sal_Char *pWhereToReadEnd = pWhereToRead + nBytesRead;
601 + sal_Char *pEntryEnd = pWhereToRead;
602 + do {
603 + for ( ; pEntryEnd < pWhereToReadEnd && *pEntryEnd != '\n'; ++pEntryEnd )
606 + if ( pEntryEnd < pWhereToReadEnd )
608 + bFoundNL = sal_True;
609 + *pEntryEnd = 0;
611 + if ( strcmp( pEntryBegin, "exited" ) == 0 )
612 + bShouldExit = sal_True;
613 + else
614 + handleCommand( ::rtl::OUString( pEntryBegin, pEntryEnd - pEntryBegin, RTL_TEXTENCODING_UTF8 )/*, bQuit*/ );
616 + pEntryBegin = pEntryEnd + 1;
618 + } while ( pEntryEnd < pWhereToReadEnd );
620 + if ( bFoundNL )
622 + if ( pEntryBegin < pBufferEnd )
623 + memmove( pBuffer, pEntryBegin, pWhereToReadEnd - pEntryBegin );
625 + else
627 + // enlarge the buffer size
628 + nBufferSize *= 2;
629 + sal_Char *pNewBuffer = new sal_Char[nBufferSize];
630 + if ( pEntryBegin < pBufferEnd )
631 + memmove( pNewBuffer, pEntryBegin, pWhereToReadEnd - pEntryBegin );
633 + delete[] pBuffer;
634 + pBuffer = pNewBuffer;
635 + pBufferEnd = pBuffer + nBufferSize;
638 + pWhereToRead = pBuffer + ( pWhereToReadEnd - pEntryBegin );
639 + pEntryBegin = pBuffer;
643 +void SAL_CALL UnxFilePickerCommandThread::handleCommand( const ::rtl::OUString &rCommand )
645 + ::osl::MutexGuard aGuard( m_aMutex );
647 +#if OSL_DEBUG_LEVEL > 0
648 + ::std::cerr << "UnxFilePicker received: \"" <<
649 + OUStringToOString( rCommand, RTL_TEXTENCODING_ASCII_US ).getStr() << "\"" << ::std::endl;
650 +#endif
652 + ::std::list< ::rtl::OUString > aList = tokenize( rCommand );
654 + if ( aList.size() == 0 )
655 + return;
657 + ::rtl::OUString aCommandName = aList.front();
658 + aList.pop_front();
660 + if ( aCommandName.equalsAscii( "accept" ) )
662 + m_aResult = sal_True;
663 + m_aExecCondition.set();
665 + else if ( aCommandName.equalsAscii( "reject" ) )
667 + m_aResult = sal_False;
668 + m_aExecCondition.set();
670 + else if ( aCommandName.equalsAscii( "fileSelectionChanged" ) )
672 + if ( m_pNotifyThread )
673 + m_pNotifyThread->fileSelectionChanged();
675 + else if ( aCommandName.equalsAscii( "files" ) )
677 + m_aGetFiles = aList;
678 + m_aGetFilesCondition.set();
680 + else if ( aCommandName.equalsAscii( "value" ) )
682 + ::rtl::OUString aType;
683 + if ( !aList.empty() )
685 + aType = aList.front();
686 + aList.pop_front();
689 + if ( aType.equalsAscii( "bool" ) )
691 + sal_Bool bValue = !aList.empty() && aList.front().equalsIgnoreAsciiCaseAscii( "true" );
693 + m_aGetValue <<= bValue;
694 + m_aGetValueCondition.set();
696 + else if ( aType.equalsAscii( "int" ) )
698 + sal_Int32 nValue = 0;
699 + if ( !aList.empty() )
700 + nValue = aList.front().toInt32();
702 + m_aGetValue <<= nValue;
703 + m_aGetValueCondition.set();
705 + else if ( aType.equalsAscii( "string" ) )
707 + ::rtl::OUString aValue;
708 + if ( !aList.empty() )
709 + aValue = aList.front();
711 + m_aGetValue <<= aValue;
712 + m_aGetValueCondition.set();
714 + else if ( aType.equalsAscii( "stringList" ) )
716 + uno::Sequence< ::rtl::OUString > aSequence( aList.size() );
717 + sal_Int32 nIdx = 0;
718 + for ( ::std::list< ::rtl::OUString >::const_iterator it = aList.begin(); it != aList.end(); ++it, ++nIdx )
719 + aSequence[nIdx] = (*it);
721 + m_aGetValue <<= aSequence;
722 + m_aGetValueCondition.set();
724 + else
726 + m_aGetValue = uno::Any();
727 + m_aGetValueCondition.set();
730 + else if ( aCommandName.equalsAscii( "currentFilter" ) )
732 + m_aGetCurrentFilter = aList.empty()? ::rtl::OUString(): aList.front();
733 + m_aGetCurrentFilterCondition.set();
735 + else if ( aCommandName.equalsAscii( "currentDirectory" ) )
737 + m_aGetDirectory = aList.empty()? ::rtl::OUString(): aList.front();
738 + m_aGetDirectoryCondition.set();
740 + else
742 +#if OSL_DEBUG_LEVEL > 0
743 + ::std::cerr << "Unrecognized command: "
744 + << OUStringToOString( aCommandName, RTL_TEXTENCODING_ASCII_US ).getStr() << "\"" << ::std::endl;
745 +#endif
749 +::std::list< ::rtl::OUString > SAL_CALL UnxFilePickerCommandThread::tokenize( const ::rtl::OUString &rCommand )
751 + ::std::list< ::rtl::OUString > aList;
752 + ::rtl::OUStringBuffer aBuffer( 1024 );
754 + const sal_Unicode *pUnicode = rCommand.getStr();
755 + const sal_Unicode *pEnd = pUnicode + rCommand.getLength();
756 + sal_Bool bQuoted = sal_False;
758 + for ( ; pUnicode != pEnd; ++pUnicode )
760 + if ( *pUnicode == '\\' )
762 + ++pUnicode;
763 + if ( pUnicode != pEnd )
765 + if ( *pUnicode == 'n' )
766 + aBuffer.appendAscii( "\n", 1 );
767 + else
768 + aBuffer.append( *pUnicode );
771 + else if ( *pUnicode == '"' )
772 + bQuoted = !bQuoted;
773 + else if ( *pUnicode == ' ' && !bQuoted )
774 + aList.push_back( aBuffer.makeStringAndClear() );
775 + else
776 + aBuffer.append( *pUnicode );
778 + aList.push_back( aBuffer.makeStringAndClear() );
780 + return aList;
782 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
783 +++ fpicker/source/unx/kde_unx/UnxCommandThread.hxx 2004-06-11 17:08:30.375883816 +0200
784 @@ -0,0 +1,142 @@
785 +/*************************************************************************
793 + * The Contents of this file are made available subject to the terms of
794 + * either of the following licenses
796 + * - GNU Lesser General Public License Version 2.1
797 + * - Sun Industry Standards Source License Version 1.1
799 + * Sun Microsystems Inc., October, 2000
801 + * GNU Lesser General Public License Version 2.1
802 + * =============================================
803 + * Copyright 2000 by Sun Microsystems, Inc.
804 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
806 + * This library is free software; you can redistribute it and/or
807 + * modify it under the terms of the GNU Lesser General Public
808 + * License version 2.1, as published by the Free Software Foundation.
810 + * This library is distributed in the hope that it will be useful,
811 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
812 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
813 + * Lesser General Public License for more details.
815 + * You should have received a copy of the GNU Lesser General Public
816 + * License along with this library; if not, write to the Free Software
817 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
818 + * MA 02111-1307 USA
821 + * Sun Industry Standards Source License Version 1.1
822 + * =================================================
823 + * The contents of this file are subject to the Sun Industry Standards
824 + * Source License Version 1.1 (the "License"); You may not use this file
825 + * except in compliance with the License. You may obtain a copy of the
826 + * License at http://www.openoffice.org/license.html.
828 + * Software provided under this License is provided on an "AS IS" basis,
829 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
830 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
831 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
832 + * See the License for the specific provisions governing your rights and
833 + * obligations concerning the Software.
835 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
837 + * Copyright: 2000 by Sun Microsystems, Inc.
839 + * All Rights Reserved.
841 + * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
844 + ************************************************************************/
846 +#ifndef _UNXCOMMANDTHREAD_HXX_
847 +#define _UNXCOMMANDTHREAD_HXX_
849 +#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
850 +#include <com/sun/star/uno/Any.hxx>
851 +#endif
853 +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
854 +#include <com/sun/star/uno/Sequence.hxx>
855 +#endif
857 +#ifndef _OSL_CONDITN_HXX_
858 +#include <osl/conditn.hxx>
859 +#endif
861 +#ifndef _OSL_MUTEX_HXX_
862 +#include <osl/mutex.hxx>
863 +#endif
865 +#ifndef _OSL_THREAD_HXX_
866 +#include <osl/thread.hxx>
867 +#endif
869 +#ifndef _RTL_USTRBUF_HXX_
870 +#include <rtl/ustring.hxx>
871 +#endif
873 +#include <list>
875 +class UnxFilePickerNotifyThread;
877 +class UnxFilePickerCommandThread : public ::osl::Thread
879 +protected:
880 + UnxFilePickerNotifyThread *m_pNotifyThread;
881 + int m_nReadFD;
883 + ::osl::Mutex m_aMutex;
885 + ::osl::Condition m_aExecCondition;
886 + sal_Bool m_aResult;
888 + ::osl::Condition m_aGetCurrentFilterCondition;
889 + ::rtl::OUString m_aGetCurrentFilter;
891 + ::osl::Condition m_aGetDirectoryCondition;
892 + ::rtl::OUString m_aGetDirectory;
894 + ::osl::Condition m_aGetFilesCondition;
895 + ::std::list< ::rtl::OUString > m_aGetFiles;
897 + ::osl::Condition m_aGetValueCondition;
898 + ::com::sun::star::uno::Any m_aGetValue;
900 +public:
901 + UnxFilePickerCommandThread( UnxFilePickerNotifyThread *pNotifyThread, int nReadFD );
902 + ~UnxFilePickerCommandThread();
904 + ::osl::Condition& SAL_CALL execCondition() { return m_aExecCondition; }
905 + sal_Bool SAL_CALL result();
907 + ::osl::Condition& SAL_CALL getCurrentFilterCondition() { return m_aGetCurrentFilterCondition; }
908 + ::rtl::OUString SAL_CALL getCurrentFilter();
910 + ::osl::Condition& SAL_CALL getDirectoryCondition() { return m_aGetDirectoryCondition; }
911 + ::rtl::OUString SAL_CALL getDirectory();
913 + ::osl::Condition& SAL_CALL getFilesCondition() { return m_aGetFilesCondition; }
914 + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles();
916 + ::osl::Condition& SAL_CALL getValueCondition() { return m_aGetValueCondition; }
917 + ::com::sun::star::uno::Any SAL_CALL getValue();
919 +protected:
920 + virtual void SAL_CALL run();
922 + virtual void SAL_CALL handleCommand( const ::rtl::OUString &rCommand/*, sal_Bool &rQuit*/ );
923 + ::std::list< ::rtl::OUString > SAL_CALL tokenize( const ::rtl::OUString &rCommand );
926 +#endif // _UNXCOMMANDTHREAD_HXX_
927 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
928 +++ fpicker/source/unx/kde_unx/UnxFilePicker.cxx 2004-06-21 17:40:01.026496344 +0200
929 @@ -0,0 +1,977 @@
930 +/*************************************************************************
938 + * The Contents of this file are made available subject to the terms of
939 + * either of the following licenses
941 + * - GNU Lesser General Public License Version 2.1
942 + * - Sun Industry Standards Source License Version 1.1
944 + * Sun Microsystems Inc., October, 2000
946 + * GNU Lesser General Public License Version 2.1
947 + * =============================================
948 + * Copyright 2000 by Sun Microsystems, Inc.
949 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
951 + * This library is free software; you can redistribute it and/or
952 + * modify it under the terms of the GNU Lesser General Public
953 + * License version 2.1, as published by the Free Software Foundation.
955 + * This library is distributed in the hope that it will be useful,
956 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
957 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
958 + * Lesser General Public License for more details.
960 + * You should have received a copy of the GNU Lesser General Public
961 + * License along with this library; if not, write to the Free Software
962 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
963 + * MA 02111-1307 USA
966 + * Sun Industry Standards Source License Version 1.1
967 + * =================================================
968 + * The contents of this file are subject to the Sun Industry Standards
969 + * Source License Version 1.1 (the "License"); You may not use this file
970 + * except in compliance with the License. You may obtain a copy of the
971 + * License at http://www.openoffice.org/license.html.
973 + * Software provided under this License is provided on an "AS IS" basis,
974 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
975 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
976 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
977 + * See the License for the specific provisions governing your rights and
978 + * obligations concerning the Software.
980 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
982 + * Copyright: 2000 by Sun Microsystems, Inc.
984 + * All Rights Reserved.
986 + * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
989 + ************************************************************************/
991 +//////////////////////////////////////////////////////////////////////////
992 +// includes
993 +//////////////////////////////////////////////////////////////////////////
995 +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
996 +#include <com/sun/star/lang/DisposedException.hpp>
997 +#endif
999 +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
1000 +#include <com/sun/star/lang/XMultiServiceFactory.hpp>
1001 +#endif
1003 +#ifndef _CPPUHELPER_INTERFACECONTAINER_H_
1004 +#include <cppuhelper/interfacecontainer.h>
1005 +#endif
1007 +#ifndef _OSL_DIAGNOSE_H_
1008 +#include <osl/diagnose.h>
1009 +#endif
1011 +#ifndef _COM_SUN_STAR_UI_DIALOGS_TEMPLATEDESCRIPTION_HPP_
1012 +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
1013 +#endif
1015 +#ifndef _COM_SUN_STAR_UI_DIALOGS_COMMONFILEPICKERELEMENTIDS_HPP_
1016 +#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
1017 +#endif
1019 +#ifndef _COM_SUN_STAR_UI_DIALOGS_EXTENDEDFILEPICKERELEMENTIDS_HPP_
1020 +#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
1021 +#endif
1023 +#ifndef _COM_SUN_STAR_UI_DIALOGS_CONTROLACTIONS_HPP_
1024 +#include <com/sun/star/ui/dialogs/ControlActions.hpp>
1025 +#endif
1027 +#ifndef _RTL_USTRING_H_
1028 +#include <rtl/ustring.hxx>
1029 +#endif
1031 +#ifndef _RTL_USTRBUF_HXX_
1032 +#include <rtl/ustrbuf.hxx>
1033 +#endif
1035 +#ifndef _FPSERVICEINFO_HXX_
1036 +#include <FPServiceInfo.hxx>
1037 +#endif
1039 +#ifndef _SVTOOLS_SVTDATA_HXX
1040 +#include <svtools/svtdata.hxx>
1041 +#endif
1043 +#ifndef _SVTOOLS_HRC
1044 +#include <svtools/svtools.hrc>
1045 +#endif
1047 +#ifndef _UNXFILEOPENIMPL_HXX_
1048 +#include <UnxFilePicker.hxx>
1049 +#endif
1051 +#ifndef _UNXCOMMANDTHREAD_HXX_
1052 +#include <UnxCommandThread.hxx>
1053 +#endif
1055 +#ifndef _UNXNOTIFYTHREAD_HXX_
1056 +#include <UnxNotifyThread.hxx>
1057 +#endif
1059 +#include <sys/wait.h>
1060 +#include <unistd.h>
1061 +#include <fcntl.h>
1063 +#include <iostream>
1065 +using namespace ::com::sun::star;
1067 +using namespace ::com::sun::star::ui::dialogs;
1068 +using namespace ::com::sun::star::ui::dialogs::TemplateDescription;
1070 +//////////////////////////////////////////////////////////////////////////
1071 +// helper functions
1072 +//////////////////////////////////////////////////////////////////////////
1074 +namespace
1076 + // controling event notifications
1077 + const bool STARTUP_SUSPENDED = true;
1078 + const bool STARTUP_ALIVE = false;
1080 + uno::Sequence<rtl::OUString> SAL_CALL FilePicker_getSupportedServiceNames()
1082 + uno::Sequence<rtl::OUString> aRet(3);
1083 + aRet[0] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FilePicker");
1084 + aRet[1] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFilePicker");
1085 + aRet[2] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.KDEFilePicker");
1086 + return aRet;
1090 +//////////////////////////////////////////////////////////////////////////
1091 +// UnxFilePicker
1092 +//////////////////////////////////////////////////////////////////////////
1094 +UnxFilePicker::UnxFilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr )
1095 + : cppu::WeakComponentImplHelper8<
1096 + XFilterManager,
1097 + XFilterGroupManager,
1098 + XFilePickerControlAccess,
1099 + XFilePickerNotifier,
1100 +// TODO XFilePreview,
1101 + lang::XInitialization,
1102 + util::XCancellable,
1103 + lang::XEventListener,
1104 + lang::XServiceInfo>( m_rbHelperMtx ),
1105 + m_xServiceMgr( xServiceMgr ),
1106 + m_nFilePickerPid( -1 ),
1107 + m_nFilePickerWrite( -1 ),
1108 + m_nFilePickerRead( -1 ),
1109 + m_pNotifyThread( NULL ),
1110 + m_pCommandThread( NULL )
1114 +UnxFilePicker::~UnxFilePicker()
1116 + if ( m_nFilePickerPid > 0 )
1118 + sendCommand( ::rtl::OUString::createFromAscii( "exit" ) );
1119 + waitpid( m_nFilePickerPid, NULL, 0 );
1122 + if ( m_pCommandThread )
1124 + m_pCommandThread->join();
1126 + delete m_pCommandThread, m_pCommandThread = NULL;
1129 + if ( m_pNotifyThread )
1131 + m_pNotifyThread->exit();
1133 + m_pNotifyThread->join();
1135 + delete m_pNotifyThread, m_pNotifyThread = NULL;
1138 + if ( m_nFilePickerWrite >= 0 )
1139 + close( m_nFilePickerWrite );
1141 + if ( m_nFilePickerRead >= 0 )
1142 + close( m_nFilePickerRead );
1145 +void SAL_CALL UnxFilePicker::addFilePickerListener( const uno::Reference<XFilePickerListener>& xListener )
1146 + throw( uno::RuntimeException )
1148 + OSL_ASSERT( m_pNotifyThread );
1149 + osl::MutexGuard aGuard( m_aMutex );
1151 + m_pNotifyThread->addFilePickerListener( xListener );
1154 +void SAL_CALL UnxFilePicker::removeFilePickerListener( const uno::Reference<XFilePickerListener>& xListener )
1155 + throw( uno::RuntimeException )
1157 + OSL_ASSERT( m_pNotifyThread );
1158 + osl::MutexGuard aGuard( m_aMutex );
1160 + m_pNotifyThread->removeFilePickerListener( xListener );
1163 +void SAL_CALL UnxFilePicker::setTitle( const rtl::OUString &rTitle )
1164 + throw( uno::RuntimeException )
1166 + checkFilePicker();
1167 + ::osl::MutexGuard aGuard( m_aMutex );
1169 + ::rtl::OUStringBuffer aBuffer( 1024 );
1171 + aBuffer.appendAscii( "setTitle " );
1172 + appendEscaped( aBuffer, rTitle );
1174 + sendCommand( aBuffer.makeStringAndClear() );
1177 +sal_Int16 SAL_CALL UnxFilePicker::execute()
1178 + throw( uno::RuntimeException )
1180 + checkFilePicker();
1182 + sendCommand( ::rtl::OUString::createFromAscii( "exec" ),
1183 + m_pCommandThread->execCondition() );
1185 + return m_pCommandThread->result();
1188 +void SAL_CALL UnxFilePicker::setMultiSelectionMode( sal_Bool bMode )
1189 + throw( uno::RuntimeException )
1191 + checkFilePicker();
1192 + ::osl::MutexGuard aGuard( m_aMutex );
1194 + ::rtl::OUString aString = bMode?
1195 + ::rtl::OUString::createFromAscii( "setMultiSelection true" ):
1196 + ::rtl::OUString::createFromAscii( "setMultiSelection false" );
1198 + sendCommand( aString );
1201 +void SAL_CALL UnxFilePicker::setDefaultName( const ::rtl::OUString &rName )
1202 + throw( uno::RuntimeException )
1204 + checkFilePicker();
1205 + ::osl::MutexGuard aGuard( m_aMutex );
1207 + ::rtl::OUStringBuffer aBuffer( 1024 );
1209 + aBuffer.appendAscii( "setDefaultName " );
1210 + appendEscaped( aBuffer, rName );
1212 + sendCommand( aBuffer.makeStringAndClear() );
1215 +void SAL_CALL UnxFilePicker::setDisplayDirectory( const rtl::OUString &rDirectory )
1216 + throw( uno::RuntimeException )
1218 + checkFilePicker();
1219 + ::osl::MutexGuard aGuard( m_aMutex );
1221 + ::rtl::OUStringBuffer aBuffer( 1024 );
1223 + aBuffer.appendAscii( "setDirectory " );
1224 + appendEscaped( aBuffer, rDirectory );
1226 + sendCommand( aBuffer.makeStringAndClear() );
1229 +rtl::OUString SAL_CALL UnxFilePicker::getDisplayDirectory()
1230 + throw( uno::RuntimeException )
1232 + checkFilePicker();
1233 + ::osl::MutexGuard aGuard( m_aMutex );
1235 + sendCommand( ::rtl::OUString::createFromAscii( "getDirectory" ),
1236 + m_pCommandThread->getDirectoryCondition() );
1238 + return m_pCommandThread->getDirectory();
1241 +uno::Sequence< ::rtl::OUString > SAL_CALL UnxFilePicker::getFiles()
1242 + throw( uno::RuntimeException )
1244 + checkFilePicker();
1245 + ::osl::MutexGuard aGuard( m_aMutex );
1247 + sendCommand( ::rtl::OUString::createFromAscii( "getFiles" ),
1248 + m_pCommandThread->getFilesCondition() );
1250 + return m_pCommandThread->getFiles();
1253 +void SAL_CALL UnxFilePicker::appendFilter( const ::rtl::OUString &rTitle, const ::rtl::OUString &rFilter )
1254 + throw( lang::IllegalArgumentException, uno::RuntimeException )
1256 + checkFilePicker();
1257 + ::osl::MutexGuard aGuard( m_aMutex );
1259 + ::rtl::OUStringBuffer aBuffer( 1024 );
1261 + aBuffer.appendAscii( "appendFilter " );
1262 + appendEscaped( aBuffer, rTitle );
1263 + aBuffer.appendAscii( " ", 1 );
1264 + appendEscaped( aBuffer, rFilter );
1266 + sendCommand( aBuffer.makeStringAndClear() );
1269 +void SAL_CALL UnxFilePicker::setCurrentFilter( const rtl::OUString &rTitle )
1270 + throw( lang::IllegalArgumentException, uno::RuntimeException )
1272 + checkFilePicker();
1273 + ::osl::MutexGuard aGuard( m_aMutex );
1275 + ::rtl::OUStringBuffer aBuffer( 1024 );
1277 + aBuffer.appendAscii( "setCurrentFilter " );
1278 + appendEscaped( aBuffer, rTitle );
1280 + sendCommand( aBuffer.makeStringAndClear() );
1283 +rtl::OUString SAL_CALL UnxFilePicker::getCurrentFilter()
1284 + throw( uno::RuntimeException )
1286 + checkFilePicker();
1287 + ::osl::MutexGuard aGuard( m_aMutex );
1289 + sendCommand( ::rtl::OUString::createFromAscii( "getCurrentFilter" ),
1290 + m_pCommandThread->getCurrentFilterCondition() );
1292 + return m_pCommandThread->getCurrentFilter();
1295 +void SAL_CALL UnxFilePicker::appendFilterGroup( const rtl::OUString &rGroupTitle, const uno::Sequence<beans::StringPair> &rFilters )
1296 + throw( lang::IllegalArgumentException, uno::RuntimeException )
1298 + checkFilePicker();
1299 + ::osl::MutexGuard aGuard( m_aMutex );
1301 + ::rtl::OUStringBuffer aBuffer( 1024 );
1303 + aBuffer.appendAscii( "appendFilterGroup " );
1304 + appendEscaped( aBuffer, rGroupTitle );
1306 + for ( sal_Int32 i = 0; i < rFilters.getLength(); ++i )
1308 + beans::StringPair aPair = rFilters[i];
1310 + aBuffer.appendAscii( " ", 1 );
1311 + appendEscaped( aBuffer, aPair.First );
1312 + aBuffer.appendAscii( " ", 1 );
1313 + appendEscaped( aBuffer, aPair.Second );
1316 + sendCommand( aBuffer.makeStringAndClear() );
1319 +void SAL_CALL UnxFilePicker::setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const uno::Any &rValue )
1320 + throw( uno::RuntimeException )
1322 + checkFilePicker();
1323 + ::osl::MutexGuard aGuard( m_aMutex );
1325 + ::rtl::OUString aType;
1326 + ::rtl::OUString aAction;
1327 + sal_Int32 nTitleId;
1329 + if ( controlIdInfo( nControlId, aType, nTitleId ) && controlActionInfo( nControlAction, aAction ) )
1331 + ::rtl::OUStringBuffer aBuffer( 1024 );
1333 + aBuffer.appendAscii( "setValue " );
1334 + aBuffer.append( static_cast< sal_Int32 >( nControlId ) );
1335 + aBuffer.appendAscii( " ", 1 );
1336 + aBuffer.append( aAction );
1338 + if ( aType.equalsAscii( "checkbox" ) )
1340 + sal_Bool bControlValue;
1341 + if ( ( rValue >>= bControlValue ) && bControlValue )
1342 + aBuffer.appendAscii( " true" );
1343 + else
1344 + aBuffer.appendAscii( " false" );
1346 + else if ( aType.equalsAscii( "listbox" ) )
1348 + switch ( nControlAction )
1350 + case ControlActions::ADD_ITEM:
1351 + case ControlActions::SET_HELP_URL:
1353 + ::rtl::OUString aString;
1354 + if ( rValue >>= aString )
1356 + aBuffer.appendAscii( " ", 1 );
1357 + appendEscaped( aBuffer, aString );
1360 + break;
1362 + case ControlActions::ADD_ITEMS:
1364 + uno::Sequence< ::rtl::OUString > aSequence;
1365 + if ( rValue >>= aSequence )
1367 + for ( sal_Int32 nIdx = 0; nIdx < aSequence.getLength(); ++nIdx )
1369 + aBuffer.appendAscii( " ", 1 );
1370 + appendEscaped( aBuffer, aSequence[nIdx] );
1375 + break;
1377 + case ControlActions::DELETE_ITEM:
1378 + case ControlActions::SET_SELECT_ITEM:
1380 + sal_Int32 nInt;
1381 + if ( rValue >>= nInt )
1383 + aBuffer.appendAscii( " ", 1 );
1384 + aBuffer.append( nInt );
1387 + break;
1389 + default:
1390 + // nothing
1391 + break;
1394 + // TODO else if push button...
1396 + sendCommand( aBuffer.makeStringAndClear() );
1400 +uno::Any SAL_CALL UnxFilePicker::getValue( sal_Int16 nControlId, sal_Int16 nControlAction )
1401 + throw( uno::RuntimeException )
1403 + checkFilePicker();
1404 + ::osl::MutexGuard aGuard( m_aMutex );
1406 + ::rtl::OUString aAction;
1408 + if ( controlActionInfo( nControlAction, aAction ) )
1410 + ::rtl::OUStringBuffer aBuffer( 1024 );
1412 + aBuffer.appendAscii( "getValue " );
1413 + aBuffer.append( static_cast< sal_Int32 >( nControlId ) );
1414 + aBuffer.appendAscii( " ", 1 );
1415 + aBuffer.append( aAction );
1417 + sendCommand( aBuffer.makeStringAndClear(),
1418 + m_pCommandThread->getValueCondition() );
1420 + return m_pCommandThread->getValue();
1423 + return uno::Any();
1426 +void SAL_CALL UnxFilePicker::enableControl( sal_Int16 nControlId, sal_Bool bEnable )
1427 + throw( uno::RuntimeException )
1429 + checkFilePicker();
1430 + ::osl::MutexGuard aGuard( m_aMutex );
1432 + ::rtl::OUStringBuffer aBuffer( 1024 );
1434 + aBuffer.appendAscii( "enableControl " );
1435 + aBuffer.append( static_cast< sal_Int32 >( nControlId ) );
1436 + aBuffer.appendAscii( bEnable? " true": " false" );
1438 + sendCommand( aBuffer.makeStringAndClear() );
1441 +void SAL_CALL UnxFilePicker::setLabel( sal_Int16 nControlId, const ::rtl::OUString &rLabel )
1442 + throw( uno::RuntimeException )
1444 + checkFilePicker();
1445 + ::osl::MutexGuard aGuard( m_aMutex );
1447 + ::rtl::OUStringBuffer aBuffer( 1024 );
1449 + aBuffer.appendAscii( "setLabel " );
1450 + aBuffer.append( static_cast< sal_Int32 >( nControlId ) );
1451 + aBuffer.appendAscii( " ", 1 );
1452 + appendEscaped( aBuffer, rLabel );
1454 + sendCommand( aBuffer.makeStringAndClear() );
1457 +rtl::OUString SAL_CALL UnxFilePicker::getLabel(sal_Int16 nControlId)
1458 + throw ( uno::RuntimeException )
1460 + // FIXME getLabel() is not yet implemented
1461 + checkFilePicker();
1462 + ::osl::MutexGuard aGuard( m_aMutex );
1464 + // TODO return m_pImpl->getLabel(nControlId);
1465 + return ::rtl::OUString();
1468 +/* TODO
1469 +uno::Sequence<sal_Int16> SAL_CALL UnxFilePicker::getSupportedImageFormats()
1470 + throw( uno::RuntimeException )
1472 + checkFilePicker();
1473 + ::osl::MutexGuard aGuard( m_aMutex );
1475 + return m_pImpl->getSupportedImageFormats();
1478 +sal_Int32 SAL_CALL UnxFilePicker::getTargetColorDepth()
1479 + throw( uno::RuntimeException )
1481 + checkFilePicker();
1482 + ::osl::MutexGuard aGuard( m_aMutex );
1484 + return m_pImpl->getTargetColorDepth();
1487 +sal_Int32 SAL_CALL UnxFilePicker::getAvailableWidth()
1488 + throw( uno::RuntimeException )
1490 + checkFilePicker();
1491 + ::osl::MutexGuard aGuard( m_aMutex );
1493 + return m_pImpl->getAvailableWidth();
1496 +sal_Int32 SAL_CALL UnxFilePicker::getAvailableHeight()
1497 + throw( uno::RuntimeException )
1499 + checkFilePicker();
1500 + ::osl::MutexGuard aGuard( m_aMutex );
1502 + return m_pImpl->getAvailableHeight();
1505 +void SAL_CALL UnxFilePicker::setImage( sal_Int16 aImageFormat, const uno::Any &rImage )
1506 + throw( lang::IllegalArgumentException, uno::RuntimeException )
1508 + checkFilePicker();
1509 + ::osl::MutexGuard aGuard( m_aMutex );
1511 + m_pImpl->setImage( aImageFormat, aImage );
1514 +sal_Bool SAL_CALL UnxFilePicker::setShowState( sal_Bool bShowState )
1515 + throw( uno::RuntimeException )
1517 + checkFilePicker();
1518 + ::osl::MutexGuard aGuard( m_aMutex );
1520 + return m_pImpl->setShowState( bShowState );
1523 +sal_Bool SAL_CALL UnxFilePicker::getShowState()
1524 + throw( uno::RuntimeException )
1526 + checkFilePicker();
1527 + ::osl::MutexGuard aGuard( m_aMutex );
1529 + return m_pImpl->getShowState();
1533 +void SAL_CALL UnxFilePicker::initialize( const uno::Sequence<uno::Any> &rArguments )
1534 + throw( uno::Exception, uno::RuntimeException )
1536 + initFilePicker();
1538 + // parameter checking
1539 + uno::Any aAny;
1540 + if ( 0 == rArguments.getLength( ) )
1541 + throw lang::IllegalArgumentException(
1542 + rtl::OUString::createFromAscii( "no arguments" ),
1543 + static_cast< XFilePicker* >( this ), 1 );
1545 + aAny = rArguments[0];
1547 + if ( ( aAny.getValueType() != ::getCppuType( (sal_Int16*)0 ) ) && ( aAny.getValueType() != ::getCppuType( (sal_Int8*)0 ) ) )
1548 + throw lang::IllegalArgumentException(
1549 + rtl::OUString::createFromAscii( "invalid argument type" ),
1550 + static_cast< XFilePicker* >( this ), 1 );
1552 + sal_Int16 templateId = -1;
1553 + aAny >>= templateId;
1555 + ::rtl::OUString aTypeOpen = ::rtl::OUString::createFromAscii( "setType \"open\"" );
1556 + ::rtl::OUString aTypeSaveAs = ::rtl::OUString::createFromAscii( "setType \"save\"" );
1558 + switch ( templateId )
1560 + case FILEOPEN_SIMPLE:
1561 + sendCommand( aTypeOpen );
1562 + break;
1564 + case FILESAVE_SIMPLE:
1565 + sendCommand( aTypeSaveAs );
1566 + break;
1568 + case FILESAVE_AUTOEXTENSION_PASSWORD:
1569 + sendCommand( aTypeSaveAs );
1571 + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
1572 + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD );
1573 + break;
1575 + case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS:
1576 + sendCommand( aTypeSaveAs );
1578 + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
1579 + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD );
1580 + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS );
1581 + break;
1583 + case FILESAVE_AUTOEXTENSION_SELECTION:
1584 + sendCommand( aTypeSaveAs );
1586 + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
1587 + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_SELECTION );
1588 + break;
1590 + case FILESAVE_AUTOEXTENSION_TEMPLATE:
1591 + sendCommand( aTypeSaveAs );
1593 + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
1594 + sendAppendControlCommand( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE );
1595 + break;
1597 + case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE:
1598 + sendCommand( aTypeOpen );
1600 + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_LINK );
1601 + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW );
1602 + sendAppendControlCommand( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE );
1603 + break;
1605 + case FILEOPEN_PLAY:
1606 + sendCommand( aTypeOpen );
1608 + sendAppendControlCommand( ExtendedFilePickerElementIds::PUSHBUTTON_PLAY );
1609 + break;
1611 + case FILEOPEN_READONLY_VERSION:
1612 + sendCommand( aTypeOpen );
1614 + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_READONLY );
1615 + sendAppendControlCommand( ExtendedFilePickerElementIds::LISTBOX_VERSION );
1616 + break;
1618 + case FILEOPEN_LINK_PREVIEW:
1619 + sendCommand( aTypeOpen );
1621 + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_LINK );
1622 + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW );
1623 + break;
1625 + case FILESAVE_AUTOEXTENSION:
1626 + sendCommand( aTypeSaveAs );
1628 + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
1629 + break;
1631 + default:
1632 + throw lang::IllegalArgumentException(
1633 + rtl::OUString::createFromAscii( "Unknown template" ),
1634 + static_cast< XFilePicker* >( this ),
1635 + 1 );
1639 +void SAL_CALL UnxFilePicker::cancel()
1640 + throw ( uno::RuntimeException )
1642 + // FIXME cancel() is not implemented
1643 + checkFilePicker();
1644 + ::osl::MutexGuard aGuard( m_aMutex );
1646 + // TODO m_pImpl->cancel();
1649 +void SAL_CALL UnxFilePicker::disposing( const lang::EventObject &rEvent )
1650 + throw( uno::RuntimeException )
1652 + uno::Reference<XFilePickerListener> xFilePickerListener( rEvent.Source, uno::UNO_QUERY );
1654 + if ( xFilePickerListener.is() )
1655 + removeFilePickerListener( xFilePickerListener );
1658 +rtl::OUString SAL_CALL UnxFilePicker::getImplementationName()
1659 + throw( uno::RuntimeException )
1661 + return rtl::OUString::createFromAscii( FILE_PICKER_IMPL_NAME );
1664 +sal_Bool SAL_CALL UnxFilePicker::supportsService( const rtl::OUString& ServiceName )
1665 + throw( uno::RuntimeException )
1667 + uno::Sequence< ::rtl::OUString > SupportedServicesNames = FilePicker_getSupportedServiceNames();
1669 + for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
1671 + if ( SupportedServicesNames[n].compareTo( ServiceName ) == 0 )
1672 + return sal_True;
1675 + return sal_False;
1678 +uno::Sequence< ::rtl::OUString > SAL_CALL UnxFilePicker::getSupportedServiceNames()
1679 + throw( uno::RuntimeException )
1681 + return FilePicker_getSupportedServiceNames();
1684 +void UnxFilePicker::initFilePicker()
1686 + int aFiledesStdin[2], aFiledesStdout[2];
1687 + if ( pipe( aFiledesStdin ) < 0 || pipe( aFiledesStdout ) < 0 )
1688 + return;
1690 + m_nFilePickerPid = fork();
1691 + if ( m_nFilePickerPid < 0 )
1692 + return;
1694 + if ( m_nFilePickerPid == 0 )
1696 + // Child...
1697 + close( aFiledesStdin[1] ); // write end of the pipe
1698 + dup2( aFiledesStdin[0], 0 );
1699 + close( aFiledesStdin[0] );
1701 + close( aFiledesStdout[0] ); // read end of the pipe
1702 + dup2( aFiledesStdout[1], 1 );
1703 + close( aFiledesStdout[1] );
1705 +#if OSL_DEBUG_LEVEL == 0
1706 + int nRedirect = open( "/dev/null", O_WRONLY );
1707 + if( nRedirect != -1 )
1709 + dup2( nRedirect, 2 );
1711 +#endif
1713 + // FIXME: window id, etc.
1714 + const char *pFname = "kdefilepicker";
1716 + execlp( pFname, pFname, NULL );
1718 + // Error, finish the child
1719 + exit( -1 );
1722 + // Parent continues
1723 + close( aFiledesStdin[0] );
1724 + m_nFilePickerWrite = aFiledesStdin[1];
1726 + close( aFiledesStdout[1] );
1727 + m_nFilePickerRead = aFiledesStdout[0];
1729 + // Create the notify thread
1730 + if ( !m_pNotifyThread )
1731 + m_pNotifyThread = new UnxFilePickerNotifyThread( this );
1733 + // Create the command thread
1734 + if ( !m_pCommandThread )
1735 + m_pCommandThread = new UnxFilePickerCommandThread( m_pNotifyThread, m_nFilePickerRead );
1737 + // Start the threads
1738 + m_pNotifyThread->create();
1739 + m_pCommandThread->create();
1741 + return;
1744 +void UnxFilePicker::checkFilePicker() throw( ::com::sun::star::uno::RuntimeException )
1746 + if ( m_nFilePickerPid > 0 )
1748 + // TODO check if external file picker is runnning
1750 + else
1752 + throw uno::RuntimeException(
1753 + ::rtl::OUString::createFromAscii( "the external file picker does not run" ),
1754 + *this );
1758 +void UnxFilePicker::sendCommand( const ::rtl::OUString &rCommand )
1760 + if ( m_nFilePickerWrite < 0 )
1761 + return;
1763 + ::rtl::OString aUtfString = OUStringToOString( rCommand + ::rtl::OUString::createFromAscii( "\n" ), RTL_TEXTENCODING_UTF8 );
1765 +#if OSL_DEBUG_LEVEL > 0
1766 + ::std::cerr << "UnxFilePicker sent: \"" << aUtfString.getStr() << "\"" << ::std::endl;
1767 +#endif
1769 + write( m_nFilePickerWrite, aUtfString.getStr(), aUtfString.getLength() );
1772 +void UnxFilePicker::sendCommand( const ::rtl::OUString &rCommand, ::osl::Condition &rCondition )
1774 + rCondition.reset();
1776 + sendCommand( rCommand );
1778 + rCondition.wait();
1781 +void UnxFilePicker::appendEscaped( ::rtl::OUStringBuffer &rBuffer, const ::rtl::OUString &rString )
1783 + const sal_Unicode *pUnicode = rString.getStr();
1784 + const sal_Unicode *pEnd = pUnicode + rString.getLength();
1786 + rBuffer.appendAscii( "\"" , 1 );
1788 + for ( ; pUnicode != pEnd; ++pUnicode )
1790 + if ( *pUnicode == '\\' )
1791 + rBuffer.appendAscii( "\\\\", 2 );
1792 + else if ( *pUnicode == '"' )
1793 + rBuffer.appendAscii( "\\\"", 2 );
1794 + else if ( *pUnicode == '\n' )
1795 + rBuffer.appendAscii( "\\n", 2 );
1796 + else
1797 + rBuffer.append( *pUnicode );
1800 + rBuffer.appendAscii( "\"", 1 );
1803 +sal_Bool UnxFilePicker::controlIdInfo( sal_Int16 nControlId, ::rtl::OUString &rType, sal_Int32 &rTitleId )
1805 + typedef struct {
1806 + sal_Int16 nId;
1807 + const ::rtl::OUString *pType;
1808 + sal_Int32 nTitle;
1809 + } ElementToName;
1811 + const ::rtl::OUString aCheckBox( RTL_CONSTASCII_USTRINGPARAM( "checkbox" ) );
1812 + const ::rtl::OUString aControl( RTL_CONSTASCII_USTRINGPARAM( "control" ) );
1813 + const ::rtl::OUString aEdit( RTL_CONSTASCII_USTRINGPARAM( "edit" ) );
1814 + const ::rtl::OUString aLabel( RTL_CONSTASCII_USTRINGPARAM( "label" ) );
1815 + const ::rtl::OUString aListBox( RTL_CONSTASCII_USTRINGPARAM( "listbox" ) );
1816 + const ::rtl::OUString aPushButton( RTL_CONSTASCII_USTRINGPARAM( "pushbutton" ) );
1818 + const ElementToName *pPtr;
1819 + const ElementToName pArray[] =
1821 + { CommonFilePickerElementIds::PUSHBUTTON_OK, &aPushButton, 0/*FIXME?*/ },
1822 + { CommonFilePickerElementIds::PUSHBUTTON_CANCEL, &aPushButton, 0/*FIXME?*/ },
1823 + { CommonFilePickerElementIds::LISTBOX_FILTER, &aListBox, 0/*FIXME?*/ },
1824 + { CommonFilePickerElementIds::CONTROL_FILEVIEW, &aControl, 0/*FIXME?*/ },
1825 + { CommonFilePickerElementIds::EDIT_FILEURL, &aEdit, 0/*FIXME?*/ },
1826 + { CommonFilePickerElementIds::LISTBOX_FILTER_LABEL, &aLabel, 0/*FIXME?*/ },
1827 + { CommonFilePickerElementIds::EDIT_FILEURL_LABEL, &aLabel, 0/*FIXME?*/ },
1829 + { ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, &aCheckBox, STR_SVT_FILEPICKER_AUTO_EXTENSION },
1830 + { ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, &aCheckBox, STR_SVT_FILEPICKER_PASSWORD },
1831 + { ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS, &aCheckBox, STR_SVT_FILEPICKER_FILTER_OPTIONS },
1832 + { ExtendedFilePickerElementIds::CHECKBOX_READONLY, &aCheckBox, STR_SVT_FILEPICKER_READONLY },
1833 + { ExtendedFilePickerElementIds::CHECKBOX_LINK, &aCheckBox, STR_SVT_FILEPICKER_INSERT_AS_LINK },
1834 + { ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, &aCheckBox, STR_SVT_FILEPICKER_SHOW_PREVIEW },
1835 + { ExtendedFilePickerElementIds::PUSHBUTTON_PLAY, &aPushButton, STR_SVT_FILEPICKER_PLAY },
1836 + { ExtendedFilePickerElementIds::LISTBOX_VERSION, &aListBox, STR_SVT_FILEPICKER_VERSION },
1837 + { ExtendedFilePickerElementIds::LISTBOX_TEMPLATE, &aListBox, STR_SVT_FILEPICKER_TEMPLATES },
1838 + { ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE, &aListBox, STR_SVT_FILEPICKER_IMAGE_TEMPLATE },
1839 + { ExtendedFilePickerElementIds::CHECKBOX_SELECTION, &aCheckBox, STR_SVT_FILEPICKER_SELECTION },
1840 + { 0, 0, 0 }
1841 + };
1843 + for ( pPtr = pArray; pPtr->nId && ( pPtr->nId != nControlId ); ++pPtr )
1846 + if ( pPtr->nId == nControlId )
1848 + rType = *(pPtr->pType);
1849 + rTitleId = pPtr->nTitle;
1851 + return sal_True;
1854 + return sal_False;
1857 +sal_Bool UnxFilePicker::controlActionInfo( sal_Int16 nControlAction, ::rtl::OUString &rType )
1859 + typedef struct {
1860 + sal_Int16 nId;
1861 + const ::rtl::OUString pType;
1862 + } ElementToName;
1864 + const ElementToName *pPtr;
1865 + const ElementToName pArray[] =
1867 + { ControlActions::ADD_ITEM, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "addItem" ) ) },
1868 + { ControlActions::ADD_ITEMS, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "addItems" ) ) },
1869 + { ControlActions::DELETE_ITEM, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "deleteItem" ) ) },
1870 + { ControlActions::DELETE_ITEMS, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "deleteItems" ) ) },
1871 + { ControlActions::SET_SELECT_ITEM, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "setSelectedItem" ) ) },
1872 + { ControlActions::GET_ITEMS, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getItems" ) ) },
1873 + { ControlActions::GET_SELECTED_ITEM, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getSelectedItem" ) ) },
1874 + { ControlActions::GET_SELECTED_ITEM_INDEX, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getSelectedItemIndex" ) ) },
1875 + { ControlActions::SET_HELP_URL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "setHelpURL" ) ) },
1876 + { ControlActions::GET_HELP_URL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getHelpURL" ) ) },
1877 + { 0, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "noAction" ) ) }
1878 + };
1880 + for ( pPtr = pArray; pPtr->nId && ( pPtr->nId != nControlAction ); ++pPtr )
1883 + rType = pPtr->pType;
1885 + return sal_True;
1888 +void UnxFilePicker::sendAppendControlCommand( sal_Int16 nControlId )
1890 + ::rtl::OUString aType;
1891 + sal_Int32 nTitleId;
1893 + if ( controlIdInfo( nControlId, aType, nTitleId ) )
1895 + ::rtl::OUStringBuffer aBuffer( 1024 );
1897 + aBuffer.appendAscii( "appendControl " );
1898 + aBuffer.append( static_cast< sal_Int32 >( nControlId ) );
1899 + aBuffer.appendAscii( " ", 1 );
1900 + appendEscaped( aBuffer, aType );
1901 + aBuffer.appendAscii( " ", 1 );
1902 + appendEscaped( aBuffer, String( SvtResId( nTitleId ) ) );
1904 + sendCommand( aBuffer.makeStringAndClear() );
1907 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
1908 +++ fpicker/source/unx/kde_unx/UnxFilePicker.hxx 2004-06-16 13:57:49.733143432 +0200
1909 @@ -0,0 +1,238 @@
1910 +/*************************************************************************
1918 + * The Contents of this file are made available subject to the terms of
1919 + * either of the following licenses
1921 + * - GNU Lesser General Public License Version 2.1
1922 + * - Sun Industry Standards Source License Version 1.1
1924 + * Sun Microsystems Inc., October, 2000
1926 + * GNU Lesser General Public License Version 2.1
1927 + * =============================================
1928 + * Copyright 2000 by Sun Microsystems, Inc.
1929 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
1931 + * This library is free software; you can redistribute it and/or
1932 + * modify it under the terms of the GNU Lesser General Public
1933 + * License version 2.1, as published by the Free Software Foundation.
1935 + * This library is distributed in the hope that it will be useful,
1936 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1937 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1938 + * Lesser General Public License for more details.
1940 + * You should have received a copy of the GNU Lesser General Public
1941 + * License along with this library; if not, write to the Free Software
1942 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1943 + * MA 02111-1307 USA
1946 + * Sun Industry Standards Source License Version 1.1
1947 + * =================================================
1948 + * The contents of this file are subject to the Sun Industry Standards
1949 + * Source License Version 1.1 (the "License"); You may not use this file
1950 + * except in compliance with the License. You may obtain a copy of the
1951 + * License at http://www.openoffice.org/license.html.
1953 + * Software provided under this License is provided on an "AS IS" basis,
1954 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
1955 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
1956 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
1957 + * See the License for the specific provisions governing your rights and
1958 + * obligations concerning the Software.
1960 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
1962 + * Copyright: 2000 by Sun Microsystems, Inc.
1964 + * All Rights Reserved.
1966 + * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
1969 + ************************************************************************/
1971 +#ifndef _UNXFILEPICKER_HXX_
1972 +#define _UNXFILEPICKER_HXX_
1974 +#ifndef _CPPUHELPER_COMPBASE8_HXX_
1975 +#include <cppuhelper/compbase8.hxx>
1976 +#endif
1978 +#ifndef _OSL_CONDITN_HXX_
1979 +#include <osl/conditn.hxx>
1980 +#endif
1982 +#ifndef _OSL_MUTEX_HXX_
1983 +#include <osl/mutex.hxx>
1984 +#endif
1986 +#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
1987 +#include <com/sun/star/lang/XInitialization.hpp>
1988 +#endif
1990 +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
1991 +#include <com/sun/star/lang/XServiceInfo.hpp>
1992 +#endif
1994 +#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERNOTIFIER_HPP_
1995 +#include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
1996 +#endif
1998 +#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILTERMANAGER_HPP_
1999 +#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
2000 +#endif
2002 +#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILTERGROUPMANAGER_HPP_
2003 +#include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp>
2004 +#endif
2006 +#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERCONTROLACCESS_HPP_
2007 +#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
2008 +#endif
2010 +#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPREVIEW_HPP_
2011 +#include <com/sun/star/ui/dialogs/XFilePreview.hpp>
2012 +#endif
2014 +#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_
2015 +#include <com/sun/star/util/XCancellable.hpp>
2016 +#endif
2018 +#ifndef _RTL_USTRBUF_HXX_
2019 +#include <rtl/ustrbuf.hxx>
2020 +#endif
2022 +#include <list>
2024 +class UnxFilePickerCommandThread;
2025 +class UnxFilePickerNotifyThread;
2027 +class UnxFilePickerDummy
2029 +protected:
2030 + osl::Mutex m_aMutex;
2031 + osl::Mutex m_rbHelperMtx;
2034 +class UnxFilePicker :
2035 + public UnxFilePickerDummy,
2036 + public cppu::WeakComponentImplHelper8<
2037 + ::com::sun::star::ui::dialogs::XFilterManager,
2038 + ::com::sun::star::ui::dialogs::XFilterGroupManager,
2039 + ::com::sun::star::ui::dialogs::XFilePickerControlAccess,
2040 + ::com::sun::star::ui::dialogs::XFilePickerNotifier,
2041 +// TODO ::com::sun::star::ui::dialogs::XFilePreview,
2042 + ::com::sun::star::lang::XInitialization,
2043 + ::com::sun::star::util::XCancellable,
2044 + ::com::sun::star::lang::XEventListener,
2045 + ::com::sun::star::lang::XServiceInfo >
2047 +protected:
2048 + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceMgr; // to instanciate own services
2050 + pid_t m_nFilePickerPid;
2051 + int m_nFilePickerWrite; // (kde|...)filepicker gets it as stdin
2052 + int m_nFilePickerRead; // (kde|...)filepicker gets it as stdout
2054 + UnxFilePickerNotifyThread *m_pNotifyThread;
2055 + UnxFilePickerCommandThread *m_pCommandThread;
2057 +public:
2058 + UnxFilePicker( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceMgr );
2059 + virtual ~UnxFilePicker();
2061 + // XFilePickerNotifier
2063 + virtual void SAL_CALL addFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException );
2064 + virtual void SAL_CALL removeFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException );
2066 + // XExecutableDialog functions
2068 + virtual void SAL_CALL setTitle( const ::rtl::OUString &rTitle ) throw( ::com::sun::star::uno::RuntimeException );
2069 + virtual sal_Int16 SAL_CALL execute() throw( ::com::sun::star::uno::RuntimeException );
2071 + // XFilePicker functions
2073 + virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode ) throw( ::com::sun::star::uno::RuntimeException );
2074 + virtual void SAL_CALL setDefaultName( const ::rtl::OUString &rName ) throw( ::com::sun::star::uno::RuntimeException );
2075 + virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString &rDirectory ) throw( ::com::sun::star::uno::RuntimeException );
2076 + virtual ::rtl::OUString SAL_CALL getDisplayDirectory() throw( ::com::sun::star::uno::RuntimeException );
2077 + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles() throw( ::com::sun::star::uno::RuntimeException );
2079 + // XFilterManager functions
2081 + virtual void SAL_CALL appendFilter( const ::rtl::OUString &rTitle, const ::rtl::OUString &rFilter ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
2082 + virtual void SAL_CALL setCurrentFilter( const ::rtl::OUString &rTitle ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
2083 + virtual ::rtl::OUString SAL_CALL getCurrentFilter() throw( ::com::sun::star::uno::RuntimeException );
2085 + // XFilterGroupManager functions
2087 + virtual void SAL_CALL appendFilterGroup( const ::rtl::OUString &rGroupTitle, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > &rFilters ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
2089 + // XFilePickerControlAccess functions
2091 + virtual void SAL_CALL setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const ::com::sun::star::uno::Any &rValue ) throw (::com::sun::star::uno::RuntimeException);
2092 + virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 nControlId, sal_Int16 nControlAction ) throw (::com::sun::star::uno::RuntimeException);
2093 + virtual void SAL_CALL enableControl( sal_Int16 nControlId, sal_Bool bEnable ) throw( ::com::sun::star::uno::RuntimeException );
2094 + virtual void SAL_CALL setLabel( sal_Int16 nControlId, const ::rtl::OUString &rLabel ) throw (::com::sun::star::uno::RuntimeException);
2095 + virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 nControlId ) throw (::com::sun::star::uno::RuntimeException);
2097 + /* TODO XFilePreview
2099 + virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( ) throw (::com::sun::star::uno::RuntimeException);
2100 + virtual sal_Int32 SAL_CALL getTargetColorDepth( ) throw (::com::sun::star::uno::RuntimeException);
2101 + virtual sal_Int32 SAL_CALL getAvailableWidth( ) throw (::com::sun::star::uno::RuntimeException);
2102 + virtual sal_Int32 SAL_CALL getAvailableHeight( ) throw (::com::sun::star::uno::RuntimeException);
2103 + virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any &rImage ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
2104 + virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) throw (::com::sun::star::uno::RuntimeException);
2105 + virtual sal_Bool SAL_CALL getShowState( ) throw (::com::sun::star::uno::RuntimeException);
2106 + */
2108 + // XInitialization
2110 + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > &rArguments ) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException );
2112 + // XCancellable
2114 + virtual void SAL_CALL cancel( ) throw( ::com::sun::star::uno::RuntimeException );
2116 + // XEventListener
2118 + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject &rEvent ) throw( ::com::sun::star::uno::RuntimeException );
2120 + // XServiceInfo
2122 + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
2123 + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString &rServiceName ) throw( ::com::sun::star::uno::RuntimeException );
2124 + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
2126 +private:
2127 + // prevent copy and assignment
2128 + UnxFilePicker( const UnxFilePicker& );
2129 + UnxFilePicker& operator=( const UnxFilePicker& );
2131 +protected:
2132 + void initFilePicker();
2133 + void checkFilePicker() throw( ::com::sun::star::uno::RuntimeException );
2135 + // Async sendCommand
2136 + void sendCommand( const ::rtl::OUString &rCommand );
2137 + // Synchronized sendCommand
2138 + void sendCommand( const ::rtl::OUString &rCommand, ::osl::Condition &rCondition );
2139 + void appendEscaped( ::rtl::OUStringBuffer &rBuffer, const ::rtl::OUString &rString );
2141 +private:
2142 + sal_Bool controlIdInfo( sal_Int16 nControlId, ::rtl::OUString &rType, sal_Int32 &rTitleId );
2143 + sal_Bool controlActionInfo( sal_Int16 nControlId, ::rtl::OUString &rType );
2144 + void sendAppendControlCommand( sal_Int16 nControlId );
2145 +};
2147 +#endif // _UNXFILEPICKER_HXX_
2148 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
2149 +++ fpicker/source/unx/kde_unx/UnxNotifyThread.cxx 2004-06-16 17:38:35.509479352 +0200
2150 @@ -0,0 +1,150 @@
2151 +/*************************************************************************
2159 + * The Contents of this file are made available subject to the terms of
2160 + * either of the following licenses
2162 + * - GNU Lesser General Public License Version 2.1
2163 + * - Sun Industry Standards Source License Version 1.1
2165 + * Sun Microsystems Inc., October, 2000
2167 + * GNU Lesser General Public License Version 2.1
2168 + * =============================================
2169 + * Copyright 2000 by Sun Microsystems, Inc.
2170 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
2172 + * This library is free software; you can redistribute it and/or
2173 + * modify it under the terms of the GNU Lesser General Public
2174 + * License version 2.1, as published by the Free Software Foundation.
2176 + * This library is distributed in the hope that it will be useful,
2177 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2178 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2179 + * Lesser General Public License for more details.
2181 + * You should have received a copy of the GNU Lesser General Public
2182 + * License along with this library; if not, write to the Free Software
2183 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
2184 + * MA 02111-1307 USA
2187 + * Sun Industry Standards Source License Version 1.1
2188 + * =================================================
2189 + * The contents of this file are subject to the Sun Industry Standards
2190 + * Source License Version 1.1 (the "License"); You may not use this file
2191 + * except in compliance with the License. You may obtain a copy of the
2192 + * License at http://www.openoffice.org/license.html.
2194 + * Software provided under this License is provided on an "AS IS" basis,
2195 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
2196 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
2197 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
2198 + * See the License for the specific provisions governing your rights and
2199 + * obligations concerning the Software.
2201 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
2203 + * Copyright: 2000 by Sun Microsystems, Inc.
2205 + * All Rights Reserved.
2207 + * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
2210 + ************************************************************************/
2212 +#ifndef _UNXNOTIFYTHREAD_HXX_
2213 +#include <UnxNotifyThread.hxx>
2214 +#endif
2216 +#ifndef _UNXFILEOPENIMPL_HXX_
2217 +#include <UnxFilePicker.hxx>
2218 +#endif
2220 +using namespace ::com::sun::star;
2222 +//////////////////////////////////////////////////////////////////////////
2223 +// UnxFilePickerNotifyThread
2224 +//////////////////////////////////////////////////////////////////////////
2226 +UnxFilePickerNotifyThread::UnxFilePickerNotifyThread( UnxFilePicker *pUnxFilePicker )
2227 + : m_pUnxFilePicker( pUnxFilePicker ),
2228 + m_bExit( sal_False ),
2229 + m_eNotifyType( Nothing ),
2230 + m_nControlId( 0 )
2234 +void SAL_CALL UnxFilePickerNotifyThread::addFilePickerListener( const uno::Reference< ui::dialogs::XFilePickerListener >& xListener )
2235 + throw( uno::RuntimeException )
2237 + ::osl::MutexGuard aGuard( m_aMutex );
2239 + m_xListener = xListener;
2242 +void SAL_CALL UnxFilePickerNotifyThread::removeFilePickerListener( const uno::Reference< ui::dialogs::XFilePickerListener >& xListener )
2243 + throw( uno::RuntimeException )
2245 + ::osl::MutexGuard aGuard( m_aMutex );
2247 + m_xListener.clear();
2250 +void SAL_CALL UnxFilePickerNotifyThread::exit()
2252 + ::osl::MutexGuard aGuard( m_aMutex );
2254 + m_bExit = sal_True;
2256 + m_aExitCondition.reset();
2257 + m_aNotifyCondition.set();
2259 + m_aExitCondition.wait();
2262 +void SAL_CALL UnxFilePickerNotifyThread::fileSelectionChanged()
2264 + ::osl::MutexGuard aGuard( m_aMutex );
2266 + m_eNotifyType = FileSelectionChanged;
2267 + m_nControlId = 0;
2269 + m_aNotifyCondition.set();
2272 +void SAL_CALL UnxFilePickerNotifyThread::run()
2274 + do {
2275 + m_aNotifyCondition.reset();
2276 + m_aNotifyCondition.wait();
2278 + if ( m_xListener.is() && m_pUnxFilePicker )
2280 + ::osl::MutexGuard aGuard( m_aMutex );
2282 + ui::dialogs::FilePickerEvent aEvent( *m_pUnxFilePicker, m_nControlId );
2284 + switch ( m_eNotifyType )
2286 + case FileSelectionChanged:
2287 + m_xListener->fileSelectionChanged( aEvent );
2288 + break;
2290 + // TODO More to come...
2292 + default:
2293 + // nothing
2294 + break;
2297 + } while ( !m_bExit );
2299 + m_aExitCondition.set();
2301 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
2302 +++ fpicker/source/unx/kde_unx/UnxNotifyThread.hxx 2004-06-16 17:30:52.535862040 +0200
2303 @@ -0,0 +1,132 @@
2304 +/*************************************************************************
2312 + * The Contents of this file are made available subject to the terms of
2313 + * either of the following licenses
2315 + * - GNU Lesser General Public License Version 2.1
2316 + * - Sun Industry Standards Source License Version 1.1
2318 + * Sun Microsystems Inc., October, 2000
2320 + * GNU Lesser General Public License Version 2.1
2321 + * =============================================
2322 + * Copyright 2000 by Sun Microsystems, Inc.
2323 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
2325 + * This library is free software; you can redistribute it and/or
2326 + * modify it under the terms of the GNU Lesser General Public
2327 + * License version 2.1, as published by the Free Software Foundation.
2329 + * This library is distributed in the hope that it will be useful,
2330 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2331 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2332 + * Lesser General Public License for more details.
2334 + * You should have received a copy of the GNU Lesser General Public
2335 + * License along with this library; if not, write to the Free Software
2336 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
2337 + * MA 02111-1307 USA
2340 + * Sun Industry Standards Source License Version 1.1
2341 + * =================================================
2342 + * The contents of this file are subject to the Sun Industry Standards
2343 + * Source License Version 1.1 (the "License"); You may not use this file
2344 + * except in compliance with the License. You may obtain a copy of the
2345 + * License at http://www.openoffice.org/license.html.
2347 + * Software provided under this License is provided on an "AS IS" basis,
2348 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
2349 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
2350 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
2351 + * See the License for the specific provisions governing your rights and
2352 + * obligations concerning the Software.
2354 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
2356 + * Copyright: 2000 by Sun Microsystems, Inc.
2358 + * All Rights Reserved.
2360 + * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
2363 + ************************************************************************/
2365 +#ifndef _UNXNOTIFYTHREAD_HXX_
2366 +#define _UNXNOTIFYTHREAD_HXX_
2368 +#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERLISTENER_HPP_
2369 +#include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
2370 +#endif
2372 +#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
2373 +#include <com/sun/star/uno/Reference.hxx>
2374 +#endif
2376 +#ifndef _OSL_CONDITN_HXX_
2377 +#include <osl/conditn.hxx>
2378 +#endif
2380 +#ifndef _OSL_MUTEX_HXX_
2381 +#include <osl/mutex.hxx>
2382 +#endif
2384 +#ifndef _OSL_THREAD_HXX_
2385 +#include <osl/thread.hxx>
2386 +#endif
2388 +class UnxFilePicker;
2390 +class UnxFilePickerNotifyThread : public ::osl::Thread
2392 +protected:
2393 + enum NotifyType
2395 + Nothing = 0,
2396 + FileSelectionChanged
2397 + // TODO More to come...
2398 + };
2400 + UnxFilePicker *m_pUnxFilePicker;
2402 + ::osl::Mutex m_aMutex;
2404 + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener > m_xListener;
2406 + sal_Bool m_bExit;
2407 + ::osl::Condition m_aExitCondition;
2409 + NotifyType m_eNotifyType;
2410 + ::osl::Condition m_aNotifyCondition;
2411 + sal_Int16 m_nControlId;
2413 +public:
2414 + UnxFilePickerNotifyThread( UnxFilePicker *pUnxFilePicker );
2416 + virtual void SAL_CALL addFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener )
2417 + throw( ::com::sun::star::uno::RuntimeException );
2418 + virtual void SAL_CALL removeFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener )
2419 + throw( ::com::sun::star::uno::RuntimeException );
2421 + void SAL_CALL exit();
2423 + void SAL_CALL fileSelectionChanged();
2424 + /* TODO
2425 + void SAL_CALL directoryChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent );
2426 + rtl::OUString SAL_CALL helpRequested( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ) const;
2427 + void SAL_CALL controlStateChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent );
2428 + void SAL_CALL dialogSizeChanged( );
2429 + */
2431 +protected:
2432 + virtual void SAL_CALL run();
2435 +#endif // _UNXNOTIFYTHREAD_HXX_
2436 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
2437 +++ fpicker/source/unx/kde_unx/fps-kde-ucd.txt 2004-06-16 17:30:52.535862040 +0200
2438 @@ -0,0 +1,6 @@
2439 +[ComponentDescriptor]
2440 +ImplementationName=com.sun.star.ui.dialogs.UnxFilePicker
2441 +ComponentName=fps_kde.uno.so
2442 +LoaderName=com.sun.star.loader.SharedLibrary
2443 +[SupportedServices]
2444 +com.sun.star.ui.dialogs.KDEFilePicker