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: VistaFilePicker.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 #pragma warning (disable:4917)
42 #include "VistaFilePicker.hxx"
43 #include "WinFileOpenImpl.hxx"
44 #include "..\misc\WinImplHelper.hxx"
47 #include <com/sun/star/lang/DisposedException.hpp>
48 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
49 #include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
50 #include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
51 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
53 #include <cppuhelper/interfacecontainer.h>
54 #include <comphelper/configurationhelper.hxx>
55 #include <osl/diagnose.h>
56 #include <osl/mutex.hxx>
57 #include <osl/file.hxx>
61 #pragma warning (push, 1)
68 //------------------------------------------------------------------------
69 // namespace directives
70 //------------------------------------------------------------------------
72 namespace css
= ::com::sun::star
;
78 //------------------------------------------------------------------------
80 //------------------------------------------------------------------------
82 #define FILE_PICKER_DLL_NAME TEXT("fps.dll")
84 //------------------------------------------------------------------------
86 //------------------------------------------------------------------------
90 // controling event notifications
91 const bool STARTUP_SUSPENDED
= true;
92 const bool STARTUP_ALIVE
= false;
94 css::uno::Sequence
< ::rtl::OUString
> SAL_CALL
VistaFilePicker_getSupportedServiceNames()
96 css::uno::Sequence
< ::rtl::OUString
> aRet(2);
97 aRet
[0] = ::rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FilePicker");
98 aRet
[1] = ::rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFilePicker");
103 //-----------------------------------------------------------------------------------------
104 #define ENABLE_LOGGING
106 #define LOGFILE_VISTA "c:\\temp\\vistafiledialog.log"
108 #ifdef ENABLE_LOGGING
110 #define LOG_FILE(PARAM_MESSAGE) \
112 FILE* pFile = fopen(LOGFILE_VISTA, "a"); \
113 fprintf(pFile, PARAM_MESSAGE); \
117 #define LOG_FILE_1_PARAM(PARAM_MESSAGE, PARAM_1) \
119 FILE* pFile = fopen(LOGFILE_VISTA, "a"); \
120 fprintf(pFile, PARAM_MESSAGE, PARAM_1); \
124 #define LOG_FILE_2_PARAM(PARAM_MESSAGE, PARAM_1, PARAM_2) \
126 FILE* pFile = fopen(LOGFILE_VISTA, "a"); \
127 fprintf(pFile, PARAM_MESSAGE, PARAM_1, PARAM_2); \
133 #define LOG_FILE(PARAM_MESSAGE)
134 #define LOG_FILE_1_PARAM(PARAM_MESSAGE, PARAM_1)
135 #define LOG_FILE_2_PARAM(PARAM_MESSAGE, PARAM_1, PARAM_2)
139 //-----------------------------------------------------------------------------------------
140 #define VISTAFILEDIALOG_CHECKED_COMCALL(PARAM_CODE, PARAM_LOGMESSAGE, PARAM_ERRORMESSAGE) \
143 VISTAFILEDIALOG_CHECKED_COMCALL_WITH_RETURN(aResult, PARAM_CODE, PARAM_LOGMESSAGE, PARAM_ERRORMESSAGE) \
146 //-----------------------------------------------------------------------------------------
147 #define VISTAFILEDIALOG_CHECKED_COMCALL_WITH_RETURN(RETURN_HR, PARAM_CODE, PARAM_LOGMESSAGE, PARAM_ERRORMESSAGE) \
149 LOG_FILE(PARAM_LOGMESSAGE) \
150 RETURN_HR = PARAM_CODE; \
151 if ( FAILED(RETURN_HR) ) \
153 LOG_FILE_1_PARAM("will throw exception for checked COM call:\n%s", PARAM_ERRORMESSAGE) \
154 throw css::uno::RuntimeException( \
155 ::rtl::OUString::createFromAscii(PARAM_ERRORMESSAGE), \
156 css::uno::Reference< css::ui::dialogs::XFilePicker >()); \
162 //-----------------------------------------------------------------------------------------
163 VistaFilePicker::VistaFilePicker(const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xSMGR
)
164 : TVistaFilePickerBase (m_aMutex
)
166 , m_rDialog (new VistaFilePickerImpl())
167 , m_aAsyncExecute (m_rDialog
)
168 , m_nFilePickerThreadId (0 )
169 , m_bInitialized (false )
173 //-----------------------------------------------------------------------------------------
174 VistaFilePicker::~VistaFilePicker()
178 //------------------------------------------------------------------------------------
179 void SAL_CALL
VistaFilePicker::addFilePickerListener(const css::uno::Reference
< css::ui::dialogs::XFilePickerListener
>& xListener
)
180 throw(css::uno::RuntimeException
)
182 RequestRef
rRequest(new Request());
183 rRequest
->setRequest (VistaFilePickerImpl::E_ADD_PICKER_LISTENER
);
184 rRequest
->setArgument(PROP_PICKER_LISTENER
, xListener
);
186 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::NON_BLOCKED
);
189 //-----------------------------------------------------------------------------------------
190 void SAL_CALL
VistaFilePicker::removeFilePickerListener(const css::uno::Reference
< css::ui::dialogs::XFilePickerListener
>& xListener
)
191 throw(css::uno::RuntimeException
)
193 RequestRef
rRequest(new Request());
194 rRequest
->setRequest (VistaFilePickerImpl::E_REMOVE_PICKER_LISTENER
);
195 rRequest
->setArgument(PROP_PICKER_LISTENER
, xListener
);
197 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::NON_BLOCKED
);
200 // -------------------------------------------------
201 void SAL_CALL
VistaFilePicker::disposing(const css::lang::EventObject
& /*aEvent*/)
202 throw(css::uno::RuntimeException
)
206 //------------------------------------------------------------------------------------
207 void SAL_CALL
VistaFilePicker::setMultiSelectionMode(::sal_Bool bMode
)
208 throw(css::uno::RuntimeException
)
210 RequestRef
rRequest(new Request());
211 rRequest
->setRequest (VistaFilePickerImpl::E_SET_MULTISELECTION_MODE
);
212 rRequest
->setArgument(PROP_MULTISELECTION_MODE
, bMode
);
214 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::NON_BLOCKED
);
217 //-----------------------------------------------------------------------------------------
218 void SAL_CALL
VistaFilePicker::setTitle(const ::rtl::OUString
& sTitle
)
219 throw(css::uno::RuntimeException
)
221 RequestRef
rRequest(new Request());
222 rRequest
->setRequest (VistaFilePickerImpl::E_SET_TITLE
);
223 rRequest
->setArgument(PROP_TITLE
, sTitle
);
225 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::NON_BLOCKED
);
228 //-----------------------------------------------------------------------------------------
229 void SAL_CALL
VistaFilePicker::appendFilter(const ::rtl::OUString
& sTitle
,
230 const ::rtl::OUString
& sFilter
)
231 throw(css::lang::IllegalArgumentException
,
232 css::uno::RuntimeException
)
234 RequestRef
rRequest(new Request());
235 rRequest
->setRequest (VistaFilePickerImpl::E_APPEND_FILTER
);
236 rRequest
->setArgument(PROP_FILTER_TITLE
, sTitle
);
237 rRequest
->setArgument(PROP_FILTER_VALUE
, sFilter
);
239 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::NON_BLOCKED
);
242 //-----------------------------------------------------------------------------------------
243 void SAL_CALL
VistaFilePicker::setCurrentFilter(const ::rtl::OUString
& sTitle
)
244 throw(css::lang::IllegalArgumentException
,
245 css::uno::RuntimeException
)
247 RequestRef
rRequest(new Request());
248 rRequest
->setRequest (VistaFilePickerImpl::E_SET_CURRENT_FILTER
);
249 rRequest
->setArgument(PROP_FILTER_TITLE
, sTitle
);
251 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::NON_BLOCKED
);
254 //-----------------------------------------------------------------------------------------
255 ::rtl::OUString SAL_CALL
VistaFilePicker::getCurrentFilter()
256 throw(css::uno::RuntimeException
)
258 RequestRef
rRequest(new Request());
259 rRequest
->setRequest (VistaFilePickerImpl::E_GET_CURRENT_FILTER
);
261 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::BLOCKED
);
263 const ::rtl::OUString sTitle
= rRequest
->getArgumentOrDefault(PROP_FILTER_TITLE
, ::rtl::OUString());
267 //-----------------------------------------------------------------------------------------
268 void SAL_CALL
VistaFilePicker::appendFilterGroup(const ::rtl::OUString
& /*sGroupTitle*/,
269 const css::uno::Sequence
< css::beans::StringPair
>& lFilters
)
270 throw (css::lang::IllegalArgumentException
,
271 css::uno::RuntimeException
)
273 ::sal_Int32 c
= lFilters
.getLength();
277 const css::beans::StringPair
& rFilter
= lFilters
[i
];
278 appendFilter(rFilter
.First
, rFilter
.Second
);
282 //-----------------------------------------------------------------------------------------
283 void SAL_CALL
VistaFilePicker::setDefaultName(const ::rtl::OUString
& sName
)
284 throw(css::uno::RuntimeException
)
286 RequestRef
rRequest(new Request());
287 rRequest
->setRequest (VistaFilePickerImpl::E_SET_DEFAULT_NAME
);
288 rRequest
->setArgument(PROP_FILENAME
, sName
);
290 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::NON_BLOCKED
);
293 //-----------------------------------------------------------------------------------------
294 void SAL_CALL
VistaFilePicker::setDisplayDirectory(const ::rtl::OUString
& sDirectory
)
295 throw (css::lang::IllegalArgumentException
,
296 css::uno::RuntimeException
)
298 const ::rtl::OUString
aPackage( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/"));
299 const ::rtl::OUString
aRelPath( RTL_CONSTASCII_USTRINGPARAM("Path/Info"));
300 const ::rtl::OUString
aKey( RTL_CONSTASCII_USTRINGPARAM("WorkPathChanged"));
302 css::uno::Any aValue
= ::comphelper::ConfigurationHelper::readDirectKey(
303 m_xSMGR
, aPackage
, aRelPath
, aKey
, ::comphelper::ConfigurationHelper::E_READONLY
);
305 bool bChanged(false);
306 if (( aValue
>>= bChanged
) && bChanged
)
308 ::comphelper::ConfigurationHelper::writeDirectKey(
309 m_xSMGR
, aPackage
, aRelPath
, aKey
, css::uno::makeAny(false), ::comphelper::ConfigurationHelper::E_STANDARD
);
312 RequestRef
rRequest(new Request());
313 rRequest
->setRequest (VistaFilePickerImpl::E_SET_DIRECTORY
);
314 rRequest
->setArgument(PROP_DIRECTORY
, sDirectory
);
315 rRequest
->setArgument(PROP_FORCE
, bChanged
);
317 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::NON_BLOCKED
);
320 //-----------------------------------------------------------------------------------------
321 ::rtl::OUString SAL_CALL
VistaFilePicker::getDisplayDirectory()
322 throw(css::uno::RuntimeException
)
324 RequestRef
rRequest(new Request());
325 rRequest
->setRequest (VistaFilePickerImpl::E_GET_DIRECTORY
);
326 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::NON_BLOCKED
);
327 const ::rtl::OUString sDirectory
= rRequest
->getArgumentOrDefault(PROP_FILENAME
, ::rtl::OUString());
332 //-----------------------------------------------------------------------------------------
333 // @deprecated cant be supported any longer ... see IDL description for further details
334 css::uno::Sequence
< ::rtl::OUString
> SAL_CALL
VistaFilePicker::getFiles()
335 throw(css::uno::RuntimeException
)
337 RequestRef
rRequest(new Request());
338 rRequest
->setRequest (VistaFilePickerImpl::E_GET_SELECTED_FILES
);
340 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::BLOCKED
);
342 const css::uno::Sequence
< ::rtl::OUString
> lFiles
= rRequest
->getArgumentOrDefault(PROP_SELECTED_FILES
, css::uno::Sequence
< ::rtl::OUString
>());
343 m_lLastFiles
= lFiles
;
347 //-----------------------------------------------------------------------------------------
348 css::uno::Sequence
< ::rtl::OUString
> SAL_CALL
VistaFilePicker::getSelectedFiles()
349 throw(css::uno::RuntimeException
)
351 RequestRef
rRequest(new Request());
352 rRequest
->setRequest (VistaFilePickerImpl::E_GET_SELECTED_FILES
);
354 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::BLOCKED
);
356 const css::uno::Sequence
< ::rtl::OUString
> lFiles
= rRequest
->getArgumentOrDefault(PROP_SELECTED_FILES
, css::uno::Sequence
< ::rtl::OUString
>());
357 m_lLastFiles
= lFiles
;
361 //-----------------------------------------------------------------------------------------
362 ::sal_Int16 SAL_CALL
VistaFilePicker::execute()
363 throw(css::uno::RuntimeException
)
365 bool bInitialized(false);
367 osl::MutexGuard
aGuard(m_aMutex
);
368 bInitialized
= m_bInitialized
;
373 sal_Int16 nTemplateDescription
= css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE
;
374 css::uno::Sequence
< css::uno::Any
> aInitArguments(1);
375 aInitArguments
[0] <<= nTemplateDescription
;
376 initialize(aInitArguments
);
379 RequestRef
rRequest(new Request());
380 rRequest
->setRequest (VistaFilePickerImpl::E_SHOW_DIALOG_MODAL
);
382 // if we want to show a modal window, the calling thread needs to process messages
383 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::PROCESS_MESSAGES
);
385 const ::sal_Bool bOK
= rRequest
->getArgumentOrDefault(PROP_DIALOG_SHOW_RESULT
, (::sal_Bool
)sal_False
);
386 m_lLastFiles
= rRequest
->getArgumentOrDefault(PROP_SELECTED_FILES
, css::uno::Sequence
< ::rtl::OUString
>());
388 ::sal_Int16 nResult
= css::ui::dialogs::ExecutableDialogResults::CANCEL
;
390 nResult
= css::ui::dialogs::ExecutableDialogResults::OK
;
394 //------------------------------------------------------------------------------------
395 // XFilePicker functions
396 //------------------------------------------------------------------------------------
398 void SAL_CALL
VistaFilePicker::setValue( ::sal_Int16 nControlId
,
399 ::sal_Int16 nControlAction
,
400 const css::uno::Any
& aValue
)
401 throw(css::uno::RuntimeException
)
403 RequestRef
rRequest(new Request());
404 rRequest
->setRequest (VistaFilePickerImpl::E_SET_CONTROL_VALUE
);
405 rRequest
->setArgument(PROP_CONTROL_ID
, nControlId
);
406 rRequest
->setArgument(PROP_CONTROL_ACTION
, nControlAction
);
407 rRequest
->setArgument(PROP_CONTROL_VALUE
, aValue
);
409 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::NON_BLOCKED
);
412 //-----------------------------------------------------------------------------------------
414 //-----------------------------------------------------------------------------------------
416 css::uno::Any SAL_CALL
VistaFilePicker::getValue(::sal_Int16 nControlId
,
417 ::sal_Int16 nControlAction
)
418 throw(css::uno::RuntimeException
)
420 RequestRef
rRequest(new Request());
421 rRequest
->setRequest (VistaFilePickerImpl::E_GET_CONTROL_VALUE
);
422 rRequest
->setArgument(PROP_CONTROL_ID
, nControlId
);
423 rRequest
->setArgument(PROP_CONTROL_ACTION
, nControlAction
);
425 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::BLOCKED
);
426 const css::uno::Any aValue
= rRequest
->getArgumentOrDefault(PROP_CONTROL_VALUE
, css::uno::Any());
430 //-----------------------------------------------------------------------------------------
432 //-----------------------------------------------------------------------------------------
434 void SAL_CALL
VistaFilePicker::enableControl(::sal_Int16 nControlId
,
436 throw(css::uno::RuntimeException
)
438 RequestRef
rRequest(new Request());
439 rRequest
->setRequest (VistaFilePickerImpl::E_ENABLE_CONTROL
);
440 rRequest
->setArgument(PROP_CONTROL_ID
, nControlId
);
441 rRequest
->setArgument(PROP_CONTROL_ENABLE
, bEnable
);
443 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::NON_BLOCKED
);
446 //-----------------------------------------------------------------------------------------
448 //-----------------------------------------------------------------------------------------
450 void SAL_CALL
VistaFilePicker::setLabel( ::sal_Int16 nControlId
,
451 const ::rtl::OUString
& sLabel
)
452 throw (css::uno::RuntimeException
)
454 RequestRef
rRequest(new Request());
455 rRequest
->setRequest (VistaFilePickerImpl::E_SET_CONTROL_LABEL
);
456 rRequest
->setArgument(PROP_CONTROL_ID
, nControlId
);
457 rRequest
->setArgument(PROP_CONTROL_LABEL
, sLabel
);
459 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::NON_BLOCKED
);
462 //-----------------------------------------------------------------------------------------
464 //-----------------------------------------------------------------------------------------
466 ::rtl::OUString SAL_CALL
VistaFilePicker::getLabel(::sal_Int16 nControlId
)
467 throw (css::uno::RuntimeException
)
469 RequestRef
rRequest(new Request());
470 rRequest
->setRequest (VistaFilePickerImpl::E_GET_CONTROL_LABEL
);
471 rRequest
->setArgument(PROP_CONTROL_ID
, nControlId
);
473 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::BLOCKED
);
474 const ::rtl::OUString sLabel
= rRequest
->getArgumentOrDefault(PROP_CONTROL_LABEL
, ::rtl::OUString());
478 //------------------------------------------------------------------------------------
480 //------------------------------------------------------------------------------------
482 css::uno::Sequence
< ::sal_Int16
> SAL_CALL
VistaFilePicker::getSupportedImageFormats()
483 throw (css::uno::RuntimeException
)
485 return css::uno::Sequence
< sal_Int16
>();
488 //------------------------------------------------------------------------------------
490 //------------------------------------------------------------------------------------
492 sal_Int32 SAL_CALL
VistaFilePicker::getTargetColorDepth()
493 throw (css::uno::RuntimeException
)
498 //------------------------------------------------------------------------------------
500 //------------------------------------------------------------------------------------
502 sal_Int32 SAL_CALL
VistaFilePicker::getAvailableWidth()
503 throw (css::uno::RuntimeException
)
508 //------------------------------------------------------------------------------------
510 //------------------------------------------------------------------------------------
512 sal_Int32 SAL_CALL
VistaFilePicker::getAvailableHeight()
513 throw (css::uno::RuntimeException
)
518 //------------------------------------------------------------------------------------
520 //------------------------------------------------------------------------------------
522 void SAL_CALL
VistaFilePicker::setImage( sal_Int16
/*nImageFormat*/,
523 const css::uno::Any
& /*aImage */)
524 throw (css::lang::IllegalArgumentException
,
525 css::uno::RuntimeException
)
529 //------------------------------------------------------------------------------------
531 //------------------------------------------------------------------------------------
533 sal_Bool SAL_CALL
VistaFilePicker::setShowState(sal_Bool
/*bShowState*/)
534 throw (css::uno::RuntimeException
)
539 //------------------------------------------------------------------------------------
541 //------------------------------------------------------------------------------------
543 sal_Bool SAL_CALL
VistaFilePicker::getShowState()
544 throw (css::uno::RuntimeException
)
549 //------------------------------------------------------------------------------------
551 //------------------------------------------------------------------------------------
553 void SAL_CALL
VistaFilePicker::initialize(const css::uno::Sequence
< css::uno::Any
>& lArguments
)
554 throw(css::uno::Exception
,
555 css::uno::RuntimeException
)
560 throw css::uno::Exception(
561 ::rtl::OUString::createFromAscii( "XInitialization::initialize() called twice." ),
562 static_cast< css::ui::dialogs::XFilePicker* >( this ));
565 if (lArguments
.getLength() < 1)
566 throw css::lang::IllegalArgumentException(
567 ::rtl::OUString::createFromAscii( "XInitialization::initialize() called without arguments." ),
568 static_cast< css::ui::dialogs::XFilePicker2
* >( this ),
571 sal_Int32 nTemplate
= -1;
572 lArguments
[0] >>= nTemplate
;
574 ::sal_Bool bFileOpenDialog
= sal_True
;
575 ::sal_Int32 nFeatures
= 0;
579 case css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE
:
581 bFileOpenDialog
= sal_True
;
585 case css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE
:
587 bFileOpenDialog
= sal_False
;
591 case css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD
:
593 bFileOpenDialog
= sal_False
;
594 nFeatures
|= FEATURE_AUTOEXTENSION
;
595 nFeatures
|= FEATURE_PASSWORD
;
599 case css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS
:
601 bFileOpenDialog
= sal_False
;
602 nFeatures
|= FEATURE_AUTOEXTENSION
;
603 nFeatures
|= FEATURE_PASSWORD
;
604 nFeatures
|= FEATURE_FILTEROPTIONS
;
608 case css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION_SELECTION
:
610 bFileOpenDialog
= sal_False
;
611 nFeatures
|= FEATURE_AUTOEXTENSION
;
612 nFeatures
|= FEATURE_SELECTION
;
616 case css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION_TEMPLATE
:
618 bFileOpenDialog
= sal_False
;
619 nFeatures
|= FEATURE_AUTOEXTENSION
;
620 nFeatures
|= FEATURE_TEMPLATE
;
624 case css::ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE
:
626 bFileOpenDialog
= sal_True
;
627 nFeatures
|= FEATURE_LINK
;
628 nFeatures
|= FEATURE_PREVIEW
;
629 nFeatures
|= FEATURE_IMAGETEMPLATE
;
633 case css::ui::dialogs::TemplateDescription::FILEOPEN_PLAY
:
635 bFileOpenDialog
= sal_True
;
636 nFeatures
|= FEATURE_PLAY
;
640 case css::ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION
:
642 bFileOpenDialog
= sal_True
;
643 nFeatures
|= FEATURE_READONLY
;
644 nFeatures
|= FEATURE_VERSION
;
648 case css::ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW
:
650 bFileOpenDialog
= sal_True
;
651 nFeatures
|= FEATURE_LINK
;
652 nFeatures
|= FEATURE_PREVIEW
;
656 case css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION
:
658 bFileOpenDialog
= sal_False
;
659 nFeatures
|= FEATURE_AUTOEXTENSION
;
664 RequestRef
rRequest(new Request());
666 rRequest
->setRequest (VistaFilePickerImpl::E_CREATE_OPEN_DIALOG
);
668 rRequest
->setRequest (VistaFilePickerImpl::E_CREATE_SAVE_DIALOG
);
669 rRequest
->setArgument(PROP_FEATURES
, nFeatures
);
670 rRequest
->setArgument(PROP_TEMPLATE_DESCR
, nTemplate
);
671 if ( ! m_aAsyncExecute
.isRunning())
672 m_aAsyncExecute
.create();
673 m_aAsyncExecute
.triggerRequestThreadAware(rRequest
, AsyncRequests::NON_BLOCKED
);
676 osl::MutexGuard
aGuard(m_aMutex
);
677 m_bInitialized
= true;
681 //------------------------------------------------------------------------------------
683 //------------------------------------------------------------------------------------
685 void SAL_CALL
VistaFilePicker::cancel()
686 throw(css::uno::RuntimeException
)
690 // -------------------------------------------------
692 // -------------------------------------------------
694 ::rtl::OUString SAL_CALL
VistaFilePicker::getImplementationName()
695 throw(css::uno::RuntimeException
)
697 return ::rtl::OUString::createFromAscii("com.sun.star.comp.fpicker.VistaFileDialog");
700 // -------------------------------------------------
702 // -------------------------------------------------
704 sal_Bool SAL_CALL
VistaFilePicker::supportsService(const ::rtl::OUString
& sServiceName
)
705 throw(css::uno::RuntimeException
)
707 css::uno::Sequence
< ::rtl::OUString
> lSupportedServicesNames
= VistaFilePicker_getSupportedServiceNames();
709 for (sal_Int32 n
= lSupportedServicesNames
.getLength(); n
--;)
710 if (lSupportedServicesNames
[n
].compareTo(sServiceName
) == 0)
716 // -------------------------------------------------
718 // -------------------------------------------------
720 css::uno::Sequence
< ::rtl::OUString
> SAL_CALL
VistaFilePicker::getSupportedServiceNames()
721 throw(css::uno::RuntimeException
)
723 return VistaFilePicker_getSupportedServiceNames();
728 } // namespace fpicker