bump product version to 4.1.6.2
[LibreOffice.git] / fpicker / source / win32 / filepicker / FPentry.cxx
blob5c26204a5d27de9bf8f11b528580ef41fcd2aa3d
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 <cppuhelper/factory.hxx>
21 #include <com/sun/star/container/XSet.hpp>
22 #include <osl/diagnose.h>
23 #include "FilePicker.hxx"
24 #include "FPServiceInfo.hxx"
26 #ifdef _MSC_VER
27 #pragma warning (disable:4917)
28 #endif
29 #include "VistaFilePicker.hxx"
30 #include "../misc/WinImplHelper.hxx"
31 #include <stdio.h>
33 #include "../folderpicker/FolderPicker.hxx"
34 #include "../folderpicker/FOPServiceInfo.hxx"
35 #include "../folderpicker/WinFOPImpl.hxx"
37 //-----------------------------------------------
38 // namespace directives
39 //-----------------------------------------------
41 using namespace ::rtl ;
42 using namespace ::com::sun::star::uno ;
43 using namespace ::com::sun::star::container ;
44 using namespace ::com::sun::star::lang ;
45 using namespace ::com::sun::star::registry ;
46 using namespace ::cppu ;
47 using ::com::sun::star::ui::dialogs::XFilePicker;
48 using ::com::sun::star::ui::dialogs::XFilePicker2;
50 //------------------------------------------------
52 //------------------------------------------------
54 static Reference< XInterface > SAL_CALL createInstance(
55 const Reference< XMultiServiceFactory >& rServiceManager )
57 Reference< XInterface > xDlg;
59 #ifdef __IFileDialogCustomize_INTERFACE_DEFINED__
60 bool bVistaOrNewer = IsWindowsVistaOrNewer();
62 if (bVistaOrNewer)
64 OSL_TRACE("use special (vista) system file picker ...");
65 xDlg.set(
66 static_cast< XFilePicker2* >(
67 new ::fpicker::win32::vista::VistaFilePicker( rServiceManager ) ) );
69 else
70 #endif
72 OSL_TRACE("use normal system file picker ...");
73 xDlg.set(
74 static_cast< XFilePicker2* >(
75 new CFilePicker( rServiceManager ) ) );
78 return xDlg;
81 static Reference< XInterface > SAL_CALL
82 createInstance_fop( const Reference< XMultiServiceFactory >& rServiceManager )
84 return Reference< XInterface >( static_cast< cppu::OWeakObject * >( new CFolderPicker( rServiceManager ) ) );
88 extern "C"
91 SAL_DLLPUBLIC_EXPORT void* SAL_CALL fps_win32_component_getFactory(
92 const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* )
94 void* pRet = 0;
96 if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FILE_PICKER_IMPL_NAME ) ) )
98 Sequence< OUString > aSNS( 1 );
99 aSNS.getArray( )[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( FILE_PICKER_SERVICE_NAME ));
101 Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
102 reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
103 OUString::createFromAscii( pImplName ),
104 createInstance,
105 aSNS ) );
106 if ( xFactory.is() )
108 xFactory->acquire();
109 pRet = xFactory.get();
113 if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FOLDER_PICKER_IMPL_NAME ) ) )
115 Sequence< OUString > aSNS( 1 );
116 aSNS.getArray( )[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) );
118 Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
119 reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
120 OUString::createFromAscii( pImplName ),
121 createInstance_fop,
122 aSNS ) );
123 if ( xFactory.is() )
125 xFactory->acquire();
126 pRet = xFactory.get();
130 return pRet;
133 } // extern "C"
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */