Remove recently unused CTLScriptType code
This is now unused after:
commit 98f7ec383d
Author: Khaled Hosny <khaled@libreoffice.org>
Date: Sun May 28 16:28:52 2023 +0300
tdf#139863, tdf#155514: Don’t split COMPLEX text portions
The code is also broken as it doesn’t handle surrogate pairs.
The UNO API now throws an exception.
Change-Id: I454ed741e3834e762a2731d671c21a3e73515da3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152359
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: خالد حسني <khaled@libreoffice.org>
This commit is contained in:
@@ -43,23 +43,21 @@ UnoScriptTypeDetector::endOfScriptDirection( const OUString& Text, sal_Int32 nPo
|
||||
}
|
||||
|
||||
sal_Int16 SAL_CALL
|
||||
UnoScriptTypeDetector::getCTLScriptType( const OUString& Text, sal_Int32 nPos )
|
||||
UnoScriptTypeDetector::getCTLScriptType( const OUString&, sal_Int32 )
|
||||
{
|
||||
return ScriptTypeDetector::getCTLScriptType(Text, nPos);
|
||||
throw css::uno::RuntimeException("not implemented");
|
||||
}
|
||||
|
||||
// Begin of Script Type is inclusive.
|
||||
sal_Int32 SAL_CALL
|
||||
UnoScriptTypeDetector::beginOfCTLScriptType( const OUString& Text, sal_Int32 nPos )
|
||||
UnoScriptTypeDetector::beginOfCTLScriptType( const OUString&, sal_Int32 )
|
||||
{
|
||||
return ScriptTypeDetector::beginOfCTLScriptType(Text, nPos);
|
||||
throw css::uno::RuntimeException("not implemented");
|
||||
}
|
||||
|
||||
// End of the Script Type is exclusive, the return value pointing to the begin of next script type
|
||||
sal_Int32 SAL_CALL
|
||||
UnoScriptTypeDetector::endOfCTLScriptType( const OUString& Text, sal_Int32 nPos )
|
||||
UnoScriptTypeDetector::endOfCTLScriptType( const OUString&, sal_Int32 )
|
||||
{
|
||||
return ScriptTypeDetector::endOfCTLScriptType(Text, nPos);
|
||||
throw css::uno::RuntimeException("not implemented");
|
||||
}
|
||||
|
||||
OUString SAL_CALL
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <com/sun/star/i18n/CTLScriptType.hpp>
|
||||
#include <com/sun/star/i18n/ScriptDirection.hpp>
|
||||
#include <com/sun/star/i18n/UnicodeScript.hpp>
|
||||
#include <i18nutil/scripttypedetector.hxx>
|
||||
@@ -82,52 +81,4 @@ sal_Int32 ScriptTypeDetector::endOfScriptDirection( std::u16string_view Text, sa
|
||||
return cPos == nPos ? -1 : cPos;
|
||||
}
|
||||
|
||||
sal_Int16 ScriptTypeDetector::getCTLScriptType( std::u16string_view Text, sal_Int32 nPos )
|
||||
{
|
||||
static const ScriptTypeList typeList[] = {
|
||||
{ UnicodeScript_kHebrew, UnicodeScript_kHebrew, CTLScriptType::CTL_HEBREW }, // 10
|
||||
{ UnicodeScript_kArabic, UnicodeScript_kArabic, CTLScriptType::CTL_ARABIC }, // 11
|
||||
{ UnicodeScript_kDevanagari, UnicodeScript_kDevanagari, CTLScriptType::CTL_INDIC }, // 14
|
||||
{ UnicodeScript_kThai, UnicodeScript_kThai, CTLScriptType::CTL_THAI }, // 24
|
||||
{ UnicodeScript_kScriptCount, UnicodeScript_kScriptCount, CTLScriptType::CTL_UNKNOWN } // 88
|
||||
};
|
||||
|
||||
return unicode::getUnicodeScriptType(Text[nPos], typeList);
|
||||
}
|
||||
|
||||
// Begin of Script Type is inclusive.
|
||||
sal_Int32 ScriptTypeDetector::beginOfCTLScriptType( std::u16string_view Text, sal_Int32 nPos )
|
||||
{
|
||||
if (nPos < 0)
|
||||
return 0;
|
||||
else if (o3tl::make_unsigned(nPos) >= Text.size())
|
||||
return Text.size();
|
||||
else {
|
||||
sal_Int16 cType = getCTLScriptType(Text, nPos);
|
||||
for (nPos--; nPos >= 0; nPos--) {
|
||||
if (cType != getCTLScriptType(Text, nPos))
|
||||
break;
|
||||
}
|
||||
return nPos + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// End of the Script Type is exclusive, the return value pointing to the begin of next script type
|
||||
sal_Int32 ScriptTypeDetector::endOfCTLScriptType( std::u16string_view Text, sal_Int32 nPos )
|
||||
{
|
||||
if (nPos < 0)
|
||||
return 0;
|
||||
else if (o3tl::make_unsigned(nPos) >= Text.size())
|
||||
return Text.size();
|
||||
else {
|
||||
sal_Int16 cType = getCTLScriptType(Text, nPos);
|
||||
sal_Int32 len = Text.size();
|
||||
for (nPos++; nPos < len; nPos++) {
|
||||
if (cType != getCTLScriptType(Text, nPos))
|
||||
break;
|
||||
}
|
||||
return nPos;
|
||||
}
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -28,9 +28,6 @@ public:
|
||||
static sal_Int32 beginOfScriptDirection( std::u16string_view Text, sal_Int32 nPos, sal_Int16 scriptDirection );
|
||||
static sal_Int32 endOfScriptDirection( std::u16string_view Text, sal_Int32 nPos, sal_Int16 scriptDirection );
|
||||
static sal_Int16 getScriptDirection( std::u16string_view Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection );
|
||||
static sal_Int32 beginOfCTLScriptType( std::u16string_view Text, sal_Int32 nPos );
|
||||
static sal_Int32 endOfCTLScriptType( std::u16string_view Text, sal_Int32 nPos );
|
||||
static sal_Int16 getCTLScriptType(std::u16string_view Text, sal_Int32 nPos );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,6 +26,7 @@ module com { module sun { module star { module i18n {
|
||||
XScriptTypeDetector::getCTLScriptType()
|
||||
|
||||
@since OOo 1.1.2
|
||||
@deprecated since LibreOffice 7.6
|
||||
*/
|
||||
|
||||
published constants CTLScriptType
|
||||
|
||||
@@ -51,15 +51,18 @@ published interface XScriptTypeDetector : ::com::sun::star::uno::XInterface
|
||||
[in] short nDefaultScriptDirection );
|
||||
|
||||
/** @returns the position where the specified CTL Script Type starts.
|
||||
@deprecated since LibreOffice 7.6
|
||||
*/
|
||||
long beginOfCTLScriptType( [in] string aText, [in] long nPos);
|
||||
|
||||
/** @returns the position where the specified CTL Script Type ends.
|
||||
@deprecated since LibreOffice 7.6
|
||||
*/
|
||||
long endOfCTLScriptType( [in] string aText, [in] long nPos);
|
||||
|
||||
/** @returns the CTL script type of the current position. <br/>
|
||||
One of CTLScriptType constants.
|
||||
@deprecated since LibreOffice 7.6
|
||||
*/
|
||||
short getCTLScriptType ([in] string aText, [in] long nPos);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user