convert FmSearchProgress::State to scoped enum

Change-Id: I7ca1afedd6ca9b626c1e61322bffc66016ec7d58
This commit is contained in:
Noel Grandin
2016-08-24 10:55:12 +02:00
parent 479aa67fd9
commit 1332241a03
3 changed files with 15 additions and 15 deletions

View File

@@ -701,7 +701,7 @@ IMPL_LINK_TYPED(FmSearchDialog, OnSearchProgress, const FmSearchProgress*, pProg
switch (pProgress->aSearchState)
{
case FmSearchProgress::STATE_PROGRESS:
case FmSearchProgress::State::Progress:
if (pProgress->bOverflow)
{
OUString sHint( CUI_RES( m_pcbBackwards->IsChecked() ? RID_STR_OVERFLOW_BACKWARD : RID_STR_OVERFLOW_FORWARD ) );
@@ -713,7 +713,7 @@ IMPL_LINK_TYPED(FmSearchDialog, OnSearchProgress, const FmSearchProgress*, pProg
m_pftRecord->Invalidate();
break;
case FmSearchProgress::STATE_PROGRESS_COUNTING:
case FmSearchProgress::State::ProgressCounting:
m_pftHint->SetText(CUI_RESSTR(RID_STR_SEARCH_COUNTING));
m_pftHint->Invalidate();
@@ -721,21 +721,21 @@ IMPL_LINK_TYPED(FmSearchDialog, OnSearchProgress, const FmSearchProgress*, pProg
m_pftRecord->Invalidate();
break;
case FmSearchProgress::STATE_SUCCESSFULL:
case FmSearchProgress::State::Successful:
OnFound(pProgress->aBookmark, (sal_Int16)pProgress->nFieldIndex);
EnableSearchUI(true);
break;
case FmSearchProgress::STATE_ERROR:
case FmSearchProgress::STATE_NOTHINGFOUND:
case FmSearchProgress::State::Error:
case FmSearchProgress::State::NothingFound:
{
sal_uInt16 nErrorId = (FmSearchProgress::STATE_ERROR == pProgress->aSearchState)
sal_uInt16 nErrorId = (FmSearchProgress::State::Error == pProgress->aSearchState)
? RID_STR_SEARCH_GENERAL_ERROR
: RID_STR_SEARCH_NORECORD;
ScopedVclPtrInstance<MessageDialog>(this, CUI_RES(nErrorId))->Execute();
SAL_FALLTHROUGH;
}
case FmSearchProgress::STATE_CANCELED:
case FmSearchProgress::State::Canceled:
EnableSearchUI(true);
if (m_lnkCanceledNotFoundHdl.IsSet())
{

View File

@@ -61,10 +61,10 @@ public:
*/
struct FmSearchProgress
{
enum STATE { STATE_PROGRESS, STATE_PROGRESS_COUNTING, STATE_CANCELED, STATE_SUCCESSFULL, STATE_NOTHINGFOUND, STATE_ERROR };
enum class State { Progress, ProgressCounting, Canceled, Successful, NothingFound, Error };
// (move to new record; progress during counting of records; cancelled; record found; nothing found;
// any non-processable error)
STATE aSearchState;
State aSearchState;
// current record - always valid (e.g. of interest for continuing search in case of cancellation)
sal_uInt32 nCurrentRecord;

View File

@@ -865,7 +865,7 @@ void FmSearchEngine::PropagateProgress(bool _bDontPropagateOverflow)
FmSearchProgress aProgress;
try
{
aProgress.aSearchState = FmSearchProgress::STATE_PROGRESS;
aProgress.aSearchState = FmSearchProgress::State::Progress;
aProgress.nCurrentRecord = m_xSearchCursor.getRow() - 1;
if (m_bForward)
aProgress.bOverflow = !_bDontPropagateOverflow && m_xSearchCursor.isFirst();
@@ -994,19 +994,19 @@ IMPL_LINK_NOARG_TYPED(FmSearchEngine, OnSearchTerminated, FmSearchThread*, void)
switch (m_srResult)
{
case SearchResult::Error :
aProgress.aSearchState = FmSearchProgress::STATE_ERROR;
aProgress.aSearchState = FmSearchProgress::State::Error;
break;
case SearchResult::Found :
aProgress.aSearchState = FmSearchProgress::STATE_SUCCESSFULL;
aProgress.aSearchState = FmSearchProgress::State::Successful;
aProgress.aBookmark = m_aPreviousLocBookmark;
aProgress.nFieldIndex = m_iterPreviousLocField - m_arrUsedFields.begin();
break;
case SearchResult::NotFound :
aProgress.aSearchState = FmSearchProgress::STATE_NOTHINGFOUND;
aProgress.aSearchState = FmSearchProgress::State::NothingFound;
aProgress.aBookmark = m_xSearchCursor.getBookmark();
break;
case SearchResult::Cancelled :
aProgress.aSearchState = FmSearchProgress::STATE_CANCELED;
aProgress.aSearchState = FmSearchProgress::State::Canceled;
aProgress.aBookmark = m_xSearchCursor.getBookmark();
break;
}
@@ -1031,7 +1031,7 @@ IMPL_LINK_TYPED(FmSearchEngine, OnNewRecordCount, sal_Int32, theCounter, void)
FmSearchProgress aProgress;
aProgress.nCurrentRecord = theCounter;
aProgress.aSearchState = FmSearchProgress::STATE_PROGRESS_COUNTING;
aProgress.aSearchState = FmSearchProgress::State::ProgressCounting;
m_aProgressHandler.Call(&aProgress);
}