tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / i18npool / source / transliteration / transliteration_commonclass.cxx
blob625a8a9177abb42fb2580f99095e8edabf0b774f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <transliteration_commonclass.hxx>
21 #include <cppuhelper/supportsservice.hxx>
23 using namespace ::com::sun::star::uno;
24 using namespace ::com::sun::star::i18n;
25 using namespace ::com::sun::star::lang;
27 namespace i18npool {
29 transliteration_commonclass::transliteration_commonclass()
31 transliterationName = "";
32 implementationName = "";
35 OUString SAL_CALL transliteration_commonclass::getName()
37 return OUString::createFromAscii(transliterationName);
40 void SAL_CALL transliteration_commonclass::loadModule( TransliterationModules /*modName*/, const Locale& rLocale )
42 aLocale = rLocale;
46 void SAL_CALL
47 transliteration_commonclass::loadModuleNew( const Sequence < TransliterationModulesNew >& /*modName*/, const Locale& /*rLocale*/ )
49 throw RuntimeException();
53 void SAL_CALL
54 transliteration_commonclass::loadModuleByImplName( const OUString& /*implName*/, const Locale& /*rLocale*/ )
56 throw RuntimeException();
59 void SAL_CALL
60 transliteration_commonclass::loadModulesByImplNames(const Sequence< OUString >& /*modNamelist*/, const Locale& /*rLocale*/)
62 throw RuntimeException();
65 Sequence< OUString > SAL_CALL
66 transliteration_commonclass::getAvailableModules( const Locale& /*rLocale*/, sal_Int16 /*sType*/ )
68 throw RuntimeException();
71 sal_Int32 SAL_CALL
72 transliteration_commonclass::compareSubstring(
73 const OUString& str1, sal_Int32 off1, sal_Int32 len1,
74 const OUString& str2, sal_Int32 off2, sal_Int32 len2)
76 Sequence <sal_Int32> offset1(2*len1);
77 Sequence <sal_Int32> offset2(2*len2);
79 OUString in_str1 = transliterate(str1, off1, len1, offset1);
80 OUString in_str2 = transliterate(str2, off2, len2, offset2);
81 sal_Int32 strlen1 = in_str1.getLength();
82 sal_Int32 strlen2 = in_str2.getLength();
83 const sal_Unicode* unistr1 = in_str1.getStr();
84 const sal_Unicode* unistr2 = in_str2.getStr();
86 while (strlen1 && strlen2)
88 sal_Int32 ret = *unistr1 - *unistr2;
89 if (ret)
90 return ret;
92 unistr1++;
93 unistr2++;
94 strlen1--;
95 strlen2--;
97 return strlen1 - strlen2;
100 sal_Int32 SAL_CALL
101 transliteration_commonclass::compareString( const OUString& str1, const OUString& str2 )
103 return compareSubstring(str1, 0, str1.getLength(), str2, 0, str2.getLength());
106 OUString SAL_CALL
107 transliteration_commonclass::transliterateString2String( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount )
109 return transliterateImpl(inStr, startPos, nCount, nullptr);
112 OUString SAL_CALL
113 transliteration_commonclass::transliterateChar2String( sal_Unicode inChar )
115 return transliteration_commonclass::transliterateString2String(OUString(&inChar, 1), 0, 1);
118 OUString SAL_CALL transliteration_commonclass::getImplementationName()
120 return OUString::createFromAscii(implementationName);
123 sal_Bool SAL_CALL transliteration_commonclass::supportsService(const OUString& rServiceName)
125 return cppu::supportsService(this, rServiceName);
128 Sequence< OUString > SAL_CALL transliteration_commonclass::getSupportedServiceNames()
130 return { u"com.sun.star.i18n.Transliteration.l10n"_ustr };
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */