2010-10-14 08:30:07 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-12-05 11:46:50 +00:00
|
|
|
/*
|
|
|
|
* 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 .
|
|
|
|
*/
|
2001-05-08 14:56:02 +00:00
|
|
|
|
2010-12-10 13:46:18 +01:00
|
|
|
|
2014-06-04 16:23:19 +02:00
|
|
|
#include <sal/config.h>
|
2018-07-14 00:48:37 +02:00
|
|
|
#include <sal/log.hxx>
|
2010-12-10 13:46:18 +01:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2001-05-08 14:56:02 +00:00
|
|
|
#include <osl/diagnose.h>
|
|
|
|
#include <rtl/ustring.hxx>
|
|
|
|
|
2013-12-16 16:45:46 +01:00
|
|
|
#include <uno/lbnames.h>
|
2007-05-09 12:26:19 +00:00
|
|
|
#include <uno/mapping.hxx>
|
|
|
|
|
|
|
|
#include <cppuhelper/bootstrap.hxx>
|
2016-12-07 08:59:42 +01:00
|
|
|
#include <cppuhelper/implbase.hxx>
|
2001-05-08 14:56:02 +00:00
|
|
|
#include <typelib/typedescription.h>
|
|
|
|
|
|
|
|
#include <com/sun/star/lang/XComponent.hpp>
|
|
|
|
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
|
|
|
|
#include <com/sun/star/reflection/XTypeDescription.hpp>
|
|
|
|
#include <com/sun/star/reflection/XEnumTypeDescription.hpp>
|
|
|
|
#include <com/sun/star/reflection/XIndirectTypeDescription.hpp>
|
|
|
|
#include <com/sun/star/reflection/XInterfaceMemberTypeDescription.hpp>
|
2010-12-10 13:46:18 +01:00
|
|
|
#include <com/sun/star/reflection/XInterfaceAttributeTypeDescription2.hpp>
|
2001-05-08 14:56:02 +00:00
|
|
|
#include <com/sun/star/reflection/XMethodParameter.hpp>
|
|
|
|
#include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
|
2004-02-03 12:28:45 +00:00
|
|
|
#include <com/sun/star/reflection/XInterfaceTypeDescription2.hpp>
|
2001-05-08 14:56:02 +00:00
|
|
|
#include <com/sun/star/reflection/XCompoundTypeDescription.hpp>
|
2004-06-04 02:21:58 +00:00
|
|
|
#include <com/sun/star/reflection/XStructTypeDescription.hpp>
|
2001-05-08 14:56:02 +00:00
|
|
|
|
2015-06-15 17:58:15 +09:00
|
|
|
#include <memory>
|
2004-02-03 12:28:45 +00:00
|
|
|
|
2001-05-08 14:56:02 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::reflection;
|
|
|
|
|
|
|
|
namespace cppu
|
|
|
|
{
|
|
|
|
|
2004-06-04 02:21:58 +00:00
|
|
|
static typelib_TypeDescription * createCTD(
|
|
|
|
Reference< container::XHierarchicalNameAccess > const & access,
|
|
|
|
const Reference< XTypeDescription > & xType );
|
2001-05-08 14:56:02 +00:00
|
|
|
|
2014-02-25 18:02:27 +01:00
|
|
|
|
2018-10-09 10:28:48 +02:00
|
|
|
static typelib_TypeDescription * createCTD(
|
2001-05-08 14:56:02 +00:00
|
|
|
const Reference< XCompoundTypeDescription > & xType )
|
|
|
|
{
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_TypeDescription * pRet = nullptr;
|
2001-05-08 14:56:02 +00:00
|
|
|
if (xType.is())
|
|
|
|
{
|
|
|
|
typelib_TypeDescription * pBaseType = createCTD(
|
|
|
|
Reference< XCompoundTypeDescription >::query( xType->getBaseType() ) );
|
|
|
|
if (pBaseType)
|
|
|
|
typelib_typedescription_register( &pBaseType );
|
|
|
|
|
|
|
|
// construct member init array
|
|
|
|
const Sequence<Reference< XTypeDescription > > & rMemberTypes = xType->getMemberTypes();
|
|
|
|
const Sequence< OUString > & rMemberNames = xType->getMemberNames();
|
|
|
|
|
|
|
|
const Reference< XTypeDescription > * pMemberTypes = rMemberTypes.getConstArray();
|
|
|
|
const OUString * pMemberNames = rMemberNames.getConstArray();
|
|
|
|
|
|
|
|
sal_Int32 nMembers = rMemberTypes.getLength();
|
|
|
|
OSL_ENSURE( nMembers == rMemberNames.getLength(), "### lens differ!" );
|
|
|
|
|
|
|
|
OUString aTypeName( xType->getName() );
|
|
|
|
|
2015-03-28 19:00:21 +01:00
|
|
|
typelib_CompoundMember_Init * pMemberInits = static_cast<typelib_CompoundMember_Init *>(alloca(
|
|
|
|
sizeof(typelib_CompoundMember_Init) * nMembers ));
|
2001-05-08 14:56:02 +00:00
|
|
|
|
|
|
|
sal_Int32 nPos;
|
|
|
|
for ( nPos = nMembers; nPos--; )
|
|
|
|
{
|
|
|
|
typelib_CompoundMember_Init & rInit = pMemberInits[nPos];
|
2018-01-15 09:06:32 +01:00
|
|
|
rInit.eTypeClass = static_cast<typelib_TypeClass>(pMemberTypes[nPos]->getTypeClass());
|
2001-05-08 14:56:02 +00:00
|
|
|
|
|
|
|
OUString aMemberTypeName( pMemberTypes[nPos]->getName() );
|
2020-04-14 14:55:22 +02:00
|
|
|
rInit.pTypeName = aMemberTypeName.pData;
|
|
|
|
rtl_uString_acquire( rInit.pTypeName );
|
2001-05-08 14:56:02 +00:00
|
|
|
|
|
|
|
// string is held by rMemberNames
|
|
|
|
rInit.pMemberName = pMemberNames[nPos].pData;
|
|
|
|
}
|
|
|
|
|
|
|
|
typelib_typedescription_new(
|
|
|
|
&pRet,
|
2018-01-15 09:06:32 +01:00
|
|
|
static_cast<typelib_TypeClass>(xType->getTypeClass()),
|
2001-05-08 14:56:02 +00:00
|
|
|
aTypeName.pData,
|
2015-11-10 10:13:11 +01:00
|
|
|
(pBaseType ? pBaseType->pWeakRef : nullptr),
|
2001-05-08 14:56:02 +00:00
|
|
|
nMembers, pMemberInits );
|
|
|
|
|
|
|
|
// cleanup
|
|
|
|
for ( nPos = nMembers; nPos--; )
|
|
|
|
{
|
|
|
|
rtl_uString_release( pMemberInits[nPos].pTypeName );
|
|
|
|
}
|
|
|
|
if (pBaseType)
|
|
|
|
typelib_typedescription_release( pBaseType );
|
|
|
|
}
|
|
|
|
return pRet;
|
|
|
|
}
|
2014-02-25 18:02:27 +01:00
|
|
|
|
2018-10-09 10:28:48 +02:00
|
|
|
static typelib_TypeDescription * createCTD(
|
2004-06-04 02:21:58 +00:00
|
|
|
Reference< container::XHierarchicalNameAccess > const & access,
|
|
|
|
const Reference< XStructTypeDescription > & xType )
|
|
|
|
{
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_TypeDescription * pRet = nullptr;
|
2019-05-04 21:20:18 +03:00
|
|
|
if (xType.is() && !xType->getTypeParameters().hasElements())
|
2004-06-04 02:21:58 +00:00
|
|
|
{
|
|
|
|
typelib_TypeDescription * pBaseType = createCTD(
|
|
|
|
access, xType->getBaseType() );
|
|
|
|
if (pBaseType)
|
|
|
|
typelib_typedescription_register( &pBaseType );
|
|
|
|
|
|
|
|
// construct member init array
|
|
|
|
const Sequence<Reference< XTypeDescription > > & rMemberTypes = xType->getMemberTypes();
|
|
|
|
const Sequence< OUString > & rMemberNames = xType->getMemberNames();
|
|
|
|
|
|
|
|
const Reference< XTypeDescription > * pMemberTypes = rMemberTypes.getConstArray();
|
|
|
|
const OUString * pMemberNames = rMemberNames.getConstArray();
|
|
|
|
|
|
|
|
sal_Int32 nMembers = rMemberTypes.getLength();
|
|
|
|
OSL_ENSURE( nMembers == rMemberNames.getLength(), "### lens differ!" );
|
|
|
|
|
|
|
|
OUString aTypeName( xType->getName() );
|
|
|
|
|
2015-03-28 19:00:21 +01:00
|
|
|
typelib_StructMember_Init * pMemberInits = static_cast<typelib_StructMember_Init *>(alloca(
|
|
|
|
sizeof(typelib_StructMember_Init) * nMembers ));
|
2004-06-04 02:21:58 +00:00
|
|
|
|
|
|
|
Sequence< Reference< XTypeDescription > > templateMemberTypes;
|
|
|
|
sal_Int32 i = aTypeName.indexOf('<');
|
|
|
|
if (i >= 0) {
|
|
|
|
Reference< XStructTypeDescription > templateDesc(
|
|
|
|
access->getByHierarchicalName(aTypeName.copy(0, i)),
|
|
|
|
UNO_QUERY_THROW);
|
2017-05-07 17:03:35 +10:00
|
|
|
OSL_ASSERT(
|
2004-06-04 02:21:58 +00:00
|
|
|
templateDesc->getTypeParameters().getLength()
|
|
|
|
== xType->getTypeArguments().getLength());
|
|
|
|
templateMemberTypes = templateDesc->getMemberTypes();
|
2017-05-07 17:03:35 +10:00
|
|
|
OSL_ASSERT(templateMemberTypes.getLength() == nMembers);
|
2004-06-04 02:21:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int32 nPos;
|
|
|
|
for ( nPos = nMembers; nPos--; )
|
|
|
|
{
|
|
|
|
typelib_StructMember_Init & rInit = pMemberInits[nPos];
|
|
|
|
rInit.aBase.eTypeClass
|
2018-01-15 09:06:32 +01:00
|
|
|
= static_cast<typelib_TypeClass>(pMemberTypes[nPos]->getTypeClass());
|
2004-06-04 02:21:58 +00:00
|
|
|
|
|
|
|
OUString aMemberTypeName( pMemberTypes[nPos]->getName() );
|
2020-04-14 14:55:22 +02:00
|
|
|
rInit.aBase.pTypeName = aMemberTypeName.pData;
|
|
|
|
rtl_uString_acquire( rInit.aBase.pTypeName );
|
2004-06-04 02:21:58 +00:00
|
|
|
|
|
|
|
// string is held by rMemberNames
|
|
|
|
rInit.aBase.pMemberName = pMemberNames[nPos].pData;
|
|
|
|
|
2019-05-04 21:20:18 +03:00
|
|
|
rInit.bParameterizedType = templateMemberTypes.hasElements()
|
2004-06-04 02:21:58 +00:00
|
|
|
&& (templateMemberTypes[nPos]->getTypeClass()
|
|
|
|
== TypeClass_UNKNOWN);
|
|
|
|
}
|
|
|
|
|
|
|
|
typelib_typedescription_newStruct(
|
|
|
|
&pRet,
|
|
|
|
aTypeName.pData,
|
2015-11-10 10:13:11 +01:00
|
|
|
(pBaseType ? pBaseType->pWeakRef : nullptr),
|
2004-06-04 02:21:58 +00:00
|
|
|
nMembers, pMemberInits );
|
|
|
|
|
|
|
|
// cleanup
|
|
|
|
for ( nPos = nMembers; nPos--; )
|
|
|
|
{
|
|
|
|
rtl_uString_release( pMemberInits[nPos].aBase.pTypeName );
|
|
|
|
}
|
|
|
|
if (pBaseType)
|
|
|
|
typelib_typedescription_release( pBaseType );
|
|
|
|
}
|
|
|
|
return pRet;
|
|
|
|
}
|
2014-02-25 18:02:27 +01:00
|
|
|
|
2018-10-09 10:28:48 +02:00
|
|
|
static typelib_TypeDescription * createCTD(
|
2010-12-10 13:46:18 +01:00
|
|
|
const Reference< XInterfaceAttributeTypeDescription2 > & xAttribute )
|
2001-05-08 14:56:02 +00:00
|
|
|
{
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_TypeDescription * pRet = nullptr;
|
2001-05-08 14:56:02 +00:00
|
|
|
if (xAttribute.is())
|
|
|
|
{
|
|
|
|
OUString aMemberName( xAttribute->getName() );
|
|
|
|
Reference< XTypeDescription > xType( xAttribute->getType() );
|
|
|
|
OUString aMemberTypeName( xType->getName() );
|
2010-12-10 13:46:18 +01:00
|
|
|
std::vector< rtl_uString * > getExc;
|
2020-05-19 19:16:41 +02:00
|
|
|
const Sequence< Reference< XCompoundTypeDescription > > getExcs(
|
2010-12-10 13:46:18 +01:00
|
|
|
xAttribute->getGetExceptions() );
|
2020-05-19 19:16:41 +02:00
|
|
|
for (const auto & ctd : getExcs)
|
2010-12-10 13:46:18 +01:00
|
|
|
{
|
2020-05-19 19:16:41 +02:00
|
|
|
OSL_ASSERT( ctd.is() );
|
|
|
|
getExc.push_back( ctd->getName().pData );
|
2010-12-10 13:46:18 +01:00
|
|
|
}
|
|
|
|
std::vector< rtl_uString * > setExc;
|
2020-05-19 19:16:41 +02:00
|
|
|
const Sequence< Reference< XCompoundTypeDescription > > setExcs(
|
2010-12-10 13:46:18 +01:00
|
|
|
xAttribute->getSetExceptions() );
|
2020-05-19 19:16:41 +02:00
|
|
|
for (const auto & ctd : setExcs)
|
2010-12-10 13:46:18 +01:00
|
|
|
{
|
2020-05-19 19:16:41 +02:00
|
|
|
OSL_ASSERT( ctd.is() );
|
|
|
|
setExc.push_back( ctd->getName().pData );
|
2010-12-10 13:46:18 +01:00
|
|
|
}
|
|
|
|
typelib_typedescription_newExtendedInterfaceAttribute(
|
2015-01-17 18:19:08 +01:00
|
|
|
reinterpret_cast<typelib_InterfaceAttributeTypeDescription **>(&pRet),
|
2001-05-08 14:56:02 +00:00
|
|
|
xAttribute->getPosition(),
|
|
|
|
aMemberName.pData, // name
|
2018-01-15 09:06:32 +01:00
|
|
|
static_cast<typelib_TypeClass>(xType->getTypeClass()),
|
2001-05-08 14:56:02 +00:00
|
|
|
aMemberTypeName.pData, // type name
|
2010-12-10 13:46:18 +01:00
|
|
|
xAttribute->isReadOnly(),
|
2015-01-28 17:53:30 +01:00
|
|
|
getExc.size(), getExc.data(),
|
|
|
|
setExc.size(), setExc.data() );
|
2001-05-08 14:56:02 +00:00
|
|
|
}
|
|
|
|
return pRet;
|
|
|
|
}
|
2014-02-25 18:02:27 +01:00
|
|
|
|
2001-10-15 15:07:59 +00:00
|
|
|
static typelib_TypeDescription * createCTD(
|
2001-05-08 14:56:02 +00:00
|
|
|
const Reference< XInterfaceMethodTypeDescription > & xMethod )
|
|
|
|
{
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_TypeDescription * pRet = nullptr;
|
2001-05-08 14:56:02 +00:00
|
|
|
if (xMethod.is())
|
|
|
|
{
|
|
|
|
Reference< XTypeDescription > xReturnType( xMethod->getReturnType() );
|
|
|
|
|
|
|
|
// init all params
|
|
|
|
const Sequence<Reference< XMethodParameter > > & rParams = xMethod->getParameters();
|
|
|
|
const Reference< XMethodParameter > * pParams = rParams.getConstArray();
|
|
|
|
sal_Int32 nParams = rParams.getLength();
|
|
|
|
|
2015-03-28 19:00:21 +01:00
|
|
|
typelib_Parameter_Init * pParamInit = static_cast<typelib_Parameter_Init *>(alloca(
|
|
|
|
sizeof(typelib_Parameter_Init) * nParams ));
|
2001-05-08 14:56:02 +00:00
|
|
|
|
|
|
|
sal_Int32 nPos;
|
|
|
|
for ( nPos = nParams; nPos--; )
|
|
|
|
{
|
|
|
|
const Reference< XMethodParameter > & xParam = pParams[nPos];
|
|
|
|
const Reference< XTypeDescription > & xType = xParam->getType();
|
|
|
|
typelib_Parameter_Init & rInit = pParamInit[xParam->getPosition()];
|
|
|
|
|
2018-01-15 09:06:32 +01:00
|
|
|
rInit.eTypeClass = static_cast<typelib_TypeClass>(xType->getTypeClass());
|
2001-05-08 14:56:02 +00:00
|
|
|
OUString aParamTypeName( xType->getName() );
|
2020-04-14 14:55:22 +02:00
|
|
|
rInit.pTypeName = aParamTypeName.pData;
|
|
|
|
rtl_uString_acquire( rInit.pTypeName );
|
2001-05-08 14:56:02 +00:00
|
|
|
OUString aParamName( xParam->getName() );
|
2020-04-14 14:55:22 +02:00
|
|
|
rInit.pParamName = aParamName.pData;
|
|
|
|
rtl_uString_acquire( rInit.pParamName );
|
2001-05-08 14:56:02 +00:00
|
|
|
rInit.bIn = xParam->isIn();
|
|
|
|
rInit.bOut = xParam->isOut();
|
|
|
|
}
|
|
|
|
|
|
|
|
// init all exception strings
|
|
|
|
const Sequence<Reference< XTypeDescription > > & rExceptions = xMethod->getExceptions();
|
|
|
|
const Reference< XTypeDescription > * pExceptions = rExceptions.getConstArray();
|
|
|
|
sal_Int32 nExceptions = rExceptions.getLength();
|
2015-03-28 19:00:21 +01:00
|
|
|
rtl_uString ** ppExceptionNames = static_cast<rtl_uString **>(alloca(
|
|
|
|
sizeof(rtl_uString *) * nExceptions ));
|
2001-05-08 14:56:02 +00:00
|
|
|
|
|
|
|
for ( nPos = nExceptions; nPos--; )
|
|
|
|
{
|
|
|
|
OUString aExceptionTypeName( pExceptions[nPos]->getName() );
|
2020-04-14 14:55:22 +02:00
|
|
|
ppExceptionNames[nPos] = aExceptionTypeName.pData;
|
|
|
|
rtl_uString_acquire( ppExceptionNames[nPos] );
|
2001-05-08 14:56:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OUString aTypeName( xMethod->getName() );
|
|
|
|
OUString aReturnTypeName( xReturnType->getName() );
|
|
|
|
|
|
|
|
typelib_typedescription_newInterfaceMethod(
|
2015-01-17 18:19:08 +01:00
|
|
|
reinterpret_cast<typelib_InterfaceMethodTypeDescription **>(&pRet),
|
2001-05-08 14:56:02 +00:00
|
|
|
xMethod->getPosition(),
|
|
|
|
xMethod->isOneway(),
|
|
|
|
aTypeName.pData,
|
2018-01-15 09:06:32 +01:00
|
|
|
static_cast<typelib_TypeClass>(xReturnType->getTypeClass()),
|
2001-05-08 14:56:02 +00:00
|
|
|
aReturnTypeName.pData,
|
|
|
|
nParams, pParamInit,
|
|
|
|
nExceptions, ppExceptionNames );
|
|
|
|
|
|
|
|
for ( nPos = nParams; nPos--; )
|
|
|
|
{
|
|
|
|
rtl_uString_release( pParamInit[nPos].pTypeName );
|
|
|
|
rtl_uString_release( pParamInit[nPos].pParamName );
|
|
|
|
}
|
|
|
|
for ( nPos = nExceptions; nPos--; )
|
|
|
|
{
|
|
|
|
rtl_uString_release( ppExceptionNames[nPos] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pRet;
|
|
|
|
}
|
2014-02-25 18:02:27 +01:00
|
|
|
|
2018-10-09 10:28:48 +02:00
|
|
|
static typelib_TypeDescription * createCTD(
|
2004-06-04 02:21:58 +00:00
|
|
|
Reference< container::XHierarchicalNameAccess > const & access,
|
2004-02-03 12:28:45 +00:00
|
|
|
const Reference< XInterfaceTypeDescription2 > & xType )
|
2001-05-08 14:56:02 +00:00
|
|
|
{
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_TypeDescription * pRet = nullptr;
|
2001-05-08 14:56:02 +00:00
|
|
|
if (xType.is())
|
|
|
|
{
|
2004-06-04 02:21:58 +00:00
|
|
|
Sequence< Reference< XTypeDescription > > aBases(xType->getBaseTypes());
|
2004-02-03 12:28:45 +00:00
|
|
|
sal_Int32 nBases = aBases.getLength();
|
|
|
|
// Exploit the fact that a typelib_TypeDescription for an interface type
|
|
|
|
// is also the typelib_TypeDescriptionReference for that type:
|
2015-06-15 17:58:15 +09:00
|
|
|
std::unique_ptr< typelib_TypeDescription * []> aBaseTypes(
|
2004-02-03 12:28:45 +00:00
|
|
|
new typelib_TypeDescription *[nBases]);
|
2013-01-26 16:31:43 +01:00
|
|
|
for (sal_Int32 i = 0; i < nBases; ++i) {
|
2004-06-04 02:21:58 +00:00
|
|
|
typelib_TypeDescription * p = createCTD(access, aBases[i]);
|
2017-05-07 17:03:35 +10:00
|
|
|
OSL_ASSERT(
|
2004-02-03 12:28:45 +00:00
|
|
|
!TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(p->eTypeClass));
|
|
|
|
typelib_typedescription_register(&p);
|
|
|
|
aBaseTypes[i] = p;
|
2013-01-26 16:31:43 +01:00
|
|
|
}
|
2004-02-03 12:28:45 +00:00
|
|
|
typelib_TypeDescriptionReference ** pBaseTypeRefs
|
|
|
|
= reinterpret_cast< typelib_TypeDescriptionReference ** >(
|
|
|
|
aBaseTypes.get());
|
2001-05-08 14:56:02 +00:00
|
|
|
|
|
|
|
// construct all member refs
|
|
|
|
const Sequence<Reference< XInterfaceMemberTypeDescription > > & rMembers = xType->getMembers();
|
|
|
|
sal_Int32 nMembers = rMembers.getLength();
|
|
|
|
|
2015-03-28 19:00:21 +01:00
|
|
|
typelib_TypeDescriptionReference ** ppMemberRefs = static_cast<typelib_TypeDescriptionReference **>(alloca(
|
|
|
|
sizeof(typelib_TypeDescriptionReference *) * nMembers ));
|
2001-05-08 14:56:02 +00:00
|
|
|
|
|
|
|
const Reference< XInterfaceMemberTypeDescription > * pMembers = rMembers.getConstArray();
|
|
|
|
|
|
|
|
OUString aTypeName( xType->getName() );
|
|
|
|
|
|
|
|
sal_Int32 nPos;
|
|
|
|
for ( nPos = nMembers; nPos--; )
|
|
|
|
{
|
|
|
|
OUString aMemberTypeName( pMembers[nPos]->getName() );
|
2015-11-10 10:13:11 +01:00
|
|
|
ppMemberRefs[nPos] = nullptr;
|
2001-05-08 14:56:02 +00:00
|
|
|
typelib_typedescriptionreference_new(
|
|
|
|
ppMemberRefs + nPos,
|
2018-01-15 09:06:32 +01:00
|
|
|
static_cast<typelib_TypeClass>(pMembers[nPos]->getTypeClass()),
|
2001-05-08 14:56:02 +00:00
|
|
|
aMemberTypeName.pData );
|
|
|
|
}
|
|
|
|
|
2004-02-03 12:28:45 +00:00
|
|
|
typelib_typedescription_newMIInterface(
|
2015-01-17 18:19:08 +01:00
|
|
|
reinterpret_cast<typelib_InterfaceTypeDescription **>(&pRet),
|
2001-05-08 14:56:02 +00:00
|
|
|
aTypeName.pData,
|
2013-09-04 14:25:39 +02:00
|
|
|
0, 0, 0, 0, 0,
|
2004-02-03 12:28:45 +00:00
|
|
|
nBases, pBaseTypeRefs,
|
2001-05-08 14:56:02 +00:00
|
|
|
nMembers, ppMemberRefs );
|
|
|
|
|
|
|
|
// cleanup refs and base type
|
2013-01-26 16:31:43 +01:00
|
|
|
for (int i = 0; i < nBases; ++i) {
|
2004-02-03 12:28:45 +00:00
|
|
|
typelib_typedescription_release(aBaseTypes[i]);
|
2013-01-26 16:31:43 +01:00
|
|
|
}
|
2001-05-08 14:56:02 +00:00
|
|
|
|
|
|
|
for ( nPos = nMembers; nPos--; )
|
|
|
|
{
|
|
|
|
typelib_typedescriptionreference_release( ppMemberRefs[nPos] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pRet;
|
|
|
|
}
|
2014-02-25 18:02:27 +01:00
|
|
|
|
2018-10-09 10:28:48 +02:00
|
|
|
static typelib_TypeDescription * createCTD( const Reference< XEnumTypeDescription > & xType )
|
2001-05-08 14:56:02 +00:00
|
|
|
{
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_TypeDescription * pRet = nullptr;
|
2001-05-08 14:56:02 +00:00
|
|
|
if (xType.is())
|
|
|
|
{
|
|
|
|
OUString aTypeName( xType->getName() );
|
|
|
|
Sequence< OUString > aNames( xType->getEnumNames() );
|
2017-05-07 17:03:35 +10:00
|
|
|
OSL_ASSERT( sizeof(OUString) == sizeof(rtl_uString *) ); // !!!
|
2001-05-08 14:56:02 +00:00
|
|
|
Sequence< sal_Int32 > aValues( xType->getEnumValues() );
|
|
|
|
|
|
|
|
typelib_typedescription_newEnum(
|
|
|
|
&pRet, aTypeName.pData, xType->getDefaultEnumValue(),
|
|
|
|
aNames.getLength(),
|
2015-01-17 18:19:08 +01:00
|
|
|
const_cast<rtl_uString **>(reinterpret_cast<rtl_uString * const *>(aNames.getConstArray())),
|
2001-05-08 14:56:02 +00:00
|
|
|
const_cast< sal_Int32 * >( aValues.getConstArray() ) );
|
|
|
|
}
|
|
|
|
return pRet;
|
|
|
|
}
|
2014-02-25 18:02:27 +01:00
|
|
|
|
2018-10-09 10:28:48 +02:00
|
|
|
static typelib_TypeDescription * createCTD(
|
2004-06-04 02:21:58 +00:00
|
|
|
Reference< container::XHierarchicalNameAccess > const & access,
|
2001-05-08 14:56:02 +00:00
|
|
|
const Reference< XIndirectTypeDescription > & xType )
|
|
|
|
{
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_TypeDescription * pRet = nullptr;
|
2001-05-08 14:56:02 +00:00
|
|
|
if (xType.is())
|
|
|
|
{
|
2004-06-04 02:21:58 +00:00
|
|
|
typelib_TypeDescription * pRefType = createCTD(
|
|
|
|
access, xType->getReferencedType() );
|
2001-05-08 14:56:02 +00:00
|
|
|
typelib_typedescription_register( &pRefType );
|
|
|
|
|
|
|
|
OUString aTypeName( xType->getName() );
|
|
|
|
|
|
|
|
typelib_typedescription_new(
|
|
|
|
&pRet,
|
2018-01-15 09:06:32 +01:00
|
|
|
static_cast<typelib_TypeClass>(xType->getTypeClass()),
|
2001-05-08 14:56:02 +00:00
|
|
|
aTypeName.pData,
|
|
|
|
pRefType->pWeakRef,
|
2015-11-10 10:13:11 +01:00
|
|
|
0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
|
|
|
|
// cleanup
|
2011-01-12 12:54:06 +00:00
|
|
|
typelib_typedescription_release( pRefType );
|
2001-05-08 14:56:02 +00:00
|
|
|
}
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
|
2014-02-25 18:02:27 +01:00
|
|
|
|
2004-06-04 02:21:58 +00:00
|
|
|
static typelib_TypeDescription * createCTD(
|
|
|
|
Reference< container::XHierarchicalNameAccess > const & access,
|
|
|
|
const Reference< XTypeDescription > & xType )
|
2001-05-08 14:56:02 +00:00
|
|
|
{
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_TypeDescription * pRet = nullptr;
|
2001-05-08 14:56:02 +00:00
|
|
|
|
|
|
|
if (xType.is())
|
|
|
|
{
|
|
|
|
switch (xType->getTypeClass())
|
|
|
|
{
|
|
|
|
// built in types
|
|
|
|
case TypeClass_VOID:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("void");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_VOID, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_CHAR:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("char");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_CHAR, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_BOOLEAN:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("boolean");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_BOOLEAN, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_BYTE:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("byte");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_BYTE, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_SHORT:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("short");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_SHORT, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_UNSIGNED_SHORT:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("unsigned short");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_UNSIGNED_SHORT, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_LONG:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("long");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_LONG, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_UNSIGNED_LONG:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("unsigned long");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_UNSIGNED_LONG, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_HYPER:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("hyper");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_HYPER, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_UNSIGNED_HYPER:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("unsigned hyper");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_UNSIGNED_HYPER, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_FLOAT:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("float");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_FLOAT, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_DOUBLE:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("double");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_DOUBLE, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_STRING:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("string");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_STRING, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_TYPE:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("type");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_TYPE, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_ANY:
|
|
|
|
{
|
2013-03-19 11:39:07 +01:00
|
|
|
OUString aTypeName("any");
|
2015-11-10 10:13:11 +01:00
|
|
|
typelib_typedescription_new( &pRet, typelib_TypeClass_ANY, aTypeName.pData, nullptr, 0, nullptr );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case TypeClass_EXCEPTION:
|
|
|
|
pRet = createCTD( Reference< XCompoundTypeDescription >::query( xType ) );
|
|
|
|
break;
|
2004-06-04 02:21:58 +00:00
|
|
|
case TypeClass_STRUCT:
|
|
|
|
pRet = createCTD(
|
|
|
|
access, Reference< XStructTypeDescription >::query( xType ) );
|
|
|
|
break;
|
2001-05-08 14:56:02 +00:00
|
|
|
case TypeClass_ENUM:
|
|
|
|
pRet = createCTD( Reference< XEnumTypeDescription >::query( xType ) );
|
|
|
|
break;
|
|
|
|
case TypeClass_TYPEDEF:
|
|
|
|
{
|
|
|
|
Reference< XIndirectTypeDescription > xTypedef( xType, UNO_QUERY );
|
|
|
|
if (xTypedef.is())
|
2004-06-04 02:21:58 +00:00
|
|
|
pRet = createCTD( access, xTypedef->getReferencedType() );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TypeClass_SEQUENCE:
|
2004-06-04 02:21:58 +00:00
|
|
|
pRet = createCTD(
|
|
|
|
access, Reference< XIndirectTypeDescription >::query( xType ) );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
case TypeClass_INTERFACE:
|
2004-06-04 02:21:58 +00:00
|
|
|
pRet = createCTD(
|
|
|
|
access,
|
|
|
|
Reference< XInterfaceTypeDescription2 >::query( xType ) );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
|
|
|
case TypeClass_INTERFACE_METHOD:
|
|
|
|
pRet = createCTD( Reference< XInterfaceMethodTypeDescription >::query( xType ) );
|
|
|
|
break;
|
|
|
|
case TypeClass_INTERFACE_ATTRIBUTE:
|
2010-12-10 13:46:18 +01:00
|
|
|
pRet = createCTD( Reference< XInterfaceAttributeTypeDescription2 >::query( xType ) );
|
2001-05-08 14:56:02 +00:00
|
|
|
break;
|
2006-06-19 09:35:30 +00:00
|
|
|
default:
|
|
|
|
break;
|
2001-05-08 14:56:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
{
|
2017-12-08 15:58:41 +02:00
|
|
|
static void typelib_callback(
|
2001-05-08 14:56:02 +00:00
|
|
|
void * pContext, typelib_TypeDescription ** ppRet, rtl_uString * pTypeName )
|
|
|
|
{
|
|
|
|
OSL_ENSURE( pContext && ppRet && pTypeName, "### null ptr!" );
|
2020-04-17 15:08:40 +02:00
|
|
|
if (!ppRet)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (*ppRet)
|
2001-05-08 14:56:02 +00:00
|
|
|
{
|
2020-04-17 15:08:40 +02:00
|
|
|
::typelib_typedescription_release( *ppRet );
|
|
|
|
*ppRet = nullptr;
|
|
|
|
}
|
|
|
|
if (!(pContext && pTypeName))
|
|
|
|
return;
|
|
|
|
|
|
|
|
Reference< container::XHierarchicalNameAccess > access(
|
|
|
|
static_cast< container::XHierarchicalNameAccess * >(
|
|
|
|
pContext));
|
|
|
|
try
|
|
|
|
{
|
|
|
|
OUString const & rTypeName = OUString::unacquired( &pTypeName );
|
|
|
|
Reference< XTypeDescription > xTD;
|
|
|
|
if (access->getByHierarchicalName(rTypeName ) >>= xTD)
|
2001-05-08 14:56:02 +00:00
|
|
|
{
|
2020-04-17 15:08:40 +02:00
|
|
|
*ppRet = createCTD( access, xTD );
|
2001-05-08 14:56:02 +00:00
|
|
|
}
|
|
|
|
}
|
2020-04-17 15:08:40 +02:00
|
|
|
catch (const container::NoSuchElementException & exc)
|
|
|
|
{
|
|
|
|
SAL_INFO("cppuhelper", "typelibrary type not available: " << exc );
|
|
|
|
}
|
|
|
|
catch (const Exception & exc)
|
|
|
|
{
|
|
|
|
SAL_INFO("cppuhelper", exc );
|
|
|
|
}
|
2001-05-08 14:56:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Extend loplugin:external to warn about classes
...following up on 314f15bff08b76bf96acf99141776ef64d2f1355 "Extend
loplugin:external to warn about enums".
Cases where free functions were moved into an unnamed namespace along with a
class, to not break ADL, are in:
filter/source/svg/svgexport.cxx
sc/source/filter/excel/xelink.cxx
sc/source/filter/excel/xilink.cxx
svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
All other free functions mentioning moved classes appear to be harmless and not
give rise to (silent, even) ADL breakage. (One remaining TODO in
compilerplugins/clang/external.cxx is that derived classes are not covered by
computeAffectedTypes, even though they could also be affected by ADL-breakage---
but don't seem to be in any acutal case across the code base.)
For friend declarations using elaborate type specifiers, like
class C1 {};
class C2 { friend class C1; };
* If C2 (but not C1) is moved into an unnamed namespace, the friend declaration
must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see
C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither
qualified nor a template-id and the declaration is a function or an
elaborated-type-specifier, the lookup to determine whether the entity has been
previously declared shall not consider any scopes outside the innermost
enclosing namespace.")
* If C1 (but not C2) is moved into an unnamed namespace, the friend declaration
must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882>
"elaborated-type-specifier friend not looked up in unnamed namespace".
Apart from that, to keep changes simple and mostly mechanical (which should help
avoid regressions), out-of-line definitions of class members have been left in
the enclosing (named) namespace. But explicit specializations of class
templates had to be moved into the unnamed namespace to appease
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of
template from unnamed namespace using unqualified-id in enclosing namespace".
Also, accompanying declarations (of e.g. typedefs or static variables) that
could arguably be moved into the unnamed namespace too have been left alone.
And in some cases, mention of affected types in blacklists in other loplugins
needed to be adapted.
And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which
is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is
not moved into an unnamed namespace (because it is declared in
sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is. GCC warns about
such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler
doesn’t give this warning for types defined in the main .C file, as those are
unlikely to have multiple definitions."
(<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>) The
warned-about classes also don't have multiple definitions in the given test, so
disable the warning when including the .cxx.
Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4
Reviewed-on: https://gerrit.libreoffice.org/83239
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-19 16:32:49 +01:00
|
|
|
namespace {
|
2014-02-25 18:02:27 +01:00
|
|
|
|
2001-05-08 14:56:02 +00:00
|
|
|
class EventListenerImpl
|
2016-12-07 08:59:42 +01:00
|
|
|
: public WeakImplHelper< lang::XEventListener >
|
2001-05-08 14:56:02 +00:00
|
|
|
{
|
|
|
|
Reference< container::XHierarchicalNameAccess > m_xTDMgr;
|
|
|
|
|
|
|
|
public:
|
2015-06-08 20:53:33 +01:00
|
|
|
explicit EventListenerImpl(
|
2001-05-08 14:56:02 +00:00
|
|
|
Reference< container::XHierarchicalNameAccess > const & xTDMgr )
|
|
|
|
: m_xTDMgr( xTDMgr )
|
|
|
|
{}
|
|
|
|
|
|
|
|
// XEventListener
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL disposing( lang::EventObject const & rEvt ) override;
|
2001-05-08 14:56:02 +00:00
|
|
|
};
|
2014-02-22 21:20:15 +01:00
|
|
|
|
Extend loplugin:external to warn about classes
...following up on 314f15bff08b76bf96acf99141776ef64d2f1355 "Extend
loplugin:external to warn about enums".
Cases where free functions were moved into an unnamed namespace along with a
class, to not break ADL, are in:
filter/source/svg/svgexport.cxx
sc/source/filter/excel/xelink.cxx
sc/source/filter/excel/xilink.cxx
svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
All other free functions mentioning moved classes appear to be harmless and not
give rise to (silent, even) ADL breakage. (One remaining TODO in
compilerplugins/clang/external.cxx is that derived classes are not covered by
computeAffectedTypes, even though they could also be affected by ADL-breakage---
but don't seem to be in any acutal case across the code base.)
For friend declarations using elaborate type specifiers, like
class C1 {};
class C2 { friend class C1; };
* If C2 (but not C1) is moved into an unnamed namespace, the friend declaration
must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see
C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither
qualified nor a template-id and the declaration is a function or an
elaborated-type-specifier, the lookup to determine whether the entity has been
previously declared shall not consider any scopes outside the innermost
enclosing namespace.")
* If C1 (but not C2) is moved into an unnamed namespace, the friend declaration
must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882>
"elaborated-type-specifier friend not looked up in unnamed namespace".
Apart from that, to keep changes simple and mostly mechanical (which should help
avoid regressions), out-of-line definitions of class members have been left in
the enclosing (named) namespace. But explicit specializations of class
templates had to be moved into the unnamed namespace to appease
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of
template from unnamed namespace using unqualified-id in enclosing namespace".
Also, accompanying declarations (of e.g. typedefs or static variables) that
could arguably be moved into the unnamed namespace too have been left alone.
And in some cases, mention of affected types in blacklists in other loplugins
needed to be adapted.
And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which
is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is
not moved into an unnamed namespace (because it is declared in
sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is. GCC warns about
such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler
doesn’t give this warning for types defined in the main .C file, as those are
unlikely to have multiple definitions."
(<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>) The
warned-about classes also don't have multiple definitions in the given test, so
disable the warning when including the .cxx.
Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4
Reviewed-on: https://gerrit.libreoffice.org/83239
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-19 16:32:49 +01:00
|
|
|
}
|
|
|
|
|
2001-05-08 14:56:02 +00:00
|
|
|
void EventListenerImpl::disposing( lang::EventObject const & rEvt )
|
|
|
|
{
|
2006-06-19 09:35:30 +00:00
|
|
|
if (rEvt.Source != m_xTDMgr) {
|
2017-05-07 17:03:35 +10:00
|
|
|
OSL_ASSERT(false);
|
2006-06-19 09:35:30 +00:00
|
|
|
}
|
2001-05-08 14:56:02 +00:00
|
|
|
// deregister of c typelib callback
|
|
|
|
::typelib_typedescription_revokeCallback( m_xTDMgr.get(), typelib_callback );
|
|
|
|
}
|
|
|
|
|
2014-02-25 18:02:27 +01:00
|
|
|
|
2001-05-08 14:56:02 +00:00
|
|
|
sal_Bool SAL_CALL installTypeDescriptionManager(
|
2007-05-09 12:26:19 +00:00
|
|
|
Reference< container::XHierarchicalNameAccess > const & xTDMgr_c )
|
2001-05-08 14:56:02 +00:00
|
|
|
{
|
2007-05-09 12:26:19 +00:00
|
|
|
uno::Environment curr_env(Environment::getCurrent());
|
2013-12-16 16:45:46 +01:00
|
|
|
uno::Environment target_env(CPPU_CURRENT_LANGUAGE_BINDING_NAME);
|
2007-05-09 12:26:19 +00:00
|
|
|
|
|
|
|
uno::Mapping curr2target(curr_env, target_env);
|
|
|
|
|
|
|
|
|
|
|
|
Reference<container::XHierarchicalNameAccess> xTDMgr(
|
2015-03-31 13:13:09 +02:00
|
|
|
static_cast<container::XHierarchicalNameAccess *>(
|
2015-04-01 08:38:16 +02:00
|
|
|
curr2target.mapInterface(xTDMgr_c.get(), cppu::UnoType<decltype(xTDMgr_c)>::get())),
|
2007-05-09 12:26:19 +00:00
|
|
|
SAL_NO_ACQUIRE);
|
|
|
|
|
2001-05-08 14:56:02 +00:00
|
|
|
Reference< lang::XComponent > xComp( xTDMgr, UNO_QUERY );
|
|
|
|
if (xComp.is())
|
|
|
|
{
|
|
|
|
xComp->addEventListener( new EventListenerImpl( xTDMgr ) );
|
|
|
|
// register c typelib callback
|
|
|
|
::typelib_typedescription_registerCallback( xTDMgr.get(), typelib_callback );
|
2016-04-20 17:15:56 +02:00
|
|
|
return true;
|
2001-05-08 14:56:02 +00:00
|
|
|
}
|
2016-04-20 17:15:56 +02:00
|
|
|
return false;
|
2001-05-08 14:56:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // end namespace cppu
|
2001-05-31 07:41:51 +00:00
|
|
|
|
2010-10-14 08:30:07 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|