diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-12-25 03:37:45 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-12-25 10:02:53 +0100 |
commit | 86a939d5fd93173949447337738fa0625803ec92 (patch) | |
tree | d5aa7431d5c67dc5e8b2bfe31e99d6baeb79014f /tools | |
parent | 230d3d6602e80fad0ceb700da35fc0c1db28f110 (diff) |
tdf#114684: don't print pages for ranges completely outside ...
... of possible pages range.
Change-Id: Ibe50f116aecdad8c7cba7f9844bc04c15716d127
Reviewed-on: https://gerrit.libreoffice.org/47052
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/memtools/multisel.cxx | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx index dfd2fcfaceb5..ae26b2e3cf38 100644 --- a/tools/source/memtools/multisel.cxx +++ b/tools/source/memtools/multisel.cxx @@ -553,6 +553,10 @@ bool StringRangeEnumerator::insertRange( sal_Int32 i_nFirst, sal_Int32 i_nLast, bool bSuccess = true; if( bSequence ) { + // Check if the range is completely outside of possible pages range + if ((i_nFirst < mnMin && i_nLast < mnMin) || + (i_nFirst > mnMax && i_nLast > mnMax)) + return false; if( i_nFirst < mnMin ) i_nFirst = mnMin; if( i_nFirst > mnMax ) @@ -640,12 +644,18 @@ bool StringRangeEnumerator::setRange( const OUString& i_rNewRange ) { bSequence = true; if( aNumbers.empty() ) - aNumbers.push_back( mnMin ); + { + // push out-of-range small value, to exclude ranges totally outside of possible range + aNumbers.push_back( mnMin-1 ); + } } else if( *pInput == ',' || *pInput == ';' ) { if( bSequence && !aNumbers.empty() ) - aNumbers.push_back( mnMax ); + { + // push out-of-range large value, to exclude ranges totally outside of possible range + aNumbers.push_back( mnMax+1 ); + } insertJoinedRanges( aNumbers ); aNumbers.clear(); @@ -659,7 +669,10 @@ bool StringRangeEnumerator::setRange( const OUString& i_rNewRange ) } // insert last entries if( bSequence && !aNumbers.empty() ) - aNumbers.push_back( mnMax ); + { + // push out-of-range large value, to exclude ranges totally outside of possible range + aNumbers.push_back( mnMax+1 ); + } insertJoinedRanges( aNumbers ); return true; |