fpicker/aqua: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: I23b9964daba0d39cdad4e81de7b7fbfc56589b2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98787 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
666e1ae806
commit
91a6aeab9d
@@ -40,7 +40,6 @@ $(eval $(call gb_Library_add_objcxxobjects,fps_aqua,\
|
|||||||
fpicker/source/aqua/CFStringUtilities \
|
fpicker/source/aqua/CFStringUtilities \
|
||||||
fpicker/source/aqua/ControlHelper \
|
fpicker/source/aqua/ControlHelper \
|
||||||
fpicker/source/aqua/FilterHelper \
|
fpicker/source/aqua/FilterHelper \
|
||||||
fpicker/source/aqua/FPentry \
|
|
||||||
fpicker/source/aqua/NSString_OOoAdditions \
|
fpicker/source/aqua/NSString_OOoAdditions \
|
||||||
fpicker/source/aqua/NSURL_OOoAdditions \
|
fpicker/source/aqua/NSURL_OOoAdditions \
|
||||||
fpicker/source/aqua/resourceprovider \
|
fpicker/source/aqua/resourceprovider \
|
||||||
|
@@ -1,33 +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_AQUA_FPSERVICEINFO_HXX
|
|
||||||
#define INCLUDED_FPICKER_SOURCE_AQUA_FPSERVICEINFO_HXX
|
|
||||||
|
|
||||||
// the service names
|
|
||||||
#define FILE_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.AquaFilePicker"
|
|
||||||
#define FOLDER_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.AquaFolderPicker"
|
|
||||||
|
|
||||||
// the implementation names
|
|
||||||
#define FILE_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.SalAquaFilePicker"
|
|
||||||
#define FOLDER_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.SalAquaFolderPicker"
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@@ -1,94 +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 "SalAquaFilePicker.hxx"
|
|
||||||
#include "SalAquaFolderPicker.hxx"
|
|
||||||
|
|
||||||
#include "FPServiceInfo.hxx"
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
|
|
||||||
static Reference< XInterface > createFileInstance( const Reference< XMultiServiceFactory >& )
|
|
||||||
{
|
|
||||||
return Reference< XInterface >( *new SalAquaFilePicker );
|
|
||||||
}
|
|
||||||
|
|
||||||
static Reference< XInterface > createFolderInstance(
|
|
||||||
const Reference< XMultiServiceFactory >& rServiceManager )
|
|
||||||
{
|
|
||||||
return Reference< XInterface >(
|
|
||||||
*new SalAquaFolderPicker( rServiceManager ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
|
|
||||||
SAL_DLLPUBLIC_EXPORT void* fps_aqua_component_getFactory(
|
|
||||||
const char* pImplName, void* pSrvManager, void* /*pRegistryKey*/ )
|
|
||||||
{
|
|
||||||
void* pRet = nullptr;
|
|
||||||
|
|
||||||
if( pSrvManager )
|
|
||||||
{
|
|
||||||
Reference< XSingleServiceFactory > xFactory;
|
|
||||||
|
|
||||||
if (0 == rtl_str_compare(pImplName, FILE_PICKER_IMPL_NAME))
|
|
||||||
{
|
|
||||||
Sequence<OUString> aSNS { FILE_PICKER_SERVICE_NAME };
|
|
||||||
|
|
||||||
xFactory = createSingleFactory(
|
|
||||||
static_cast< XMultiServiceFactory* > ( pSrvManager ),
|
|
||||||
OUString::createFromAscii( pImplName ),
|
|
||||||
createFileInstance,
|
|
||||||
aSNS );
|
|
||||||
}
|
|
||||||
else if (0 == rtl_str_compare(pImplName, FOLDER_PICKER_IMPL_NAME))
|
|
||||||
{
|
|
||||||
Sequence<OUString> aSNS { FOLDER_PICKER_SERVICE_NAME };
|
|
||||||
|
|
||||||
xFactory = createSingleFactory(
|
|
||||||
static_cast< XMultiServiceFactory* > ( pSrvManager ),
|
|
||||||
OUString::createFromAscii( pImplName ),
|
|
||||||
createFolderInstance,
|
|
||||||
aSNS );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( xFactory.is() )
|
|
||||||
{
|
|
||||||
xFactory->acquire();
|
|
||||||
pRet = xFactory.get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // extern "C"
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@@ -33,7 +33,6 @@
|
|||||||
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
|
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
|
||||||
#include <com/sun/star/ui/dialogs/ControlActions.hpp>
|
#include <com/sun/star/ui/dialogs/ControlActions.hpp>
|
||||||
#include <com/sun/star/uno/Any.hxx>
|
#include <com/sun/star/uno/Any.hxx>
|
||||||
#include "FPServiceInfo.hxx"
|
|
||||||
#include <osl/mutex.hxx>
|
#include <osl/mutex.hxx>
|
||||||
#include <vcl/svapp.hxx>
|
#include <vcl/svapp.hxx>
|
||||||
|
|
||||||
@@ -477,7 +476,7 @@ void SalAquaFilePicker::disposing( const lang::EventObject& aEvent )
|
|||||||
|
|
||||||
OUString SAL_CALL SalAquaFilePicker::getImplementationName()
|
OUString SAL_CALL SalAquaFilePicker::getImplementationName()
|
||||||
{
|
{
|
||||||
return FILE_PICKER_IMPL_NAME;
|
return "com.sun.star.ui.dialogs.SalAquaFilePicker";
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Bool SAL_CALL SalAquaFilePicker::supportsService( const OUString& sServiceName )
|
sal_Bool SAL_CALL SalAquaFilePicker::supportsService( const OUString& sServiceName )
|
||||||
@@ -582,4 +581,12 @@ void SalAquaFilePicker::filterControlChanged()
|
|||||||
controlStateChanged( evt );
|
controlStateChanged( evt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||||
|
fpicker_SalAquaFilePicker_get_implementation(
|
||||||
|
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
|
||||||
|
{
|
||||||
|
return cppu::acquire(new SalAquaFilePicker());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -44,7 +44,7 @@ class SalAquaFolderPicker :
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
SalAquaFolderPicker( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceMgr );
|
SalAquaFolderPicker();
|
||||||
|
|
||||||
|
|
||||||
// XExecutableDialog functions
|
// XExecutableDialog functions
|
||||||
@@ -91,10 +91,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
SalAquaFolderPicker( const SalAquaFolderPicker& ) = delete;
|
SalAquaFolderPicker( const SalAquaFolderPicker& ) = delete;
|
||||||
SalAquaFolderPicker& operator=( const SalAquaFolderPicker& ) = delete;
|
SalAquaFolderPicker& operator=( const SalAquaFolderPicker& ) = delete;
|
||||||
|
|
||||||
// to instantiate own services
|
|
||||||
css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceMgr;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDED_FPICKER_SOURCE_AQUA_SALAQUAFOLDERPICKER_HXX
|
#endif // INCLUDED_FPICKER_SOURCE_AQUA_SALAQUAFOLDERPICKER_HXX
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
#include <cppuhelper/supportsservice.hxx>
|
#include <cppuhelper/supportsservice.hxx>
|
||||||
#include <osl/diagnose.h>
|
#include <osl/diagnose.h>
|
||||||
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
|
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
|
||||||
#include "FPServiceInfo.hxx"
|
|
||||||
#include <osl/mutex.hxx>
|
#include <osl/mutex.hxx>
|
||||||
#include <sal/log.hxx>
|
#include <sal/log.hxx>
|
||||||
#include <vcl/svapp.hxx>
|
#include <vcl/svapp.hxx>
|
||||||
@@ -48,17 +47,7 @@ using namespace ::com::sun::star::ui::dialogs;
|
|||||||
using namespace ::com::sun::star::lang;
|
using namespace ::com::sun::star::lang;
|
||||||
using namespace ::com::sun::star::uno;
|
using namespace ::com::sun::star::uno;
|
||||||
|
|
||||||
namespace
|
SalAquaFolderPicker::SalAquaFolderPicker()
|
||||||
{
|
|
||||||
// controlling event notifications
|
|
||||||
uno::Sequence<OUString> FolderPicker_getSupportedServiceNames()
|
|
||||||
{
|
|
||||||
return { "com.sun.star.ui.dialogs.SystemFolderPicker", "com.sun.star.ui.dialogs.AquaFolderPicker" };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SalAquaFolderPicker::SalAquaFolderPicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) :
|
|
||||||
m_xServiceMgr( xServiceMgr )
|
|
||||||
{
|
{
|
||||||
m_nDialogType = NAVIGATIONSERVICES_DIRECTORY;
|
m_nDialogType = NAVIGATIONSERVICES_DIRECTORY;
|
||||||
}
|
}
|
||||||
@@ -152,7 +141,7 @@ void SAL_CALL SalAquaFolderPicker::setDescription( const OUString& rDescription
|
|||||||
|
|
||||||
OUString SAL_CALL SalAquaFolderPicker::getImplementationName()
|
OUString SAL_CALL SalAquaFolderPicker::getImplementationName()
|
||||||
{
|
{
|
||||||
return FOLDER_PICKER_IMPL_NAME;
|
return "com.sun.star.ui.dialogs.SalAquaFolderPicker";
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Bool SAL_CALL SalAquaFolderPicker::supportsService( const OUString& sServiceName )
|
sal_Bool SAL_CALL SalAquaFolderPicker::supportsService( const OUString& sServiceName )
|
||||||
@@ -162,7 +151,7 @@ sal_Bool SAL_CALL SalAquaFolderPicker::supportsService( const OUString& sService
|
|||||||
|
|
||||||
uno::Sequence<OUString> SAL_CALL SalAquaFolderPicker::getSupportedServiceNames()
|
uno::Sequence<OUString> SAL_CALL SalAquaFolderPicker::getSupportedServiceNames()
|
||||||
{
|
{
|
||||||
return FolderPicker_getSupportedServiceNames();
|
return { "com.sun.star.ui.dialogs.SystemFolderPicker", "com.sun.star.ui.dialogs.AquaFolderPicker" };
|
||||||
}
|
}
|
||||||
|
|
||||||
// XCancellable
|
// XCancellable
|
||||||
@@ -180,4 +169,12 @@ void SAL_CALL SalAquaFolderPicker::disposing( const lang::EventObject& )
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||||
|
fpicker_SalAquaFolderPicker_get_implementation(
|
||||||
|
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
|
||||||
|
{
|
||||||
|
return cppu::acquire(new SalAquaFolderPicker());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -24,7 +24,6 @@
|
|||||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||||
#include <cppuhelper/interfacecontainer.h>
|
#include <cppuhelper/interfacecontainer.h>
|
||||||
#include <osl/diagnose.h>
|
#include <osl/diagnose.h>
|
||||||
#include "FPServiceInfo.hxx"
|
|
||||||
#include <osl/mutex.hxx>
|
#include <osl/mutex.hxx>
|
||||||
#include <vcl/svapp.hxx>
|
#include <vcl/svapp.hxx>
|
||||||
#include "SalAquaPicker.hxx"
|
#include "SalAquaPicker.hxx"
|
||||||
|
@@ -18,11 +18,13 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
|
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
|
||||||
prefix="fps_aqua" xmlns="http://openoffice.org/2010/uno-components">
|
xmlns="http://openoffice.org/2010/uno-components">
|
||||||
<implementation name="com.sun.star.ui.dialogs.SalAquaFilePicker">
|
<implementation name="com.sun.star.ui.dialogs.SalAquaFilePicker"
|
||||||
|
constructor="fpicker_SalAquaFilePicker_get_implementation">
|
||||||
<service name="com.sun.star.ui.dialogs.AquaFilePicker"/>
|
<service name="com.sun.star.ui.dialogs.AquaFilePicker"/>
|
||||||
</implementation>
|
</implementation>
|
||||||
<implementation name="com.sun.star.ui.dialogs.SalAquaFolderPicker">
|
<implementation name="com.sun.star.ui.dialogs.SalAquaFolderPicker"
|
||||||
|
constructor="fpicker_SalAquaFolderPicker_get_implementation">
|
||||||
<service name="com.sun.star.ui.dialogs.AquaFolderPicker"/>
|
<service name="com.sun.star.ui.dialogs.AquaFolderPicker"/>
|
||||||
</implementation>
|
</implementation>
|
||||||
</component>
|
</component>
|
||||||
|
Reference in New Issue
Block a user