summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-09-23 16:06:36 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-09-23 18:13:13 +0200
commit203865e128ddea66041bb1597333dfb04ec81186 (patch)
tree42219cb87ba5a5ce001dc182f7c0e475f6d97d2e
parent38eadd4b0714895e9b43c2341903e2e08cc1eaa6 (diff)
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@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/ui/unoobj/docuno.cxx30
1 files changed, 15 insertions, 15 deletions
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 );