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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 23 16:14:07 UTC 2019


 sc/source/ui/unoobj/docuno.cxx |   30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 203865e128ddea66041bb1597333dfb04ec81186
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Sep 23 16:06:36 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Sep 23 18:13:13 2019 +0200

    Resolves: tdf#127682 out_of_range thrown on print empty calc doc
    
    when odd/even pages requested and print is cancelled
    
    the abort procedure will ask for page 0 to be rendered on cancel,
    which doesn't exist since the odd/even support.
    
    Let the print of an empty page to ahead in the abort scenario
    
    Change-Id: Id8dfde57fca891ba3eb220cf6e495585abf4c918
    Reviewed-on: https://gerrit.libreoffice.org/79413
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index ab464f2cde3d..46599d873f71 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1762,16 +1762,16 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32
         }
 
         MultiSelection aPage;
-        if ( nContent == 2 || nContent == 3 ) // even pages or odd pages
-        {
-            aPage.SetTotalRange( Range(0,RANGE_MAX) );
-            aPage.Select( maValidPages.at( nRenderer ) );
-        }
+        aPage.SetTotalRange( Range(0,RANGE_MAX) );
+
+        bool bOddOrEven = nContent == 2 || nContent == 3; // even pages or odd pages
+        // tdf#127682 when odd/even allow nRenderer of 0 even when maValidPages is empty
+        // to allow PrinterController::abortJob to spool an empty page as part of
+        // its abort procedure
+        if (bOddOrEven && !maValidPages.empty())
+            aPage.Select( maValidPages.at(nRenderer) );
         else
-        {
-            aPage.SetTotalRange( Range(0,RANGE_MAX) );
             aPage.Select( nRenderer+1 );
-        }
 
         long nDisplayStart = pPrintFuncCache->GetDisplayStart( nTab );
         long nTabStart = pPrintFuncCache->GetTabStart( nTab );
@@ -1946,16 +1946,16 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
     }
 
     MultiSelection aPage;
-    if ( nContent == 2 || nContent == 3 ) // even pages or odd pages
-    {
-        aPage.SetTotalRange( Range(0,RANGE_MAX) );
+    aPage.SetTotalRange( Range(0,RANGE_MAX) );
+
+    bool bOddOrEven = nContent == 2 || nContent == 3; // even pages or odd pages
+    // tdf#127682 when odd/even allow nRenderer of 0 even when maValidPages is empty
+    // to allow PrinterController::abortJob to spool an empty page as part of
+    // its abort procedure
+    if (bOddOrEven && !maValidPages.empty())
         aPage.Select( maValidPages.at( nRenderer ) );
-    }
     else
-    {
-        aPage.SetTotalRange( Range(0,RANGE_MAX) );
         aPage.Select( nRenderer+1 );
-    }
 
     long nDisplayStart = pPrintFuncCache->GetDisplayStart( nTab );
     long nTabStart = pPrintFuncCache->GetTabStart( nTab );


More information about the Libreoffice-commits mailing list