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