update emoji autocorrect entries from po-files
[LibreOffice.git] / fpicker / source / win32 / folderpicker / workbench / Test_fops.cxx
blob75503089240a3c594a79eea628de33066f45fe8a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/lang/XComponent.hpp>
21 #include <com/sun/star/registry/XSimpleRegistry.hpp>
22 #include <osl/file.hxx>
24 #include <cppuhelper/servicefactory.hxx>
26 #include <rtl/ustring.hxx>
27 #include <sal/types.h>
28 #include <osl/diagnose.h>
30 #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
32 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
33 #include <cppuhelper/implbase1.hxx>
35 #include <stdio.h>
37 #include "..\FOPServiceInfo.hxx"
39 #define _WIN32_DCOM
41 #include <windows.h>
44 // namesapces
47 using namespace ::cppu ;
48 using namespace ::com::sun::star::uno ;
49 using namespace ::com::sun::star::lang ;
50 using namespace ::com::sun::star::ui::dialogs;
51 using namespace std ;
53 #define RDB_SYSPATH "D:\\Projects\\gsl\\sysui\\wntmsci7\\bin\\applicat.rdb"
56 // global variables
59 Reference< XMultiServiceFactory > g_xFactory;
62 // main
66 int SAL_CALL main(int /*nArgc*/, char* /*Argv[]*/, char* /*Env[]*/ )
68 CoInitializeEx( NULL, COINIT_MULTITHREADED );
70 printf("Starting test of FolderPicker Service\n");
72 //CreateDeepDirectory( );
75 // get the global service-manager
78 // Get global factory for uno services.
79 OUString rdbName = OUString( RDB_SYSPATH );
80 Reference< XMultiServiceFactory > g_xFactory( createRegistryServiceFactory( rdbName ) );
82 // Print a message if an error occurred.
83 if ( g_xFactory.is() == sal_False )
85 OSL_FAIL("Can't create RegistryServiceFactory");
86 return(-1);
89 printf("Creating RegistryServiceFactory successful\n");
92 // try to get an Interface to a XFilePicker Service
95 Reference< XFolderPicker2 > xFolderPicker;
97 xFolderPicker = Reference< XFolderPicker2 >(
98 g_xFactory->createInstance( OUString( FOLDER_PICKER_SERVICE_NAME ) ), UNO_QUERY );
100 if ( xFolderPicker.is() == sal_False )
102 OSL_FAIL( "Error creating FolderPicker Service" );
103 return(-1);
108 xFolderPicker->setDisplayDirectory( L"file:///C|" );
109 xFolderPicker->setTitle( L"FolderBrowse Dialog" );
110 xFolderPicker->execute( );
112 OUString rootDir = xFolderPicker->getDisplayDirectory( );
113 OUString selectedDir = xFolderPicker->getDirectory( );
115 xFolderPicker->setDisplayDirectory( selectedDir );
116 xFolderPicker->execute( );
118 rootDir = xFolderPicker->getDisplayDirectory( );
119 selectedDir = xFolderPicker->getDirectory( );
121 catch( ::com::sun::star::uno::Exception& )
123 MessageBox( NULL, "Exception caught!", "Error", MB_OK );
127 // shutdown
130 // Cast factory to XComponent
131 Reference< XComponent > xComponent( g_xFactory, UNO_QUERY );
133 // Print a message if an error occurred.
134 if ( xComponent.is() == sal_False )
136 OSL_FAIL("Error shuting down");
139 // Dispose and clear factory
140 xComponent->dispose();
141 g_xFactory.clear();
143 printf("Test successful\n");
145 CoUninitialize( );
147 return 0;
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */