summaryrefslogtreecommitdiffstats
path: root/svx/source/dialog/langbox.cxx
diff options
context:
space:
mode:
authorThomas Lange <tl@openoffice.org>2001-06-21 08:51:30 +0000
committerThomas Lange <tl@openoffice.org>2001-06-21 08:51:30 +0000
commit4e1aa67ac1a9b24c34bc7ff34f4d6700d0847b8e (patch)
treef06abce2f6abc0926bac53827161b70999040de7 /svx/source/dialog/langbox.cxx
parent#88327# (diff)
downloadcore-4e1aa67ac1a9b24c34bc7ff34f4d6700d0847b8e.tar.gz
core-4e1aa67ac1a9b24c34bc7ff34f4d6700d0847b8e.zip
#88183# additional InsertLanguage member function to specify if an entry should be checked or not
Diffstat (limited to 'svx/source/dialog/langbox.cxx')
-rw-r--r--svx/source/dialog/langbox.cxx86
1 files changed, 71 insertions, 15 deletions
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index 3ae7c18ca77d..b3ea45e59213 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: langbox.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: tl $ $Date: 2001-06-13 12:31:52 $
+ * last change: $Author: tl $ $Date: 2001-06-21 09:51:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -196,6 +196,9 @@ USHORT TypeToPos_Impl( LanguageType eType, const ListBox& rLb )
//-----------------------------------------------------------------------
SvxLanguageBox::SvxLanguageBox( Window* pParent, WinBits nWinStyle, BOOL bCheck ) :
ListBox( pParent, nWinStyle ),
+#if SUPD >= 637
+ m_pSpellUsedLang( NULL ),
+#endif
m_bWithCheckmark( bCheck )
{
Init();
@@ -203,6 +206,9 @@ SvxLanguageBox::SvxLanguageBox( Window* pParent, WinBits nWinStyle, BOOL bCheck
//------------------------------------------------------------------------
SvxLanguageBox::SvxLanguageBox( Window* pParent, const ResId& rResId, BOOL bCheck ) :
ListBox( pParent, rResId ),
+#if SUPD >= 637
+ m_pSpellUsedLang( NULL ),
+#endif
m_bWithCheckmark( bCheck )
{
Init();
@@ -247,6 +253,9 @@ void SvxLanguageBox::Init()
SvxLanguageBox::~SvxLanguageBox()
{
+#if SUPD >= 637
+ delete m_pSpellUsedLang;
+#endif
delete m_pLangTable;
}
@@ -267,6 +276,9 @@ void SvxLanguageBox::SetLanguageList( INT16 nLangList,
Sequence< INT16 > aSpellAvailLang;
Sequence< INT16 > aHyphAvailLang;
Sequence< INT16 > aThesAvailLang;
+ Sequence< INT16 > aSpellUsedLang;
+ Sequence< INT16 > aHyphUsedLang;
+ Sequence< INT16 > aThesUsedLang;
Reference< XAvailableLocales > xAvail( LinguMgr::GetLngSvcMgr(), UNO_QUERY );
if (xAvail.is())
{
@@ -288,6 +300,24 @@ void SvxLanguageBox::SetLanguageList( INT16 nLangList,
aThesAvailLang = lcl_LocaleSeqToLangSeq( aTmp );
}
}
+ if (LANG_LIST_SPELL_USED & nLangList)
+ {
+ Reference< XSpellChecker1 > xTmp1( SvxGetSpellChecker(), UNO_QUERY );
+ if (xTmp1.is())
+ aSpellUsedLang = xTmp1->getLanguages();
+ }
+ if (LANG_LIST_HYPH_USED & nLangList)
+ {
+ Reference< XHyphenator > xTmp( SvxGetHyphenator() );
+ if (xTmp.is())
+ aHyphUsedLang = lcl_LocaleSeqToLangSeq( xTmp->getLocales() );
+ }
+ if (LANG_LIST_THES_USED & nLangList)
+ {
+ Reference< XThesaurus > xTmp( SvxGetThesaurus() );
+ if (xTmp.is())
+ aThesUsedLang = lcl_LocaleSeqToLangSeq( xTmp->getLocales() );
+ }
SvxLanguageTable aLangTable;
::com::sun::star::uno::Sequence< sal_uInt16 > xKnown;
@@ -334,6 +364,12 @@ void SvxLanguageBox::SetLanguageList( INT16 nLangList,
bInsert |= lcl_SeqHasLang( aHyphAvailLang, nLangType );
if (!bInsert && (nLangList & LANG_LIST_THES_AVAIL))
bInsert |= lcl_SeqHasLang( aThesAvailLang, nLangType );
+ if (!bInsert && (nLangList & LANG_LIST_SPELL_USED))
+ bInsert |= lcl_SeqHasLang( aSpellUsedLang, nLangType );
+ if (!bInsert && (nLangList & LANG_LIST_HYPH_USED))
+ bInsert |= lcl_SeqHasLang( aHyphUsedLang, nLangType );
+ if (!bInsert && (nLangList & LANG_LIST_THES_USED))
+ bInsert |= lcl_SeqHasLang( aThesUsedLang, nLangType );
}
if (bInsert)
@@ -357,21 +393,22 @@ USHORT SvxLanguageBox::InsertLanguage( const LanguageType nLangType, USHORT nPos
if ( m_bWithCheckmark )
{
sal_Bool bFound = sal_False;
- Reference< XSpellChecker1 > xSpell( SvxGetSpellChecker(), UNO_QUERY );
- if (xSpell.is())
+
+#if SUPD >= 637
+ if (!m_pSpellUsedLang)
{
- Sequence< INT16 > aLang( xSpell->getLanguages() );
- const USHORT nLanguageCount = aLang.getLength();
- const Language* pLangList = aLang.getConstArray();
- for ( USHORT i = 0; i < nLanguageCount; ++i )
- {
- if ( nLangType == pLangList[i] )
- {
- bFound = sal_True;
- break;
- }
- }
+ Reference< XSpellChecker1 > xSpell( SvxGetSpellChecker(), UNO_QUERY );
+ if ( xSpell.is() )
+ m_pSpellUsedLang = new Sequence< INT16 >( xSpell->getLanguages() );
}
+ bFound = m_pSpellUsedLang ?
+ lcl_SeqHasLang( *m_pSpellUsedLang, nLangType ) : FALSE;
+#else
+ Reference< XSpellChecker1 > xSpell( SvxGetSpellChecker(), UNO_QUERY );
+ if ( xSpell.is() )
+ bFound = lcl_SeqHasLang( xSpell->getLanguages(), nLangType );
+#endif
+
if ( !bFound )
nAt = InsertEntry( aStrEntry, m_aNotCheckedImage, nPos );
else
@@ -386,6 +423,25 @@ USHORT SvxLanguageBox::InsertLanguage( const LanguageType nLangType, USHORT nPos
//------------------------------------------------------------------------
+USHORT SvxLanguageBox::InsertLanguage( const LanguageType nLangType,
+ BOOL bCheckEntry, USHORT nPos )
+{
+ String aStrEntry = m_pLangTable->GetString( nLangType );
+ if (LANGUAGE_NONE == nLangType && m_bHasLangNone && m_bLangNoneIsLangAll)
+ aStrEntry = m_aAllString;
+
+ USHORT nAt = 0;
+ if ( !bCheckEntry )
+ nAt = InsertEntry( aStrEntry, m_aNotCheckedImage, nPos );
+ else
+ nAt = InsertEntry( aStrEntry, m_aCheckedImage, nPos );
+ SetEntryData( nAt, (void*)(ULONG)nLangType );
+
+ return nPos;
+}
+
+//------------------------------------------------------------------------
+
void SvxLanguageBox::RemoveLanguage( const LanguageType eLangType )
{
USHORT nAt = TypeToPos_Impl( eLangType, *this );