Kaydet (Commit) 694afdba authored tarafından Stephan Bergmann's avatar Stephan Bergmann

SfxProgress::SetState always returns true

Change-Id: Ib606b0391f814ea9ff4383397a40a8a692563fa3
üst bf64e7d6
...@@ -47,8 +47,8 @@ public: ...@@ -47,8 +47,8 @@ public:
bool bWait = true); bool bWait = true);
virtual ~SfxProgress(); virtual ~SfxProgress();
bool SetStateText( sal_uIntPtr nVal, const rtl::OUString &rVal ); void SetStateText( sal_uIntPtr nVal, const rtl::OUString &rVal );
bool SetState( sal_uIntPtr nVal, sal_uIntPtr nNewRange = 0 ); void SetState( sal_uIntPtr nVal, sal_uIntPtr nNewRange = 0 );
sal_uIntPtr GetState() const { return nVal; } sal_uIntPtr GetState() const { return nVal; }
void Resume(); void Resume();
......
...@@ -140,7 +140,6 @@ ...@@ -140,7 +140,6 @@
#define STR_UNKNOWN_FILTER 94 #define STR_UNKNOWN_FILTER 94
#define STR_DATABASE_NOTFOUND 95 #define STR_DATABASE_NOTFOUND 95
#define STR_DATABASE_ABORTED 96
#define STR_UNDO_PRINTRANGES 97 #define STR_UNDO_PRINTRANGES 97
......
...@@ -42,7 +42,6 @@ private: ...@@ -42,7 +42,6 @@ private:
static SfxProgress* pGlobalProgress; static SfxProgress* pGlobalProgress;
static sal_uLong nGlobalRange; static sal_uLong nGlobalRange;
static sal_uLong nGlobalPercent; static sal_uLong nGlobalPercent;
static bool bGlobalNoUserBreak;
static ScProgress* pInterpretProgress; static ScProgress* pInterpretProgress;
static ScProgress* pOldInterpretProgress; static ScProgress* pOldInterpretProgress;
static sal_uLong nInterpretProgress; static sal_uLong nInterpretProgress;
...@@ -63,7 +62,6 @@ private: ...@@ -63,7 +62,6 @@ private:
} }
public: public:
static bool IsUserBreak() { return !bGlobalNoUserBreak; }
static void CreateInterpretProgress( ScDocument* pDoc, static void CreateInterpretProgress( ScDocument* pDoc,
bool bWait = true ); bool bWait = true );
static ScProgress* GetInterpretProgress() { return pInterpretProgress; } static ScProgress* GetInterpretProgress() { return pInterpretProgress; }
...@@ -80,47 +78,37 @@ public: ...@@ -80,47 +78,37 @@ public:
ScProgress(); ScProgress();
#endif #endif
bool SetStateText( sal_uLong nVal, const OUString &rVal ) void SetStateText( sal_uLong nVal, const OUString &rVal )
{ {
if ( pProgress ) if ( pProgress )
{ {
CalcGlobalPercent( nVal ); CalcGlobalPercent( nVal );
if ( !pProgress->SetStateText( nVal, rVal ) ) pProgress->SetStateText( nVal, rVal );
bGlobalNoUserBreak = false;
return bGlobalNoUserBreak;
} }
return true;
} }
bool SetState( sal_uLong nVal, sal_uLong nNewRange = 0 ) void SetState( sal_uLong nVal, sal_uLong nNewRange = 0 )
{ {
if ( pProgress ) if ( pProgress )
{ {
if ( nNewRange ) if ( nNewRange )
nGlobalRange = nNewRange; nGlobalRange = nNewRange;
CalcGlobalPercent( nVal ); CalcGlobalPercent( nVal );
if ( !pProgress->SetState( nVal, nNewRange ) ) pProgress->SetState( nVal, nNewRange );
bGlobalNoUserBreak = false;
return bGlobalNoUserBreak;
} }
return true;
} }
bool SetStateCountDown( sal_uLong nVal ) void SetStateCountDown( sal_uLong nVal )
{ {
if ( pProgress ) if ( pProgress )
{ {
CalcGlobalPercent( nGlobalRange - nVal ); CalcGlobalPercent( nGlobalRange - nVal );
if ( !pProgress->SetState( nGlobalRange - nVal ) ) pProgress->SetState( nGlobalRange - nVal );
bGlobalNoUserBreak = false;
return bGlobalNoUserBreak;
} }
return true;
} }
bool SetStateOnPercent( sal_uLong nVal ) void SetStateOnPercent( sal_uLong nVal )
{ /// only if percentage increased { /// only if percentage increased
if ( nGlobalRange && (nVal * 100 / if ( nGlobalRange && (nVal * 100 /
nGlobalRange) > nGlobalPercent ) nGlobalRange) > nGlobalPercent )
return SetState( nVal ); SetState( nVal );
return true;
} }
void SetStateCountDownOnPercent( sal_uLong nVal ) void SetStateCountDownOnPercent( sal_uLong nVal )
{ /// only if percentage increased { /// only if percentage increased
......
...@@ -456,8 +456,6 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet ...@@ -456,8 +456,6 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet
else else
pCell = nullptr; pCell = nullptr;
} }
if ( ScProgress::IsUserBreak() )
pCell = nullptr;
} }
if ( bProgress ) if ( bProgress )
ScProgress::DeleteInterpretProgress(); ScProgress::DeleteInterpretProgress();
......
...@@ -37,7 +37,6 @@ static ScProgress theDummyInterpretProgress; ...@@ -37,7 +37,6 @@ static ScProgress theDummyInterpretProgress;
SfxProgress* ScProgress::pGlobalProgress = nullptr; SfxProgress* ScProgress::pGlobalProgress = nullptr;
sal_uLong ScProgress::nGlobalRange = 0; sal_uLong ScProgress::nGlobalRange = 0;
sal_uLong ScProgress::nGlobalPercent = 0; sal_uLong ScProgress::nGlobalPercent = 0;
bool ScProgress::bGlobalNoUserBreak = true;
ScProgress* ScProgress::pInterpretProgress = &theDummyInterpretProgress; ScProgress* ScProgress::pInterpretProgress = &theDummyInterpretProgress;
ScProgress* ScProgress::pOldInterpretProgress = nullptr; ScProgress* ScProgress::pOldInterpretProgress = nullptr;
sal_uLong ScProgress::nInterpretProgress = 0; sal_uLong ScProgress::nInterpretProgress = 0;
...@@ -111,7 +110,6 @@ ScProgress::ScProgress(SfxObjectShell* pObjSh, const OUString& rText, ...@@ -111,7 +110,6 @@ ScProgress::ScProgress(SfxObjectShell* pObjSh, const OUString& rText,
pGlobalProgress = pProgress; pGlobalProgress = pProgress;
nGlobalRange = nRange; nGlobalRange = nRange;
nGlobalPercent = 0; nGlobalPercent = 0;
bGlobalNoUserBreak = true;
} }
} }
...@@ -130,7 +128,6 @@ ScProgress::~ScProgress() ...@@ -130,7 +128,6 @@ ScProgress::~ScProgress()
pGlobalProgress = nullptr; pGlobalProgress = nullptr;
nGlobalRange = 0; nGlobalRange = 0;
nGlobalPercent = 0; nGlobalPercent = 0;
bGlobalNoUserBreak = true;
} }
} }
......
...@@ -346,12 +346,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, ...@@ -346,12 +346,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
aText += OUString::number( nInserted ); aText += OUString::number( nInserted );
aText += aPict.getToken(1,'#'); aText += aPict.getToken(1,'#');
if (!aProgress.SetStateText( 0, aText )) // stopped by user? aProgress.SetStateText( 0, aText );
{
bEnd = true;
bSuccess = false;
nErrStringId = STR_DATABASE_ABORTED;
}
} }
} }
else // past the end of the spreadsheet else // past the end of the spreadsheet
......
...@@ -1013,11 +1013,7 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, rtl_TextEncodi ...@@ -1013,11 +1013,7 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, rtl_TextEncodi
//! error handling and recovery of old //! error handling and recovery of old
//! ScDocShell::SbaSdbExport is still missing! //! ScDocShell::SbaSdbExport is still missing!
if ( !aProgress.SetStateOnPercent( nDocRow - nFirstRow ) ) aProgress.SetStateOnPercent( nDocRow - nFirstRow );
{ // UserBreak
nErr = SCERR_EXPORT_DATA;
break;
}
} }
comphelper::disposeComponent( xRowSet ); comphelper::disposeComponent( xRowSet );
......
...@@ -393,10 +393,6 @@ Resource RID_GLOBSTR ...@@ -393,10 +393,6 @@ Resource RID_GLOBSTR
{ {
Text [ en-US ] = "The query '#' could not be opened." ; Text [ en-US ] = "The query '#' could not be opened." ;
}; };
String STR_DATABASE_ABORTED
{
Text [ en-US ] = "Database import terminated." ;
};
String STR_PROGRESS_IMPORT String STR_PROGRESS_IMPORT
{ {
Text [ en-US ] = "# records imported..." ; Text [ en-US ] = "# records imported..." ;
......
...@@ -208,7 +208,7 @@ void SfxProgress::Stop() ...@@ -208,7 +208,7 @@ void SfxProgress::Stop()
pImpl->Enable_Impl(); pImpl->Enable_Impl();
} }
bool SfxProgress::SetStateText void SfxProgress::SetStateText
( (
sal_uLong nNewVal, /* New value for the progress-bar */ sal_uLong nNewVal, /* New value for the progress-bar */
const OUString& rNewVal /* Status as Text */ const OUString& rNewVal /* Status as Text */
...@@ -216,10 +216,10 @@ bool SfxProgress::SetStateText ...@@ -216,10 +216,10 @@ bool SfxProgress::SetStateText
{ {
pImpl->aStateText = rNewVal; pImpl->aStateText = rNewVal;
return SetState( nNewVal ); SetState( nNewVal );
} }
bool SfxProgress::SetState void SfxProgress::SetState
( (
sal_uLong nNewVal, /* new value for the progress bar */ sal_uLong nNewVal, /* new value for the progress bar */
...@@ -228,18 +228,10 @@ bool SfxProgress::SetState ...@@ -228,18 +228,10 @@ bool SfxProgress::SetState
/* [Description] /* [Description]
Setting the current status, after a time delay Reschedule is called. Setting the current status, after a time delay Reschedule is called.
[Return value]
bool TRUE
Proceed with the action
FALSE
Cancel action
*/ */
{ {
if( pImpl->pActiveProgress ) return true; if( pImpl->pActiveProgress ) return;
nVal = nNewVal; nVal = nNewVal;
...@@ -300,8 +292,6 @@ bool SfxProgress::SetState ...@@ -300,8 +292,6 @@ bool SfxProgress::SetState
{ {
pImpl->xStatusInd->setValue( nNewVal ); pImpl->xStatusInd->setValue( nNewVal );
} }
return true;
} }
......
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