fpicker/office: create instances with uno constructors

See tdf#74608 for motivation.

Change-Id: Ia6e1aec18e6450de9c65ed059a25493fc54a9f75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98788
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2020-07-14 20:22:54 +02:00
committed by Noel Grandin
parent 3e50a30235
commit 666e1ae806
7 changed files with 25 additions and 149 deletions

View File

@@ -51,7 +51,6 @@ $(eval $(call gb_Library_add_exception_objects,fps_office,\
fpicker/source/office/foldertree \
fpicker/source/office/fpinteraction \
fpicker/source/office/fpsmartcontent \
fpicker/source/office/fps_office \
fpicker/source/office/iodlg \
fpicker/source/office/iodlgimp \
fpicker/source/office/OfficeControlAccess \

View File

@@ -1027,7 +1027,7 @@ bool SvtFilePicker::implHandleInitializationArgument( const OUString& _rName, co
/* XServiceInfo */
OUString SAL_CALL SvtFilePicker::getImplementationName()
{
return impl_getStaticImplementationName();
return "com.sun.star.svtools.OfficeFilePicker";
}
/* XServiceInfo */
@@ -1039,28 +1039,16 @@ sal_Bool SAL_CALL SvtFilePicker::supportsService( const OUString& sServiceName )
/* XServiceInfo */
Sequence< OUString > SAL_CALL SvtFilePicker::getSupportedServiceNames()
{
return impl_getStaticSupportedServiceNames();
return { "com.sun.star.ui.dialogs.OfficeFilePicker" };
}
/* Helper for XServiceInfo */
Sequence< OUString > SvtFilePicker::impl_getStaticSupportedServiceNames()
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
fpicker_SvtFilePicker_get_implementation(
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
{
Sequence<OUString> seqServiceNames { "com.sun.star.ui.dialogs.OfficeFilePicker" };
return seqServiceNames ;
return cppu::acquire(new SvtFilePicker());
}
/* Helper for XServiceInfo */
OUString SvtFilePicker::impl_getStaticImplementationName()
{
return "com.sun.star.svtools.OfficeFilePicker";
}
/* Helper for registry */
Reference< XInterface > SvtFilePicker::impl_createInstance(
const Reference< XComponentContext >& )
{
return Reference< XInterface >( *new SvtFilePicker );
}
// SvtRemoteFilePicker
@@ -1091,7 +1079,7 @@ std::shared_ptr<SvtFileDialog_Base> SvtRemoteFilePicker::implCreateDialog(weld::
/* XServiceInfo */
OUString SAL_CALL SvtRemoteFilePicker::getImplementationName()
{
return impl_getStaticImplementationName();
return "com.sun.star.svtools.RemoteFilePicker";
}
/* XServiceInfo */
@@ -1103,27 +1091,15 @@ sal_Bool SAL_CALL SvtRemoteFilePicker::supportsService( const OUString& sService
/* XServiceInfo */
Sequence< OUString > SAL_CALL SvtRemoteFilePicker::getSupportedServiceNames()
{
return impl_getStaticSupportedServiceNames();
return { "com.sun.star.ui.dialogs.RemoteFilePicker" };
}
/* Helper for XServiceInfo */
Sequence< OUString > SvtRemoteFilePicker::impl_getStaticSupportedServiceNames()
{
Sequence<OUString> seqServiceNames { "com.sun.star.ui.dialogs.RemoteFilePicker" };
return seqServiceNames ;
}
/* Helper for XServiceInfo */
OUString SvtRemoteFilePicker::impl_getStaticImplementationName()
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
fpicker_SvtRemoteFilePicker_get_implementation(
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
{
return "com.sun.star.svtools.RemoteFilePicker";
}
/* Helper for registry */
Reference< XInterface > SvtRemoteFilePicker::impl_createInstance(
const Reference< XComponentContext >& )
{
return Reference< XInterface >( *new SvtRemoteFilePicker );
return cppu::acquire(new SvtRemoteFilePicker());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -189,16 +189,6 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames() override;
/* Helper for XServiceInfo */
static css::uno::Sequence< OUString >
impl_getStaticSupportedServiceNames();
static OUString impl_getStaticImplementationName();
/* Helper for registry */
/// @throws css::uno::Exception
static css::uno::Reference< css::uno::XInterface > impl_createInstance (
const css::uno::Reference< css::uno::XComponentContext >& rxContext );
protected:
// OCommonPicker overridables
@@ -246,15 +236,6 @@ public:
virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override;
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames() override;
/* Helper for XServiceInfo */
static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames();
static OUString impl_getStaticImplementationName();
/* Helper for registry */
/// @throws css::uno::Exception
static css::uno::Reference< css::uno::XInterface > impl_createInstance (
const css::uno::Reference< css::uno::XComponentContext >& rxContext );
};
#endif // INCLUDED_FPICKER_SOURCE_OFFICE_OFFICEFILEPICKER_HXX

View File

@@ -150,7 +150,7 @@ void SvtFolderPicker::cancel()
/* XServiceInfo */
OUString SAL_CALL SvtFolderPicker::getImplementationName()
{
return impl_getStaticImplementationName();
return "com.sun.star.svtools.OfficeFolderPicker";
}
/* XServiceInfo */
@@ -162,26 +162,14 @@ sal_Bool SAL_CALL SvtFolderPicker::supportsService( const OUString& sServiceName
/* XServiceInfo */
Sequence< OUString > SAL_CALL SvtFolderPicker::getSupportedServiceNames()
{
return impl_getStaticSupportedServiceNames();
return { "com.sun.star.ui.dialogs.OfficeFolderPicker" };
}
/* Helper for XServiceInfo */
Sequence< OUString > SvtFolderPicker::impl_getStaticSupportedServiceNames()
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
fpicker_SvtFolderPicker_get_implementation(
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
{
Sequence< OUString > seqServiceNames { "com.sun.star.ui.dialogs.OfficeFolderPicker" };
return seqServiceNames ;
}
/* Helper for XServiceInfo */
OUString SvtFolderPicker::impl_getStaticImplementationName()
{
return "com.sun.star.svtools.OfficeFolderPicker";
}
/* Helper for registry */
Reference< XInterface > SvtFolderPicker::impl_createInstance( const Reference< XComponentContext >& )
{
return Reference< XInterface >( *new SvtFolderPicker );
return cppu::acquire(new SvtFolderPicker());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -80,15 +80,6 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames() override;
/* Helper for XServiceInfo */
static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames();
static OUString impl_getStaticImplementationName();
/* Helper for registry */
/// @throws css::uno::Exception
static css::uno::Reference< css::uno::XInterface > impl_createInstance (
const css::uno::Reference< css::uno::XComponentContext >& rxContext );
protected:
// OCommonPicker overridables

View File

@@ -18,14 +18,17 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="fps_office" xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.svtools.OfficeFilePicker">
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.svtools.OfficeFilePicker"
constructor="fpicker_SvtFilePicker_get_implementation">
<service name="com.sun.star.ui.dialogs.OfficeFilePicker"/>
</implementation>
<implementation name="com.sun.star.svtools.RemoteFilePicker">
<implementation name="com.sun.star.svtools.RemoteFilePicker"
constructor="fpicker_SvtRemoteFilePicker_get_implementation">
<service name="com.sun.star.ui.dialogs.RemoteFilePicker"/>
</implementation>
<implementation name="com.sun.star.svtools.OfficeFolderPicker">
<implementation name="com.sun.star.svtools.OfficeFolderPicker"
constructor="fpicker_SvtFolderPicker_get_implementation">
<service name="com.sun.star.ui.dialogs.OfficeFolderPicker"/>
</implementation>
</component>

View File

@@ -1,62 +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 <sal/types.h>
#include <cppuhelper/implementationentry.hxx>
#include "OfficeFilePicker.hxx"
#include "OfficeFolderPicker.hxx"
const cppu::ImplementationEntry g_entries[] =
{
{
SvtRemoteFilePicker::impl_createInstance,
SvtRemoteFilePicker::impl_getStaticImplementationName,
SvtRemoteFilePicker::impl_getStaticSupportedServiceNames,
cppu::createSingleComponentFactory, nullptr, 0
},
{
SvtFilePicker::impl_createInstance,
SvtFilePicker::impl_getStaticImplementationName,
SvtFilePicker::impl_getStaticSupportedServiceNames,
cppu::createSingleComponentFactory, nullptr, 0
},
{
SvtFolderPicker::impl_createInstance,
SvtFolderPicker::impl_getStaticImplementationName,
SvtFolderPicker::impl_getStaticSupportedServiceNames,
cppu::createSingleComponentFactory, nullptr, 0
},
{ nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
};
extern "C"
{
SAL_DLLPUBLIC_EXPORT void * fps_office_component_getFactory(
const char * pImplementationName, void * pServiceManager, void * pRegistryKey)
{
return cppu::component_getFactoryHelper (
pImplementationName, pServiceManager, pRegistryKey, g_entries);
}
} // extern "C"
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */