1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
27 #pragma warning (disable:4917)
29 #include "VistaFilePicker.hxx"
30 #include "../misc/WinImplHelper.hxx"
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();
64 OSL_TRACE("use special (vista) system file picker ...");
66 static_cast< XFilePicker2
* >(
67 new ::fpicker::win32::vista::VistaFilePicker( rServiceManager
) ) );
72 OSL_TRACE("use normal system file picker ...");
74 static_cast< XFilePicker2
* >(
75 new CFilePicker( rServiceManager
) ) );
81 static Reference
< XInterface
> SAL_CALL
82 createInstance_fop( const Reference
< XMultiServiceFactory
>& rServiceManager
)
84 return Reference
< XInterface
>( static_cast< cppu::OWeakObject
* >( new CFolderPicker( rServiceManager
) ) );
91 SAL_DLLPUBLIC_EXPORT
void* SAL_CALL
fps_win32_component_getFactory(
92 const sal_Char
* pImplName
, uno_Interface
* pSrvManager
, uno_Interface
* )
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
),
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
),
126 pRet
= xFactory
.get();
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */