convert EESpellState to scoped enum

and drop unused EE_SPELL_NOLANGUAGE enumerator

Change-Id: I74a5f89335883a13d77b39f78b7de55bddb1f107
This commit is contained in:
Noel Grandin 2017-02-16 12:30:13 +02:00
parent 4e19742382
commit fd2ffceefc
15 changed files with 25 additions and 56 deletions

View File

@ -169,6 +169,7 @@ for d in definitionSet:
"dbaccess/source/inc/dsntypes.hxx", # dbaccess::DATASOURCE_TYPE (from UI) "dbaccess/source/inc/dsntypes.hxx", # dbaccess::DATASOURCE_TYPE (from UI)
"cui/source/tabpages/tparea.cxx", # FillType (from UI) "cui/source/tabpages/tparea.cxx", # FillType (from UI)
"include/editeng/svxenum.hxx", # css::style::NumberingType "include/editeng/svxenum.hxx", # css::style::NumberingType
"include/editeng/bulletitem.hxx", # css::style::NumberingType
# represents constants from an external API # represents constants from an external API
"opencl/inc/opencl_device_selection.h", "opencl/inc/opencl_device_selection.h",
"vcl/inc/sft.hxx", "vcl/inc/sft.hxx",

View File

@ -2168,7 +2168,7 @@ bool EditEngine::SpellNextDocument()
EESpellState EditEngine::HasSpellErrors() EESpellState EditEngine::HasSpellErrors()
{ {
if ( !pImpEditEngine->GetSpeller().is() ) if ( !pImpEditEngine->GetSpeller().is() )
return EE_SPELL_NOSPELLER; return EESpellState::NoSpeller;
return pImpEditEngine->HasSpellErrors(); return pImpEditEngine->HasSpellErrors();
} }

View File

@ -763,7 +763,7 @@ void EditView::CompleteAutoCorrect( vcl::Window* pFrameWin )
EESpellState EditView::StartSpeller( bool bMultipleDoc ) EESpellState EditView::StartSpeller( bool bMultipleDoc )
{ {
if ( !pImpEditView->pEditEngine->pImpEditEngine->GetSpeller().is() ) if ( !pImpEditView->pEditEngine->pImpEditEngine->GetSpeller().is() )
return EE_SPELL_NOSPELLER; return EESpellState::NoSpeller;
return pImpEditView->pEditEngine->pImpEditEngine->Spell( this, bMultipleDoc ); return pImpEditView->pEditEngine->pImpEditEngine->Spell( this, bMultipleDoc );
} }
@ -771,7 +771,7 @@ EESpellState EditView::StartSpeller( bool bMultipleDoc )
EESpellState EditView::StartThesaurus() EESpellState EditView::StartThesaurus()
{ {
if ( !pImpEditView->pEditEngine->pImpEditEngine->GetSpeller().is() ) if ( !pImpEditView->pEditEngine->pImpEditEngine->GetSpeller().is() )
return EE_SPELL_NOSPELLER; return EESpellState::NoSpeller;
return pImpEditView->pEditEngine->pImpEditEngine->StartThesaurus( this ); return pImpEditView->pEditEngine->pImpEditEngine->StartThesaurus( this );
} }

View File

@ -172,7 +172,7 @@ struct SpellInfo
svx::SpellPortions aLastSpellPortions; svx::SpellPortions aLastSpellPortions;
SpellContentSelections aLastSpellContentSelections; SpellContentSelections aLastSpellContentSelections;
SpellInfo() SpellInfo()
{ bSpellToEnd = true; eState = EE_SPELL_OK; bMultipleDoc = false; } { bSpellToEnd = true; eState = EESpellState::Ok; bMultipleDoc = false; }
}; };
// used for text conversion // used for text conversion

View File

@ -1477,7 +1477,7 @@ EESpellState ImpEditEngine::Spell( EditView* pEditView, bool bMultipleDoc )
SAL_WARN_IF( !xSpeller.is(), "editeng", "No Spell checker set!" ); SAL_WARN_IF( !xSpeller.is(), "editeng", "No Spell checker set!" );
if ( !xSpeller.is() ) if ( !xSpeller.is() )
return EE_SPELL_NOSPELLER; return EESpellState::NoSpeller;
aOnlineSpellTimer.Stop(); aOnlineSpellTimer.Stop();
@ -1898,7 +1898,7 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView )
if ( !xSpellAlt.is() ) if ( !xSpellAlt.is() )
aCurSel = WordRight( aCurSel.Min(), css::i18n::WordType::DICTIONARY_WORD ); aCurSel = WordRight( aCurSel.Min(), css::i18n::WordType::DICTIONARY_WORD );
else else
pSpellInfo->eState = EE_SPELL_ERRORFOUND; pSpellInfo->eState = EESpellState::ErrorFound;
} }
pEditView->pImpEditView->DrawSelection(); pEditView->pImpEditView->DrawSelection();
@ -1946,7 +1946,7 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpFindNextError(EditSelection& r
aCurSel = WordRight( aCurSel.Min(), css::i18n::WordType::DICTIONARY_WORD ); aCurSel = WordRight( aCurSel.Min(), css::i18n::WordType::DICTIONARY_WORD );
else else
{ {
pSpellInfo->eState = EE_SPELL_ERRORFOUND; pSpellInfo->eState = EESpellState::ErrorFound;
rSelection = aCurSel; rSelection = aCurSel;
} }
} }
@ -2456,7 +2456,7 @@ EESpellState ImpEditEngine::HasSpellErrors()
if ( ( aCurSel.Max().GetNode() == pLastNode ) && if ( ( aCurSel.Max().GetNode() == pLastNode ) &&
( aCurSel.Max().GetIndex() >= pLastNode->Len() ) ) ( aCurSel.Max().GetIndex() >= pLastNode->Len() ) )
{ {
return EE_SPELL_OK; return EESpellState::Ok;
} }
aCurSel = SelectWord( aCurSel, css::i18n::WordType::DICTIONARY_WORD ); aCurSel = SelectWord( aCurSel, css::i18n::WordType::DICTIONARY_WORD );
@ -2470,7 +2470,7 @@ EESpellState ImpEditEngine::HasSpellErrors()
aCurSel = WordRight( aCurSel.Max(), css::i18n::WordType::DICTIONARY_WORD ); aCurSel = WordRight( aCurSel.Max(), css::i18n::WordType::DICTIONARY_WORD );
} }
return EE_SPELL_ERRORFOUND; return EESpellState::ErrorFound;
} }
void ImpEditEngine::ClearSpellErrors() void ImpEditEngine::ClearSpellErrors()
@ -2487,7 +2487,7 @@ EESpellState ImpEditEngine::StartThesaurus( EditView* pEditView )
Reference< XThesaurus > xThes( LinguMgr::GetThesaurus() ); Reference< XThesaurus > xThes( LinguMgr::GetThesaurus() );
if (!xThes.is()) if (!xThes.is())
return EE_SPELL_ERRORFOUND; return EESpellState::ErrorFound;
EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create(); EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create();
ScopedVclPtr<AbstractThesaurusDialog> xDlg(pFact->CreateThesaurusDialog( pEditView->GetWindow(), xThes, aWord, GetLanguage( aCurSel.Max() ) )); ScopedVclPtr<AbstractThesaurusDialog> xDlg(pFact->CreateThesaurusDialog( pEditView->GetWindow(), xThes, aWord, GetLanguage( aCurSel.Max() ) ));
@ -2501,7 +2501,7 @@ EESpellState ImpEditEngine::StartThesaurus( EditView* pEditView )
pEditView->ShowCursor(true, false); pEditView->ShowCursor(true, false);
} }
return EE_SPELL_OK; return EESpellState::Ok;
} }
sal_Int32 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxSearchItem& rSearchItem ) sal_Int32 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxSearchItem& rSearchItem )

View File

@ -35,7 +35,7 @@ enum EEHorizontalTextDirection { EE_HTEXTDIR_DEFAULT, EE_HTEXTDIR_L2R, EE_HTEXTD
enum EESelectionMode { EE_SELMODE_STD, EE_SELMODE_TXTONLY, EE_SELMODE_HIDDEN }; enum EESelectionMode { EE_SELMODE_STD, EE_SELMODE_TXTONLY, EE_SELMODE_HIDDEN };
// EE_SELMODE_HIDDEN can be used to completely hide the selection. This is useful e.g. when you want show the selection // EE_SELMODE_HIDDEN can be used to completely hide the selection. This is useful e.g. when you want show the selection
// only as long as your window (which the edit view works on) has the focus // only as long as your window (which the edit view works on) has the focus
enum EESpellState { EE_SPELL_OK, EE_SPELL_NOLANGUAGE, EE_SPELL_LANGUAGENOTINSTALLED, EE_SPELL_NOSPELLER, EE_SPELL_ERRORFOUND }; enum class EESpellState { Ok, LanguageNotInstalled, NoSpeller, ErrorFound };
enum EVAnchorMode { enum EVAnchorMode {
ANCHOR_TOP_LEFT, ANCHOR_VCENTER_LEFT, ANCHOR_BOTTOM_LEFT, ANCHOR_TOP_LEFT, ANCHOR_VCENTER_LEFT, ANCHOR_BOTTOM_LEFT,
ANCHOR_TOP_HCENTER, ANCHOR_VCENTER_HCENTER, ANCHOR_BOTTOM_HCENTER, ANCHOR_TOP_HCENTER, ANCHOR_VCENTER_HCENTER, ANCHOR_BOTTOM_HCENTER,

View File

@ -273,7 +273,7 @@
#define STR_UNDO_GRAFEDIT 199 #define STR_UNDO_GRAFEDIT 199
#define STR_NOLANGERR 200 // empty
#define STR_UNDO_INSERT_TAB 201 #define STR_UNDO_INSERT_TAB 201
#define STR_UNDO_DELETE_TAB 202 #define STR_UNDO_DELETE_TAB 202

View File

@ -1059,10 +1059,6 @@ String STR_SPELLING_STOP_OK+RID_GLOBSTR_OFFSET
{ {
Text [ en-US ] = "The spellcheck of this sheet has been completed." ; Text [ en-US ] = "The spellcheck of this sheet has been completed." ;
}; };
String STR_NOLANGERR+RID_GLOBSTR_OFFSET
{
Text [ en-US ] = "No language set" ;
};
String STR_UNDO_INSERT_TAB+RID_GLOBSTR_OFFSET String STR_UNDO_INSERT_TAB+RID_GLOBSTR_OFFSET
{ {
Text [ en-US ] = "Insert Sheet" ; Text [ en-US ] = "Insert Sheet" ;

View File

@ -285,17 +285,11 @@ ScSpellingEngine::ScSpellingEngine(
void ScSpellingEngine::ConvertAll( EditView& rEditView ) void ScSpellingEngine::ConvertAll( EditView& rEditView )
{ {
EESpellState eState = EE_SPELL_OK; EESpellState eState = EESpellState::Ok;
if( FindNextConversionCell() ) if( FindNextConversionCell() )
eState = rEditView.StartSpeller( true ); eState = rEditView.StartSpeller( true );
OSL_ENSURE( eState != EE_SPELL_NOSPELLER, "ScSpellingEngine::Convert - no spell checker" ); OSL_ENSURE( eState != EESpellState::NoSpeller, "ScSpellingEngine::Convert - no spell checker" );
if( eState == EE_SPELL_NOLANGUAGE )
{
vcl::Window* pParent = GetDialogParent();
ScWaitCursorOff aWaitOff( pParent );
ScopedVclPtrInstance<InfoBox>( pParent, ScGlobal::GetRscString( STR_NOLANGERR ) )->Execute();
}
} }
bool ScSpellingEngine::SpellNextDocument() bool ScSpellingEngine::SpellNextDocument()
@ -305,7 +299,7 @@ bool ScSpellingEngine::SpellNextDocument()
bool ScSpellingEngine::NeedsConversion() bool ScSpellingEngine::NeedsConversion()
{ {
return HasSpellErrors() != EE_SPELL_OK; return HasSpellErrors() != EESpellState::Ok;
} }
bool ScSpellingEngine::ShowTableWrapDialog() bool ScSpellingEngine::ShowTableWrapDialog()

View File

@ -382,9 +382,9 @@ void ScViewFunc::DoThesaurus()
// language is now in EditEngine attributes -> no longer passed to StartThesaurus // language is now in EditEngine attributes -> no longer passed to StartThesaurus
eState = pEditView->StartThesaurus(); eState = pEditView->StartThesaurus();
OSL_ENSURE(eState != EE_SPELL_NOSPELLER, "No SpellChecker"); OSL_ENSURE(eState != EESpellState::NoSpeller, "No SpellChecker");
if (eState == EE_SPELL_ERRORFOUND) // should happen later through Wrapper! if (eState == EESpellState::ErrorFound) // should happen later through Wrapper!
{ {
LanguageType eLnge = ScViewUtil::GetEffLanguage( &rDoc, ScAddress( nCol, nRow, nTab ) ); LanguageType eLnge = ScViewUtil::GetEffLanguage( &rDoc, ScAddress( nCol, nRow, nTab ) );
OUString aErr = SvtLanguageTable::GetLanguageString(eLnge); OUString aErr = SvtLanguageTable::GetLanguageString(eLnge);

View File

@ -482,10 +482,6 @@ String STR_END_SPELLING_OBJ
{ {
Text [ en-US ] = "The spellcheck for the selected objects has been completed." ; Text [ en-US ] = "The spellcheck for the selected objects has been completed." ;
}; };
String STR_NOLANGUAGE
{
Text [ en-US ] = "The selected language is not available." ;
};
String STR_ASK_FOR_CONVERT_TO_BEZIER String STR_ASK_FOR_CONVERT_TO_BEZIER
{ {
Text [ en-US ] = "Convert selected object to curve?" ; Text [ en-US ] = "Convert selected object to curve?" ;

View File

@ -108,12 +108,7 @@ void FuThesaurus::DoExecute( SfxRequest& )
} }
EESpellState eState = const_cast<OutlinerView*>(pOutlView)->StartThesaurus(); EESpellState eState = const_cast<OutlinerView*>(pOutlView)->StartThesaurus();
DBG_ASSERT(eState != EE_SPELL_NOSPELLER, "No SpellChecker"); DBG_ASSERT(eState != EESpellState::NoSpeller, "No SpellChecker");
if (eState == EE_SPELL_NOLANGUAGE)
{
ScopedVclPtrInstance<MessageDialog>(mpWindow, SD_RESSTR(STR_NOLANGUAGE))->Execute();
}
} }
} }
else if (mpViewShell && dynamic_cast< OutlineViewShell *>( mpViewShell ) != nullptr) else if (mpViewShell && dynamic_cast< OutlineViewShell *>( mpViewShell ) != nullptr)
@ -135,12 +130,7 @@ void FuThesaurus::DoExecute( SfxRequest& )
} }
EESpellState eState = pOutlView->StartThesaurus(); EESpellState eState = pOutlView->StartThesaurus();
DBG_ASSERT(eState != EE_SPELL_NOSPELLER, "No SpellChecker"); DBG_ASSERT(eState != EESpellState::NoSpeller, "No SpellChecker");
if (eState == EE_SPELL_NOLANGUAGE)
{
ScopedVclPtrInstance<MessageDialog>(mpWindow, SD_RESSTR(STR_NOLANGUAGE))->Execute();
}
} }
} }

View File

@ -206,7 +206,7 @@
#define STR_OBJECTS (RID_APP_START+341) #define STR_OBJECTS (RID_APP_START+341)
#define STR_END_SPELLING (RID_APP_START+343) #define STR_END_SPELLING (RID_APP_START+343)
#define STR_NOLANGUAGE (RID_APP_START+344) // empty
#define STR_ASK_FOR_CONVERT_TO_BEZIER (RID_APP_START+347) #define STR_ASK_FOR_CONVERT_TO_BEZIER (RID_APP_START+347)
#define STR_UNDO_CHANGE_PRES_OBJECT (RID_APP_START+349) #define STR_UNDO_CHANGE_PRES_OBJECT (RID_APP_START+349)
#define STR_UNDO_MODIFY_PAGE (RID_APP_START+350) #define STR_UNDO_MODIFY_PAGE (RID_APP_START+350)

View File

@ -1273,17 +1273,9 @@ void SdOutliner::PutTextIntoOutliner()
void SdOutliner::PrepareSpellCheck() void SdOutliner::PrepareSpellCheck()
{ {
EESpellState eState = HasSpellErrors(); EESpellState eState = HasSpellErrors();
DBG_ASSERT(eState != EE_SPELL_NOSPELLER, "No SpellChecker"); DBG_ASSERT(eState != EESpellState::NoSpeller, "No SpellChecker");
if (eState == EE_SPELL_NOLANGUAGE) if (eState != EESpellState::Ok)
{
mbError = true;
mbEndOfSearch = true;
ScopedVclPtrInstance<MessageDialog> aErrorBox (
nullptr, SD_RESSTR(STR_NOLANGUAGE));
ShowModalMessageBox (*aErrorBox.get());
}
else if (eState != EE_SPELL_OK)
{ {
// When spell checking we have to test whether we have processed the // When spell checking we have to test whether we have processed the
// whole document and have reached the start page again. // whole document and have reached the start page again.

View File

@ -780,7 +780,7 @@ bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh)
pOutlView->SetOutputArea( aRect ); pOutlView->SetOutputArea( aRect );
aTmpOutliner.SetText( *pParaObj ); aTmpOutliner.SetText( *pParaObj );
aTmpOutliner.ClearModifyFlag(); aTmpOutliner.ClearModifyFlag();
bHasSpellError = EE_SPELL_OK != aTmpOutliner.HasSpellErrors(); bHasSpellError = EESpellState::Ok != aTmpOutliner.HasSpellErrors();
aTmpOutliner.RemoveView( pOutlView.get() ); aTmpOutliner.RemoveView( pOutlView.get() );
} }
if(bHasSpellError) if(bHasSpellError)