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
b88e5350
Kaydet (Commit)
b88e5350
authored
Nis 12, 2013
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
use EditView::CheckLanguage() instead of duplicated code
Change-Id: I0ff75f1dc084f426846ac4f67db85a5d932d7bee
üst
a324ad1a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
87 deletions
+4
-87
olmenu.cxx
sw/source/ui/lingu/olmenu.cxx
+4
-87
No files found.
sw/source/ui/lingu/olmenu.cxx
Dosyayı görüntüle @
b88e5350
...
...
@@ -51,6 +51,7 @@
#include <editeng/splwrap.hxx>
#include <editeng/brushitem.hxx>
#include <editeng/unolingu.hxx>
#include <editeng/editview.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <linguistic/lngprops.hxx>
...
...
@@ -98,90 +99,6 @@ using namespace ::com::sun::star;
extern
void
sw_CharDialog
(
SwWrtShell
&
rWrtSh
,
bool
bUseDialog
,
sal_uInt16
nSlot
,
const
SfxItemSet
*
pArgs
,
SfxRequest
*
pReq
);
// tries to determine the language of 'rText'
//
static
LanguageType
lcl_CheckLanguage
(
const
OUString
&
rText
,
uno
::
Reference
<
linguistic2
::
XSpellChecker1
>
xSpell
,
uno
::
Reference
<
linguistic2
::
XLanguageGuessing
>
xLangGuess
,
bool
bIsParaText
)
{
LanguageType
nLang
=
LANGUAGE_NONE
;
if
(
bIsParaText
)
// check longer texts with language-guessing...
{
if
(
!
xLangGuess
.
is
())
return
nLang
;
lang
::
Locale
aLocale
(
xLangGuess
->
guessPrimaryLanguage
(
rText
,
0
,
rText
.
getLength
())
);
// get language as from "Tools/Options - Language Settings - Languages: Locale setting"
LanguageType
nTmpLang
=
Application
::
GetSettings
().
GetLanguageTag
().
getLanguageType
();
// if the result from language guessing does not provide a 'Country' part
// try to get it by looking up the locale setting of the office.
/* FIXME-BCP47: handle language tags */
if
(
aLocale
.
Country
.
isEmpty
())
{
lang
::
Locale
aTmpLocale
=
LanguageTag
(
nTmpLang
).
getLocale
();
if
(
aTmpLocale
.
Language
==
aLocale
.
Language
)
nLang
=
nTmpLang
;
}
if
(
nLang
==
LANGUAGE_NONE
)
// language not found by looking up the system language...
nLang
=
LanguageTag
(
aLocale
).
makeFallback
().
getLanguageType
();
if
(
nLang
==
LANGUAGE_SYSTEM
)
nLang
=
nTmpLang
;
if
(
nLang
==
LANGUAGE_DONTKNOW
)
nLang
=
LANGUAGE_NONE
;
}
else
// check single word
{
if
(
!
xSpell
.
is
())
return
nLang
;
//
// build list of languages to check
//
LanguageType
aLangList
[
4
];
const
AllSettings
&
rSettings
=
Application
::
GetSettings
();
SvtLinguOptions
aLinguOpt
;
SvtLinguConfig
().
GetOptions
(
aLinguOpt
);
// The default document language from "Tools/Options - Language Settings - Languages: Western"
aLangList
[
0
]
=
MsLangId
::
resolveSystemLanguageByScriptType
(
aLinguOpt
.
nDefaultLanguage
,
::
com
::
sun
::
star
::
i18n
::
ScriptType
::
LATIN
);
// The one from "Tools/Options - Language Settings - Languages: User interface"
aLangList
[
1
]
=
rSettings
.
GetUILanguageTag
().
getLanguageType
();
// The one from "Tools/Options - Language Settings - Languages: Locale setting"
aLangList
[
2
]
=
rSettings
.
GetLanguageTag
().
getLanguageType
();
// en-US
aLangList
[
3
]
=
LANGUAGE_ENGLISH_US
;
#if OSL_DEBUG_LEVEL > 1
lang
::
Locale
a0
(
LanguageTag
(
aLangList
[
0
]
).
getLocale
()
);
lang
::
Locale
a1
(
LanguageTag
(
aLangList
[
1
]
).
getLocale
()
);
lang
::
Locale
a2
(
LanguageTag
(
aLangList
[
2
]
).
getLocale
()
);
lang
::
Locale
a3
(
LanguageTag
(
aLangList
[
3
]
).
getLocale
()
);
#endif
sal_Int32
nCount
=
SAL_N_ELEMENTS
(
aLangList
);
for
(
sal_Int32
i
=
0
;
i
<
nCount
;
i
++
)
{
sal_Int16
nTmpLang
=
aLangList
[
i
];
if
(
nTmpLang
!=
LANGUAGE_NONE
&&
nTmpLang
!=
LANGUAGE_DONTKNOW
)
{
if
(
xSpell
->
hasLanguage
(
nTmpLang
)
&&
xSpell
->
isValid
(
rText
,
nTmpLang
,
uno
::
Sequence
<
beans
::
PropertyValue
>
()
))
{
nLang
=
nTmpLang
;
break
;
}
}
}
}
return
nLang
;
}
/// @returns : the language for the selected text that is set for the
/// specified attribute (script type).
/// If there are more than one languages used LANGUAGE_DONTKNOW will be returned.
...
...
@@ -443,8 +360,8 @@ SwSpellPopup::SwSpellPopup(
nGuessLangPara
=
LANGUAGE_NONE
;
if
(
xSpellAlt
.
is
()
&&
xLG
.
is
())
{
nGuessLangWord
=
lcl_
CheckLanguage
(
xSpellAlt
->
getWord
(),
::
GetSpellChecker
(),
xLG
,
false
);
nGuessLangPara
=
lcl_
CheckLanguage
(
rParaText
,
::
GetSpellChecker
(),
xLG
,
true
);
nGuessLangWord
=
EditView
::
CheckLanguage
(
xSpellAlt
->
getWord
(),
::
GetSpellChecker
(),
xLG
,
false
);
nGuessLangPara
=
EditView
::
CheckLanguage
(
rParaText
,
::
GetSpellChecker
(),
xLG
,
true
);
}
if
(
nGuessLangWord
!=
LANGUAGE_NONE
||
nGuessLangPara
!=
LANGUAGE_NONE
)
{
...
...
@@ -652,7 +569,7 @@ aInfo16( SW_RES(IMG_INFO_16) )
nGuessLangPara
=
LANGUAGE_NONE
;
if
(
xLG
.
is
())
{
nGuessLangPara
=
lcl_
CheckLanguage
(
rParaText
,
::
GetSpellChecker
(),
xLG
,
true
);
nGuessLangPara
=
EditView
::
CheckLanguage
(
rParaText
,
::
GetSpellChecker
(),
xLG
,
true
);
}
if
(
nGuessLangWord
!=
LANGUAGE_NONE
||
nGuessLangPara
!=
LANGUAGE_NONE
)
{
...
...
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