[Libreoffice-commits] core.git: include/sfx2 sc/inc sc/source sfx2/source

Stephan Bergmann sbergman at redhat.com
Mon Jun 27 16:41:55 UTC 2016


 include/sfx2/progress.hxx          |    4 ++--
 sc/inc/globstr.hrc                 |    1 -
 sc/inc/progress.hxx                |   28 ++++++++--------------------
 sc/source/core/data/documen7.cxx   |    2 --
 sc/source/core/tool/progress.cxx   |    3 ---
 sc/source/ui/docshell/dbdocimp.cxx |    7 +------
 sc/source/ui/docshell/docsh8.cxx   |    6 +-----
 sc/source/ui/src/globstr.src       |    4 ----
 sfx2/source/bastyp/progress.cxx    |   18 ++++--------------
 9 files changed, 16 insertions(+), 57 deletions(-)

New commits:
commit 694afdbaecfab1f98279fafd1483f3c2734ce788
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jun 27 18:41:11 2016 +0200

    SfxProgress::SetState always returns true
    
    Change-Id: Ib606b0391f814ea9ff4383397a40a8a692563fa3

diff --git a/include/sfx2/progress.hxx b/include/sfx2/progress.hxx
index e487ef4..882d38d 100644
--- a/include/sfx2/progress.hxx
+++ b/include/sfx2/progress.hxx
@@ -47,8 +47,8 @@ public:
                                          bool bWait = true);
     virtual                 ~SfxProgress();
 
-    bool                    SetStateText( sal_uIntPtr nVal, const rtl::OUString &rVal );
-    bool                    SetState( sal_uIntPtr nVal, sal_uIntPtr nNewRange = 0 );
+    void                    SetStateText( sal_uIntPtr nVal, const rtl::OUString &rVal );
+    void                    SetState( sal_uIntPtr nVal, sal_uIntPtr nNewRange = 0 );
     sal_uIntPtr             GetState() const { return nVal; }
 
     void                    Resume();
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index df4369f..4d8c80c 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -140,7 +140,6 @@
 #define STR_UNKNOWN_FILTER          94
 
 #define STR_DATABASE_NOTFOUND       95
-#define STR_DATABASE_ABORTED        96
 
 #define STR_UNDO_PRINTRANGES        97
 
diff --git a/sc/inc/progress.hxx b/sc/inc/progress.hxx
index 8d1f9c5..249a4e9 100644
--- a/sc/inc/progress.hxx
+++ b/sc/inc/progress.hxx
@@ -42,7 +42,6 @@ private:
     static  SfxProgress*    pGlobalProgress;
     static  sal_uLong        nGlobalRange;
     static  sal_uLong       nGlobalPercent;
-    static  bool            bGlobalNoUserBreak;
     static  ScProgress*     pInterpretProgress;
     static  ScProgress*     pOldInterpretProgress;
     static  sal_uLong       nInterpretProgress;
@@ -63,7 +62,6 @@ private:
                                 }
 
 public:
-    static  bool            IsUserBreak() { return !bGlobalNoUserBreak; }
     static  void            CreateInterpretProgress( ScDocument* pDoc,
                                                     bool bWait = true );
     static  ScProgress*     GetInterpretProgress() { return pInterpretProgress; }
@@ -80,47 +78,37 @@ public:
                             ScProgress();
 #endif
 
-            bool            SetStateText( sal_uLong nVal, const OUString &rVal )
+            void            SetStateText( sal_uLong nVal, const OUString &rVal )
                                 {
                                     if ( pProgress )
                                     {
                                         CalcGlobalPercent( nVal );
-                                        if ( !pProgress->SetStateText( nVal, rVal ) )
-                                            bGlobalNoUserBreak = false;
-                                        return bGlobalNoUserBreak;
+                                        pProgress->SetStateText( nVal, rVal );
                                     }
-                                    return true;
                                 }
-            bool            SetState( sal_uLong nVal, sal_uLong nNewRange = 0 )
+            void            SetState( sal_uLong nVal, sal_uLong nNewRange = 0 )
                                 {
                                     if ( pProgress )
                                     {
                                         if ( nNewRange )
                                             nGlobalRange = nNewRange;
                                         CalcGlobalPercent( nVal );
-                                        if ( !pProgress->SetState( nVal, nNewRange ) )
-                                            bGlobalNoUserBreak = false;
-                                        return bGlobalNoUserBreak;
+                                        pProgress->SetState( nVal, nNewRange );
                                     }
-                                    return true;
                                 }
-            bool            SetStateCountDown( sal_uLong nVal )
+            void            SetStateCountDown( sal_uLong nVal )
                                 {
                                     if ( pProgress )
                                     {
                                         CalcGlobalPercent( nGlobalRange - nVal );
-                                        if ( !pProgress->SetState( nGlobalRange - nVal ) )
-                                            bGlobalNoUserBreak = false;
-                                        return bGlobalNoUserBreak;
+                                        pProgress->SetState( nGlobalRange - nVal );
                                     }
-                                    return true;
                                 }
-            bool            SetStateOnPercent( sal_uLong nVal )
+            void            SetStateOnPercent( sal_uLong nVal )
                                 {   /// only if percentage increased
                                     if ( nGlobalRange && (nVal * 100 /
                                             nGlobalRange) > nGlobalPercent )
-                                        return SetState( nVal );
-                                    return true;
+                                        SetState( nVal );
                                 }
             void            SetStateCountDownOnPercent( sal_uLong nVal )
                                 {   /// only if percentage increased
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 98025ec..7e86b37 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -456,8 +456,6 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet
                 else
                     pCell = nullptr;
             }
-            if ( ScProgress::IsUserBreak() )
-                pCell = nullptr;
         }
         if ( bProgress )
             ScProgress::DeleteInterpretProgress();
diff --git a/sc/source/core/tool/progress.cxx b/sc/source/core/tool/progress.cxx
index 7040238..b524eac5 100644
--- a/sc/source/core/tool/progress.cxx
+++ b/sc/source/core/tool/progress.cxx
@@ -37,7 +37,6 @@ static ScProgress theDummyInterpretProgress;
 SfxProgress*    ScProgress::pGlobalProgress = nullptr;
 sal_uLong       ScProgress::nGlobalRange = 0;
 sal_uLong       ScProgress::nGlobalPercent = 0;
-bool            ScProgress::bGlobalNoUserBreak = true;
 ScProgress*     ScProgress::pInterpretProgress = &theDummyInterpretProgress;
 ScProgress*     ScProgress::pOldInterpretProgress = nullptr;
 sal_uLong       ScProgress::nInterpretProgress = 0;
@@ -111,7 +110,6 @@ ScProgress::ScProgress(SfxObjectShell* pObjSh, const OUString& rText,
         pGlobalProgress = pProgress;
         nGlobalRange = nRange;
         nGlobalPercent = 0;
-        bGlobalNoUserBreak = true;
     }
 }
 
@@ -130,7 +128,6 @@ ScProgress::~ScProgress()
         pGlobalProgress = nullptr;
         nGlobalRange = 0;
         nGlobalPercent = 0;
-        bGlobalNoUserBreak = true;
     }
 }
 
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 8cba579..7d02ce3 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -346,12 +346,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
                                 aText += OUString::number( nInserted );
                                 aText += aPict.getToken(1,'#');
 
-                                if (!aProgress.SetStateText( 0, aText ))    // stopped by user?
-                                {
-                                    bEnd = true;
-                                    bSuccess = false;
-                                    nErrStringId = STR_DATABASE_ABORTED;
-                                }
+                                aProgress.SetStateText( 0, aText );
                             }
                         }
                         else        // past the end of the spreadsheet
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 72a7d2f..7fa8dc5 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -1013,11 +1013,7 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, rtl_TextEncodi
             //! error handling and recovery of old
             //! ScDocShell::SbaSdbExport is still missing!
 
-            if ( !aProgress.SetStateOnPercent( nDocRow - nFirstRow ) )
-            {   // UserBreak
-                nErr = SCERR_EXPORT_DATA;
-                break;
-            }
+            aProgress.SetStateOnPercent( nDocRow - nFirstRow );
         }
 
         comphelper::disposeComponent( xRowSet );
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index 08e84c9..90576bf 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -393,10 +393,6 @@ Resource RID_GLOBSTR
     {
         Text [ en-US ] = "The query '#' could not be opened." ;
     };
-    String STR_DATABASE_ABORTED
-    {
-        Text [ en-US ] = "Database import terminated." ;
-    };
     String STR_PROGRESS_IMPORT
     {
         Text [ en-US ] = "# records imported..." ;
diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx
index 3524aea..df5a8fe 100644
--- a/sfx2/source/bastyp/progress.cxx
+++ b/sfx2/source/bastyp/progress.cxx
@@ -208,7 +208,7 @@ void SfxProgress::Stop()
         pImpl->Enable_Impl();
 }
 
-bool SfxProgress::SetStateText
+void SfxProgress::SetStateText
 (
     sal_uLong       nNewVal,     /* New value for the progress-bar */
     const OUString& rNewVal     /* Status as Text */
@@ -216,10 +216,10 @@ bool SfxProgress::SetStateText
 
 {
     pImpl->aStateText = rNewVal;
-    return SetState( nNewVal );
+    SetState( nNewVal );
 }
 
-bool SfxProgress::SetState
+void SfxProgress::SetState
 (
     sal_uLong   nNewVal,    /* new value for the progress bar */
 
@@ -228,18 +228,10 @@ bool SfxProgress::SetState
 /*  [Description]
 
     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;
 
@@ -300,8 +292,6 @@ bool SfxProgress::SetState
     {
         pImpl->xStatusInd->setValue( nNewVal );
     }
-
-    return true;
 }
 
 


More information about the Libreoffice-commits mailing list