Kill use of macro LINGU_EXCEPTIONS

This macro is not defined, so we can kill all code that have the
"#ifdef LINGU_EXCEPTIONS". Just a cleanup, the rationale is the same.

Change-Id: Ib6f784859210d5a59210af51766ef4d7b8d7ead6
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/778
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Marcos Paulo de Souza
2012-10-05 23:42:12 -03:00
committed by Caolán McNamara
parent 55149144cb
commit ebf82e52c9
7 changed files with 6 additions and 101 deletions

View File

@@ -281,11 +281,7 @@ sal_Bool SAL_CALL
return sal_True; return sal_True;
if (!hasLocale( rLocale )) if (!hasLocale( rLocale ))
#ifdef LINGU_EXCEPTIONS
throw( IllegalArgumentException() );
#else
return sal_True; return sal_True;
#endif
// Get property values to be used. // Get property values to be used.
// These are be the default values set in the SN_LINGU_PROPERTIES // These are be the default values set in the SN_LINGU_PROPERTIES
@@ -395,11 +391,7 @@ Reference< XSpellAlternatives > SAL_CALL
return NULL; return NULL;
if (!hasLocale( rLocale )) if (!hasLocale( rLocale ))
#ifdef LINGU_EXCEPTIONS
throw( IllegalArgumentException() );
#else
return NULL; return NULL;
#endif
Reference< XSpellAlternatives > xAlt; Reference< XSpellAlternatives > xAlt;
if (!isValid( rWord, rLocale, rProperties )) if (!isValid( rWord, rLocale, rProperties ))

View File

@@ -359,11 +359,7 @@ sal_Bool SAL_CALL SpellChecker::isValid( const OUString& rWord, const Locale& rL
return sal_True; return sal_True;
if (!hasLocale( rLocale )) if (!hasLocale( rLocale ))
#ifdef LINGU_EXCEPTIONS
throw( IllegalArgumentException() );
#else
return sal_True; return sal_True;
#endif
// return sal_False to process SPELLML requests (they are longer than the header) // return sal_False to process SPELLML requests (they are longer than the header)
if (rWord.match(A2OU(SPELLML_HEADER), 0) && (rWord.getLength() > 10)) return sal_False; if (rWord.match(A2OU(SPELLML_HEADER), 0) && (rWord.getLength() > 10)) return sal_False;
@@ -480,11 +476,7 @@ Reference< XSpellAlternatives > SAL_CALL SpellChecker::spell(
return NULL; return NULL;
if (!hasLocale( rLocale )) if (!hasLocale( rLocale ))
#ifdef LINGU_EXCEPTIONS
throw( IllegalArgumentException() );
#else
return NULL; return NULL;
#endif
Reference< XSpellAlternatives > xAlt; Reference< XSpellAlternatives > xAlt;
if (!isValid( rWord, rLocale, rProperties )) if (!isValid( rWord, rLocale, rProperties ))

View File

@@ -333,10 +333,6 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL)
break; break;
if (0 != (nErr = pStream->GetError())) if (0 != (nErr = pStream->GetError()))
return nErr; return nErr;
#ifdef LINGU_EXCEPTIONS
if (nLen >= BUFSIZE)
throw io::IOException() ;
#endif
if (nLen < BUFSIZE) if (nLen < BUFSIZE)
{ {
@@ -1006,13 +1002,7 @@ void SAL_CALL DictionaryNeo::store()
if (bIsModified && hasLocation() && !isReadonly()) if (bIsModified && hasLocation() && !isReadonly())
{ {
if (saveEntries( aMainURL )) if (!saveEntries( aMainURL ))
{
#ifdef LINGU_EXCEPTIONS
throw io::IOException();
#endif
}
else
bIsModified = sal_False; bIsModified = sal_False;
} }
} }
@@ -1024,13 +1014,7 @@ void SAL_CALL DictionaryNeo::storeAsURL(
{ {
MutexGuard aGuard( GetLinguMutex() ); MutexGuard aGuard( GetLinguMutex() );
if (saveEntries( aURL )) if (!saveEntries( aURL ))
{
#ifdef LINGU_EXCEPTIONS
throw io::IOException();
#endif
}
else
{ {
aMainURL = aURL; aMainURL = aURL;
bIsModified = sal_False; bIsModified = sal_False;
@@ -1044,13 +1028,6 @@ void SAL_CALL DictionaryNeo::storeToURL(
throw(io::IOException, RuntimeException) throw(io::IOException, RuntimeException)
{ {
MutexGuard aGuard( GetLinguMutex() ); MutexGuard aGuard( GetLinguMutex() );
if (saveEntries( aURL ))
{
#ifdef LINGU_EXCEPTIONS
throw io::IOException();
#endif
}
} }

View File

@@ -264,11 +264,7 @@ Reference< XHyphenatedWord > SAL_CALL
bool bWordModified = false; bool bWordModified = false;
if (!pEntry || (nMaxLeading < 0 || nMaxLeading > nWordLen)) if (!pEntry || (nMaxLeading < 0 || nMaxLeading > nWordLen))
{ {
#ifdef LINGU_EXCEPTIONS
throw IllegalArgumentException();
#else
return NULL; return NULL;
#endif
} }
else else
{ {
@@ -405,11 +401,7 @@ Reference< XHyphenatedWord > SAL_CALL
bool bWordModified = false; bool bWordModified = false;
if (!pEntry || !(0 <= nIndex && nIndex <= nWordLen - 2)) if (!pEntry || !(0 <= nIndex && nIndex <= nWordLen - 2))
{ {
#ifdef LINGU_EXCEPTIONS
throw IllegalArgumentException();
#else
return NULL; return NULL;
#endif
} }
else else
{ {
@@ -537,13 +529,7 @@ Reference< XPossibleHyphens > SAL_CALL
HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) );
LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
if (!pEntry) if (pEntry)
{
#ifdef LINGU_EXCEPTIONS
throw IllegalArgumentException();
#endif
}
else
{ {
OUString aChkWord( rWord ); OUString aChkWord( rWord );

View File

@@ -250,12 +250,6 @@ void SAL_CALL LinguProps::setPropertyValue(
launchEvent( aChgEvt ); launchEvent( aChgEvt );
} }
} }
#ifdef LINGU_EXCEPTIONS
else
{
throw UnknownPropertyException();
}
#endif
} }
Any SAL_CALL LinguProps::getPropertyValue( const OUString& rPropertyName ) Any SAL_CALL LinguProps::getPropertyValue( const OUString& rPropertyName )
@@ -270,12 +264,6 @@ Any SAL_CALL LinguProps::getPropertyValue( const OUString& rPropertyName )
{ {
aRet = aConfig.GetProperty( pCur->nWID ); aRet = aConfig.GetProperty( pCur->nWID );
} }
#ifdef LINGU_EXCEPTIONS
else
{
throw UnknownPropertyException();
}
#endif
return aRet; return aRet;
} }
@@ -292,12 +280,6 @@ void SAL_CALL LinguProps::addPropertyChangeListener(
const SfxItemPropertySimpleEntry* pCur = aPropertyMap.getByName( rPropertyName ); const SfxItemPropertySimpleEntry* pCur = aPropertyMap.getByName( rPropertyName );
if(pCur) if(pCur)
aPropListeners.addInterface( pCur->nWID, rxListener ); aPropListeners.addInterface( pCur->nWID, rxListener );
#ifdef LINGU_EXCEPTIONS
else
{
throw UnknownPropertyException();
}
#endif
} }
} }
@@ -313,12 +295,6 @@ void SAL_CALL LinguProps::removePropertyChangeListener(
const SfxItemPropertySimpleEntry* pCur = aPropertyMap.getByName( rPropertyName ); const SfxItemPropertySimpleEntry* pCur = aPropertyMap.getByName( rPropertyName );
if(pCur) if(pCur)
aPropListeners.removeInterface( pCur->nWID, rxListener ); aPropListeners.removeInterface( pCur->nWID, rxListener );
#ifdef LINGU_EXCEPTIONS
else
{
throw UnknownPropertyException();
}
#endif
} }
} }

View File

@@ -295,13 +295,7 @@ sal_Bool SpellCheckerDispatcher::isValid_Impl(
SpellSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); SpellSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) );
LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
if (!pEntry) if (pEntry)
{
#ifdef LINGU_EXCEPTIONS
throw IllegalArgumentException();
#endif
}
else
{ {
OUString aChkWord( rWord ); OUString aChkWord( rWord );
Locale aLocale( CreateLocale( nLanguage ) ); Locale aLocale( CreateLocale( nLanguage ) );
@@ -461,13 +455,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
SpellSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); SpellSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) );
LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
if (!pEntry) if (pEntry)
{
#ifdef LINGU_EXCEPTIONS
throw IllegalArgumentException();
#endif
}
else
{ {
OUString aChkWord( rWord ); OUString aChkWord( rWord );
Locale aLocale( CreateLocale( nLanguage ) ); Locale aLocale( CreateLocale( nLanguage ) );

View File

@@ -124,13 +124,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
ThesSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); ThesSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) );
LangSvcEntries_Thes *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; LangSvcEntries_Thes *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
if (!pEntry) if (pEntry)
{
#ifdef LINGU_EXCEPTIONS
throw IllegalArgumentException();
#endif
}
else
{ {
OUString aChkWord( rTerm ); OUString aChkWord( rTerm );
aChkWord = aChkWord.replace( SVT_HARD_SPACE, ' ' ); aChkWord = aChkWord.replace( SVT_HARD_SPACE, ' ' );