1b557fc96SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3b557fc96SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4b557fc96SAndrew Rist * or more contributor license agreements. See the NOTICE file
5b557fc96SAndrew Rist * distributed with this work for additional information
6b557fc96SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7b557fc96SAndrew Rist * to you under the Apache License, Version 2.0 (the
8b557fc96SAndrew Rist * "License"); you may not use this file except in compliance
9b557fc96SAndrew Rist * with the License. You may obtain a copy of the License at
10b557fc96SAndrew Rist *
11b557fc96SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12b557fc96SAndrew Rist *
13b557fc96SAndrew Rist * Unless required by applicable law or agreed to in writing,
14b557fc96SAndrew Rist * software distributed under the License is distributed on an
15b557fc96SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b557fc96SAndrew Rist * KIND, either express or implied. See the License for the
17b557fc96SAndrew Rist * specific language governing permissions and limitations
18b557fc96SAndrew Rist * under the License.
19b557fc96SAndrew Rist *
20b557fc96SAndrew Rist *************************************************************/
21b557fc96SAndrew Rist
22b557fc96SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_fpicker.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir //_________________________________________________________________________________________________________________________
29cdf0e10cSrcweir // interface includes
30cdf0e10cSrcweir //_________________________________________________________________________________________________________________________
31cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
32cdf0e10cSrcweir #include <com/sun/star/registry/XSimpleRegistry.hpp>
33cdf0e10cSrcweir #include <osl/file.hxx>
34cdf0e10cSrcweir
35cdf0e10cSrcweir //_________________________________________________________________________________________________________________________
36cdf0e10cSrcweir // other includes
37cdf0e10cSrcweir //_________________________________________________________________________________________________________________________
38cdf0e10cSrcweir #include <cppuhelper/servicefactory.hxx>
39cdf0e10cSrcweir
40cdf0e10cSrcweir #ifndef _RTL_USTRING_
41cdf0e10cSrcweir #include <rtl/ustring>
42cdf0e10cSrcweir #endif
43cdf0e10cSrcweir #include <sal/types.h>
44cdf0e10cSrcweir #include <osl/diagnose.h>
45cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
46cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
47cdf0e10cSrcweir
48cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UI_DIALOGS_FILEDIALOGRESULTS_HPP_
49cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
50cdf0e10cSrcweir #endif
51cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
52cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
53cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
54cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
55cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
56cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
57cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
58cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
59cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePreview.hpp>
60cdf0e10cSrcweir
61cdf0e10cSrcweir #include <osl/thread.h>
62cdf0e10cSrcweir
63cdf0e10cSrcweir #include <stdio.h>
64cdf0e10cSrcweir #include <windows.h>
65cdf0e10cSrcweir
66cdf0e10cSrcweir #include "..\FPServiceInfo.hxx"
67cdf0e10cSrcweir
68cdf0e10cSrcweir //
69cdf0e10cSrcweir // namesapces
70cdf0e10cSrcweir //
71cdf0e10cSrcweir
72cdf0e10cSrcweir using namespace ::rtl ;
73cdf0e10cSrcweir using namespace ::cppu ;
74cdf0e10cSrcweir using namespace ::com::sun::star::uno ;
75cdf0e10cSrcweir using namespace ::com::sun::star::lang ;
76cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs ;
77cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs::TemplateDescription;
78cdf0e10cSrcweir
79cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds;
80cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds;
81cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs::ListboxControlActions;
82cdf0e10cSrcweir
83cdf0e10cSrcweir using namespace std ;
84cdf0e10cSrcweir
85cdf0e10cSrcweir // forward
86cdf0e10cSrcweir
87cdf0e10cSrcweir void TestFilterManager( Reference< XFilePicker > xFilePicker );
88cdf0e10cSrcweir
89cdf0e10cSrcweir
90cdf0e10cSrcweir #define RDB_SYSPATH "D:\\Projects\\gsl\\sysui\\wntmsci7\\bin\\applicat.rdb"
91cdf0e10cSrcweir
92cdf0e10cSrcweir //_________________________________________________________________________________________________________________________
93cdf0e10cSrcweir // global variables
94cdf0e10cSrcweir //_________________________________________________________________________________________________________________________
95cdf0e10cSrcweir
96cdf0e10cSrcweir Reference< XMultiServiceFactory > g_xFactory;
97cdf0e10cSrcweir
98cdf0e10cSrcweir const OUString BMP_EXTENSION = OUString::createFromAscii( "bmp" );
99cdf0e10cSrcweir
100cdf0e10cSrcweir //-------------------------------------------------------------------------------------------------------------------------
101cdf0e10cSrcweir // a test client
102cdf0e10cSrcweir //-------------------------------------------------------------------------------------------------------------------------
103cdf0e10cSrcweir
104cdf0e10cSrcweir class FilePickerListener : public WeakImplHelper1< XFilePickerListener >
105cdf0e10cSrcweir {
106cdf0e10cSrcweir public:
107cdf0e10cSrcweir
108cdf0e10cSrcweir // XEventListener
109cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
110cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException);
111cdf0e10cSrcweir
112cdf0e10cSrcweir // XFilePickerListener
113cdf0e10cSrcweir virtual void SAL_CALL fileSelectionChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent )
114cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException);
115cdf0e10cSrcweir
116cdf0e10cSrcweir virtual void SAL_CALL directoryChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent )
117cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException);
118cdf0e10cSrcweir
119cdf0e10cSrcweir virtual OUString SAL_CALL helpRequested( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent )
120cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException);
121cdf0e10cSrcweir
122cdf0e10cSrcweir virtual void SAL_CALL controlStateChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent )
123cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException);
124cdf0e10cSrcweir
125cdf0e10cSrcweir virtual void SAL_CALL dialogSizeChanged( )
126cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException);
127cdf0e10cSrcweir };
128cdf0e10cSrcweir
disposing(const::com::sun::star::lang::EventObject & Source)129cdf0e10cSrcweir void SAL_CALL FilePickerListener::disposing( const ::com::sun::star::lang::EventObject& Source )
130cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException)
131cdf0e10cSrcweir {
132cdf0e10cSrcweir }
133cdf0e10cSrcweir
fileSelectionChanged(const::com::sun::star::ui::dialogs::FilePickerEvent & aEvent)134cdf0e10cSrcweir void SAL_CALL FilePickerListener::fileSelectionChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent )
135cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException)
136cdf0e10cSrcweir {
137cdf0e10cSrcweir try
138cdf0e10cSrcweir {
139cdf0e10cSrcweir Reference< XFilePicker > rXFilePicker( aEvent.Source, UNO_QUERY );
140cdf0e10cSrcweir Reference< XFilePreview > rXFilePreview( rXFilePicker, UNO_QUERY );
141cdf0e10cSrcweir
142cdf0e10cSrcweir if ( !rXFilePreview.is( ) )
143cdf0e10cSrcweir return;
144cdf0e10cSrcweir
145cdf0e10cSrcweir Sequence< OUString > aFileList = rXFilePicker->getFiles( );
146cdf0e10cSrcweir if ( 1 == aFileList.getLength( ) )
147cdf0e10cSrcweir {
148cdf0e10cSrcweir OUString FilePath = aFileList[0];
149cdf0e10cSrcweir
150cdf0e10cSrcweir // detect file extension
151cdf0e10cSrcweir sal_Int32 nIndex = FilePath.lastIndexOf( BMP_EXTENSION );
152cdf0e10cSrcweir if ( (FilePath.getLength( ) - 3) == nIndex )
153cdf0e10cSrcweir {
154cdf0e10cSrcweir OUString FileSysPath;
155cdf0e10cSrcweir ::osl::FileBase::getSystemPathFromFileURL(
156cdf0e10cSrcweir FilePath, FileSysPath );
157cdf0e10cSrcweir
158cdf0e10cSrcweir HANDLE hFile = CreateFileW(
159cdf0e10cSrcweir FileSysPath.getStr( ),
160cdf0e10cSrcweir GENERIC_READ, FILE_SHARE_READ, NULL,
161cdf0e10cSrcweir OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL) ;
162cdf0e10cSrcweir
163cdf0e10cSrcweir if (hFile == INVALID_HANDLE_VALUE)
164cdf0e10cSrcweir return;
165cdf0e10cSrcweir
166cdf0e10cSrcweir DWORD dwHighSize;
167cdf0e10cSrcweir DWORD dwFileSize = GetFileSize (hFile, &dwHighSize) ;
168cdf0e10cSrcweir
169cdf0e10cSrcweir if (dwHighSize)
170cdf0e10cSrcweir {
171cdf0e10cSrcweir CloseHandle (hFile) ;
172cdf0e10cSrcweir return;
173cdf0e10cSrcweir }
174cdf0e10cSrcweir
175cdf0e10cSrcweir Sequence< sal_Int8 > aDIB( dwFileSize );
176cdf0e10cSrcweir
177cdf0e10cSrcweir DWORD dwBytesRead;
178cdf0e10cSrcweir sal_Bool bSuccess = ReadFile (hFile, aDIB.getArray( ), dwFileSize, &dwBytesRead, NULL) ;
179cdf0e10cSrcweir CloseHandle (hFile);
180cdf0e10cSrcweir
181cdf0e10cSrcweir BITMAPFILEHEADER* pbmfh = (BITMAPFILEHEADER*)aDIB.getConstArray( );
182cdf0e10cSrcweir if (!bSuccess || (dwBytesRead != dwFileSize)
183cdf0e10cSrcweir || (pbmfh->bfType != * (WORD *) "BM")
184cdf0e10cSrcweir || (pbmfh->bfSize != dwFileSize))
185cdf0e10cSrcweir {
186cdf0e10cSrcweir return;
187cdf0e10cSrcweir }
188cdf0e10cSrcweir
189cdf0e10cSrcweir Any aAny;
190cdf0e10cSrcweir
191cdf0e10cSrcweir aAny <<= aDIB;
192cdf0e10cSrcweir rXFilePreview->setImage( 1, aAny );
193cdf0e10cSrcweir }
194cdf0e10cSrcweir }
195cdf0e10cSrcweir }
196cdf0e10cSrcweir catch( IllegalArgumentException& ex )
197cdf0e10cSrcweir {
198cdf0e10cSrcweir ex = ex;
199cdf0e10cSrcweir }
200cdf0e10cSrcweir }
201cdf0e10cSrcweir
directoryChanged(const::com::sun::star::ui::dialogs::FilePickerEvent & aEvent)202cdf0e10cSrcweir void SAL_CALL FilePickerListener::directoryChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent )
203cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException)
204cdf0e10cSrcweir {
205cdf0e10cSrcweir Reference< XFilePickerControlAccess > rFilePickerCtrlAccess( aEvent.Source, UNO_QUERY );
206cdf0e10cSrcweir }
207cdf0e10cSrcweir
helpRequested(const::com::sun::star::ui::dialogs::FilePickerEvent & aEvent)208cdf0e10cSrcweir OUString SAL_CALL FilePickerListener::helpRequested( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent )
209cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException)
210cdf0e10cSrcweir {
211cdf0e10cSrcweir return OUString( );
212cdf0e10cSrcweir }
213cdf0e10cSrcweir
controlStateChanged(const::com::sun::star::ui::dialogs::FilePickerEvent & aEvent)214cdf0e10cSrcweir void SAL_CALL FilePickerListener::controlStateChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent )
215cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException)
216cdf0e10cSrcweir {
217cdf0e10cSrcweir try
218cdf0e10cSrcweir {
219cdf0e10cSrcweir Reference< XFilePickerControlAccess > rFPCtrlAccess( aEvent.Source, UNO_QUERY );
220cdf0e10cSrcweir
221cdf0e10cSrcweir Any aValue;
222cdf0e10cSrcweir
223cdf0e10cSrcweir OUString lbString( L"Ein Eintrag 1" );
224cdf0e10cSrcweir aValue <<= lbString;
225cdf0e10cSrcweir rFPCtrlAccess->setValue( LISTBOX_VERSION, ADD_ITEM, aValue );
226cdf0e10cSrcweir
227cdf0e10cSrcweir lbString = OUString( L"Ein Eintrag 2" );
228cdf0e10cSrcweir aValue <<= lbString;
229cdf0e10cSrcweir rFPCtrlAccess->setValue( LISTBOX_VERSION, ADD_ITEM, aValue );
230cdf0e10cSrcweir
231cdf0e10cSrcweir lbString = OUString( L"Ein Eintrag 3" );
232cdf0e10cSrcweir aValue <<= lbString;
233cdf0e10cSrcweir rFPCtrlAccess->setValue( LISTBOX_VERSION, ADD_ITEM, aValue );
234cdf0e10cSrcweir
235cdf0e10cSrcweir sal_Int16 nSel = 1;
236cdf0e10cSrcweir aValue <<= nSel;
237cdf0e10cSrcweir rFPCtrlAccess->setValue( LISTBOX_VERSION, SET_SELECT_ITEM, aValue );
238cdf0e10cSrcweir
239cdf0e10cSrcweir sal_Int32 nDel = 0;
240cdf0e10cSrcweir aValue <<= nDel;
241cdf0e10cSrcweir rFPCtrlAccess->setValue( LISTBOX_VERSION, DELETE_ITEM, aValue );
242cdf0e10cSrcweir }
243cdf0e10cSrcweir catch( ... )
244cdf0e10cSrcweir {
245cdf0e10cSrcweir }
246cdf0e10cSrcweir }
247cdf0e10cSrcweir
dialogSizeChanged()248cdf0e10cSrcweir void SAL_CALL FilePickerListener::dialogSizeChanged( )
249cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException)
250cdf0e10cSrcweir {
251cdf0e10cSrcweir }
252cdf0e10cSrcweir
253cdf0e10cSrcweir //--------------------------------------------------------
254cdf0e10cSrcweir // main
255cdf0e10cSrcweir //--------------------------------------------------------
256cdf0e10cSrcweir
257cdf0e10cSrcweir
main(int nArgc,char * Argv[],char * Env[])258cdf0e10cSrcweir int SAL_CALL main(int nArgc, char* Argv[], char* Env[] )
259cdf0e10cSrcweir {
260cdf0e10cSrcweir printf("Starting test of FPS-Service\n");
261cdf0e10cSrcweir
262cdf0e10cSrcweir //-------------------------------------------------
263cdf0e10cSrcweir // get the global service-manager
264cdf0e10cSrcweir //-------------------------------------------------
265cdf0e10cSrcweir
266cdf0e10cSrcweir // Get global factory for uno services.
267cdf0e10cSrcweir OUString rdbName = OUString( RTL_CONSTASCII_USTRINGPARAM( RDB_SYSPATH ) );
268cdf0e10cSrcweir Reference< XMultiServiceFactory > g_xFactory( createRegistryServiceFactory( rdbName ) );
269cdf0e10cSrcweir
270*07a3d7f1SPedro Giffuni // Print a message if an error occurred.
271cdf0e10cSrcweir if ( g_xFactory.is() == sal_False )
272cdf0e10cSrcweir {
273cdf0e10cSrcweir OSL_ENSURE(sal_False, "Can't create RegistryServiceFactory");
274cdf0e10cSrcweir return(-1);
275cdf0e10cSrcweir }
276cdf0e10cSrcweir
277cdf0e10cSrcweir //-------------------------------------------------
278cdf0e10cSrcweir // try to get an Interface to a XFilePicker Service
279cdf0e10cSrcweir //-------------------------------------------------
280cdf0e10cSrcweir
281cdf0e10cSrcweir Sequence< Any > arguments(1);
282cdf0e10cSrcweir //arguments[0] = makeAny( FILEOPEN_SIMPLE );
283cdf0e10cSrcweir //arguments[0] = makeAny( FILESAVE_SIMPLE );
284cdf0e10cSrcweir //arguments[0] = makeAny( FILESAVE_AUTOEXTENSION_PASSWORD );
285cdf0e10cSrcweir //arguments[0] = makeAny( FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS );
286cdf0e10cSrcweir //arguments[0] = makeAny( FILESAVE_AUTOEXTENSION_SELECTION );
287cdf0e10cSrcweir //arguments[0] = makeAny( FILESAVE_AUTOEXTENSION_TEMPLATE );
288cdf0e10cSrcweir //arguments[0] = makeAny( FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE );
289cdf0e10cSrcweir //arguments[0] = makeAny( FILEOPEN_PLAY );
290cdf0e10cSrcweir arguments[0] = makeAny( FILEOPEN_READONLY_VERSION );
291cdf0e10cSrcweir
292cdf0e10cSrcweir Reference< XFilePicker > xFilePicker = Reference< XFilePicker >(
293cdf0e10cSrcweir g_xFactory->createInstanceWithArguments(
294cdf0e10cSrcweir OUString::createFromAscii( FILE_PICKER_SERVICE_NAME ), arguments ), UNO_QUERY );
295cdf0e10cSrcweir
296cdf0e10cSrcweir // install a FilePicker notifier
297cdf0e10cSrcweir Reference< XFilePickerListener > xFPListener(
298cdf0e10cSrcweir static_cast< XFilePickerListener* >( new FilePickerListener()), UNO_QUERY );
299cdf0e10cSrcweir
300cdf0e10cSrcweir Reference< XFilePickerNotifier > xFPNotifier( xFilePicker, UNO_QUERY );
301cdf0e10cSrcweir if ( xFPNotifier.is( ) )
302cdf0e10cSrcweir xFPNotifier->addFilePickerListener( xFPListener );
303cdf0e10cSrcweir
304cdf0e10cSrcweir xFilePicker->setTitle( OUString::createFromAscii("FileOpen Simple..."));
305cdf0e10cSrcweir xFilePicker->setMultiSelectionMode( sal_True );
306cdf0e10cSrcweir xFilePicker->setDefaultName( OUString::createFromAscii("d:\\test2.sxw"));
307cdf0e10cSrcweir
308cdf0e10cSrcweir OUString aDirURL;
309cdf0e10cSrcweir OUString aSysPath = OStringToOUString( "d:\\ueaeoe", osl_getThreadTextEncoding( ) );
310cdf0e10cSrcweir ::osl::FileBase::getFileURLFromSystemPath( aSysPath, aDirURL );
311cdf0e10cSrcweir xFilePicker->setDisplayDirectory( aDirURL );
312cdf0e10cSrcweir
313cdf0e10cSrcweir Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY );
314cdf0e10cSrcweir if ( xFilterMgr.is( ) )
315cdf0e10cSrcweir {
316cdf0e10cSrcweir xFilterMgr->appendFilter( L"Alle", L"*.*" );
317cdf0e10cSrcweir xFilterMgr->appendFilter( L"BMP", L"*.bmp" );
318cdf0e10cSrcweir xFilterMgr->appendFilter( L"SDW", L"*.sdw;*.sdc;*.sdi" );
319cdf0e10cSrcweir xFilterMgr->appendFilter( L"SXW", L"*.sxw;*.sxi" );
320cdf0e10cSrcweir }
321cdf0e10cSrcweir
322cdf0e10cSrcweir Reference< XFilePickerControlAccess > xFPControlAccess( xFilePicker, UNO_QUERY );
323cdf0e10cSrcweir
324cdf0e10cSrcweir Any aAny;
325cdf0e10cSrcweir sal_Bool bChkState = sal_False;
326cdf0e10cSrcweir
327cdf0e10cSrcweir aAny.setValue( &bChkState, getCppuType( (sal_Bool*)0 ) );
328cdf0e10cSrcweir xFPControlAccess->setValue( CHECKBOX_AUTOEXTENSION, 0, aAny );
329cdf0e10cSrcweir
330cdf0e10cSrcweir OUString aVersion( L"Version 1" );
331cdf0e10cSrcweir aAny <<= aVersion;
332cdf0e10cSrcweir xFPControlAccess->setValue( LISTBOX_VERSION, ADD_ITEM, aAny );
333cdf0e10cSrcweir xFPControlAccess->setValue( LISTBOX_VERSION, ADD_ITEM, aAny );
334cdf0e10cSrcweir xFPControlAccess->setValue( LISTBOX_VERSION, ADD_ITEM, aAny );
335cdf0e10cSrcweir
336cdf0e10cSrcweir xFilePicker->execute( );
337cdf0e10cSrcweir
338cdf0e10cSrcweir sal_Bool bCheckState;
339cdf0e10cSrcweir aAny = xFPControlAccess->getValue( CHECKBOX_AUTOEXTENSION, 0 );
340cdf0e10cSrcweir if ( aAny.hasValue( ) )
341cdf0e10cSrcweir bCheckState = *reinterpret_cast< const sal_Bool* >( aAny.getValue( ) );
342cdf0e10cSrcweir
343cdf0e10cSrcweir aAny = xFPControlAccess->getValue( CHECKBOX_READONLY, 0 );
344cdf0e10cSrcweir if ( aAny.hasValue( ) )
345cdf0e10cSrcweir bCheckState = *reinterpret_cast< const sal_Bool* >( aAny.getValue( ) );
346cdf0e10cSrcweir
347cdf0e10cSrcweir aAny = xFPControlAccess->getValue( LISTBOX_VERSION, GET_SELECTED_ITEM );
348cdf0e10cSrcweir sal_Int32 nSel;
349cdf0e10cSrcweir if ( aAny.hasValue( ) )
350cdf0e10cSrcweir aAny >>= nSel;
351cdf0e10cSrcweir
352cdf0e10cSrcweir aDirURL = xFilePicker->getDisplayDirectory( );
353cdf0e10cSrcweir Sequence< OUString > aFileList = xFilePicker->getFiles( );
354cdf0e10cSrcweir for ( int i = 0; i < aFileList.getLength( ); i++ )
355cdf0e10cSrcweir {
356cdf0e10cSrcweir OUString nextPath = aFileList[i];
357cdf0e10cSrcweir }
358cdf0e10cSrcweir
359cdf0e10cSrcweir if ( xFPNotifier.is( ) )
360cdf0e10cSrcweir xFPNotifier->removeFilePickerListener( xFPListener );
361cdf0e10cSrcweir
362cdf0e10cSrcweir //--------------------------------------------------
363cdf0e10cSrcweir // shutdown
364cdf0e10cSrcweir //--------------------------------------------------
365cdf0e10cSrcweir
366cdf0e10cSrcweir // Cast factory to XComponent
367cdf0e10cSrcweir Reference< XComponent > xComponent( g_xFactory, UNO_QUERY );
368cdf0e10cSrcweir
369*07a3d7f1SPedro Giffuni // Print a message if an error occurred.
370cdf0e10cSrcweir if ( xComponent.is() == sal_False )
371cdf0e10cSrcweir {
372cdf0e10cSrcweir OSL_ENSURE(sal_False, "Error shuting down");
373cdf0e10cSrcweir }
374cdf0e10cSrcweir
375cdf0e10cSrcweir // Dispose and clear factory
376cdf0e10cSrcweir xComponent->dispose();
377cdf0e10cSrcweir g_xFactory.clear();
378cdf0e10cSrcweir g_xFactory = Reference< XMultiServiceFactory >();
379cdf0e10cSrcweir
380cdf0e10cSrcweir printf("Test successful\n");
381cdf0e10cSrcweir
382cdf0e10cSrcweir return 0;
383cdf0e10cSrcweir }
384