summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2020-07-26 20:54:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-26 22:15:12 +0200
commit946e742aa63a2559721c761cea5c80286fbffa6b (patch)
tree390ef78138e7134d30121cc17d359bd0a99f1fa7 /fpicker
parente59ac9bea9caf5b24258ac1fecfc886a0fc7374f (diff)
fpicker/win32: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: Ic7d6c94e8709184fc8f195bd019402e361e9b810 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99461 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/Library_fps.mk1
-rw-r--r--fpicker/source/win32/FPServiceInfo.hxx37
-rw-r--r--fpicker/source/win32/FPentry.cxx97
-rw-r--r--fpicker/source/win32/VistaFilePicker.cxx39
-rw-r--r--fpicker/source/win32/VistaFilePicker.hxx9
-rw-r--r--fpicker/source/win32/fps.component8
-rw-r--r--fpicker/source/win32/workbench/Test_fps.cxx2
7 files changed, 29 insertions, 164 deletions
diff --git a/fpicker/Library_fps.mk b/fpicker/Library_fps.mk
index 31dd47e88b30..e41a8a40a081 100644
--- a/fpicker/Library_fps.mk
+++ b/fpicker/Library_fps.mk
@@ -56,7 +56,6 @@ endif
$(eval $(call gb_Library_add_exception_objects,fps,\
fpicker/source/win32/asyncrequests \
fpicker/source/win32/FilterContainer \
- fpicker/source/win32/FPentry \
fpicker/source/win32/VistaFilePicker \
fpicker/source/win32/VistaFilePickerEventHandler \
fpicker/source/win32/VistaFilePickerImpl \
diff --git a/fpicker/source/win32/FPServiceInfo.hxx b/fpicker/source/win32/FPServiceInfo.hxx
deleted file mode 100644
index edc350c1a9cc..000000000000
--- a/fpicker/source/win32/FPServiceInfo.hxx
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_FPICKER_SOURCE_WIN32_FILEPICKER_FPSERVICEINFO_HXX
-#define INCLUDED_FPICKER_SOURCE_WIN32_FILEPICKER_FPSERVICEINFO_HXX
-
-// the service names
-#define FILE_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.SystemFilePicker"
-
-// the implementation names
-#define FILE_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.Win32FilePicker"
-
-// the service names
-#define FOLDER_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.SystemFolderPicker"
-
-// the implementation names
-#define FOLDER_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.Win32FolderPicker"
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/win32/FPentry.cxx b/fpicker/source/win32/FPentry.cxx
deleted file mode 100644
index a4e48f8865e5..000000000000
--- a/fpicker/source/win32/FPentry.cxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <cppuhelper/factory.hxx>
-#include <com/sun/star/container/XSet.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include "FPServiceInfo.hxx"
-
-#include "VistaFilePicker.hxx"
-#include "WinImplHelper.hxx"
-#include <stdio.h>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-using namespace ::cppu;
-using ::com::sun::star::ui::dialogs::XFilePicker2;
-using ::com::sun::star::ui::dialogs::XFolderPicker2;
-
-static Reference< XInterface > createInstance(
- const Reference< XMultiServiceFactory >& rServiceManager )
-{
- return Reference<ui::dialogs::XFilePicker2>(
- new ::fpicker::win32::vista::VistaFilePicker(rServiceManager, false));
-}
-
-static Reference< XInterface >
-createInstance_fop( const Reference< XMultiServiceFactory >& rServiceManager )
-{
- return Reference<ui::dialogs::XFolderPicker2>(
- new ::fpicker::win32::vista::VistaFilePicker(rServiceManager, true));
-}
-
-extern "C"
-{
-
-SAL_DLLPUBLIC_EXPORT void* fps_win32_component_getFactory(
- const char* pImplName, void* pSrvManager, void* )
-{
- void* pRet = nullptr;
-
- if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FILE_PICKER_IMPL_NAME ) ) )
- {
- Sequence<OUString> aSNS { FILE_PICKER_SERVICE_NAME };
-
- Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
- static_cast< XMultiServiceFactory* > ( pSrvManager ),
- OUString::createFromAscii( pImplName ),
- createInstance,
- aSNS ) );
- if ( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FOLDER_PICKER_IMPL_NAME ) ) )
- {
- Sequence<OUString> aSNS { FOLDER_PICKER_SERVICE_NAME };
-
- Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
- static_cast< XMultiServiceFactory* > ( pSrvManager ),
- OUString::createFromAscii( pImplName ),
- createInstance_fop,
- aSNS ) );
- if ( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
-}
-
-} // extern "C"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/win32/VistaFilePicker.cxx b/fpicker/source/win32/VistaFilePicker.cxx
index 67c49f4d1420..e391bcf53c58 100644
--- a/fpicker/source/win32/VistaFilePicker.cxx
+++ b/fpicker/source/win32/VistaFilePicker.cxx
@@ -24,7 +24,6 @@
#include "VistaFilePicker.hxx"
#include "WinImplHelper.hxx"
-#include "FPServiceInfo.hxx"
#include "shared.hxx"
#include <com/sun/star/awt/XWindow.hpp>
@@ -47,20 +46,8 @@ namespace fpicker{
namespace win32{
namespace vista{
-namespace
-{
- css::uno::Sequence< OUString > VistaFilePicker_getSupportedServiceNames()
- {
- return {
- "com.sun.star.ui.dialogs.FilePicker",
- "com.sun.star.ui.dialogs.SystemFilePicker",
- "com.sun.star.ui.dialogs.SystemFolderPicker" };
- }
-}
-
-VistaFilePicker::VistaFilePicker(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR, bool bFolderPicker)
+VistaFilePicker::VistaFilePicker(bool bFolderPicker)
: TVistaFilePickerBase (m_aMutex )
- , m_xSMGR (xSMGR )
, m_rDialog (std::make_shared<VistaFilePickerImpl>())
, m_aAsyncExecute (m_rDialog )
, m_nFilePickerThreadId (0 )
@@ -533,9 +520,9 @@ void SAL_CALL VistaFilePicker::setDescription( const OUString& aDescription )
OUString SAL_CALL VistaFilePicker::getImplementationName()
{
if (m_bFolderPicker)
- return FOLDER_PICKER_IMPL_NAME;
+ return "com.sun.star.ui.dialogs.Win32FolderPicker";
else
- return FILE_PICKER_IMPL_NAME;
+ return "com.sun.star.ui.dialogs.Win32FilePicker";
}
sal_Bool SAL_CALL VistaFilePicker::supportsService(const OUString& sServiceName)
@@ -545,11 +532,29 @@ sal_Bool SAL_CALL VistaFilePicker::supportsService(const OUString& sServiceName)
css::uno::Sequence< OUString > SAL_CALL VistaFilePicker::getSupportedServiceNames()
{
- return VistaFilePicker_getSupportedServiceNames();
+ return {
+ "com.sun.star.ui.dialogs.FilePicker",
+ "com.sun.star.ui.dialogs.SystemFilePicker",
+ "com.sun.star.ui.dialogs.SystemFolderPicker" };
}
} // namespace vista
} // namespace win32
} // namespace fpicker
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+fpicker_win32_FilePicker_get_implementation(
+ css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(new ::fpicker::win32::vista::VistaFilePicker(false));
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+fpicker_win32_FolderPicker_get_implementation(
+ css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(new ::fpicker::win32::vista::VistaFilePicker(true));
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/win32/VistaFilePicker.hxx b/fpicker/source/win32/VistaFilePicker.hxx
index 71ccfd992ba9..53879c0c8742 100644
--- a/fpicker/source/win32/VistaFilePicker.hxx
+++ b/fpicker/source/win32/VistaFilePicker.hxx
@@ -69,7 +69,7 @@ public:
// ctor/dtor
- explicit VistaFilePicker( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR, bool bFolderPicker );
+ explicit VistaFilePicker( bool bFolderPicker );
virtual ~VistaFilePicker() override;
@@ -210,21 +210,14 @@ public:
private:
-
- /// service manager to create own used uno services
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
-
-
css::uno::Sequence< OUString > m_lLastFiles;
-
/** execute the COM dialog within a STA thread
* Must be used on the heap ... because it's implemented as OSL thread .-)
*/
RequestHandlerRef m_rDialog;
AsyncRequests m_aAsyncExecute;
-
oslThreadIdentifier m_nFilePickerThreadId;
bool m_bInitialized;
diff --git a/fpicker/source/win32/fps.component b/fpicker/source/win32/fps.component
index 80dac1a9b5fa..3cc9c8029814 100644
--- a/fpicker/source/win32/fps.component
+++ b/fpicker/source/win32/fps.component
@@ -17,11 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="fps_win32" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.ui.dialogs.Win32FilePicker">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.ui.dialogs.Win32FilePicker"
+ constructor="fpicker_win32_FilePicker_get_implementation">
<service name="com.sun.star.ui.dialogs.SystemFilePicker"/>
</implementation>
- <implementation name="com.sun.star.ui.dialogs.Win32FolderPicker">
+ <implementation name="com.sun.star.ui.dialogs.Win32FolderPicker"
+ constructor="fpicker_win32_FolderPicker_get_implementation">
<service name="com.sun.star.ui.dialogs.SystemFolderPicker"/>
</implementation>
</component>
diff --git a/fpicker/source/win32/workbench/Test_fps.cxx b/fpicker/source/win32/workbench/Test_fps.cxx
index b801fcef3c50..62bc00550cca 100644
--- a/fpicker/source/win32/workbench/Test_fps.cxx
+++ b/fpicker/source/win32/workbench/Test_fps.cxx
@@ -263,7 +263,7 @@ int SAL_CALL main(int nArgc, char* Argv[], char* Env[] )
Reference< XFilePicker > xFilePicker(
g_xFactory->createInstanceWithArguments(
- FILE_PICKER_SERVICE_NAME, arguments ), UNO_QUERY );
+ "com.sun.star.ui.dialogs.SystemFilePicker", arguments ), UNO_QUERY );
// install a FilePicker notifier
Reference< XFilePickerListener > xFPListener(