23#include <com/sun/star/i18n/ScriptType.hpp>
24#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
25#include <com/sun/star/i18n/BreakIterator.hpp>
27#include <unicode/uchar.h>
86 sal_uInt16 nScript = i18n::ScriptType::WEAK;
89 if(
nPos &&
nPos == rText.getLength() )
95 sal_Int32 nChgPos = 0;
96 if (i18n::ScriptType::WEAK == nScript &&
nPos >= 0 &&
nPos + 1 < rText.getLength())
100 switch (u_charType(rText[
nPos + 1]))
102 case U_NON_SPACING_MARK:
103 case U_ENCLOSING_MARK:
104 case U_COMBINING_SPACING_MARK:
109 if( i18n::ScriptType::WEAK == nScript &&
nPos )
111 nChgPos =
m_xBreak->beginOfScript(rText,
nPos, nScript);
113 nScript =
m_xBreak->getScriptType(rText, nChgPos-1);
116 if( i18n::ScriptType::WEAK == nScript )
119 if( rText.getLength() > nChgPos && 0 <= nChgPos )
120 nScript =
m_xBreak->getScriptType(rText, nChgPos);
123 if( i18n::ScriptType::WEAK == nScript )
131 SvtScriptType::ASIAN |
132 SvtScriptType::COMPLEX;
134 sal_uInt16 nScript = 0;
135 if (!rText.isEmpty())
137 for( sal_Int32
n = 0, nEnd = rText.getLength();
n < nEnd;
138 n =
m_xBreak->endOfScript(rText,
n, nScript) )
140 nScript =
m_xBreak->getScriptType(rText,
n);
143 case i18n::ScriptType::LATIN: nRet |= SvtScriptType::LATIN;
break;
144 case i18n::ScriptType::ASIAN: nRet |= SvtScriptType::ASIAN;
break;
145 case i18n::ScriptType::COMPLEX: nRet |= SvtScriptType::COMPLEX;
break;
146 case i18n::ScriptType::WEAK:
147 if( nRet == SvtScriptType::NONE )
148 nRet |= coAllScripts;
151 if( coAllScripts == nRet )
159 sal_Int32 nStart, sal_Int32 nEnd)
const
161 sal_Int32 nGraphemeCount = 0;
163 sal_Int32 nCurPos = std::max(
static_cast<sal_Int32
>(0), nStart);
164 while (nCurPos < nEnd)
168 if (rText[nCurPos] ==
' ')
174 sal_Int32 nCount2 = 1;
175 nCurPos =
m_xBreak->nextCharacters(rText, nCurPos, lang::Locale(),
176 i18n::CharacterIteratorMode::SKIPCELL, nCount2, nCount2);
181 return nGraphemeCount;
Reference< XComponentContext > m_xContext
css::i18n::ForbiddenCharacters getForbiddenCharacters() const
void GetForbidden_(const LanguageType aLang)
static void Create_(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
sal_Int32 getGraphemeCount(const OUString &rStr, sal_Int32 nStart, sal_Int32 nEnd) const
std::optional< css::i18n::ForbiddenCharacters > m_oForbidden
SwBreakIt(SwBreakIt const &)=delete
SvtScriptType GetAllScriptsOfText(const OUString &rText) const
void GetLocale_(const LanguageType aLang)
LanguageType m_aForbiddenLang
language of the current forbiddenChar struct
sal_uInt16 GetRealScriptOfText(const OUString &rText, sal_Int32 nPos) const
std::unique_ptr< LanguageTag > m_xLanguageTag
language tag of the current locale
css::uno::Reference< css::uno::XComponentContext > m_xContext
css::uno::Reference< css::i18n::XBreakIterator > m_xBreak
const LanguageTag & GetLanguageTag(const LanguageType aLang)
LanguageType GetAppLanguage()
#define LANGUAGE_DONTKNOW
sal_Int16 GetI18NScriptTypeOfLanguage(LanguageType nLang)
css::uno::Reference< css::deployment::XPackageRegistry > create(css::uno::Reference< css::deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, css::uno::Reference< css::uno::XComponentContext > const &xComponentContext)