1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: serviceinfohelper.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_configmgr.hxx"
34 #include "serviceinfohelper.hxx"
38 // ---------------------------------------------------------------------------
40 sal_Int32
ServiceInfoHelper::countServices( ) const
46 if (sal_Char
const * const* p
= m_info
->registeredServiceNames
)
54 if (sal_Char
const * const* p
= m_info
->additionalServiceNames
)
65 // ---------------------------------------------------------------------------
67 rtl::OUString
ServiceInfoHelper::getImplementationName( ) const
68 throw(uno::RuntimeException
)
70 sal_Char
const * p
= m_info
? m_info
->implementationName
: 0;
72 return p
? rtl::OUString::createFromAscii(p
) : rtl::OUString();
74 // ---------------------------------------------------------------------------
76 sal_Bool
ServiceInfoHelper::supportsService( rtl::OUString
const & ServiceName
) const
77 throw(uno::RuntimeException
)
82 if (sal_Char
const * const* p
= m_info
->registeredServiceNames
)
86 if (ServiceName
.equalsAscii(*p
))
91 if (sal_Char
const * const* p
= m_info
->additionalServiceNames
)
95 if (ServiceName
.equalsAscii(*p
))
103 // ---------------------------------------------------------------------------
105 uno::Sequence
< rtl::OUString
> ServiceInfoHelper::getSupportedServiceNames( ) const
106 throw(uno::RuntimeException
)
108 sal_Int32
const nCount
= countServices();
110 uno::Sequence
< rtl::OUString
> aServices( nCount
);
116 if (sal_Char
const * const* p
= m_info
->registeredServiceNames
)
120 aServices
[i
++] = rtl::OUString::createFromAscii(*p
++);
123 if (sal_Char
const * const* p
= m_info
->additionalServiceNames
)
127 aServices
[i
++] = rtl::OUString::createFromAscii(*p
++);
130 OSL_ASSERT( i
== nCount
);
135 // ---------------------------------------------------------------------------
136 // ---------------------------------------------------------------------------
138 sal_Int32
ServiceRegistrationHelper::countServices( ) const
143 sal_Int32 nCount
= 0;
144 if (sal_Char
const * const* p
= m_info
->registeredServiceNames
)
155 // ---------------------------------------------------------------------------
157 rtl::OUString
ServiceRegistrationHelper::getImplementationName( ) const
158 throw(uno::RuntimeException
)
160 sal_Char
const * p
= m_info
? m_info
->implementationName
: 0;
162 return p
? rtl::OUString::createFromAscii(p
) : rtl::OUString();
164 // ---------------------------------------------------------------------------
166 uno::Sequence
< rtl::OUString
> ServiceRegistrationHelper::getRegisteredServiceNames( ) const
167 throw(uno::RuntimeException
)
169 sal_Int32
const nCount
= countServices();
171 uno::Sequence
< rtl::OUString
> aServices( nCount
);
177 if (sal_Char
const * const* p
= m_info
->registeredServiceNames
)
181 aServices
[i
++] = rtl::OUString::createFromAscii(*p
++);
184 OSL_ASSERT( i
== nCount
);
189 // ---------------------------------------------------------------------------
190 } // namespace config