xref: /AOO41X/main/fpicker/source/win32/filepicker/VistaFilePicker.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_fpicker.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir //------------------------------------------------------------------------
32*cdf0e10cSrcweir // includes
33*cdf0e10cSrcweir //------------------------------------------------------------------------
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #ifdef _MSC_VER
36*cdf0e10cSrcweir #pragma warning (disable:4917)
37*cdf0e10cSrcweir #endif
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include "VistaFilePicker.hxx"
40*cdf0e10cSrcweir #include "WinFileOpenImpl.hxx"
41*cdf0e10cSrcweir #include "..\misc\WinImplHelper.hxx"
42*cdf0e10cSrcweir #include "shared.hxx"
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
47*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
48*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h>
51*cdf0e10cSrcweir #include <comphelper/configurationhelper.hxx>
52*cdf0e10cSrcweir #include <osl/diagnose.h>
53*cdf0e10cSrcweir #include <osl/mutex.hxx>
54*cdf0e10cSrcweir #include <osl/file.hxx>
55*cdf0e10cSrcweir #include <tchar.h>
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir #ifdef _MSC_VER
58*cdf0e10cSrcweir #pragma warning (push, 1)
59*cdf0e10cSrcweir #endif
60*cdf0e10cSrcweir #include <shlobj.h>
61*cdf0e10cSrcweir #ifdef _MSC_VER
62*cdf0e10cSrcweir #pragma warning (pop)
63*cdf0e10cSrcweir #endif
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir //------------------------------------------------------------------------
66*cdf0e10cSrcweir // namespace directives
67*cdf0e10cSrcweir //------------------------------------------------------------------------
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir namespace css = ::com::sun::star;
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir namespace fpicker{
72*cdf0e10cSrcweir namespace win32{
73*cdf0e10cSrcweir namespace vista{
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir //------------------------------------------------------------------------
76*cdf0e10cSrcweir // defines
77*cdf0e10cSrcweir //------------------------------------------------------------------------
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir #define FILE_PICKER_DLL_NAME  TEXT("fps.dll")
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir //------------------------------------------------------------------------
82*cdf0e10cSrcweir // helper functions
83*cdf0e10cSrcweir //------------------------------------------------------------------------
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir namespace
86*cdf0e10cSrcweir {
87*cdf0e10cSrcweir     // controling event notifications
88*cdf0e10cSrcweir     const bool STARTUP_SUSPENDED = true;
89*cdf0e10cSrcweir     const bool STARTUP_ALIVE     = false;
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir 	css::uno::Sequence< ::rtl::OUString > SAL_CALL VistaFilePicker_getSupportedServiceNames()
92*cdf0e10cSrcweir 	{
93*cdf0e10cSrcweir 		css::uno::Sequence< ::rtl::OUString > aRet(2);
94*cdf0e10cSrcweir         aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FilePicker");
95*cdf0e10cSrcweir 		aRet[1] = ::rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFilePicker");
96*cdf0e10cSrcweir 		return aRet;
97*cdf0e10cSrcweir 	}
98*cdf0e10cSrcweir }
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
101*cdf0e10cSrcweir #define ENABLE_LOGGING
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir #define LOGFILE_VISTA "c:\\temp\\vistafiledialog.log"
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir #ifdef ENABLE_LOGGING
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     #define LOG_FILE(PARAM_MESSAGE)                                 \
108*cdf0e10cSrcweir         {                                                           \
109*cdf0e10cSrcweir             FILE* pFile = fopen(LOGFILE_VISTA, "a");                \
110*cdf0e10cSrcweir             fprintf(pFile, PARAM_MESSAGE);                          \
111*cdf0e10cSrcweir             fclose(pFile);                                          \
112*cdf0e10cSrcweir         }
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir     #define LOG_FILE_1_PARAM(PARAM_MESSAGE, PARAM_1)                \
115*cdf0e10cSrcweir         {                                                           \
116*cdf0e10cSrcweir             FILE* pFile = fopen(LOGFILE_VISTA, "a");                \
117*cdf0e10cSrcweir             fprintf(pFile, PARAM_MESSAGE, PARAM_1);                 \
118*cdf0e10cSrcweir             fclose(pFile);                                          \
119*cdf0e10cSrcweir         }
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir     #define LOG_FILE_2_PARAM(PARAM_MESSAGE, PARAM_1, PARAM_2)       \
122*cdf0e10cSrcweir         {                                                           \
123*cdf0e10cSrcweir             FILE* pFile = fopen(LOGFILE_VISTA, "a");                \
124*cdf0e10cSrcweir             fprintf(pFile, PARAM_MESSAGE, PARAM_1, PARAM_2);        \
125*cdf0e10cSrcweir             fclose(pFile);                                          \
126*cdf0e10cSrcweir         }
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir #else
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir     #define LOG_FILE(PARAM_MESSAGE)
131*cdf0e10cSrcweir     #define LOG_FILE_1_PARAM(PARAM_MESSAGE, PARAM_1)
132*cdf0e10cSrcweir     #define LOG_FILE_2_PARAM(PARAM_MESSAGE, PARAM_1, PARAM_2)
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir #endif
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
137*cdf0e10cSrcweir #define VISTAFILEDIALOG_CHECKED_COMCALL(PARAM_CODE, PARAM_LOGMESSAGE, PARAM_ERRORMESSAGE)                                   \
138*cdf0e10cSrcweir     {                                                                                                                       \
139*cdf0e10cSrcweir         HRESULT aResult;                                                                                                    \
140*cdf0e10cSrcweir         VISTAFILEDIALOG_CHECKED_COMCALL_WITH_RETURN(aResult, PARAM_CODE, PARAM_LOGMESSAGE, PARAM_ERRORMESSAGE)              \
141*cdf0e10cSrcweir     }
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
144*cdf0e10cSrcweir #define VISTAFILEDIALOG_CHECKED_COMCALL_WITH_RETURN(RETURN_HR, PARAM_CODE, PARAM_LOGMESSAGE, PARAM_ERRORMESSAGE)            \
145*cdf0e10cSrcweir     {                                                                                                                       \
146*cdf0e10cSrcweir         LOG_FILE(PARAM_LOGMESSAGE)                                                                                          \
147*cdf0e10cSrcweir         RETURN_HR = PARAM_CODE;                                                                                             \
148*cdf0e10cSrcweir         if ( FAILED(RETURN_HR) )                                                                                            \
149*cdf0e10cSrcweir         {                                                                                                                   \
150*cdf0e10cSrcweir             LOG_FILE_1_PARAM("will throw exception for checked COM call:\n%s", PARAM_ERRORMESSAGE)                          \
151*cdf0e10cSrcweir             throw css::uno::RuntimeException(                                                                               \
152*cdf0e10cSrcweir                 ::rtl::OUString::createFromAscii(PARAM_ERRORMESSAGE),                                                       \
153*cdf0e10cSrcweir                 css::uno::Reference< css::ui::dialogs::XFilePicker >());                                                    \
154*cdf0e10cSrcweir         }                                                                                                                   \
155*cdf0e10cSrcweir     }
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
160*cdf0e10cSrcweir VistaFilePicker::VistaFilePicker(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
161*cdf0e10cSrcweir     : TVistaFilePickerBase  (m_aMutex                 )
162*cdf0e10cSrcweir     , m_xSMGR               (xSMGR                    )
163*cdf0e10cSrcweir     , m_rDialog             (new VistaFilePickerImpl())
164*cdf0e10cSrcweir     , m_aAsyncExecute       (m_rDialog                )
165*cdf0e10cSrcweir     , m_nFilePickerThreadId (0                        )
166*cdf0e10cSrcweir 	, m_bInitialized		(false					  )
167*cdf0e10cSrcweir {
168*cdf0e10cSrcweir }
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
171*cdf0e10cSrcweir VistaFilePicker::~VistaFilePicker()
172*cdf0e10cSrcweir {
173*cdf0e10cSrcweir }
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir //------------------------------------------------------------------------------------
176*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::addFilePickerListener(const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener)
177*cdf0e10cSrcweir 	throw(css::uno::RuntimeException)
178*cdf0e10cSrcweir {
179*cdf0e10cSrcweir     RequestRef rRequest(new Request());
180*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_ADD_PICKER_LISTENER);
181*cdf0e10cSrcweir     rRequest->setArgument(PROP_PICKER_LISTENER, xListener);
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
184*cdf0e10cSrcweir }
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
187*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::removeFilePickerListener(const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener )
188*cdf0e10cSrcweir 	throw(css::uno::RuntimeException)
189*cdf0e10cSrcweir {
190*cdf0e10cSrcweir     RequestRef rRequest(new Request());
191*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_REMOVE_PICKER_LISTENER);
192*cdf0e10cSrcweir     rRequest->setArgument(PROP_PICKER_LISTENER, xListener);
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
195*cdf0e10cSrcweir }
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir // -------------------------------------------------
198*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::disposing(const css::lang::EventObject& /*aEvent*/)
199*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
200*cdf0e10cSrcweir {
201*cdf0e10cSrcweir }
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir //------------------------------------------------------------------------------------
204*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::setMultiSelectionMode(::sal_Bool bMode)
205*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
206*cdf0e10cSrcweir {
207*cdf0e10cSrcweir     RequestRef rRequest(new Request());
208*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_SET_MULTISELECTION_MODE);
209*cdf0e10cSrcweir     rRequest->setArgument(PROP_MULTISELECTION_MODE, bMode);
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
212*cdf0e10cSrcweir }
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
215*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::setTitle(const ::rtl::OUString& sTitle)
216*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
217*cdf0e10cSrcweir {
218*cdf0e10cSrcweir     RequestRef rRequest(new Request());
219*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_SET_TITLE);
220*cdf0e10cSrcweir     rRequest->setArgument(PROP_TITLE, sTitle);
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
223*cdf0e10cSrcweir }
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
226*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::appendFilter(const ::rtl::OUString& sTitle ,
227*cdf0e10cSrcweir                                             const ::rtl::OUString& sFilter)
228*cdf0e10cSrcweir 	throw(css::lang::IllegalArgumentException,
229*cdf0e10cSrcweir           css::uno::RuntimeException         )
230*cdf0e10cSrcweir {
231*cdf0e10cSrcweir     RequestRef rRequest(new Request());
232*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_APPEND_FILTER);
233*cdf0e10cSrcweir     rRequest->setArgument(PROP_FILTER_TITLE, sTitle );
234*cdf0e10cSrcweir     rRequest->setArgument(PROP_FILTER_VALUE, sFilter);
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
237*cdf0e10cSrcweir }
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
240*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::setCurrentFilter(const ::rtl::OUString& sTitle)
241*cdf0e10cSrcweir 	throw(css::lang::IllegalArgumentException,
242*cdf0e10cSrcweir           css::uno::RuntimeException         )
243*cdf0e10cSrcweir {
244*cdf0e10cSrcweir     RequestRef rRequest(new Request());
245*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_SET_CURRENT_FILTER);
246*cdf0e10cSrcweir     rRequest->setArgument(PROP_FILTER_TITLE, sTitle);
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
249*cdf0e10cSrcweir }
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
252*cdf0e10cSrcweir ::rtl::OUString SAL_CALL VistaFilePicker::getCurrentFilter()
253*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
254*cdf0e10cSrcweir {
255*cdf0e10cSrcweir     RequestRef rRequest(new Request());
256*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_GET_CURRENT_FILTER);
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::BLOCKED);
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir     const  ::rtl::OUString sTitle = rRequest->getArgumentOrDefault(PROP_FILTER_TITLE, ::rtl::OUString());
261*cdf0e10cSrcweir     return sTitle;
262*cdf0e10cSrcweir }
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
265*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::appendFilterGroup(const ::rtl::OUString&                              /*sGroupTitle*/,
266*cdf0e10cSrcweir                                                  const css::uno::Sequence< css::beans::StringPair >& rFilters   )
267*cdf0e10cSrcweir 	throw (css::lang::IllegalArgumentException,
268*cdf0e10cSrcweir            css::uno::RuntimeException         )
269*cdf0e10cSrcweir {
270*cdf0e10cSrcweir     RequestRef rRequest(new Request());
271*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_APPEND_FILTERGROUP);
272*cdf0e10cSrcweir     rRequest->setArgument(PROP_FILTER_GROUP, rFilters);
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
275*cdf0e10cSrcweir }
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
278*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::setDefaultName(const ::rtl::OUString& sName )
279*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
280*cdf0e10cSrcweir {
281*cdf0e10cSrcweir     RequestRef rRequest(new Request());
282*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_SET_DEFAULT_NAME);
283*cdf0e10cSrcweir     rRequest->setArgument(PROP_FILENAME, sName);
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
286*cdf0e10cSrcweir }
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
289*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::setDisplayDirectory(const ::rtl::OUString& sDirectory)
290*cdf0e10cSrcweir 	throw (css::lang::IllegalArgumentException,
291*cdf0e10cSrcweir            css::uno::RuntimeException         )
292*cdf0e10cSrcweir {
293*cdf0e10cSrcweir     const ::rtl::OUString aPackage( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/"));
294*cdf0e10cSrcweir     const ::rtl::OUString aRelPath( RTL_CONSTASCII_USTRINGPARAM("Path/Info"));
295*cdf0e10cSrcweir     const ::rtl::OUString aKey( RTL_CONSTASCII_USTRINGPARAM("WorkPathChanged"));
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir     css::uno::Any aValue = ::comphelper::ConfigurationHelper::readDirectKey(
298*cdf0e10cSrcweir         m_xSMGR, aPackage, aRelPath, aKey, ::comphelper::ConfigurationHelper::E_READONLY);
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir     bool bChanged(false);
301*cdf0e10cSrcweir     if (( aValue >>= bChanged ) && bChanged )
302*cdf0e10cSrcweir     {
303*cdf0e10cSrcweir         ::comphelper::ConfigurationHelper::writeDirectKey(
304*cdf0e10cSrcweir             m_xSMGR, aPackage, aRelPath, aKey, css::uno::makeAny(false), ::comphelper::ConfigurationHelper::E_STANDARD);
305*cdf0e10cSrcweir     }
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir     RequestRef rRequest(new Request());
308*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_SET_DIRECTORY);
309*cdf0e10cSrcweir     rRequest->setArgument(PROP_DIRECTORY, sDirectory);
310*cdf0e10cSrcweir     rRequest->setArgument(PROP_FORCE, bChanged);
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
313*cdf0e10cSrcweir }
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
316*cdf0e10cSrcweir ::rtl::OUString SAL_CALL VistaFilePicker::getDisplayDirectory()
317*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
318*cdf0e10cSrcweir {
319*cdf0e10cSrcweir 	RequestRef rRequest(new Request());
320*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_GET_DIRECTORY);
321*cdf0e10cSrcweir 	m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
322*cdf0e10cSrcweir 	const ::rtl::OUString sDirectory = rRequest->getArgumentOrDefault(PROP_FILENAME, ::rtl::OUString());
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir     return sDirectory;
325*cdf0e10cSrcweir }
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
328*cdf0e10cSrcweir // @deprecated cant be supported any longer ... see IDL description for further details
329*cdf0e10cSrcweir css::uno::Sequence< ::rtl::OUString > SAL_CALL VistaFilePicker::getFiles()
330*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
331*cdf0e10cSrcweir {
332*cdf0e10cSrcweir     RequestRef rRequest(new Request());
333*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_GET_SELECTED_FILES);
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::BLOCKED);
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir     const  css::uno::Sequence< ::rtl::OUString > lFiles = rRequest->getArgumentOrDefault(PROP_SELECTED_FILES, css::uno::Sequence< ::rtl::OUString >());
338*cdf0e10cSrcweir     m_lLastFiles = lFiles;
339*cdf0e10cSrcweir     return lFiles;
340*cdf0e10cSrcweir }
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
343*cdf0e10cSrcweir css::uno::Sequence< ::rtl::OUString > SAL_CALL VistaFilePicker::getSelectedFiles()
344*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
345*cdf0e10cSrcweir {
346*cdf0e10cSrcweir     RequestRef rRequest(new Request());
347*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_GET_SELECTED_FILES);
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::BLOCKED);
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir     const  css::uno::Sequence< ::rtl::OUString > lFiles = rRequest->getArgumentOrDefault(PROP_SELECTED_FILES, css::uno::Sequence< ::rtl::OUString >());
352*cdf0e10cSrcweir     m_lLastFiles = lFiles;
353*cdf0e10cSrcweir     return lFiles;
354*cdf0e10cSrcweir }
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
357*cdf0e10cSrcweir ::sal_Int16 SAL_CALL VistaFilePicker::execute()
358*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
359*cdf0e10cSrcweir {
360*cdf0e10cSrcweir 	bool bInitialized(false);
361*cdf0e10cSrcweir 	{
362*cdf0e10cSrcweir 		osl::MutexGuard aGuard(m_aMutex);
363*cdf0e10cSrcweir 		bInitialized = m_bInitialized;
364*cdf0e10cSrcweir 	}
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir 	if ( !bInitialized )
367*cdf0e10cSrcweir 	{
368*cdf0e10cSrcweir 		sal_Int16 nTemplateDescription = css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
369*cdf0e10cSrcweir 		css::uno::Sequence < css::uno::Any > aInitArguments(1);
370*cdf0e10cSrcweir 		aInitArguments[0] <<= nTemplateDescription;
371*cdf0e10cSrcweir 		initialize(aInitArguments);
372*cdf0e10cSrcweir 	}
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir     RequestRef rRequest(new Request());
375*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_SHOW_DIALOG_MODAL);
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir 	// if we want to show a modal window, the calling thread needs to process messages
378*cdf0e10cSrcweir 	m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::PROCESS_MESSAGES);
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir     const ::sal_Bool bOK          = rRequest->getArgumentOrDefault(PROP_DIALOG_SHOW_RESULT, (::sal_Bool)sal_False                  );
381*cdf0e10cSrcweir                      m_lLastFiles = rRequest->getArgumentOrDefault(PROP_SELECTED_FILES    , css::uno::Sequence< ::rtl::OUString >());
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir     ::sal_Int16 nResult = css::ui::dialogs::ExecutableDialogResults::CANCEL;
384*cdf0e10cSrcweir     if (bOK)
385*cdf0e10cSrcweir         nResult = css::ui::dialogs::ExecutableDialogResults::OK;
386*cdf0e10cSrcweir     return nResult;
387*cdf0e10cSrcweir }
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir //------------------------------------------------------------------------------------
390*cdf0e10cSrcweir // XFilePicker functions
391*cdf0e10cSrcweir //------------------------------------------------------------------------------------
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::setValue(      ::sal_Int16    nControlId    ,
394*cdf0e10cSrcweir                                               ::sal_Int16    nControlAction,
395*cdf0e10cSrcweir                                         const css::uno::Any& aValue        )
396*cdf0e10cSrcweir 	throw(css::uno::RuntimeException)
397*cdf0e10cSrcweir {
398*cdf0e10cSrcweir     RequestRef rRequest(new Request());
399*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_SET_CONTROL_VALUE);
400*cdf0e10cSrcweir     rRequest->setArgument(PROP_CONTROL_ID    , nControlId    );
401*cdf0e10cSrcweir     rRequest->setArgument(PROP_CONTROL_ACTION, nControlAction);
402*cdf0e10cSrcweir     rRequest->setArgument(PROP_CONTROL_VALUE , aValue        );
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
405*cdf0e10cSrcweir }
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
408*cdf0e10cSrcweir //
409*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir css::uno::Any SAL_CALL VistaFilePicker::getValue(::sal_Int16 nControlId    ,
412*cdf0e10cSrcweir                                                  ::sal_Int16 nControlAction)
413*cdf0e10cSrcweir 	throw(css::uno::RuntimeException)
414*cdf0e10cSrcweir {
415*cdf0e10cSrcweir     RequestRef rRequest(new Request());
416*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_GET_CONTROL_VALUE);
417*cdf0e10cSrcweir     rRequest->setArgument(PROP_CONTROL_ID    , nControlId    );
418*cdf0e10cSrcweir     rRequest->setArgument(PROP_CONTROL_ACTION, nControlAction);
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::BLOCKED);
421*cdf0e10cSrcweir     const css::uno::Any aValue = rRequest->getArgumentOrDefault(PROP_CONTROL_VALUE, css::uno::Any());
422*cdf0e10cSrcweir     return aValue;
423*cdf0e10cSrcweir }
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
426*cdf0e10cSrcweir //
427*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::enableControl(::sal_Int16 nControlId,
430*cdf0e10cSrcweir                                              ::sal_Bool  bEnable   )
431*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
432*cdf0e10cSrcweir {
433*cdf0e10cSrcweir     RequestRef rRequest(new Request());
434*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_ENABLE_CONTROL);
435*cdf0e10cSrcweir     rRequest->setArgument(PROP_CONTROL_ID    , nControlId);
436*cdf0e10cSrcweir     rRequest->setArgument(PROP_CONTROL_ENABLE, bEnable   );
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
439*cdf0e10cSrcweir }
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
442*cdf0e10cSrcweir //
443*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::setLabel(      ::sal_Int16      nControlId,
446*cdf0e10cSrcweir                                          const ::rtl::OUString& sLabel    )
447*cdf0e10cSrcweir 	throw (css::uno::RuntimeException)
448*cdf0e10cSrcweir {
449*cdf0e10cSrcweir     RequestRef rRequest(new Request());
450*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_SET_CONTROL_LABEL);
451*cdf0e10cSrcweir     rRequest->setArgument(PROP_CONTROL_ID   , nControlId);
452*cdf0e10cSrcweir     rRequest->setArgument(PROP_CONTROL_LABEL, sLabel    );
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
455*cdf0e10cSrcweir }
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
458*cdf0e10cSrcweir //
459*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------
460*cdf0e10cSrcweir 
461*cdf0e10cSrcweir ::rtl::OUString SAL_CALL VistaFilePicker::getLabel(::sal_Int16 nControlId)
462*cdf0e10cSrcweir 	throw (css::uno::RuntimeException)
463*cdf0e10cSrcweir {
464*cdf0e10cSrcweir     RequestRef rRequest(new Request());
465*cdf0e10cSrcweir     rRequest->setRequest (VistaFilePickerImpl::E_GET_CONTROL_LABEL);
466*cdf0e10cSrcweir     rRequest->setArgument(PROP_CONTROL_ID, nControlId);
467*cdf0e10cSrcweir 
468*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::BLOCKED);
469*cdf0e10cSrcweir     const ::rtl::OUString sLabel = rRequest->getArgumentOrDefault(PROP_CONTROL_LABEL, ::rtl::OUString());
470*cdf0e10cSrcweir     return sLabel;
471*cdf0e10cSrcweir }
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir //------------------------------------------------------------------------------------
474*cdf0e10cSrcweir //
475*cdf0e10cSrcweir //------------------------------------------------------------------------------------
476*cdf0e10cSrcweir 
477*cdf0e10cSrcweir css::uno::Sequence< ::sal_Int16 > SAL_CALL VistaFilePicker::getSupportedImageFormats()
478*cdf0e10cSrcweir     throw (css::uno::RuntimeException)
479*cdf0e10cSrcweir {
480*cdf0e10cSrcweir     return css::uno::Sequence< sal_Int16 >();
481*cdf0e10cSrcweir }
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir //------------------------------------------------------------------------------------
484*cdf0e10cSrcweir //
485*cdf0e10cSrcweir //------------------------------------------------------------------------------------
486*cdf0e10cSrcweir 
487*cdf0e10cSrcweir sal_Int32 SAL_CALL VistaFilePicker::getTargetColorDepth()
488*cdf0e10cSrcweir     throw (css::uno::RuntimeException)
489*cdf0e10cSrcweir {
490*cdf0e10cSrcweir     return 0;
491*cdf0e10cSrcweir }
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir //------------------------------------------------------------------------------------
494*cdf0e10cSrcweir //
495*cdf0e10cSrcweir //------------------------------------------------------------------------------------
496*cdf0e10cSrcweir 
497*cdf0e10cSrcweir sal_Int32 SAL_CALL VistaFilePicker::getAvailableWidth()
498*cdf0e10cSrcweir     throw (css::uno::RuntimeException)
499*cdf0e10cSrcweir {
500*cdf0e10cSrcweir     return 0;
501*cdf0e10cSrcweir }
502*cdf0e10cSrcweir 
503*cdf0e10cSrcweir //------------------------------------------------------------------------------------
504*cdf0e10cSrcweir //
505*cdf0e10cSrcweir //------------------------------------------------------------------------------------
506*cdf0e10cSrcweir 
507*cdf0e10cSrcweir sal_Int32 SAL_CALL VistaFilePicker::getAvailableHeight()
508*cdf0e10cSrcweir     throw (css::uno::RuntimeException)
509*cdf0e10cSrcweir {
510*cdf0e10cSrcweir     return 0;
511*cdf0e10cSrcweir }
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir //------------------------------------------------------------------------------------
514*cdf0e10cSrcweir //
515*cdf0e10cSrcweir //------------------------------------------------------------------------------------
516*cdf0e10cSrcweir 
517*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::setImage(      sal_Int16      /*nImageFormat*/,
518*cdf0e10cSrcweir                                          const css::uno::Any& /*aImage      */)
519*cdf0e10cSrcweir 	throw (css::lang::IllegalArgumentException,
520*cdf0e10cSrcweir            css::uno::RuntimeException         )
521*cdf0e10cSrcweir {
522*cdf0e10cSrcweir }
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir //------------------------------------------------------------------------------------
525*cdf0e10cSrcweir //
526*cdf0e10cSrcweir //------------------------------------------------------------------------------------
527*cdf0e10cSrcweir 
528*cdf0e10cSrcweir sal_Bool SAL_CALL VistaFilePicker::setShowState(sal_Bool /*bShowState*/)
529*cdf0e10cSrcweir     throw (css::uno::RuntimeException)
530*cdf0e10cSrcweir {
531*cdf0e10cSrcweir     return sal_False;
532*cdf0e10cSrcweir }
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir //------------------------------------------------------------------------------------
535*cdf0e10cSrcweir //
536*cdf0e10cSrcweir //------------------------------------------------------------------------------------
537*cdf0e10cSrcweir 
538*cdf0e10cSrcweir sal_Bool SAL_CALL VistaFilePicker::getShowState()
539*cdf0e10cSrcweir     throw (css::uno::RuntimeException)
540*cdf0e10cSrcweir {
541*cdf0e10cSrcweir     return sal_False;
542*cdf0e10cSrcweir }
543*cdf0e10cSrcweir 
544*cdf0e10cSrcweir //------------------------------------------------------------------------------------
545*cdf0e10cSrcweir //
546*cdf0e10cSrcweir //------------------------------------------------------------------------------------
547*cdf0e10cSrcweir 
548*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::initialize(const css::uno::Sequence< css::uno::Any >& lArguments)
549*cdf0e10cSrcweir 	throw(css::uno::Exception       ,
550*cdf0e10cSrcweir           css::uno::RuntimeException)
551*cdf0e10cSrcweir {
552*cdf0e10cSrcweir     /*
553*cdf0e10cSrcweir     // called twice ?
554*cdf0e10cSrcweir     if (m_pDlg)
555*cdf0e10cSrcweir 		throw css::uno::Exception(
556*cdf0e10cSrcweir                 ::rtl::OUString::createFromAscii( "XInitialization::initialize() called twice." ),
557*cdf0e10cSrcweir                 static_cast< css::ui::dialogs::XFilePicker* >( this ));
558*cdf0e10cSrcweir     */
559*cdf0e10cSrcweir 
560*cdf0e10cSrcweir     if (lArguments.getLength() < 1)
561*cdf0e10cSrcweir 		throw css::lang::IllegalArgumentException(
562*cdf0e10cSrcweir                 ::rtl::OUString::createFromAscii( "XInitialization::initialize() called without arguments." ),
563*cdf0e10cSrcweir                 static_cast< css::ui::dialogs::XFilePicker2* >( this ),
564*cdf0e10cSrcweir                 1);
565*cdf0e10cSrcweir 
566*cdf0e10cSrcweir     sal_Int32         nTemplate = -1;
567*cdf0e10cSrcweir     lArguments[0] >>= nTemplate;
568*cdf0e10cSrcweir 
569*cdf0e10cSrcweir     ::sal_Bool  bFileOpenDialog = sal_True;
570*cdf0e10cSrcweir     ::sal_Int32 nFeatures       = 0;
571*cdf0e10cSrcweir 
572*cdf0e10cSrcweir     switch(nTemplate)
573*cdf0e10cSrcweir     {
574*cdf0e10cSrcweir         case css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE :
575*cdf0e10cSrcweir         {
576*cdf0e10cSrcweir             bFileOpenDialog = sal_True;
577*cdf0e10cSrcweir         }
578*cdf0e10cSrcweir         break;
579*cdf0e10cSrcweir 
580*cdf0e10cSrcweir         case css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE :
581*cdf0e10cSrcweir         {
582*cdf0e10cSrcweir             bFileOpenDialog = sal_False;
583*cdf0e10cSrcweir         }
584*cdf0e10cSrcweir         break;
585*cdf0e10cSrcweir 
586*cdf0e10cSrcweir         case css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD :
587*cdf0e10cSrcweir         {
588*cdf0e10cSrcweir             bFileOpenDialog  = sal_False;
589*cdf0e10cSrcweir             nFeatures        |= FEATURE_AUTOEXTENSION;
590*cdf0e10cSrcweir             nFeatures        |= FEATURE_PASSWORD;
591*cdf0e10cSrcweir         }
592*cdf0e10cSrcweir         break;
593*cdf0e10cSrcweir 
594*cdf0e10cSrcweir         case css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS :
595*cdf0e10cSrcweir         {
596*cdf0e10cSrcweir             bFileOpenDialog = sal_False;
597*cdf0e10cSrcweir             nFeatures        |= FEATURE_AUTOEXTENSION;
598*cdf0e10cSrcweir             nFeatures        |= FEATURE_PASSWORD;
599*cdf0e10cSrcweir             nFeatures        |= FEATURE_FILTEROPTIONS;
600*cdf0e10cSrcweir         }
601*cdf0e10cSrcweir         break;
602*cdf0e10cSrcweir 
603*cdf0e10cSrcweir         case css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION_SELECTION :
604*cdf0e10cSrcweir         {
605*cdf0e10cSrcweir             bFileOpenDialog  = sal_False;
606*cdf0e10cSrcweir             nFeatures        |= FEATURE_AUTOEXTENSION;
607*cdf0e10cSrcweir             nFeatures        |= FEATURE_SELECTION;
608*cdf0e10cSrcweir         }
609*cdf0e10cSrcweir         break;
610*cdf0e10cSrcweir 
611*cdf0e10cSrcweir         case css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION_TEMPLATE :
612*cdf0e10cSrcweir         {
613*cdf0e10cSrcweir             bFileOpenDialog  = sal_False;
614*cdf0e10cSrcweir             nFeatures        |= FEATURE_AUTOEXTENSION;
615*cdf0e10cSrcweir             nFeatures        |= FEATURE_TEMPLATE;
616*cdf0e10cSrcweir         }
617*cdf0e10cSrcweir         break;
618*cdf0e10cSrcweir 
619*cdf0e10cSrcweir         case css::ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE :
620*cdf0e10cSrcweir         {
621*cdf0e10cSrcweir             bFileOpenDialog  = sal_True;
622*cdf0e10cSrcweir             nFeatures        |= FEATURE_LINK;
623*cdf0e10cSrcweir             nFeatures        |= FEATURE_PREVIEW;
624*cdf0e10cSrcweir             nFeatures        |= FEATURE_IMAGETEMPLATE;
625*cdf0e10cSrcweir         }
626*cdf0e10cSrcweir         break;
627*cdf0e10cSrcweir 
628*cdf0e10cSrcweir         case css::ui::dialogs::TemplateDescription::FILEOPEN_PLAY :
629*cdf0e10cSrcweir         {
630*cdf0e10cSrcweir             bFileOpenDialog  = sal_True;
631*cdf0e10cSrcweir             nFeatures        |= FEATURE_PLAY;
632*cdf0e10cSrcweir         }
633*cdf0e10cSrcweir         break;
634*cdf0e10cSrcweir 
635*cdf0e10cSrcweir         case css::ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION :
636*cdf0e10cSrcweir         {
637*cdf0e10cSrcweir             bFileOpenDialog  = sal_True;
638*cdf0e10cSrcweir             nFeatures        |= FEATURE_READONLY;
639*cdf0e10cSrcweir             nFeatures        |= FEATURE_VERSION;
640*cdf0e10cSrcweir         }
641*cdf0e10cSrcweir         break;
642*cdf0e10cSrcweir 
643*cdf0e10cSrcweir         case css::ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW :
644*cdf0e10cSrcweir         {
645*cdf0e10cSrcweir             bFileOpenDialog  = sal_True;
646*cdf0e10cSrcweir             nFeatures        |= FEATURE_LINK;
647*cdf0e10cSrcweir             nFeatures        |= FEATURE_PREVIEW;
648*cdf0e10cSrcweir         }
649*cdf0e10cSrcweir         break;
650*cdf0e10cSrcweir 
651*cdf0e10cSrcweir         case css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION :
652*cdf0e10cSrcweir         {
653*cdf0e10cSrcweir             bFileOpenDialog  = sal_False;
654*cdf0e10cSrcweir             nFeatures        |= FEATURE_AUTOEXTENSION;
655*cdf0e10cSrcweir         }
656*cdf0e10cSrcweir         break;
657*cdf0e10cSrcweir     }
658*cdf0e10cSrcweir 
659*cdf0e10cSrcweir     RequestRef rRequest(new Request());
660*cdf0e10cSrcweir     if (bFileOpenDialog)
661*cdf0e10cSrcweir         rRequest->setRequest (VistaFilePickerImpl::E_CREATE_OPEN_DIALOG);
662*cdf0e10cSrcweir     else
663*cdf0e10cSrcweir         rRequest->setRequest (VistaFilePickerImpl::E_CREATE_SAVE_DIALOG);
664*cdf0e10cSrcweir     rRequest->setArgument(PROP_FEATURES, nFeatures);
665*cdf0e10cSrcweir 	rRequest->setArgument(PROP_TEMPLATE_DESCR, nTemplate);
666*cdf0e10cSrcweir     if ( ! m_aAsyncExecute.isRunning())
667*cdf0e10cSrcweir         m_aAsyncExecute.create();
668*cdf0e10cSrcweir     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
669*cdf0e10cSrcweir 
670*cdf0e10cSrcweir 	{
671*cdf0e10cSrcweir 		osl::MutexGuard aGuard(m_aMutex);
672*cdf0e10cSrcweir 		m_bInitialized = true;
673*cdf0e10cSrcweir 	}
674*cdf0e10cSrcweir }
675*cdf0e10cSrcweir 
676*cdf0e10cSrcweir //------------------------------------------------------------------------------------
677*cdf0e10cSrcweir //
678*cdf0e10cSrcweir //------------------------------------------------------------------------------------
679*cdf0e10cSrcweir 
680*cdf0e10cSrcweir void SAL_CALL VistaFilePicker::cancel()
681*cdf0e10cSrcweir 	throw(css::uno::RuntimeException)
682*cdf0e10cSrcweir {
683*cdf0e10cSrcweir }
684*cdf0e10cSrcweir 
685*cdf0e10cSrcweir // -------------------------------------------------
686*cdf0e10cSrcweir // XServiceInfo
687*cdf0e10cSrcweir // -------------------------------------------------
688*cdf0e10cSrcweir 
689*cdf0e10cSrcweir ::rtl::OUString SAL_CALL VistaFilePicker::getImplementationName()
690*cdf0e10cSrcweir 	throw(css::uno::RuntimeException)
691*cdf0e10cSrcweir {
692*cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii("com.sun.star.comp.fpicker.VistaFileDialog");
693*cdf0e10cSrcweir }
694*cdf0e10cSrcweir 
695*cdf0e10cSrcweir // -------------------------------------------------
696*cdf0e10cSrcweir //	XServiceInfo
697*cdf0e10cSrcweir // -------------------------------------------------
698*cdf0e10cSrcweir 
699*cdf0e10cSrcweir sal_Bool SAL_CALL VistaFilePicker::supportsService(const ::rtl::OUString& sServiceName)
700*cdf0e10cSrcweir 	throw(css::uno::RuntimeException )
701*cdf0e10cSrcweir {
702*cdf0e10cSrcweir 	css::uno::Sequence< ::rtl::OUString > lSupportedServicesNames = VistaFilePicker_getSupportedServiceNames();
703*cdf0e10cSrcweir 
704*cdf0e10cSrcweir 	for (sal_Int32 n = lSupportedServicesNames.getLength(); n--;)
705*cdf0e10cSrcweir 		if (lSupportedServicesNames[n].compareTo(sServiceName) == 0)
706*cdf0e10cSrcweir 			return sal_True;
707*cdf0e10cSrcweir 
708*cdf0e10cSrcweir 	return sal_False;
709*cdf0e10cSrcweir }
710*cdf0e10cSrcweir 
711*cdf0e10cSrcweir // -------------------------------------------------
712*cdf0e10cSrcweir //	XServiceInfo
713*cdf0e10cSrcweir // -------------------------------------------------
714*cdf0e10cSrcweir 
715*cdf0e10cSrcweir css::uno::Sequence< ::rtl::OUString > SAL_CALL VistaFilePicker::getSupportedServiceNames()
716*cdf0e10cSrcweir 	throw(css::uno::RuntimeException)
717*cdf0e10cSrcweir {
718*cdf0e10cSrcweir 	return VistaFilePicker_getSupportedServiceNames();
719*cdf0e10cSrcweir }
720*cdf0e10cSrcweir 
721*cdf0e10cSrcweir } // namespace vista
722*cdf0e10cSrcweir } // namespace win32
723*cdf0e10cSrcweir } // namespace fpicker
724