Kaydet (Commit) f1830339 authored tarafından Rüdiger Timm's avatar Rüdiger Timm

INTEGRATION: CWS calc06 (1.2.44); FILE MERGED

2003/03/21 22:08:16 khong 1.2.44.1: #106680# Implementing new XExtendedTransliteration interface
üst c564086e
......@@ -2,9 +2,9 @@
*
* $RCSfile: transliteration_Numeric.cxx,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: er $ $Date: 2002-03-26 17:13:19 $
* last change: $Author: rt $ $Date: 2003-04-08 16:07:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -60,36 +60,122 @@
************************************************************************/
#include <transliteration_Numeric.hxx>
using namespace com::sun::star::uno;
#include <nativenumbersupplier.hxx>
#include <defaultnumberingprovider.hxx>
using namespace drafts::com::sun::star::i18n;
using namespace com::sun::star::uno;
using namespace rtl;
namespace com { namespace sun { namespace star { namespace i18n {
sal_Int16 SAL_CALL transliteration_Numeric::getType() throw(RuntimeException)
{
return TransliterationType::NUMERIC;
return TransliterationType::NUMERIC;
}
OUString SAL_CALL
transliteration_Numeric::folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
throw(RuntimeException)
throw(RuntimeException)
{
throw (new RuntimeException());
throw (new RuntimeException());
}
sal_Bool SAL_CALL
transliteration_Numeric::equals( const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, const OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 )
throw(RuntimeException)
throw(RuntimeException)
{
throw (new RuntimeException());
throw (new RuntimeException());
}
Sequence< OUString > SAL_CALL
transliteration_Numeric::transliterateRange( const OUString& str1, const OUString& str2 )
throw(RuntimeException)
throw(RuntimeException)
{
throw (new RuntimeException());
}
#define isNumber(c) ((c) >= 0x30 && (c) <= 0x39)
#define NUMBER_ZERO 0x30
OUString SAL_CALL
transliteration_Numeric::transliterateBullet( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
Sequence< sal_Int32 >& offset ) throw(RuntimeException)
{
sal_Int32 number = -1, j = 0, endPos = startPos + nCount;
if (endPos > inStr.getLength())
endPos = inStr.getLength();
rtl_uString* pStr = x_rtl_uString_new_WithLength( nCount, 1 ); // our x_rtl_ustring.h
sal_Unicode* out = pStr->buffer;
if (useOffset)
offset.realloc(nCount);
for (sal_Int32 i = startPos; i < endPos; i++) {
if (i < endPos && isNumber(inStr[i])) {
if (number == -1) {
startPos = i;
number = (inStr[i] - NUMBER_ZERO);
} else {
number = number * 10 + (inStr[i] - NUMBER_ZERO);
}
} else {
if (number == 0) {
if (useOffset)
offset[j] = startPos;
out[j++] = NUMBER_ZERO;
} if (number > tableSize && !recycleSymbol) {
for (sal_Int32 k = startPos; k < i; k++) {
if (useOffset)
offset[j] = k;
out[j++] = inStr[k];
}
} else if (number > 0) {
if (useOffset)
offset[j] = startPos;
out[j++] = table[--number % tableSize];
} else if (i < endPos) {
if (useOffset)
offset[j] = i;
out[j++] = inStr[i];
}
number = -1;
}
}
out[j] = 0;
if (useOffset)
offset.realloc(j);
return OUString( pStr, SAL_NO_ACQUIRE );
}
OUString SAL_CALL
transliteration_Numeric::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
Sequence< sal_Int32 >& offset ) throw(RuntimeException)
{
if (tableSize)
return transliterateBullet( inStr, startPos, nCount, offset);
else
return NativeNumberSupplier(useOffset).getNativeNumberString( inStr.copy(startPos, nCount), aLocale, nNativeNumberMode, offset );
}
sal_Unicode SAL_CALL
transliteration_Numeric::transliterateChar2Char( sal_Unicode inChar ) throw(RuntimeException, MultipleCharsOutputException)
{
throw (new RuntimeException());
if (tableSize) {
if (isNumber(inChar)) {
sal_Int16 number = inChar - NUMBER_ZERO;
if (number <= tableSize || recycleSymbol)
return table[--number % tableSize];
}
return inChar;
}
else
return NativeNumberSupplier().getNativeNumberChar( inChar, aLocale, nNativeNumberMode );
}
} } } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment