Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / fpicker / source / win32 / FPentry.cxx
blob2e24682d5544961f6ccd8d56de40da5f465cc52f
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 <com/sun/star/lang/XSingleServiceFactory.hpp>
23 #include "FPServiceInfo.hxx"
25 #include "VistaFilePicker.hxx"
26 #include "WinImplHelper.hxx"
27 #include <stdio.h>
29 using namespace ::com::sun::star;
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::container;
32 using namespace ::com::sun::star::lang;
33 using namespace ::com::sun::star::registry;
34 using namespace ::cppu;
35 using ::com::sun::star::ui::dialogs::XFilePicker2;
36 using ::com::sun::star::ui::dialogs::XFolderPicker2;
38 static Reference< XInterface > createInstance(
39 const Reference< XMultiServiceFactory >& rServiceManager )
41 return Reference<ui::dialogs::XFilePicker2>(
42 new ::fpicker::win32::vista::VistaFilePicker(rServiceManager, false));
45 static Reference< XInterface >
46 createInstance_fop( const Reference< XMultiServiceFactory >& rServiceManager )
48 return Reference<ui::dialogs::XFolderPicker2>(
49 new ::fpicker::win32::vista::VistaFilePicker(rServiceManager, true));
52 extern "C"
55 SAL_DLLPUBLIC_EXPORT void* fps_win32_component_getFactory(
56 const sal_Char* pImplName, void* pSrvManager, void* )
58 void* pRet = nullptr;
60 if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FILE_PICKER_IMPL_NAME ) ) )
62 Sequence<OUString> aSNS { FILE_PICKER_SERVICE_NAME };
64 Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
65 static_cast< XMultiServiceFactory* > ( pSrvManager ),
66 OUString::createFromAscii( pImplName ),
67 createInstance,
68 aSNS ) );
69 if ( xFactory.is() )
71 xFactory->acquire();
72 pRet = xFactory.get();
76 if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FOLDER_PICKER_IMPL_NAME ) ) )
78 Sequence<OUString> aSNS { FOLDER_PICKER_SERVICE_NAME };
80 Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
81 static_cast< XMultiServiceFactory* > ( pSrvManager ),
82 OUString::createFromAscii( pImplName ),
83 createInstance_fop,
84 aSNS ) );
85 if ( xFactory.is() )
87 xFactory->acquire();
88 pRet = xFactory.get();
92 return pRet;
95 } // extern "C"
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */