Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
f647df27
Kaydet (Commit)
f647df27
authored
Mar 26, 2002
tarafından
Bustamam Harun
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#97583# Add inputsequencechecker
üst
7f3fe721
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
329 additions
and
0 deletions
+329
-0
inputsequencechecker.cxx
i18npool/source/inputchecker/inputsequencechecker.cxx
+163
-0
inputsequencechecker_th.cxx
i18npool/source/inputchecker/inputsequencechecker_th.cxx
+102
-0
makefile.mk
i18npool/source/inputchecker/makefile.mk
+64
-0
No files found.
i18npool/source/inputchecker/inputsequencechecker.cxx
0 → 100644
Dosyayı görüntüle @
f647df27
/*************************************************************************
*
* $RCSfile: inputsequencechecker.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: bustamam $ $Date: 2002-03-26 12:54:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include <inputsequencechecker.hxx>
#include <drafts/com/sun/star/i18n/InputSequenceCheckMode.hpp>
#include <com/sun/star/i18n/UnicodeType.hpp>
#include <unicode.hxx>
#include <rtl/ustrbuf.hxx>
using
namespace
::
drafts
::
com
::
sun
::
star
::
i18n
;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
lang
;
using
namespace
::
rtl
;
namespace
com
{
namespace
sun
{
namespace
star
{
namespace
i18n
{
InputSequenceCheckerImpl
::
InputSequenceCheckerImpl
(
const
Reference
<
XMultiServiceFactory
>&
rxMSF
)
:
xMSF
(
rxMSF
)
{
serviceName
=
"com.sun.star.i18n.InputSequenceCheckerImpl"
;
cachedItem
=
NULL
;
}
InputSequenceCheckerImpl
::
InputSequenceCheckerImpl
()
{
}
InputSequenceCheckerImpl
::~
InputSequenceCheckerImpl
()
{
// Clear lookuptable
for
(
cachedItem
=
(
lookupTableItem
*
)
lookupTable
.
First
();
cachedItem
;
cachedItem
=
(
lookupTableItem
*
)
lookupTable
.
Next
())
delete
cachedItem
;
lookupTable
.
Clear
();
}
sal_Bool
SAL_CALL
InputSequenceCheckerImpl
::
checkInputSequence
(
const
OUString
&
Text
,
sal_Int32
nStartPos
,
sal_Unicode
inputChar
,
sal_Int16
inputCheckMode
)
throw
(
RuntimeException
)
{
if
(
inputCheckMode
==
InputSequenceCheckMode
::
PASSTHROUGH
)
return
sal_True
;
sal_Char
*
language
=
getLanguageByScripType
(
Text
[
nStartPos
],
inputChar
);
if
(
language
)
return
getInputSequenceChecker
(
language
)
->
checkInputSequence
(
Text
,
nStartPos
,
inputChar
,
inputCheckMode
);
else
return
sal_True
;
// not a checkable languages.
}
static
ScriptTypeList
typeList
[]
=
{
//{ UnicodeScript_kHebrew, UnicodeScript_kHebrew }, // 10,
//{ UnicodeScript_kArabic, UnicodeScript_kArabic }, // 11,
//{ UnicodeScript_kDevanagari, UnicodeScript_kDevanagari }, // 14,
{
UnicodeScript_kThai
,
UnicodeScript_kThai
},
// 24,
{
UnicodeScript_kScriptCount
,
UnicodeScript_kScriptCount
}
// 88
};
sal_Char
*
SAL_CALL
InputSequenceCheckerImpl
::
getLanguageByScripType
(
sal_Unicode
cChar
,
sal_Unicode
nChar
)
{
sal_Int16
type
=
unicode
::
getUnicodeScriptType
(
cChar
,
typeList
,
UnicodeScript_kScriptCount
);
if
(
type
!=
UnicodeScript_kScriptCount
&&
type
==
unicode
::
getUnicodeScriptType
(
nChar
,
typeList
,
UnicodeScript_kScriptCount
))
{
switch
(
type
)
{
case
UnicodeScript_kThai
:
return
"th"
;
//case UnicodeScript_kArabic: return "ar";
//case UnicodeScript_kHebrew: return "he";
//cace UnicodeScript_kDevanagari: return "hi";
}
}
return
NULL
;
}
Reference
<
XInputSequenceChecker
>&
SAL_CALL
InputSequenceCheckerImpl
::
getInputSequenceChecker
(
sal_Char
*
rLanguage
)
throw
(
RuntimeException
)
{
if
(
cachedItem
&&
cachedItem
->
aLanguage
==
rLanguage
)
{
return
cachedItem
->
xISC
;
}
else
if
(
xMSF
.
is
())
{
for
(
cachedItem
=
(
lookupTableItem
*
)
lookupTable
.
First
();
cachedItem
;
cachedItem
=
(
lookupTableItem
*
)
lookupTable
.
Next
())
{
if
(
cachedItem
->
aLanguage
==
rLanguage
)
{
return
cachedItem
->
xISC
;
}
}
Reference
<
uno
::
XInterface
>
xI
=
xMSF
->
createInstance
(
OUString
::
createFromAscii
(
"com.sun.star.i18n.InputSequenceChecker_"
)
+
OUString
::
createFromAscii
(
rLanguage
));
if
(
xI
.
is
()
)
{
Reference
<
XInputSequenceChecker
>
xISC
;
xI
->
queryInterface
(
getCppuType
((
const
Reference
<
XInputSequenceChecker
>*
)
0
)
)
>>=
xISC
;
if
(
xISC
.
is
())
{
lookupTable
.
Insert
(
cachedItem
=
new
lookupTableItem
(
rLanguage
,
xISC
));
return
cachedItem
->
xISC
;
}
}
}
throw
RuntimeException
();
}
OUString
SAL_CALL
InputSequenceCheckerImpl
::
getImplementationName
(
void
)
throw
(
RuntimeException
)
{
return
OUString
::
createFromAscii
(
serviceName
);
}
sal_Bool
SAL_CALL
InputSequenceCheckerImpl
::
supportsService
(
const
OUString
&
rServiceName
)
throw
(
RuntimeException
)
{
return
!
rServiceName
.
compareToAscii
(
serviceName
);
}
Sequence
<
OUString
>
SAL_CALL
InputSequenceCheckerImpl
::
getSupportedServiceNames
(
void
)
throw
(
RuntimeException
)
{
Sequence
<
OUString
>
aRet
(
1
);
aRet
[
0
]
=
OUString
::
createFromAscii
(
serviceName
);
return
aRet
;
}
}
}
}
}
i18npool/source/inputchecker/inputsequencechecker_th.cxx
0 → 100644
Dosyayı görüntüle @
f647df27
/*************************************************************************
*
* $RCSfile: inputsequencechecker_th.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: bustamam $ $Date: 2002-03-26 12:54:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include <inputsequencechecker_th.hxx>
#include <wtt.h>
using
namespace
rtl
;
namespace
com
{
namespace
sun
{
namespace
star
{
namespace
i18n
{
InputSequenceChecker_th
::
InputSequenceChecker_th
()
{
serviceName
=
"com.sun.star.i18n.InputSequenceChecker_th"
;
}
InputSequenceChecker_th
::~
InputSequenceChecker_th
()
{
}
/* Table for Thai Cell Manipulation */
sal_Char
_TAC_celltype_inputcheck
[
17
][
17
]
=
{
/* Cn */
/* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F */
/* Cn-1 00 */
'X'
,
'A'
,
'A'
,
'A'
,
'A'
,
'A'
,
'A'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
/* 10 */
'X'
,
'A'
,
'A'
,
'A'
,
'S'
,
'S'
,
'A'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
/* 20 */
'X'
,
'A'
,
'A'
,
'A'
,
'A'
,
'S'
,
'A'
,
'C'
,
'C'
,
'C'
,
'C'
,
'C'
,
'C'
,
'C'
,
'C'
,
'C'
,
'C'
,
/* 30 */
'X'
,
'S'
,
'A'
,
'S'
,
'S'
,
'S'
,
'S'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
/* 40 */
'X'
,
'S'
,
'A'
,
'S'
,
'A'
,
'S'
,
'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'
,
'R'
,
'R'
,
'R'
,
/* E0 */
'X'
,
'A'
,
'A'
,
'A'
,
'S'
,
'S'
,
'A'
,
'R'
,
'R'
,
'R'
,
'C'
,
'C'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
/* F0 */
'X'
,
'A'
,
'A'
,
'A'
,
'S'
,
'S'
,
'A'
,
'R'
,
'R'
,
'R'
,
'C'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'R'
,
'X'
,
'A'
,
'A'
,
'A'
,
'S'
,
'S'
,
'A'
,
'R'
,
'R'
,
'R'
,
'C'
,
'R'
,
'C'
,
'R'
,
'R'
,
'R'
,
'R'
};
sal_Bool
_TAC_Composible
[
3
][
5
]
=
{
/* 'A', 'C', 'S', 'R', 'X' */
/* Mode 0 */
{
sal_True
,
sal_True
,
sal_True
,
sal_True
,
sal_True
},
// PASSTHROUGH = 0
/* Mode 1 */
{
sal_True
,
sal_True
,
sal_True
,
sal_False
,
sal_True
},
// BASIC = 1
/* Mode 2 */
{
sal_True
,
sal_True
,
sal_False
,
sal_False
,
sal_True
}
// STRICT = 2
};
sal_Bool
SAL_CALL
InputSequenceChecker_th
::
checkInputSequence
(
const
OUString
&
Text
,
sal_Int32
nStartPos
,
sal_Unicode
inputChar
,
sal_Int16
inputCheckMode
)
throw
(
com
::
sun
::
star
::
uno
::
RuntimeException
)
{
sal_Int16
composible_class
;
sal_Unicode
currentChar
=
Text
[
nStartPos
];
switch
(
_TAC_celltype_inputcheck
[
getCharType
(
currentChar
)][
getCharType
(
inputChar
)])
{
case
'A'
:
composible_class
=
0
;
break
;
case
'C'
:
composible_class
=
1
;
break
;
case
'S'
:
composible_class
=
2
;
break
;
case
'R'
:
composible_class
=
3
;
break
;
case
'X'
:
composible_class
=
4
;
break
;
default
:
composible_class
=
0
;
}
return
(
_TAC_Composible
[
inputCheckMode
][
composible_class
]);
}
}
}
}
}
i18npool/source/inputchecker/makefile.mk
0 → 100644
Dosyayı görüntüle @
f647df27
#*************************************************************************
#*
#* $RCSfile: makefile.mk,v $
#*
#* $Revision: 1.1 $
#*
#* last change: $Author: bustamam $ $Date: 2002-03-26 12:54:35 $
#*
#* The Contents of this file are made available subject to the terms of
#* either of the following licenses
#*
#* - Sun Industry Standards Source License Version 1.1
#*
#* Sun Microsystems Inc., October, 2000
#*
#* Sun Industry Standards Source License Version 1.1
#* =================================================
#* The contents of this file are subject to the Sun Industry Standards
#* Source License Version 1.1 (the "License"); You may not use this file
#* except in compliance with the License. You may obtain a copy of the
#* License at http://www.openoffice.org/license.html.
#*
#* Software provided under this License is provided on an "AS IS" basis,
#* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
#* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
#* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
#* See the License for the specific provisions governing your rights and
#* obligations concerning the Software.
#*
#* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#*
#* Copyright: 2000 by Sun Microsystems, Inc.
#*
#* All Rights Reserved.
#*
#* Contributor(s): _______________________________________
#*
#*
#************************************************************************/
PRJ
=
..
$/
..
PRJNAME
=
i18npool
TARGET
=
inputchecker
ENABLE_EXCEPTIONS
=
TRUE
# --- Settings -----------------------------------------------------
.INCLUDE
:
svpre.mk
.INCLUDE
:
settings.mk
.INCLUDE
:
sv.mk
# --- Files --------------------------------------------------------
SLOFILES
=
\
$(SLO)$/
inputsequencechecker.obj
\
$(SLO)$/
inputsequencechecker_th.obj
# --- Targets ------------------------------------------------------
.INCLUDE
:
target.mk
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment