20#include <com/sun/star/lang/NoSupportException.hpp>
21#include <com/sun/star/uno/XComponentContext.hpp>
32TextConversionResult SAL_CALL
34 const Locale& rLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions)
38 sal_Int32 len = aText.getLength() - nStartPos;
40 nLength = std::max<sal_Int32>(len, 0);
41 return xTC->getConversions(aText, nStartPos,
nLength, rLocale, nConversionType, nConversionOptions);
46 const Locale& rLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions)
50 sal_Int32 len = aText.getLength() - nStartPos;
52 nLength = std::max<sal_Int32>(len, 0);
53 return xTC->getConversion(aText, nStartPos,
nLength, rLocale, nConversionType, nConversionOptions);
58 const Locale& rLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions,
Sequence< sal_Int32>& offset)
62 sal_Int32 len = aText.getLength() - nStartPos;
64 nLength = std::max<sal_Int32>(len, 0);
65 return xTC->getConversionWithOffset(aText, nStartPos,
nLength, rLocale, nConversionType, nConversionOptions, offset);
73 return xTC->interactiveConversion(rLocale, nTextConversionType, nTextConversionOptions);
82 OUString aPrefix(
"com.sun.star.i18n.TextConversion_");
88 for (
auto const& fallback : aFallbacks)
90 xI =
m_xContext->getServiceManager()->createInstanceWithContext( aPrefix + fallback,
m_xContext);
96 xTC.set( xI, UNO_QUERY );
101 throw NoSupportException();
107 return "com.sun.star.i18n.TextConversion";
119 return {
"com.sun.star.i18n.TextConversion" };
124extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
126 css::uno::XComponentContext *context,
127 css::uno::Sequence<css::uno::Any>
const &)
static ::std::vector< OUString > getFallbackLocaleServiceNames(const css::lang::Locale &rLocale)
Generates fallback strings suitable as parts of service names, excluding the one obtained via getFirs...
static OUString getFirstLocaleServiceName(const css::lang::Locale &rLocale)
Generates a <Language>_<Country> or <Variant> (if Language=="qlt") string suitable as part of service...
sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
css::i18n::TextConversionResult SAL_CALL getConversions(const OUString &aText, sal_Int32 nStartPos, sal_Int32 nLength, const css::lang::Locale &aLocale, sal_Int16 nTextConversionType, sal_Int32 nTextConversionOptions) override
void getLocaleSpecificTextConversion(const css::lang::Locale &rLocale)
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
OUString SAL_CALL getImplementationName() override
css::lang::Locale aLocale
OUString SAL_CALL getConversion(const OUString &aText, sal_Int32 nStartPos, sal_Int32 nLength, const css::lang::Locale &aLocale, sal_Int16 nTextConversionType, sal_Int32 nTextConversionOptions) override
css::uno::Reference< css::i18n::XExtendedTextConversion > xTC
sal_Bool SAL_CALL interactiveConversion(const css::lang::Locale &aLocale, sal_Int16 nTextConversionType, sal_Int32 nTextConversionOptions) override
OUString SAL_CALL getConversionWithOffset(const OUString &aText, sal_Int32 nStartPos, sal_Int32 nLength, const css::lang::Locale &aLocale, sal_Int16 nTextConversionType, sal_Int32 nTextConversionOptions, css::uno::Sequence< sal_Int32 > &offset) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Constant values shared between i18npool and, for example, the number formatter.
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_i18n_TextConversion_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)