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
17e6b8fd
Kaydet (Commit)
17e6b8fd
authored
Nis 07, 2011
tarafından
Cédric Bosdonnat
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
i#20348: made the ordinal suffixe autocorrection internationalized
üst
207bbf87
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
35 deletions
+46
-35
dispatchwatcher.cxx
desktop/source/app/dispatchwatcher.cxx
+1
-1
svxacorr.cxx
editeng/source/misc/svxacorr.cxx
+45
-34
No files found.
desktop/source/app/dispatchwatcher.cxx
Dosyayı görüntüle @
17e6b8fd
...
...
@@ -479,7 +479,7 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
{
xStorable
->
storeToURL
(
aOutFile
,
conversionProperties
);
}
catch
(
Exception
&
)
catch
(
Exception
&
e
)
{
fprintf
(
stderr
,
"Error: Please reverify input parameters...
\n
"
);
}
...
...
editeng/source/misc/svxacorr.cxx
Dosyayı görüntüle @
17e6b8fd
...
...
@@ -49,6 +49,7 @@
#include <unotools/collatorwrapper.hxx>
#include <com/sun/star/i18n/CollatorOptions.hpp>
#include <com/sun/star/i18n/UnicodeScript.hpp>
#include <com/sun/star/i18n/XOrdinalSuffix.hpp>
#include <unotools/localedatawrapper.hxx>
#include <unotools/transliterationwrapper.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
...
...
@@ -510,48 +511,58 @@ sal_Bool SvxAutoCorrect::FnChgOrdinalNumber(
if
(
!
lcl_IsInAsciiArr
(
sImplEndSkipChars
,
rTxt
.
GetChar
(
nEndPos
-
1
)
))
break
;
if
(
2
<
nEndPos
-
nSttPos
&&
rCC
.
isDigit
(
rTxt
,
nEndPos
-
3
)
)
// Get the last number in the string to check
xub_StrLen
nNumEnd
=
nEndPos
;
bool
foundEnd
=
false
;
bool
validNumber
=
true
;
xub_StrLen
i
=
nEndPos
;
do
{
static
sal_Char
const
sAll
[]
=
"th"
,
/* rest */
sFirst
[]
=
"st"
,
/* 1 */
sSecond
[]
=
"nd"
,
/* 2 */
sThird
[]
=
"rd"
;
/* 3 */
static
const
sal_Char
*
const
aNumberTab
[
4
]
=
i
--
;
bool
isDigit
=
rCC
.
isDigit
(
rTxt
,
i
);
if
(
foundEnd
)
validNumber
|=
isDigit
;
if
(
isDigit
&&
!
foundEnd
)
{
sAll
,
sFirst
,
sSecond
,
sThird
};
foundEnd
=
true
;
nNumEnd
=
i
;
}
}
while
(
i
>
nSttPos
);
sal_Unicode
c
=
rTxt
.
GetChar
(
nEndPos
-
3
);
if
(
(
c
-=
'0'
)
>
3
)
c
=
0
;
if
(
foundEnd
&&
validNumber
)
{
sal_Int32
nNum
=
rTxt
.
Copy
(
nSttPos
,
nNumEnd
-
nSttPos
+
1
).
ToInt32
(
);
bChg
=
(
((
sal_Unicode
)
*
((
aNumberTab
[
c
])
+
0
))
==
rTxt
.
GetChar
(
nEndPos
-
2
)
&&
((
sal_Unicode
)
*
((
aNumberTab
[
c
])
+
1
))
==
rTxt
.
GetChar
(
nEndPos
-
1
))
||
(
3
<
nEndPos
-
nSttPos
&&
(
((
sal_Unicode
)
*
(
sAll
+
0
))
==
rTxt
.
GetChar
(
nEndPos
-
2
)
&&
((
sal_Unicode
)
*
(
sAll
+
1
))
==
rTxt
.
GetChar
(
nEndPos
-
1
)));
// Check if the characters after that number correspond to the ordinal suffix
rtl
::
OUString
sServiceName
=
rtl
::
OUString
::
createFromAscii
(
"com.sun.star.i18n.OrdinalSuffix"
);
uno
::
Reference
<
i18n
::
XOrdinalSuffix
>
xOrdSuffix
(
comphelper
::
createProcessComponent
(
sServiceName
),
uno
::
UNO_QUERY
);
if
(
bChg
)
if
(
xOrdSuffix
.
is
(
)
)
{
// then check to the start, if all are numbers
for
(
xub_StrLen
n
=
nEndPos
-
3
;
nSttPos
<
n
;
)
if
(
!
rCC
.
isDigit
(
rTxt
,
--
n
)
)
uno
::
Sequence
<
rtl
::
OUString
>
aSuffixes
=
xOrdSuffix
->
getOrdinalSuffix
(
nNum
,
rCC
.
getLocale
(
)
);
for
(
sal_Int32
nSuff
=
0
;
nSuff
<
aSuffixes
.
getLength
();
nSuff
++
)
{
String
sSuffix
(
aSuffixes
[
nSuff
]
);
String
sEnd
=
rTxt
.
Copy
(
nNumEnd
+
1
,
nEndPos
-
nNumEnd
-
1
);
if
(
sSuffix
==
sEnd
)
{
bChg
=
!
rCC
.
isLetter
(
rTxt
,
n
);
break
;
// Check if the ordinal suffix has to be set as super script
if
(
rCC
.
isLetter
(
sSuffix
)
)
{
// Do the change
SvxEscapementItem
aSvxEscapementItem
(
DFLT_ESC_AUTO_SUPER
,
DFLT_ESC_PROP
,
SID_ATTR_CHAR_ESCAPEMENT
);
rDoc
.
SetAttr
(
nNumEnd
+
1
,
nEndPos
,
SID_ATTR_CHAR_ESCAPEMENT
,
aSvxEscapementItem
);
}
}
if
(
bChg
)
// then set the escapement attribute
{
SvxEscapementItem
aSvxEscapementItem
(
DFLT_ESC_AUTO_SUPER
,
DFLT_ESC_PROP
,
SID_ATTR_CHAR_ESCAPEMENT
);
rDoc
.
SetAttr
(
nEndPos
-
2
,
nEndPos
,
SID_ATTR_CHAR_ESCAPEMENT
,
aSvxEscapementItem
);
}
}
...
...
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