[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 24 07:25:24 UTC 2019


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

New commits:
commit d7bd0b2d010b4fa64dd6773ad63f864e13fffb29
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Sep 23 16:06:36 2019 +0100
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Tue Sep 24 09:24:41 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/79414
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 7443bf3ba018..c2f3b3e97be5 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1837,16 +1837,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 );
@@ -2021,16 +2021,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