diff options
Diffstat (limited to 'include/i18nutil')
-rw-r--r-- | include/i18nutil/unicode.hxx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/include/i18nutil/unicode.hxx b/include/i18nutil/unicode.hxx index 6561da039f6b..051da5bd9188 100644 --- a/include/i18nutil/unicode.hxx +++ b/include/i18nutil/unicode.hxx @@ -21,6 +21,7 @@ #include <com/sun/star/i18n/UnicodeScript.hpp> #include <sal/types.h> +#include <rtl/ustrbuf.hxx> #include <unicode/uscript.h> #include <i18nutil/i18nutildllapi.h> @@ -58,6 +59,51 @@ public: const LanguageTag &rLangTag); }; +/* + Toggle between a character and its Unicode Notation. + -implements the concept found in Microsoft Word's Alt-X + -accepts sequences of up to 8 hex characters and converts into the corresponding Unicode Character + -example: 0000A78c or 2bc + -accepts sequences of up to 256 characters in Unicode notation + -example: U+00000065u+0331u+308 + -handles complex characters (with combining elements) and the all of the Unicode planes. +*/ +class I18NUTIL_DLLPUBLIC ToggleUnicodeCodepoint +{ +private: + OUStringBuffer maInput; + OUStringBuffer maOutput; + OUStringBuffer maUtf16; + OUStringBuffer maCombining; + bool mbAllowMoreChars = true; + bool mbRequiresU = false; + bool mbIsHexString = false; + +public: + ToggleUnicodeCodepoint(); + + /** + Build an input string of valid UTF16 units to toggle. + -do not call the other functions until the input process is complete + -build string from Right to Left. (Start from the character to the left of the cursor: move left.) + */ + bool AllowMoreInput(sal_Unicode uChar); + + /** + Validates (and potentially modifies) the input string. + -all non-input functions must use this function to first to validate the input string + -additional input may be prevented after this function is called + */ + OUString StringToReplace(); + OUString ReplacementString(); + + /** + While sInput.getLength() returns the number of utf16 units to delete, + this function returns the number of "characters" to delete - potentially a smaller number + */ + sal_uInt32 CharsToDelete(); +}; + #endif |