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
f3e70f0f
Kaydet (Commit)
f3e70f0f
authored
Nis 12, 2013
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
make that a proper static method EditView::CheckLanguage()
Change-Id: I08c1af6813314b4881aafdd7f3f98a7629d5cf76
üst
cabde845
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
16 deletions
+40
-16
editview.hxx
editeng/inc/editeng/editview.hxx
+26
-1
editview.cxx
editeng/source/editeng/editview.cxx
+14
-15
No files found.
editeng/inc/editeng/editview.hxx
Dosyayı görüntüle @
f3e70f0f
...
@@ -60,7 +60,12 @@ namespace sun {
...
@@ -60,7 +60,12 @@ namespace sun {
namespace
star
{
namespace
star
{
namespace
datatransfer
{
namespace
datatransfer
{
class
XTransferable
;
class
XTransferable
;
}}}}
}
namespace
linguistic2
{
class
XSpellChecker1
;
class
XLanguageGuessing
;
}
}}}
class
EDITENG_DLLPUBLIC
EditView
class
EDITENG_DLLPUBLIC
EditView
{
{
...
@@ -215,6 +220,26 @@ public:
...
@@ -215,6 +220,26 @@ public:
String
GetSurroundingText
()
const
;
String
GetSurroundingText
()
const
;
Selection
GetSurroundingTextSelection
()
const
;
Selection
GetSurroundingTextSelection
()
const
;
/** Tries to determine the language of 'rText', returning a matching known
locale if possible, or a fallback, or LANGUAGE_NONE if nothing found or
matched.
@param bIsParaText
If TRUE, rText is a paragraph and the language is obtained by
passing the text to xLangGuess.
IF FALSE, a language match is tried for, in order,
1. the default document language (non-CTL, non-CJK, aka LATIN)
2. the UI language (Tools->Options->LanguageSettings->Languages User Interface)
3. the locale (Tools->Options->LanguageSettings->Languages Locale)
4. en-US
If nothing matched, LANGUAGE_NONE is returned.
*/
static
LanguageType
CheckLanguage
(
const
OUString
&
rText
,
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
linguistic2
::
XSpellChecker1
>
xSpell
,
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
linguistic2
::
XLanguageGuessing
>
xLangGuess
,
bool
bIsParaText
);
};
};
#endif // _MyEDITVIEW_HXX
#endif // _MyEDITVIEW_HXX
...
...
editeng/source/editeng/editview.cxx
Dosyayı görüntüle @
f3e70f0f
...
@@ -68,18 +68,17 @@
...
@@ -68,18 +68,17 @@
using
namespace
com
::
sun
::
star
;
using
namespace
com
::
sun
::
star
;
using
namespace
com
::
sun
::
star
::
uno
;
using
namespace
com
::
sun
::
star
::
uno
;
using
namespace
com
::
sun
::
star
::
beans
;
using
namespace
com
::
sun
::
star
::
beans
;
using
namespace
com
::
sun
::
star
::
linguistic2
;
DBG_NAME
(
EditView
)
DBG_NAME
(
EditView
)
//
From SW => Create common method
//
static
static
LanguageType
lcl_
CheckLanguage
(
LanguageType
EditView
::
CheckLanguage
(
const
OUString
&
rText
,
const
OUString
&
rText
,
Reference
<
XSpellChecker1
>
xSpell
,
Reference
<
linguistic2
::
XSpellChecker1
>
xSpell
,
Reference
<
linguistic2
::
XLanguageGuessing
>
xLangGuess
,
Reference
<
linguistic2
::
XLanguageGuessing
>
xLangGuess
,
sal_B
ool
bIsParaText
)
b
ool
bIsParaText
)
{
{
LanguageType
nLang
=
LANGUAGE_NONE
;
LanguageType
nLang
=
LANGUAGE_NONE
;
if
(
bIsParaText
)
// check longer texts with language-guessing...
if
(
bIsParaText
)
// check longer texts with language-guessing...
...
@@ -889,7 +888,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
...
@@ -889,7 +888,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
Point
aPos
(
pImpEditView
->
GetWindow
()
->
PixelToLogic
(
rPosPixel
)
);
Point
aPos
(
pImpEditView
->
GetWindow
()
->
PixelToLogic
(
rPosPixel
)
);
aPos
=
pImpEditView
->
GetDocPos
(
aPos
);
aPos
=
pImpEditView
->
GetDocPos
(
aPos
);
EditPaM
aPaM
=
pImpEditView
->
pEditEngine
->
GetPaM
(
aPos
,
false
);
EditPaM
aPaM
=
pImpEditView
->
pEditEngine
->
GetPaM
(
aPos
,
false
);
Reference
<
XSpellChecker1
>
xSpeller
(
PIMPEE
->
GetSpeller
()
);
Reference
<
linguistic2
::
XSpellChecker1
>
xSpeller
(
PIMPEE
->
GetSpeller
()
);
ESelection
aOldSel
=
GetSelection
();
ESelection
aOldSel
=
GetSelection
();
if
(
xSpeller
.
is
()
&&
pImpEditView
->
IsWrongSpelledWord
(
aPaM
,
sal_True
)
)
if
(
xSpeller
.
is
()
&&
pImpEditView
->
IsWrongSpelledWord
(
aPaM
,
sal_True
)
)
{
{
...
@@ -920,10 +919,10 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
...
@@ -920,10 +919,10 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
rVal
.
Value
<<=
(
sal_Int16
)
7
;
rVal
.
Value
<<=
(
sal_Int16
)
7
;
//
//
// Are there any replace suggestions?
// Are there any replace suggestions?
Reference
<
XSpellAlternatives
>
xSpellAlt
=
Reference
<
linguistic2
::
XSpellAlternatives
>
xSpellAlt
=
xSpeller
->
spell
(
aSelected
,
PIMPEE
->
GetLanguage
(
aPaM2
),
aPropVals
);
xSpeller
->
spell
(
aSelected
,
PIMPEE
->
GetLanguage
(
aPaM2
),
aPropVals
);
Reference
<
XLanguageGuessing
>
xLangGuesser
(
EE_DLL
().
GetGlobalData
()
->
GetLanguageGuesser
()
);
Reference
<
linguistic2
::
XLanguageGuessing
>
xLangGuesser
(
EE_DLL
().
GetGlobalData
()
->
GetLanguageGuesser
()
);
// check if text might belong to a different language...
// check if text might belong to a different language...
LanguageType
nGuessLangWord
=
LANGUAGE_NONE
;
LanguageType
nGuessLangWord
=
LANGUAGE_NONE
;
...
@@ -941,8 +940,8 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
...
@@ -941,8 +940,8 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
OSL_FAIL
(
"content node is NULL"
);
OSL_FAIL
(
"content node is NULL"
);
}
}
nGuessLangWord
=
lcl_CheckLanguage
(
xSpellAlt
->
getWord
(),
xSpeller
,
xLangGuesser
,
sal_F
alse
);
nGuessLangWord
=
CheckLanguage
(
xSpellAlt
->
getWord
(),
xSpeller
,
xLangGuesser
,
f
alse
);
nGuessLangPara
=
lcl_CheckLanguage
(
aParaText
,
xSpeller
,
xLangGuesser
,
sal_T
rue
);
nGuessLangPara
=
CheckLanguage
(
aParaText
,
xSpeller
,
xLangGuesser
,
t
rue
);
}
}
if
(
nGuessLangWord
!=
LANGUAGE_NONE
||
nGuessLangPara
!=
LANGUAGE_NONE
)
if
(
nGuessLangWord
!=
LANGUAGE_NONE
||
nGuessLangPara
!=
LANGUAGE_NONE
)
{
{
...
@@ -993,11 +992,11 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
...
@@ -993,11 +992,11 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
SvtLinguConfig
aCfg
;
SvtLinguConfig
aCfg
;
Reference
<
XSearchableDictionaryList
>
xDicList
(
SvxGetDictionaryList
()
);
Reference
<
linguistic2
::
XSearchableDictionaryList
>
xDicList
(
SvxGetDictionaryList
()
);
Sequence
<
Reference
<
XDictionary
>
>
aDics
;
Sequence
<
Reference
<
linguistic2
::
XDictionary
>
>
aDics
;
if
(
xDicList
.
is
())
if
(
xDicList
.
is
())
{
{
const
Reference
<
XDictionary
>
*
pDic
=
NULL
;
const
Reference
<
linguistic2
::
XDictionary
>
*
pDic
=
NULL
;
// add the default positive dictionary to dic-list (if not already done).
// add the default positive dictionary to dic-list (if not already done).
// This is to ensure that there is at least one dictionary to which
// This is to ensure that there is at least one dictionary to which
// words could be added.
// words could be added.
...
...
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