INTEGRATION: CWS contextmenu (1.35.270); FILE MERGED
2005/04/13 14:06:45 tl 1.35.270.2: #i32169# behaviour for proposed languages in spellcheck context menu changed 2005/04/13 14:00:14 tl 1.35.270.1: #i32169# behaviour for proposed languages in spellcheck context menu changed
This commit is contained in:
parent
f0a127c2a1
commit
916eb94a90
1 changed files with 45 additions and 31 deletions
|
@ -2,9 +2,9 @@
|
||||||
*
|
*
|
||||||
* $RCSfile: editview.cxx,v $
|
* $RCSfile: editview.cxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.35 $
|
* $Revision: 1.36 $
|
||||||
*
|
*
|
||||||
* last change: $Author: rt $ $Date: 2005-01-11 12:58:26 $
|
* last change: $Author: obo $ $Date: 2005-04-27 11:32:09 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
|
@ -86,17 +86,33 @@
|
||||||
#ifndef _UNO_LINGU_HXX
|
#ifndef _UNO_LINGU_HXX
|
||||||
#include <unolingu.hxx>
|
#include <unolingu.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _COM_SUN_STAR_LINGUISTIC2_XDICTIONARY1_HPP_
|
#ifndef _COM_SUN_STAR_LINGUISTIC2_XDICTIONARY1_HPP_
|
||||||
#include <com/sun/star/linguistic2/XDictionary1.hpp>
|
#include <com/sun/star/linguistic2/XDictionary1.hpp>
|
||||||
#endif
|
#endif
|
||||||
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUES_HDL_
|
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUES_HDL_
|
||||||
#include <com/sun/star/beans/PropertyValues.hdl>
|
#include <com/sun/star/beans/PropertyValues.hdl>
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
|
||||||
|
#include <com/sun/star/lang/Locale.hpp>
|
||||||
|
#endif
|
||||||
#ifndef _LINGUISTIC_LNGPROPS_HHX_
|
#ifndef _LINGUISTIC_LNGPROPS_HHX_
|
||||||
#include <linguistic/lngprops.hxx>
|
#include <linguistic/lngprops.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _SV_SVAPP_HXX
|
||||||
|
#include <vcl/svapp.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _SV_SETTINGS_HXX
|
||||||
|
#include <vcl/settings.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _SVTOOLS_LINGUCFG_HXX_
|
||||||
|
#include <svtools/lingucfg.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
using namespace rtl;
|
using namespace rtl;
|
||||||
|
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;
|
using namespace com::sun::star::linguistic2;
|
||||||
|
@ -107,46 +123,44 @@ DBG_NAME( EditView );
|
||||||
// From SW => Create common method
|
// From SW => Create common method
|
||||||
LanguageType lcl_CheckLanguage( const OUString &rWord, Reference< XSpellChecker1 > xSpell )
|
LanguageType lcl_CheckLanguage( const OUString &rWord, Reference< XSpellChecker1 > xSpell )
|
||||||
{
|
{
|
||||||
LanguageType nLang = LANGUAGE_NONE;
|
//
|
||||||
|
// 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] = aLinguOpt.nDefaultLanguage;
|
||||||
|
// The one from "Tools/Options - Language Settings - Languages: User interface"
|
||||||
|
aLangList[1] = rSettings.GetUILanguage();
|
||||||
|
// The one from "Tools/Options - Language Settings - Languages: Locale setting"
|
||||||
|
aLangList[2] = rSettings.GetLanguage();
|
||||||
|
// en-US
|
||||||
|
aLangList[3] = LANGUAGE_ENGLISH_US;
|
||||||
|
#ifdef DEBUG
|
||||||
|
lang::Locale a1( SvxCreateLocale( aLangList[0] ) );
|
||||||
|
lang::Locale a2( SvxCreateLocale( aLangList[1] ) );
|
||||||
|
lang::Locale a3( SvxCreateLocale( aLangList[2] ) );
|
||||||
|
lang::Locale a4( SvxCreateLocale( aLangList[3] ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
Reference< XSpellAlternatives > xAlt;
|
util::Language nLang = LANGUAGE_NONE;
|
||||||
Sequence< short > aLangs;
|
|
||||||
if (xSpell.is())
|
|
||||||
aLangs = xSpell->getLanguages();
|
|
||||||
const short *pLang = aLangs.getConstArray();
|
|
||||||
INT32 nCount = aLangs.getLength();
|
|
||||||
|
|
||||||
//! due to dieckmann (new german) spellchecker excepting many english
|
INT32 nCount = sizeof(aLangList) / sizeof(aLangList[0]);
|
||||||
//! (and other?) words as correct
|
|
||||||
//! GERMAN and GERMAN_SWISS should be checked last.
|
|
||||||
//! Otherwise e.g. english words might be reported as being german words!
|
|
||||||
for (INT32 i = 0; i < nCount; i++)
|
for (INT32 i = 0; i < nCount; i++)
|
||||||
{
|
{
|
||||||
INT16 nTmpLang = pLang[i];
|
INT16 nTmpLang = aLangList[i];
|
||||||
if (nTmpLang != LANGUAGE_NONE &&
|
if (nTmpLang != LANGUAGE_NONE && nTmpLang != LANGUAGE_DONTKNOW)
|
||||||
nTmpLang != LANGUAGE_GERMAN &&
|
|
||||||
nTmpLang != LANGUAGE_GERMAN_SWISS)
|
|
||||||
{
|
{
|
||||||
if (xSpell->isValid( rWord, nTmpLang, Sequence< PropertyValue >() ) &&
|
if (xSpell->hasLanguage( nTmpLang ) &&
|
||||||
xSpell->hasLanguage( nTmpLang ))
|
xSpell->isValid( rWord, nTmpLang, Sequence< PropertyValue >() ))
|
||||||
{
|
{
|
||||||
nLang = nTmpLang;
|
nLang = nTmpLang;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nLang == LANGUAGE_NONE &&
|
|
||||||
xSpell->isValid( rWord, LANGUAGE_GERMAN, Sequence< PropertyValue >() ) &&
|
|
||||||
xSpell->hasLanguage( LANGUAGE_GERMAN ))
|
|
||||||
{
|
|
||||||
nLang = LANGUAGE_GERMAN;
|
|
||||||
}
|
|
||||||
if (nLang == LANGUAGE_NONE &&
|
|
||||||
xSpell->isValid( rWord, LANGUAGE_GERMAN_SWISS, Sequence< PropertyValue >() ) &&
|
|
||||||
xSpell->hasLanguage( LANGUAGE_GERMAN_SWISS ))
|
|
||||||
{
|
|
||||||
nLang = LANGUAGE_GERMAN_SWISS;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nLang;
|
return nLang;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue