diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-12-25 03:37:45 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-20 12:26:22 +0100 |
commit | 77f851c3b9f9acffb69929f280b2a451a83b620c (patch) | |
tree | aa986c6a58f331b3ea582353b96eeb34beb04685 /tools | |
parent | 280f3f2761da6dcb0f0e38e26c5295a4166d28d7 (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>
(cherry picked from commit 86a939d5fd93173949447337738fa0625803ec92)
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 e6f6c0af4e84..14bf1c3bf796 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; |