2002-05-22 03:21:01 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-07 22:12:42 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
2005-09-07 22:12:42 -05:00
|
|
|
* $RCSfile: serviceinfohelper.cxx,v $
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
2005-09-07 22:12:42 -05:00
|
|
|
* $Revision: 1.3 $
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
2005-09-07 22:12:42 -05:00
|
|
|
* last change: $Author: rt $ $Date: 2005-09-08 04:12:42 $
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
2005-09-07 22:12:42 -05:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
|
|
|
*
|
2005-09-07 22:12:42 -05:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
2005-09-07 22:12:42 -05:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
2005-09-07 22:12:42 -05:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
2005-09-07 22:12:42 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include "serviceinfohelper.hxx"
|
|
|
|
|
|
|
|
namespace configmgr
|
|
|
|
{
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int32 ServiceInfoHelper::countServices( ) const
|
|
|
|
{
|
2002-12-06 06:07:49 -06:00
|
|
|
if (m_info == 0)
|
2002-05-22 03:21:01 -05:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
sal_Int32 nCount = 0;
|
2002-12-06 06:07:49 -06:00
|
|
|
if (AsciiServiceName const* p= m_info->registeredServiceNames)
|
2002-05-22 03:21:01 -05:00
|
|
|
{
|
2002-12-06 06:07:49 -06:00
|
|
|
while (*p != 0)
|
|
|
|
{
|
|
|
|
++nCount;
|
|
|
|
++p;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (AsciiServiceName const* p= m_info->additionalServiceNames)
|
|
|
|
{
|
|
|
|
while (*p != 0)
|
|
|
|
{
|
|
|
|
++nCount;
|
|
|
|
++p;
|
|
|
|
}
|
2002-05-22 03:21:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return nCount;
|
|
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
OUString ServiceInfoHelper::getImplementationName( ) const
|
|
|
|
throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
AsciiServiceName p= m_info ? m_info->implementationName : 0;
|
|
|
|
|
|
|
|
return p ? OUString::createFromAscii(p) : OUString();
|
|
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool ServiceInfoHelper::supportsService( OUString const & ServiceName ) const
|
|
|
|
throw(uno::RuntimeException)
|
|
|
|
{
|
2002-12-06 06:07:49 -06:00
|
|
|
if (m_info == 0)
|
2002-05-22 03:21:01 -05:00
|
|
|
return false;
|
|
|
|
|
2002-12-06 06:07:49 -06:00
|
|
|
if (AsciiServiceName const* p= m_info->registeredServiceNames)
|
2002-05-22 03:21:01 -05:00
|
|
|
{
|
2002-12-06 06:07:49 -06:00
|
|
|
while (*p != 0)
|
|
|
|
{
|
|
|
|
if (ServiceName.equalsAscii(*p))
|
|
|
|
return true;
|
|
|
|
++p;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (AsciiServiceName const* p= m_info->additionalServiceNames)
|
|
|
|
{
|
|
|
|
while (*p != 0)
|
|
|
|
{
|
|
|
|
if (ServiceName.equalsAscii(*p))
|
|
|
|
return true;
|
|
|
|
++p;
|
|
|
|
}
|
2002-05-22 03:21:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
uno::Sequence< OUString > ServiceInfoHelper::getSupportedServiceNames( ) const
|
|
|
|
throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
sal_Int32 const nCount = countServices();
|
|
|
|
|
|
|
|
uno::Sequence< OUString > aServices( nCount );
|
|
|
|
|
2002-12-06 06:07:49 -06:00
|
|
|
if (nCount)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(m_info);
|
|
|
|
sal_Int32 i = 0;
|
|
|
|
if (AsciiServiceName const* p= m_info->registeredServiceNames)
|
|
|
|
{
|
|
|
|
while (*p != 0)
|
|
|
|
{
|
|
|
|
aServices[i++] = OUString::createFromAscii(*p++);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (AsciiServiceName const* p= m_info->additionalServiceNames)
|
|
|
|
{
|
|
|
|
while (*p != 0)
|
|
|
|
{
|
|
|
|
aServices[i++] = OUString::createFromAscii(*p++);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OSL_ASSERT( i == nCount );
|
|
|
|
}
|
|
|
|
|
|
|
|
return aServices;
|
|
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int32 ServiceRegistrationHelper::countServices( ) const
|
|
|
|
{
|
|
|
|
if (m_info == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
sal_Int32 nCount = 0;
|
|
|
|
if (AsciiServiceName const* p= m_info->registeredServiceNames)
|
|
|
|
{
|
|
|
|
while (*p != 0)
|
|
|
|
{
|
|
|
|
++nCount;
|
|
|
|
++p;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nCount;
|
|
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
OUString ServiceRegistrationHelper::getImplementationName( ) const
|
|
|
|
throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
AsciiServiceName p= m_info ? m_info->implementationName : 0;
|
|
|
|
|
|
|
|
return p ? OUString::createFromAscii(p) : OUString();
|
|
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
uno::Sequence< OUString > ServiceRegistrationHelper::getRegisteredServiceNames( ) const
|
|
|
|
throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
sal_Int32 const nCount = countServices();
|
|
|
|
|
|
|
|
uno::Sequence< OUString > aServices( nCount );
|
|
|
|
|
|
|
|
if (nCount)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(m_info);
|
|
|
|
sal_Int32 i = 0;
|
|
|
|
if (AsciiServiceName const* p= m_info->registeredServiceNames)
|
|
|
|
{
|
|
|
|
while (*p != 0)
|
|
|
|
{
|
|
|
|
aServices[i++] = OUString::createFromAscii(*p++);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OSL_ASSERT( i == nCount );
|
|
|
|
}
|
2002-05-22 03:21:01 -05:00
|
|
|
|
|
|
|
return aServices;
|
|
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
} // namespace config
|
|
|
|
|
|
|
|
|