summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@libreoffice.org>2023-05-29 11:27:40 +0300
committerخالد حسني <khaled@libreoffice.org>2023-05-29 16:23:07 +0200
commitd7ddac208516ce2350c84c434aad933b345c9509 (patch)
tree6ca3b8af2fff138501c48b6e4235e38513292f3b
parentab1985d0b39e8bcc976543b9700e04610f434423 (diff)
Remove recently unused CTLScriptType code
This is now unused after: commit 98f7ec383db74a6491e925e30125d3fbf270afc2 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>
-rw-r--r--i18npool/source/characterclassification/unoscripttypedetector.cxx14
-rw-r--r--i18nutil/source/utility/scripttypedetector.cxx49
-rw-r--r--include/i18nutil/scripttypedetector.hxx3
-rw-r--r--offapi/com/sun/star/i18n/CTLScriptType.idl1
-rw-r--r--offapi/com/sun/star/i18n/XScriptTypeDetector.idl3
5 files changed, 10 insertions, 60 deletions
diff --git a/i18npool/source/characterclassification/unoscripttypedetector.cxx b/i18npool/source/characterclassification/unoscripttypedetector.cxx
index afcd2708ce90..1d48ed864724 100644
--- a/i18npool/source/characterclassification/unoscripttypedetector.cxx
+++ b/i18npool/source/characterclassification/unoscripttypedetector.cxx
@@ -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
diff --git a/i18nutil/source/utility/scripttypedetector.cxx b/i18nutil/source/utility/scripttypedetector.cxx
index f096ecbde831..5bc3f9bb2aa1 100644
--- a/i18nutil/source/utility/scripttypedetector.cxx
+++ b/i18nutil/source/utility/scripttypedetector.cxx
@@ -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: */
diff --git a/include/i18nutil/scripttypedetector.hxx b/include/i18nutil/scripttypedetector.hxx
index a3d4d8ed2ff7..b5d0186fb5c6 100644
--- a/include/i18nutil/scripttypedetector.hxx
+++ b/include/i18nutil/scripttypedetector.hxx
@@ -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
diff --git a/offapi/com/sun/star/i18n/CTLScriptType.idl b/offapi/com/sun/star/i18n/CTLScriptType.idl
index 4bf0052b8de9..f4eb3f4ba834 100644
--- a/offapi/com/sun/star/i18n/CTLScriptType.idl
+++ b/offapi/com/sun/star/i18n/CTLScriptType.idl
@@ -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
diff --git a/offapi/com/sun/star/i18n/XScriptTypeDetector.idl b/offapi/com/sun/star/i18n/XScriptTypeDetector.idl
index 7220e57ec8fc..083e4f39abd1 100644
--- a/offapi/com/sun/star/i18n/XScriptTypeDetector.idl
+++ b/offapi/com/sun/star/i18n/XScriptTypeDetector.idl
@@ -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);
};