21#include <com/sun/star/i18n/KCharacterType.hpp>
22#include <com/sun/star/i18n/WordType.hpp>
23#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
24#include <unicode/uchar.h>
66 sal_Int32 len =
Text.getLength();
78 sal_Int32 len =
Text.getLength();
92 sal_Int32 len =
Text.getLength();
99 rtl_uString* pStr = rtl_uString_alloc(
nCount);
102 Boundary bdy = xBrk->getWordBoundary(
Text,
nPos, rLocale,
103 WordType::ANYWORD_IGNOREWHITESPACES,
true);
106 bdy = xBrk->nextWord(
Text, bdy.endPos, rLocale,
107 WordType::ANYWORD_IGNOREWHITESPACES);
108 *out = (
i == bdy.startPos) ?
112 return OUString( pStr, SAL_NO_ACQUIRE );
121 throw lang::WrappedTargetRuntimeException(
122 "wrapped " +
a.getValueTypeName() +
": " + e.Message,
123 uno::Reference<uno::XInterface>(),
a);
130 return static_cast<sal_Int16
>(u_charType(
Text.iterateCodePoints(&
nPos, 0)));
136 return static_cast<sal_Int16
>(u_charDirection(
Text.iterateCodePoints(&
nPos, 0)));
146 return static_cast<sal_Int16
>(ublock_getCode(
Text.iterateCodePoints(&
nPos, 0)))-1;
152 using namespace ::com::sun::star::i18n::KCharacterType;
155 switch ( u_charType(
ch) ) {
157 case U_UPPERCASE_LETTER :
161 case U_LOWERCASE_LETTER :
165 case U_TITLECASE_LETTER :
169 case U_MODIFIER_LETTER :
170 case U_OTHER_LETTER :
174 case U_DECIMAL_DIGIT_NUMBER:
175 case U_LETTER_NUMBER:
180 case U_NON_SPACING_MARK:
181 case U_ENCLOSING_MARK:
182 case U_COMBINING_SPACING_MARK:
186 case U_SPACE_SEPARATOR:
188 case U_DASH_PUNCTUATION:
189 case U_INITIAL_PUNCTUATION:
190 case U_FINAL_PUNCTUATION:
191 case U_CONNECTOR_PUNCTUATION:
192 case U_OTHER_PUNCTUATION:
195 case U_CURRENCY_SYMBOL:
196 case U_MODIFIER_SYMBOL:
205 case U_LINE_SEPARATOR:
206 case U_PARAGRAPH_SEPARATOR:
211 return U_GENERAL_OTHER_TYPES;
230 sal_Int32 nOrigPos =
nPos;
232 sal_Int32 nUtf16Units =
nPos - nOrigPos;
240 const OUString& Text,
242 const Locale& rLocale,
243 sal_Int32 startCharTokenType,
244 const OUString& userDefinedCharactersStart,
245 sal_Int32 contCharTokenType,
246 const OUString& userDefinedCharactersCont )
253 startCharTokenType, userDefinedCharactersStart,
254 contCharTokenType, userDefinedCharactersCont );
262 sal_Int32 nTokenType,
263 const OUString& Text,
265 const Locale& rLocale,
266 sal_Int32 startCharTokenType,
267 const OUString& userDefinedCharactersStart,
268 sal_Int32 contCharTokenType,
269 const OUString& userDefinedCharactersCont )
276 startCharTokenType, userDefinedCharactersStart,
277 contCharTokenType, userDefinedCharactersCont );
285 return "com.sun.star.i18n.CharacterClassification_Unicode";
295 return {
"com.sun.star.i18n.CharacterClassification_Unicode" };
300extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
302 css::uno::XComponentContext *context,
303 css::uno::Sequence<css::uno::Any>
const &)
Reference< XComponentContext > m_xContext
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_i18n_CharacterClassification_Unicode_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
cclass_Unicode(css::uno::Reference< css::uno::XComponentContext > xContext)
virtual OUString SAL_CALL getImplementationName() override
virtual OUString SAL_CALL toUpper(const OUString &Text, sal_Int32 nPos, sal_Int32 nCount, const css::lang::Locale &rLocale) override
virtual OUString SAL_CALL toLower(const OUString &Text, sal_Int32 nPos, sal_Int32 nCount, const css::lang::Locale &rLocale) override
virtual css::i18n::ParseResult SAL_CALL parseAnyToken(const OUString &Text, sal_Int32 nPos, const css::lang::Locale &rLocale, sal_Int32 nStartCharFlags, const OUString &userDefinedCharactersStart, sal_Int32 nContCharFlags, const OUString &userDefinedCharactersCont) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual OUString SAL_CALL toTitle(const OUString &Text, sal_Int32 nPos, sal_Int32 nCount, const css::lang::Locale &rLocale) override
void parseText(css::i18n::ParseResult &r, const OUString &rText, sal_Int32 nPos, sal_Int32 nTokenType=0xffffffff)
Parse a text.
virtual sal_Int32 SAL_CALL getStringType(const OUString &text, sal_Int32 nPos, sal_Int32 nCount, const css::lang::Locale &rLocale) override
void setupParserTable(const css::lang::Locale &rLocale, sal_Int32 startCharTokenType, const OUString &userDefinedCharactersStart, sal_Int32 contCharTokenType, const OUString &userDefinedCharactersCont)
Setup parser table. Calls initParserTable() only if needed.
rtl::Reference< Transliteration_casemapping > transToTitle
rtl::Reference< Transliteration_casemapping > transToLower
virtual sal_Int16 SAL_CALL getCharacterDirection(const OUString &Text, sal_Int32 nPos) override
virtual css::i18n::ParseResult SAL_CALL parsePredefinedToken(sal_Int32 nTokenType, const OUString &Text, sal_Int32 nPos, const css::lang::Locale &rLocale, sal_Int32 nStartCharFlags, const OUString &userDefinedCharactersStart, sal_Int32 nContCharFlags, const OUString &userDefinedCharactersCont) override
virtual sal_Int16 SAL_CALL getType(const OUString &Text, sal_Int32 nPos) override
void destroyParserTable()
Destroy parser table.
virtual sal_Int16 SAL_CALL getScript(const OUString &Text, sal_Int32 nPos) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual sal_Int32 SAL_CALL getCharacterType(const OUString &text, sal_Int32 nPos, const css::lang::Locale &rLocale) override
rtl::Reference< Transliteration_casemapping > transToUpper
virtual ~cclass_Unicode() override
static sal_Int32 getCharType(std::u16string_view Text, sal_Int32 *nPos, sal_Int32 increment)
Implementation of getCharacterType() for one single character.
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Any SAL_CALL getCaughtException()
Constant values shared between i18npool and, for example, the number formatter.
sal_uInt32 iterateCodePoints(std::u16string_view string, sal_Int32 *indexUtf16, sal_Int32 incrementCodePoints=1)