Kaydet (Commit) e9e61324 authored tarafından Thomas Lange's avatar Thomas Lange

#90650# new error message if language is not available for spellchecking or hyphenation

üst 1a79572c
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: svxerr.hxx,v $ * $RCSfile: svxerr.hxx,v $
* *
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: hr $ $Date: 2000-09-18 17:01:01 $ * last change: $Author: tl $ $Date: 2001-08-23 14:45:58 $
* *
* 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
...@@ -71,8 +71,9 @@ ...@@ -71,8 +71,9 @@
#define ERRCODE_SVX_LINGU_THESAURUSNOTEXISTS (1UL | ERRCODE_AREA_SVX | \ #define ERRCODE_SVX_LINGU_THESAURUSNOTEXISTS (1UL | ERRCODE_AREA_SVX | \
ERRCODE_CLASS_NOTEXISTS) ERRCODE_CLASS_NOTEXISTS)
#define ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS (2UL | ERRCODE_AREA_SVX | \
ERRCODE_CLASS_NOTEXISTS) #define ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS (2UL | ERRCODE_AREA_SVX)
#define ERRCODE_SVX_LINGU_LINGUNOTEXISTS (3UL | ERRCODE_AREA_SVX | \ #define ERRCODE_SVX_LINGU_LINGUNOTEXISTS (3UL | ERRCODE_AREA_SVX | \
ERRCODE_CLASS_NOTEXISTS ) ERRCODE_CLASS_NOTEXISTS )
#define ERRCODE_SVX_LINGU_HYPHENNOTEXISTS (4UL | ERRCODE_AREA_SVX | \ #define ERRCODE_SVX_LINGU_HYPHENNOTEXISTS (4UL | ERRCODE_AREA_SVX | \
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: splwrap.cxx,v $ * $RCSfile: splwrap.cxx,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* last change: $Author: tl $ $Date: 2000-11-19 11:27:16 $ * last change: $Author: tl $ $Date: 2001-08-23 14:49:56 $
* *
* 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
...@@ -132,6 +132,82 @@ using namespace ::com::sun::star; ...@@ -132,6 +132,82 @@ 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;
// -----------------------------------------------------------------------
#define SVX_LANG_NEED_CHECK 0
#define SVX_LANG_OK 1
#define SVX_LANG_MISSING 2
#define SVX_LANG_MISSING_DO_WARN 3
#define SVX_FLAGS_NEW
class LangCheckState
{
SvUShortsSort aLang;
SvUShorts aState; // lowerbyte spell values,
// higherbyte hyph values
public:
LangCheckState();
USHORT GetCount() { return aLang.Count(); }
inline USHORT GetLanguagePos( USHORT nLang );
inline USHORT GetLanguage( USHORT nPos );
inline USHORT GetState( USHORT nPos );
inline void SetState( USHORT nPos, USHORT nState );
inline USHORT InsertLangState( USHORT nLang, USHORT nState );
};
LangCheckState::LangCheckState() :
aLang (16, 16),
aState (16, 16)
{
}
inline USHORT LangCheckState::GetLanguagePos( USHORT nLang )
{
USHORT nPos;
BOOL bFound = aLang.Seek_Entry( nLang, &nPos );
return bFound ? nPos : 0xFFFF;
}
inline USHORT LangCheckState::GetLanguage( USHORT nPos )
{
DBG_ASSERT( nPos < aLang.Count(), "index out of range" );
return aLang.GetObject( nPos );
}
inline USHORT LangCheckState::GetState( USHORT nPos )
{
DBG_ASSERT( nPos < aState.Count(), "index out of range" );
return aState.GetObject( nPos );
}
inline void LangCheckState::SetState( USHORT nPos, USHORT nState )
{
DBG_ASSERT( nPos < aState.Count(), "index out of range" );
aState.Replace( nState , nPos );
}
inline USHORT LangCheckState::InsertLangState( USHORT nLang, USHORT nState )
{
DBG_ASSERT( aLang.Count() == aState.Count(), "array length mismatch" );
USHORT nPos = aLang.Count();
aLang .Insert( nLang, nPos );
aState.Insert( nState , nPos );
return nPos;
}
static LangCheckState & GetLangCheckState()
{
static LangCheckState aState;
return aState;
}
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
* Beschreibung: Ctor, die Pruefreihenfolge wird festgelegt * Beschreibung: Ctor, die Pruefreihenfolge wird festgelegt
* *
...@@ -188,31 +264,16 @@ SvxSpellWrapper::SvxSpellWrapper( Window* pWn, ...@@ -188,31 +264,16 @@ SvxSpellWrapper::SvxSpellWrapper( Window* pWn,
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
#define SVX_LANG_NEED_CHECK 0
#define SVX_LANG_OK 1
#define SVX_LANG_MISSING 2
#define SVX_LANG_MISSING_DO_WARN 3
#define SVX_FLAGS_NEW
static SvUShortsSort _aLanguages(16, 16);
static SvUShorts _aState(16, 16); // lowerbyte spell values,
// higherbyte hyph values
sal_Int16 SvxSpellWrapper::CheckSpellLang( sal_Int16 SvxSpellWrapper::CheckSpellLang(
Reference< XSpellChecker1 > xSpell, sal_Int16 nLang) Reference< XSpellChecker1 > xSpell, sal_Int16 nLang)
{ {
DBG_ASSERT( _aLanguages.Count() == _aState.Count(), "inconsistent arrays"); LangCheckState &rLCS = GetLangCheckState();
sal_uInt16 nPos; USHORT nPos = rLCS.GetLanguagePos( nLang );
sal_Bool bFound = _aLanguages.Seek_Entry( nLang, &nPos ); sal_uInt16 nVal = 0xFFFF != nPos ? rLCS.GetState( nPos ) : 0;
sal_uInt16 nVal = bFound ? _aState.GetObject( nPos ) : 0;
if (!bFound) if (0xFFFF == nPos)
{ nPos = rLCS.InsertLangState( (sal_uInt16) nLang, nVal );
_aLanguages.Insert( (sal_uInt16) nLang, nPos );
_aState.Insert( nVal , nPos );
}
if (SVX_LANG_NEED_CHECK == (nVal & 0x00FF)) if (SVX_LANG_NEED_CHECK == (nVal & 0x00FF))
{ {
...@@ -222,26 +283,22 @@ sal_Int16 SvxSpellWrapper::CheckSpellLang( ...@@ -222,26 +283,22 @@ sal_Int16 SvxSpellWrapper::CheckSpellLang(
nVal &= 0xFF00; nVal &= 0xFF00;
nVal |= nTmpVal; nVal |= nTmpVal;
_aState.Replace( nVal , nPos ); rLCS.SetState( nPos, nVal );
} }
return (sal_Int16) _aState.GetObject( nPos ); return (sal_Int16) nVal;
} }
sal_Int16 SvxSpellWrapper::CheckHyphLang( sal_Int16 SvxSpellWrapper::CheckHyphLang(
Reference< XHyphenator > xHyph, sal_Int16 nLang) Reference< XHyphenator > xHyph, sal_Int16 nLang)
{ {
DBG_ASSERT( _aLanguages.Count() == _aState.Count(), "inconsistent arrays"); LangCheckState &rLCS = GetLangCheckState();
sal_uInt16 nPos; USHORT nPos = rLCS.GetLanguagePos( nLang );
sal_Bool bFound = _aLanguages.Seek_Entry( nLang, &nPos ); sal_uInt16 nVal = 0xFFFF != nPos ? rLCS.GetState( nPos ) : 0;
sal_uInt16 nVal = bFound ? _aState.GetObject( nPos ) : 0;
if (!bFound) if (0xFFFF == nPos)
{ nPos = rLCS.InsertLangState( (sal_uInt16) nLang, nVal );
_aLanguages.Insert( (sal_uInt16) nLang, nPos );
_aState.Insert( nVal , nPos );
}
if (SVX_LANG_NEED_CHECK == ((nVal >> 8) & 0x00FF)) if (SVX_LANG_NEED_CHECK == ((nVal >> 8) & 0x00FF))
{ {
...@@ -251,10 +308,10 @@ sal_Int16 SvxSpellWrapper::CheckHyphLang( ...@@ -251,10 +308,10 @@ sal_Int16 SvxSpellWrapper::CheckHyphLang(
nVal &= 0x00FF; nVal &= 0x00FF;
nVal |= nTmpVal << 8; nVal |= nTmpVal << 8;
_aState.Replace( nVal , nPos ); rLCS.SetState( nPos, nVal );
} }
return (sal_Int16) _aState.GetObject( nPos ); return (sal_Int16) nVal;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -285,33 +342,6 @@ sal_Bool SvxSpellWrapper::SpellMore() ...@@ -285,33 +342,6 @@ sal_Bool SvxSpellWrapper::SpellMore()
void SvxSpellWrapper::SpellEnd() void SvxSpellWrapper::SpellEnd()
{ // Bereich ist abgeschlossen, ggf. Aufraeumen { // Bereich ist abgeschlossen, ggf. Aufraeumen
DBG_ASSERT( _aLanguages.Count() == _aState.Count(), "inconsistent arrays");
sal_uInt16 nCount = _aLanguages.Count();
for (sal_uInt16 i = 0; i < nCount; ++i)
{
sal_Int16 nLang = (sal_Int16) _aLanguages.GetObject( i );
sal_uInt16 nVal = _aState.GetObject( i );
sal_uInt16 nTmpSpell = nVal & 0x00FF;
sal_uInt16 nTmpHyph = (nVal >> 8) & 0x00FF;
if (SVX_LANG_MISSING_DO_WARN == nTmpSpell)
{
String aErr( ::GetLanguageString( nLang ) );
ErrorHandler::HandleError(
*new StringErrorInfo( ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aErr ) );
nTmpSpell = SVX_LANG_MISSING;
}
if (SVX_LANG_MISSING_DO_WARN == nTmpHyph)
{
String aErr( ::GetLanguageString( nLang ) );
ErrorHandler::HandleError(
*new StringErrorInfo( ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aErr ) );
nTmpHyph = SVX_LANG_MISSING;
}
_aState.Replace( (nTmpHyph << 8) | nTmpSpell, i );
}
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -624,6 +654,36 @@ Reference< XDictionary1 > SvxSpellWrapper::GetAllRightDic() const ...@@ -624,6 +654,36 @@ Reference< XDictionary1 > SvxSpellWrapper::GetAllRightDic() const
sal_Bool SvxSpellWrapper::FindSpellError() sal_Bool SvxSpellWrapper::FindSpellError()
{ {
// display message boxes for languages not available for
// spellchecking or hyphenation
LangCheckState &rLCS = GetLangCheckState();
sal_uInt16 nCount = rLCS.GetCount();
for (sal_uInt16 i = 0; i < nCount; ++i)
{
sal_Int16 nLang = (sal_Int16) rLCS.GetLanguage( i );
sal_uInt16 nVal = rLCS.GetState( i );
sal_uInt16 nTmpSpell = nVal & 0x00FF;
sal_uInt16 nTmpHyph = (nVal >> 8) & 0x00FF;
if (SVX_LANG_MISSING_DO_WARN == nTmpSpell)
{
String aErr( ::GetLanguageString( nLang ) );
ErrorHandler::HandleError(
*new StringErrorInfo( ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aErr ) );
nTmpSpell = SVX_LANG_MISSING;
}
if (SVX_LANG_MISSING_DO_WARN == nTmpHyph)
{
String aErr( ::GetLanguageString( nLang ) );
ErrorHandler::HandleError(
*new StringErrorInfo( ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aErr ) );
nTmpHyph = SVX_LANG_MISSING;
}
rLCS.SetState( i, (nTmpHyph << 8) | nTmpSpell );
}
Reference< XInterface > xRef; Reference< XInterface > xRef;
WAIT_ON(); WAIT_ON();
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: svxerr.src,v $ * $RCSfile: svxerr.src,v $
* *
* $Revision: 1.25 $ * $Revision: 1.26 $
* *
* last change: $Author: obo $ $Date: 2001-07-24 20:20:06 $ * last change: $Author: tl $ $Date: 2001-08-23 14:48:37 $
* *
* 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
...@@ -279,33 +279,8 @@ Resource RID_SVXERRCODE ...@@ -279,33 +279,8 @@ Resource RID_SVXERRCODE
}; };
String ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS&ERRCODE_RES_MASK String ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS&ERRCODE_RES_MASK
{ {
/* ### ACHTUNG: Neuer Text in Resource? $(ARG1) ist fr die Prfung nicht verfgbar.\nberprfen Sie bitte Ihre Installation und installieren Sie gegebenenfalls die gewnschte Sprache. : $(ARG1) ist fr die Prfung nicht verfgbar.\nberprfen Sie bitte Ihre Installation und installieren Sie gegebenenfalls die gewnschte Sprache. */ TEXT = "$(ARG1) wird von der Prfung nicht untersttzt bzw. ist gegenwrtig nicht aktiviert.\nberprfen Sie Ihre Installation und installieren Sie gegebenenfalls das bentigte Sprachmodul\nbzw. aktivieren sie in 'Extras - Optionen - Spracheinstellungen - Linguistik' das entsprechende Spachmodul." ;
/* ### ACHTUNG: Neuer Text in Resource? $(ARG1) ist fr die Prfung nicht verfgbar.\nberprfen Sie bitte Ihre Installation und installieren Sie gegebenenfalls die gewnschte Sprache. : $(ARG1) ist fr die Prfung nicht verfgbar.\nberprfen Sie bitte Ihre Installation und installieren Sie gegebenenfalls die gewnschte Sprache. */ TEXT [ English ] = "$(ARG1) is not available or is currently not active.\nPlease check your installation and install the desired language\nor activate in 'Tools - Options - Language Settings - Writing Aids' the desired module." ;
TEXT = "$(ARG1) ist fr die Prfung nicht verfgbar.\nberprfen Sie bitte Ihre Installation und installieren Sie gegebenenfalls die gewnschte Sprache." ;
TEXT [ English ] = "$(ARG1) is not available for spellchecking.\nPlease check your installation and install the desired language." ;
Text [ english_us ] = "$(ARG1) is not available for spellchecking.\nPlease check your installation and install the desired language." ;
Text [ italian ] = "$(ARG1) non disponibile per il controllo.\nControllare l'installazione ed installare se necessario la lingua desiderata." ;
Text [ spanish ] = "$(ARG1) no disponible para la revisin ortogrfica.\n Examine por favor su instalacin e instale en caso dado el idioma deseado." ;
Text [ french ] = "$(ARG1) n'est pas disponible pour vrification. \nVeuillez vrifier l'installation et installer le cas chant la langue souhaite." ;
Text [ dutch ] = "$(ARG1) voor de controle is niet beschikbaar.\nControleer uw installatie en installeer de gewenste taal" ;
Text [ swedish ] = "$(ARG1) r inte tillgnglig fr stavningskontrollen.\nKontrollera installationen och installera eventuellt det nskade sprket." ;
Text [ danish ] = "$(ARG1) str ikke til rdighed for kontrollen.\nKontroller venligst din installation og installer i givet fald det nskede sprog." ;
Text [ portuguese ] = "$(ARG1) no est disponvel para a verificao ortogrfica. \nConfira a sua instalao e, se necessrio, instale a lngua desejada." ;
Text [ portuguese_brazilian ] = "$(ARG1) ist f? die Pr?ung nicht verf?bar.\n?berpr?en Sie bitte Ihre Installation und installieren Sie gegebenenfalls die gew?schte Sprache." ;
Text[ chinese_simplified ] = "$(ARG1)ڡ\n鰲װбҪ밲װ԰汾";
Text[ russian ] = "$(ARG1) .\n, . , , .";
Text[ polish ] = "$(ARG1) jest dla sprawdzania pisowni niedostpny.\nProsz sprawdzi instalacj i zainstalowa potrzebny jzyk.";
Text[ japanese ] = "$(ARG1)ͽɎgpł܂B\ngp۸т̲ݽİقāAꍇɂẮA]̌ݽ-قĂB";
Text[ chinese_traditional ] = "$(ARG1)sbC\nбzˬdwˡMYnбzw˩һݪyC";
Text[ arabic ] = "$(ARG1) .\n ߡ ɡ .";
Text[ dutch ] = "$(ARG1) voor de controle is niet beschikbaar.\nControleer uw installatie en installeer de gewenste taal";
Text[ chinese_simplified ] = "$(ARG1)ڡ\n鰲װбҪ밲װ԰汾";
Text[ greek ] = "$(ARG1) .\n ? ";
Text[ korean ] = "$(ARG1)() ˻翡 ̿ ϴ.\n ġ , ʿ 䱸Ǵ  ġϽʽÿ.";
Text[ turkish ] = "$(ARG1) yazm denetiminde kullanlamyor.\nLtfen kurulumu kontrol edin ve gerekirse istenilen dili kurun.";
Text[ language_user1 ] = " ";
Text[ catalan ] = "$(ARG1) no disponible para la revisin ortogrfica.\n Examine por favor su instalacin e instale en caso dado el idioma deseado.";
Text[ finnish ] = "$(ARG1) ei ole kytettviss oikeinkirjoituksen tarkistusta varten.\nTarkista asennetut osat ja asenna haluttu kieli.\n";
}; };
String ERRCODE_SVX_LINGU_LINGUNOTEXISTS&ERRCODE_RES_MASK String ERRCODE_SVX_LINGU_LINGUNOTEXISTS&ERRCODE_RES_MASK
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment