1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: FilePicker.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_fpicker.hxx"
34 //------------------------------------------------------------------------
36 //------------------------------------------------------------------------
39 #include <com/sun/star/lang/DisposedException.hpp>
40 #include <cppuhelper/interfacecontainer.h>
41 #include <osl/diagnose.h>
43 #ifndef _FILEPICKER_HXX_
44 #include "filepicker.hxx"
46 #include "WinFileOpenImpl.hxx"
48 #include "FPServiceInfo.hxx"
49 #include "..\misc\WinImplHelper.hxx"
50 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
51 #include "filepickereventnotification.hxx"
53 #include <comphelper/sequenceasvector.hxx>
55 //------------------------------------------------------------------------
56 // namespace directives
57 //------------------------------------------------------------------------
59 using namespace com::sun::star
;
61 using namespace ::com::sun::star::ui::dialogs
;
62 using namespace ::com::sun::star::ui::dialogs::TemplateDescription
;
64 //------------------------------------------------------------------------
66 //------------------------------------------------------------------------
68 #define FILE_PICKER_DLL_NAME TEXT("fps.dll")
70 //------------------------------------------------------------------------
72 //------------------------------------------------------------------------
76 // controling event notifications
77 const bool STARTUP_SUSPENDED
= true;
78 const bool STARTUP_ALIVE
= false;
80 uno::Sequence
<rtl::OUString
> SAL_CALL
FilePicker_getSupportedServiceNames()
82 uno::Sequence
<rtl::OUString
> aRet(2);
83 aRet
[0] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FilePicker");
84 aRet
[1] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFilePicker");
89 //-----------------------------------------------------------------------------------------
91 //-----------------------------------------------------------------------------------------
93 CFilePicker::CFilePicker( const uno::Reference
<lang::XMultiServiceFactory
>& xServiceMgr
) :
94 cppu::WeakComponentImplHelper10
<
97 XFilePickerControlAccess
,
101 lang::XInitialization
,
103 lang::XEventListener
,
104 lang::XServiceInfo
>(m_rbHelperMtx
),
105 m_xServiceMgr(xServiceMgr
),
106 m_aAsyncEventNotifier(rBHelper
)
108 HINSTANCE hInstance
= GetModuleHandle(FILE_PICKER_DLL_NAME
);
109 OSL_POSTCOND( hInstance
, "The name of the service dll must have changed" );
111 // create a default FileOpen dialog without any additional ui elements
112 m_pImpl
= std::auto_ptr
< CWinFileOpenImpl
>(
113 new CWinFileOpenImpl(
121 //------------------------------------------------------------------------------------
122 // XFPEventListenerManager
123 //------------------------------------------------------------------------------------
125 void SAL_CALL
CFilePicker::addFilePickerListener(const uno::Reference
<XFilePickerListener
>& xListener
)
126 throw(uno::RuntimeException
)
128 if ( rBHelper
.bDisposed
)
129 throw lang::DisposedException(
130 rtl::OUString::createFromAscii( "object is already disposed" ),
131 static_cast< XFilePicker2
* >( this ) );
133 if ( !rBHelper
.bInDispose
&& !rBHelper
.bDisposed
)
134 rBHelper
.aLC
.addInterface( getCppuType( &xListener
), xListener
);
137 //-----------------------------------------------------------------------------------------
139 //-----------------------------------------------------------------------------------------
141 void SAL_CALL
CFilePicker::removeFilePickerListener(const uno::Reference
<XFilePickerListener
>& xListener
)
142 throw(uno::RuntimeException
)
144 if ( rBHelper
.bDisposed
)
145 throw lang::DisposedException(
146 rtl::OUString::createFromAscii( "object is already disposed" ),
147 static_cast< XFilePicker2
* >( this ) );
149 rBHelper
.aLC
.removeInterface( getCppuType( &xListener
), xListener
);
152 // -------------------------------------------------
154 // -------------------------------------------------
156 void SAL_CALL
CFilePicker::disposing(const lang::EventObject
& aEvent
) throw(uno::RuntimeException
)
158 uno::Reference
<XFilePickerListener
> xFilePickerListener(aEvent
.Source
, ::com::sun::star::uno::UNO_QUERY
);
160 if (xFilePickerListener
.is())
161 removeFilePickerListener(xFilePickerListener
);
164 //-----------------------------------------------------------------------------------------
166 //-----------------------------------------------------------------------------------------
168 void SAL_CALL
CFilePicker::fileSelectionChanged(FilePickerEvent aEvent
)
170 aEvent
.Source
= uno::Reference
<uno::XInterface
>(static_cast<XFilePickerNotifier
*>(this));
171 m_aAsyncEventNotifier
.notifyEvent(
172 new CFilePickerParamEventNotification(&XFilePickerListener::fileSelectionChanged
,aEvent
));
175 //-----------------------------------------------------------------------------------------
177 //-----------------------------------------------------------------------------------------
179 void SAL_CALL
CFilePicker::directoryChanged(FilePickerEvent aEvent
)
181 aEvent
.Source
= uno::Reference
<uno::XInterface
>(static_cast<XFilePickerNotifier
*>(this));
182 m_aAsyncEventNotifier
.notifyEvent(
183 new CFilePickerParamEventNotification(&XFilePickerListener::directoryChanged
,aEvent
));
186 //-----------------------------------------------------------------------------------------
188 //-----------------------------------------------------------------------------------------
190 void SAL_CALL
CFilePicker::controlStateChanged(FilePickerEvent aEvent
)
192 aEvent
.Source
= uno::Reference
<uno::XInterface
>(static_cast<XFilePickerNotifier
*>(this));
193 m_aAsyncEventNotifier
.notifyEvent(
194 new CFilePickerParamEventNotification(&XFilePickerListener::controlStateChanged
,aEvent
));
197 //-----------------------------------------------------------------------------------------
199 //-----------------------------------------------------------------------------------------
201 void SAL_CALL
CFilePicker::dialogSizeChanged()
203 m_aAsyncEventNotifier
.notifyEvent(
204 new CFilePickerEventNotification(&XFilePickerListener::dialogSizeChanged
));
207 //-----------------------------------------------------------------------------------------
208 // If there are more then one listener the return value of the last one wins
209 //-----------------------------------------------------------------------------------------
211 rtl::OUString SAL_CALL
CFilePicker::helpRequested(FilePickerEvent aEvent
) const
213 rtl::OUString aHelpText
;
215 ::cppu::OInterfaceContainerHelper
* pICHelper
=
216 rBHelper
.getContainer( getCppuType((uno::Reference
<XFilePickerListener
>*)0));
220 ::cppu::OInterfaceIteratorHelper
iter(*pICHelper
);
222 while(iter
.hasMoreElements())
227 if there are multiple listeners responding
228 to this notification the next response
229 overwrittes the one before if it is not empty
234 uno::Reference
<XFilePickerListener
> xFPListener(iter
.next(), uno::UNO_QUERY
);
235 if (xFPListener
.is())
237 temp
= xFPListener
->helpRequested(aEvent
);
238 if (temp
.getLength())
243 catch(uno::RuntimeException
&)
245 OSL_ENSURE( false, "RuntimeException during event dispatching" );
253 //-------------------------------------
255 //-------------------------------------
257 bool CFilePicker::startupEventNotification(bool bStartupSuspended
)
259 return m_aAsyncEventNotifier
.startup(bStartupSuspended
);
262 //-------------------------------------
264 //-------------------------------------
266 void CFilePicker::shutdownEventNotification()
268 m_aAsyncEventNotifier
.shutdown();
271 //-------------------------------------
273 //-------------------------------------
275 void CFilePicker::suspendEventNotification()
277 m_aAsyncEventNotifier
.suspend();
280 //-------------------------------------
282 //-------------------------------------
284 void CFilePicker::resumeEventNotification()
286 m_aAsyncEventNotifier
.resume();
289 //------------------------------------------------------------------------------------
290 // XFilePicker functions
291 //------------------------------------------------------------------------------------
293 void SAL_CALL
CFilePicker::setMultiSelectionMode(sal_Bool bMode
) throw(uno::RuntimeException
)
295 OSL_ASSERT(0 != m_pImpl
.get());
296 osl::MutexGuard
aGuard(m_aMutex
);
297 m_pImpl
->setMultiSelectionMode(bMode
);
300 //-----------------------------------------------------------------------------------------
302 //-----------------------------------------------------------------------------------------
304 void SAL_CALL
CFilePicker::setTitle(const rtl::OUString
& aTitle
) throw(uno::RuntimeException
)
306 OSL_ASSERT(0 != m_pImpl
.get());
307 osl::MutexGuard
aGuard(m_aMutex
);
308 m_pImpl
->setTitle(aTitle
);
311 //-----------------------------------------------------------------------------------------
313 //-----------------------------------------------------------------------------------------
315 void SAL_CALL
CFilePicker::appendFilter(const rtl::OUString
& aTitle
, const rtl::OUString
& aFilter
)
316 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
318 OSL_ASSERT(0 != m_pImpl
.get());
319 osl::MutexGuard
aGuard(m_aMutex
);
320 m_pImpl
->appendFilter(aTitle
, aFilter
);
323 //-----------------------------------------------------------------------------------------
325 //-----------------------------------------------------------------------------------------
327 void SAL_CALL
CFilePicker::setCurrentFilter(const rtl::OUString
& aTitle
)
328 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
330 OSL_ASSERT(0 != m_pImpl
.get());
331 osl::MutexGuard
aGuard(m_aMutex
);
332 m_pImpl
->setCurrentFilter(aTitle
);
335 //-----------------------------------------------------------------------------------------
337 //-----------------------------------------------------------------------------------------
339 rtl::OUString SAL_CALL
CFilePicker::getCurrentFilter() throw(uno::RuntimeException
)
341 OSL_ASSERT(0 != m_pImpl
.get());
342 osl::MutexGuard
aGuard(m_aMutex
);
343 return m_pImpl
->getCurrentFilter();
346 //-----------------------------------------------------------------------------------------
348 //-----------------------------------------------------------------------------------------
350 void SAL_CALL
CFilePicker::appendFilterGroup(const rtl::OUString
& sGroupTitle
, const uno::Sequence
<beans::StringPair
>& aFilters
)
351 throw (lang::IllegalArgumentException
, uno::RuntimeException
)
353 OSL_ASSERT(0 != m_pImpl
.get());
354 osl::MutexGuard
aGuard(m_aMutex
);
355 m_pImpl
->appendFilterGroup(sGroupTitle
, aFilters
);
358 //-----------------------------------------------------------------------------------------
360 //-----------------------------------------------------------------------------------------
362 void SAL_CALL
CFilePicker::setDefaultName(const rtl::OUString
& aName
)
363 throw(uno::RuntimeException
)
365 OSL_ASSERT(0 != m_pImpl
.get());
366 osl::MutexGuard
aGuard(m_aMutex
);
367 m_pImpl
->setDefaultName(aName
);
370 //-----------------------------------------------------------------------------------------
372 //-----------------------------------------------------------------------------------------
374 void SAL_CALL
CFilePicker::setDisplayDirectory(const rtl::OUString
& aDirectory
)
375 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
377 OSL_ASSERT(0 != m_pImpl
.get());
378 osl::MutexGuard
aGuard(m_aMutex
);
379 m_pImpl
->setDisplayDirectory(aDirectory
);
382 //-----------------------------------------------------------------------------------------
384 //-----------------------------------------------------------------------------------------
386 rtl::OUString SAL_CALL
CFilePicker::getDisplayDirectory() throw(uno::RuntimeException
)
388 OSL_ASSERT(0 != m_pImpl
.get());
389 osl::MutexGuard
aGuard(m_aMutex
);
390 return m_pImpl
->getDisplayDirectory();
393 //-----------------------------------------------------------------------------------------
395 //-----------------------------------------------------------------------------------------
397 uno::Sequence
<rtl::OUString
> SAL_CALL
CFilePicker::getFiles() throw(uno::RuntimeException
)
399 OSL_ASSERT(0 != m_pImpl
.get());
400 osl::MutexGuard
aGuard(m_aMutex
);
401 return m_pImpl
->getFiles();
404 //-----------------------------------------------------------------------------------------
406 //-----------------------------------------------------------------------------------------
407 uno::Sequence
< ::rtl::OUString
> SAL_CALL
CFilePicker::getSelectedFiles() throw (uno::RuntimeException
)
409 OSL_ASSERT(0 != m_pImpl
.get());
410 osl::MutexGuard
aGuard(m_aMutex
);
412 const uno::Sequence
< ::rtl::OUString
> lSource
= m_pImpl
->getFiles();
413 const ::sal_Int32 c
= lSource
.getLength();
417 const ::rtl::OUString sPath
= lSource
[0];
418 ::comphelper::SequenceAsVector
< ::rtl::OUString
> lTarget
;
422 const ::rtl::OUString sFile
= lSource
[i
];
423 if (sFile
.indexOf ('/') > 0)
425 // a) file contains own path !
426 lTarget
.push_back(sFile
);
430 // b) file is relative to given path
431 ::rtl::OUStringBuffer
sFull(256);
433 sFull
.append (sPath
);
434 sFull
.appendAscii("/" );
435 sFull
.append (sFile
);
437 lTarget
.push_back(sFull
.makeStringAndClear());
441 return lTarget
.getAsConstList();
444 //-----------------------------------------------------------------------------------------
446 //-----------------------------------------------------------------------------------------
448 sal_Int16 SAL_CALL
CFilePicker::execute() throw(uno::RuntimeException
)
450 OSL_ASSERT(0 != m_pImpl
.get());
454 if (startupEventNotification(STARTUP_SUSPENDED
))
456 // we should not block in this call else
457 // in the case of an event the client can't
458 // call another function an we run into a
460 ret
= m_pImpl
->execute( );
462 shutdownEventNotification();
466 OSL_ENSURE(sal_False
, "Could not start event notifier thread!");
468 throw uno::RuntimeException(
469 rtl::OUString::createFromAscii("Error executing dialog"),
470 static_cast<XFilePicker2
*>(this));
476 //------------------------------------------------------------------------------------
477 // XFilePicker functions
478 //------------------------------------------------------------------------------------
480 void SAL_CALL
CFilePicker::setValue(sal_Int16 aControlId
, sal_Int16 aControlAction
, const uno::Any
& aValue
)
481 throw(uno::RuntimeException
)
483 OSL_ASSERT(0 != m_pImpl
.get());
485 osl::MutexGuard
aGuard(m_aMutex
);
486 m_pImpl
->setValue(aControlId
, aControlAction
, aValue
);
489 //-----------------------------------------------------------------------------------------
491 //-----------------------------------------------------------------------------------------
493 uno::Any SAL_CALL
CFilePicker::getValue(sal_Int16 aControlId
, sal_Int16 aControlAction
)
494 throw(uno::RuntimeException
)
496 OSL_ASSERT(0 != m_pImpl
.get());
498 osl::MutexGuard
aGuard(m_aMutex
);
499 return m_pImpl
->getValue(aControlId
, aControlAction
);
502 //-----------------------------------------------------------------------------------------
504 //-----------------------------------------------------------------------------------------
506 void SAL_CALL
CFilePicker::enableControl(sal_Int16 aControlId
, sal_Bool bEnable
)
507 throw(uno::RuntimeException
)
509 OSL_ASSERT( 0 != m_pImpl
.get( ) );
511 osl::MutexGuard
aGuard( m_aMutex
);
512 m_pImpl
->enableControl( aControlId
, bEnable
);
515 //-----------------------------------------------------------------------------------------
517 //-----------------------------------------------------------------------------------------
519 void SAL_CALL
CFilePicker::setLabel(sal_Int16 aControlId
, const ::rtl::OUString
& aLabel
)
520 throw (uno::RuntimeException
)
522 OSL_ASSERT(0 != m_pImpl
.get());
524 osl::MutexGuard
aGuard(m_aMutex
);
525 m_pImpl
->setLabel(aControlId
, aLabel
);
528 //-----------------------------------------------------------------------------------------
530 //-----------------------------------------------------------------------------------------
532 rtl::OUString SAL_CALL
CFilePicker::getLabel(sal_Int16 aControlId
)
533 throw (uno::RuntimeException
)
535 OSL_ASSERT(0 != m_pImpl
.get());
537 osl::MutexGuard
aGuard(m_aMutex
);
538 return m_pImpl
->getLabel(aControlId
);
541 //------------------------------------------------------------------------------------
543 //------------------------------------------------------------------------------------
545 uno::Sequence
<sal_Int16
> SAL_CALL
CFilePicker::getSupportedImageFormats() throw (uno::RuntimeException
)
547 OSL_ASSERT(0 != m_pImpl
.get());
549 osl::MutexGuard
aGuard(m_aMutex
);
550 return m_pImpl
->getSupportedImageFormats();
553 //------------------------------------------------------------------------------------
555 //------------------------------------------------------------------------------------
557 sal_Int32 SAL_CALL
CFilePicker::getTargetColorDepth() throw (uno::RuntimeException
)
559 OSL_ASSERT(0 != m_pImpl
.get());
561 osl::MutexGuard
aGuard(m_aMutex
);
562 return m_pImpl
->getTargetColorDepth();
565 //------------------------------------------------------------------------------------
567 //------------------------------------------------------------------------------------
569 sal_Int32 SAL_CALL
CFilePicker::getAvailableWidth() throw (uno::RuntimeException
)
571 OSL_ASSERT(0 != m_pImpl
.get());
573 osl::MutexGuard
aGuard(m_aMutex
);
574 return m_pImpl
->getAvailableWidth();
577 //------------------------------------------------------------------------------------
579 //------------------------------------------------------------------------------------
581 sal_Int32 SAL_CALL
CFilePicker::getAvailableHeight() throw (uno::RuntimeException
)
583 OSL_ASSERT(0 != m_pImpl
.get());
585 osl::MutexGuard
aGuard(m_aMutex
);
586 return m_pImpl
->getAvailableHeight();
589 //------------------------------------------------------------------------------------
591 //------------------------------------------------------------------------------------
593 void SAL_CALL
CFilePicker::setImage(sal_Int16 aImageFormat
, const uno::Any
& aImage
)
594 throw (lang::IllegalArgumentException
, uno::RuntimeException
)
596 OSL_ASSERT(0 != m_pImpl
.get());
598 osl::MutexGuard
aGuard(m_aMutex
);
599 m_pImpl
->setImage(aImageFormat
, aImage
);
602 //------------------------------------------------------------------------------------
604 //------------------------------------------------------------------------------------
606 sal_Bool SAL_CALL
CFilePicker::setShowState(sal_Bool bShowState
) throw (uno::RuntimeException
)
608 OSL_ASSERT(0 != m_pImpl
.get());
610 osl::MutexGuard
aGuard(m_aMutex
);
611 return m_pImpl
->setShowState(bShowState
);
614 //------------------------------------------------------------------------------------
616 //------------------------------------------------------------------------------------
618 sal_Bool SAL_CALL
CFilePicker::getShowState() throw (uno::RuntimeException
)
620 OSL_ASSERT(0 != m_pImpl
.get());
622 osl::MutexGuard
aGuard(m_aMutex
);
623 return m_pImpl
->getShowState();
626 //------------------------------------------------------------------------------------
628 //------------------------------------------------------------------------------------
630 void SAL_CALL
CFilePicker::initialize(const uno::Sequence
<uno::Any
>& aArguments
)
631 throw( uno::Exception
, uno::RuntimeException
)
633 // parameter checking
635 if ( 0 == aArguments
.getLength( ) )
636 throw lang::IllegalArgumentException(
637 rtl::OUString::createFromAscii( "no arguments" ),
638 static_cast<XFilePicker2
*>(this), 1);
640 aAny
= aArguments
[0];
642 if ( (aAny
.getValueType() != ::getCppuType((sal_Int16
*)0)) &&
643 (aAny
.getValueType() != ::getCppuType((sal_Int8
*)0)) )
644 throw lang::IllegalArgumentException(
645 rtl::OUString::createFromAscii("invalid argument type"),
646 static_cast<XFilePicker2
*>(this), 1);
648 sal_Int16 templateId
= -1;
651 sal_Bool bFileOpenDialog
= sal_True
;
652 sal_uInt32 winResTemplateId
= 0;
653 sal_Bool bIsWin2000
= IsWindows2000Platform();
655 switch ( templateId
)
657 case FILEOPEN_SIMPLE
:
658 bFileOpenDialog
= sal_True
;
661 case FILESAVE_SIMPLE
:
662 bFileOpenDialog
= sal_False
;
665 case FILESAVE_AUTOEXTENSION_PASSWORD
:
666 bFileOpenDialog
= sal_False
;
668 winResTemplateId
= TMPL2000_FILESAVE_AUTOEXT_PASSWORD_BOX_ID
;
670 winResTemplateId
= TMPL95_FILESAVE_AUTOEXT_PASSWORD_BOX_ID
;
673 case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS
:
674 bFileOpenDialog
= sal_False
;
676 winResTemplateId
= TMPL2000_AUTOEXT_PASSWORD_FILTEROPTION_BOX
;
678 winResTemplateId
= TMPL95_AUTOEXT_PASSWORD_FILTEROPTION_BOX
;
681 case FILESAVE_AUTOEXTENSION_SELECTION
:
682 bFileOpenDialog
= sal_False
;
684 winResTemplateId
= TMPL2000_AUTOEXT_SELECTION_BOX
;
686 winResTemplateId
= TMPL95_AUTOEXT_SELECTION_BOX
;
689 case FILESAVE_AUTOEXTENSION_TEMPLATE
:
690 bFileOpenDialog
= sal_False
;
692 winResTemplateId
= TMPL2000_FILEOPEN_AUTOEXT_TEMPLATE_BOX_ID
;
694 winResTemplateId
= TMPL95_FILEOPEN_AUTOEXT_TEMPLATE_BOX_ID
;
697 case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE
:
699 winResTemplateId
= TMPL2000_FILEOPEN_LINK_PREVIEW_BOX_ID
;
701 winResTemplateId
= TMPL95_FILEOPEN_LINK_PREVIEW_BOX_ID
;
706 winResTemplateId
= TMPL2000_PLAY_PUSHBUTTON
;
708 winResTemplateId
= TMPL95_PLAY_PUSHBUTTON
;
711 case FILEOPEN_READONLY_VERSION
:
713 winResTemplateId
= TMPL2000_FILEOPEN_READONLY_VERSION_BOX_ID
;
715 winResTemplateId
= TMPL95_FILEOPEN_READONLY_VERSION_BOX_ID
;
718 case FILEOPEN_LINK_PREVIEW
:
720 winResTemplateId
= TMPL2000_FILEOPEN_LINK_PREVIEW_BOX_SIMPLE_ID
;
722 winResTemplateId
= TMPL95_FILEOPEN_LINK_PREVIEW_BOX_SIMPLE_ID
;
725 case FILESAVE_AUTOEXTENSION
:
726 bFileOpenDialog
= sal_False
;
728 winResTemplateId
= TMPL2000_FILESAVE_AUTOEXT
;
730 winResTemplateId
= TMPL95_FILESAVE_AUTOEXT
;
734 throw lang::IllegalArgumentException(
735 rtl::OUString::createFromAscii( "Unknown template" ),
736 static_cast< XFilePicker2
* >( this ),
740 HINSTANCE hInstance
= GetModuleHandle( FILE_PICKER_DLL_NAME
);
741 OSL_POSTCOND( hInstance
, "The name of the service dll must have changed" );
743 // create a new impl-class here based on the
744 // given string, if the given string is empty
746 m_pImpl
= std::auto_ptr
< CWinFileOpenImpl
>(
747 new CWinFileOpenImpl(
755 //------------------------------------------------------------------------------------
757 //------------------------------------------------------------------------------------
759 void SAL_CALL
CFilePicker::cancel()
760 throw(uno::RuntimeException
)
762 OSL_ASSERT(m_pImpl
.get());
764 osl::MutexGuard
aGuard(m_aMutex
);
768 // -------------------------------------------------
770 // -------------------------------------------------
772 rtl::OUString SAL_CALL
CFilePicker::getImplementationName()
773 throw(uno::RuntimeException
)
775 return rtl::OUString::createFromAscii(FILE_PICKER_IMPL_NAME
);
778 // -------------------------------------------------
780 // -------------------------------------------------
782 sal_Bool SAL_CALL
CFilePicker::supportsService(const rtl::OUString
& ServiceName
)
783 throw(uno::RuntimeException
)
785 uno::Sequence
<rtl::OUString
> SupportedServicesNames
= FilePicker_getSupportedServiceNames();
787 for (sal_Int32 n
= SupportedServicesNames
.getLength(); n
--;)
788 if (SupportedServicesNames
[n
].compareTo(ServiceName
) == 0)
794 // -------------------------------------------------
796 // -------------------------------------------------
798 uno::Sequence
<rtl::OUString
> SAL_CALL
CFilePicker::getSupportedServiceNames()
799 throw(uno::RuntimeException
)
801 return FilePicker_getSupportedServiceNames();