dtrans/dnd: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: I39821b05dc5148870e0bd9291e21815f4868b5ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99160 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
b34e36146f
commit
b827eefd63
@@ -48,7 +48,6 @@ $(eval $(call gb_Library_use_static_libraries,dnd,\
|
|||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call gb_Library_add_exception_objects,dnd,\
|
$(eval $(call gb_Library_add_exception_objects,dnd,\
|
||||||
dtrans/source/win32/dnd/dndentry \
|
|
||||||
dtrans/source/win32/dnd/globals \
|
dtrans/source/win32/dnd/globals \
|
||||||
dtrans/source/win32/dnd/idroptarget \
|
dtrans/source/win32/dnd/idroptarget \
|
||||||
dtrans/source/win32/dnd/sourcecontext \
|
dtrans/source/win32/dnd/sourcecontext \
|
||||||
|
@@ -1,88 +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 <comphelper/processfactory.hxx>
|
|
||||||
#include <com/sun/star/container/XSet.hpp>
|
|
||||||
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
|
|
||||||
|
|
||||||
#include "source.hxx"
|
|
||||||
#include "target.hxx"
|
|
||||||
|
|
||||||
using namespace ::com::sun::star::uno ;
|
|
||||||
using namespace ::com::sun::star::registry ;
|
|
||||||
using namespace ::cppu ;
|
|
||||||
using namespace ::com::sun::star::lang;
|
|
||||||
|
|
||||||
static Reference< XInterface > createDragSource( const Reference< XMultiServiceFactory >& rServiceManager )
|
|
||||||
{
|
|
||||||
DragSource* pSource= new DragSource( comphelper::getComponentContext(rServiceManager) );
|
|
||||||
return Reference<XInterface>( static_cast<XInitialization*>(pSource), UNO_QUERY);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Reference< XInterface > createDropTarget( const Reference< XMultiServiceFactory >& rServiceManager )
|
|
||||||
{
|
|
||||||
DropTarget* pTarget= new DropTarget( comphelper::getComponentContext(rServiceManager) );
|
|
||||||
return Reference<XInterface>( static_cast<XInitialization*>(pTarget), UNO_QUERY);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
|
|
||||||
SAL_DLLPUBLIC_EXPORT void*
|
|
||||||
dnd_component_getFactory( const char* pImplName, void* pSrvManager, void* /*pRegistryKey*/ )
|
|
||||||
{
|
|
||||||
void* pRet = nullptr;
|
|
||||||
Reference< XSingleServiceFactory > xFactory;
|
|
||||||
|
|
||||||
if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, DNDSOURCE_IMPL_NAME ) ) )
|
|
||||||
{
|
|
||||||
Sequence< OUString > aSNS { DNDSOURCE_SERVICE_NAME };
|
|
||||||
|
|
||||||
xFactory= createSingleFactory(
|
|
||||||
static_cast< XMultiServiceFactory* > ( pSrvManager ),
|
|
||||||
OUString::createFromAscii( pImplName ),
|
|
||||||
createDragSource,
|
|
||||||
aSNS);
|
|
||||||
|
|
||||||
}
|
|
||||||
else if( pSrvManager && ( 0 == rtl_str_compare( pImplName, DNDTARGET_IMPL_NAME ) ) )
|
|
||||||
{
|
|
||||||
Sequence< OUString > aSNS { DNDTARGET_SERVICE_NAME };
|
|
||||||
|
|
||||||
xFactory= createSingleFactory(
|
|
||||||
static_cast< XMultiServiceFactory* > ( pSrvManager ),
|
|
||||||
OUString::createFromAscii( pImplName ),
|
|
||||||
createDropTarget,
|
|
||||||
aSNS);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( xFactory.is() )
|
|
||||||
{
|
|
||||||
xFactory->acquire();
|
|
||||||
pRet = xFactory.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
return pRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // extern "C"
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@@ -29,12 +29,6 @@ namespace com::sun::star::datatransfer { class XTransferable; }
|
|||||||
#include <wtypes.h>
|
#include <wtypes.h>
|
||||||
#include <sal/types.h>
|
#include <sal/types.h>
|
||||||
|
|
||||||
#define DNDSOURCE_SERVICE_NAME "com.sun.star.datatransfer.dnd.OleDragSource"
|
|
||||||
#define DNDSOURCE_IMPL_NAME "com.sun.star.comp.datatransfer.dnd.OleDragSource_V1"
|
|
||||||
|
|
||||||
#define DNDTARGET_SERVICE_NAME "com.sun.star.datatransfer.dnd.OleDropTarget"
|
|
||||||
#define DNDTARGET_IMPL_NAME "com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1"
|
|
||||||
|
|
||||||
// This maps key states as occur as parameter, e.g. in IDropTarget::DragEnter,
|
// This maps key states as occur as parameter, e.g. in IDropTarget::DragEnter,
|
||||||
// IDropSource::QueryContinueDrag, to actions as are declared in
|
// IDropSource::QueryContinueDrag, to actions as are declared in
|
||||||
// css::datatransfer::dnd::DNDConstants ( ACTION_MOVE etc).
|
// css::datatransfer::dnd::DNDConstants ( ACTION_MOVE etc).
|
||||||
|
@@ -278,7 +278,7 @@ dwEffect
|
|||||||
// XServiceInfo
|
// XServiceInfo
|
||||||
OUString SAL_CALL DragSource::getImplementationName( )
|
OUString SAL_CALL DragSource::getImplementationName( )
|
||||||
{
|
{
|
||||||
return DNDSOURCE_IMPL_NAME;
|
return "com.sun.star.comp.datatransfer.dnd.OleDragSource_V1";
|
||||||
}
|
}
|
||||||
// XServiceInfo
|
// XServiceInfo
|
||||||
sal_Bool SAL_CALL DragSource::supportsService( const OUString& ServiceName )
|
sal_Bool SAL_CALL DragSource::supportsService( const OUString& ServiceName )
|
||||||
@@ -288,7 +288,14 @@ sal_Bool SAL_CALL DragSource::supportsService( const OUString& ServiceName )
|
|||||||
|
|
||||||
Sequence< OUString > SAL_CALL DragSource::getSupportedServiceNames( )
|
Sequence< OUString > SAL_CALL DragSource::getSupportedServiceNames( )
|
||||||
{
|
{
|
||||||
return { DNDSOURCE_SERVICE_NAME };
|
return { "com.sun.star.datatransfer.dnd.OleDragSource" };
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||||
|
dtrans_DragSource_get_implementation(
|
||||||
|
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
|
||||||
|
{
|
||||||
|
return cppu::acquire(static_cast<cppu::OWeakObject*>(new DragSource(context)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This function is called as extra thread from
|
/** This function is called as extra thread from
|
||||||
|
@@ -248,7 +248,7 @@ DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams)
|
|||||||
// XServiceInfo
|
// XServiceInfo
|
||||||
OUString SAL_CALL DropTarget::getImplementationName( )
|
OUString SAL_CALL DropTarget::getImplementationName( )
|
||||||
{
|
{
|
||||||
return DNDTARGET_IMPL_NAME;
|
return "com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1";
|
||||||
}
|
}
|
||||||
// XServiceInfo
|
// XServiceInfo
|
||||||
sal_Bool SAL_CALL DropTarget::supportsService( const OUString& ServiceName )
|
sal_Bool SAL_CALL DropTarget::supportsService( const OUString& ServiceName )
|
||||||
@@ -258,7 +258,7 @@ sal_Bool SAL_CALL DropTarget::supportsService( const OUString& ServiceName )
|
|||||||
|
|
||||||
Sequence< OUString > SAL_CALL DropTarget::getSupportedServiceNames( )
|
Sequence< OUString > SAL_CALL DropTarget::getSupportedServiceNames( )
|
||||||
{
|
{
|
||||||
return { DNDTARGET_SERVICE_NAME };
|
return { "com.sun.star.datatransfer.dnd.OleDropTarget" };
|
||||||
}
|
}
|
||||||
|
|
||||||
// XDropTarget
|
// XDropTarget
|
||||||
@@ -625,4 +625,11 @@ inline sal_Int8 DropTarget::getFilteredActions( DWORD grfKeyState, DWORD dwEffec
|
|||||||
return actions & m_nDefaultActions;
|
return actions & m_nDefaultActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||||
|
dtrans_DropTarget_get_implementation(
|
||||||
|
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
|
||||||
|
{
|
||||||
|
return cppu::acquire(static_cast<cppu::OWeakObject*>(new DropTarget(context)));
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -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="dnd" xmlns="http://openoffice.org/2010/uno-components">
|
xmlns="http://openoffice.org/2010/uno-components">
|
||||||
<implementation name="com.sun.star.comp.datatransfer.dnd.OleDragSource_V1">
|
<implementation name="com.sun.star.comp.datatransfer.dnd.OleDragSource_V1"
|
||||||
|
constructor="dtrans_DragSource_get_implementation">
|
||||||
<service name="com.sun.star.datatransfer.dnd.OleDragSource"/>
|
<service name="com.sun.star.datatransfer.dnd.OleDragSource"/>
|
||||||
</implementation>
|
</implementation>
|
||||||
<implementation name="com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1">
|
<implementation name="com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1"
|
||||||
|
constructor="dtrans_DropTarget_get_implementation">
|
||||||
<service name="com.sun.star.datatransfer.dnd.OleDropTarget"/>
|
<service name="com.sun.star.datatransfer.dnd.OleDropTarget"/>
|
||||||
</implementation>
|
</implementation>
|
||||||
</component>
|
</component>
|
||||||
|
Reference in New Issue
Block a user