always explicitly handle empty string of ranges

This commit is contained in:
Ivan Timofeev 2011-10-23 21:35:00 +04:00
parent 3d5caa7ce3
commit a47a5ed0a5
3 changed files with 4 additions and 14 deletions

View file

@ -1584,13 +1584,15 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
rValidPagesSet.clear();
rValidStartFrms.clear();
rtl::OUString aPageRange = rOptions.getStringValue( "PageRange", rtl::OUString() );
rtl::OUString aPageRange;
// PageContent :
// 0 -> print all pages (default if aPageRange is empty)
// 1 -> print range according to PageRange
// 2 -> print selection
const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 );
if (0 == nContent)
if (nContent == 1)
aPageRange = rOptions.getStringValue( "PageRange", rtl::OUString() );
if (aPageRange.getLength() == 0) // empty string -> print all
{
// set page range to print to 'all pages'
aPageRange = OUString::valueOf( (sal_Int32)1 );

View file

@ -191,8 +191,6 @@ public:
- the string "-" means the sequence i_nMinNumber to i_nMaxNumber
- single number that doesn't fit in [i_nMinNumber,i_nMaxNumber] will be ignored
- range that doesn't fit in [i_nMinNumber,i_nMaxNumber] will be adjusted
- an empty string as input is valid and will result in the range [min,max] if given
or an empty vector, if not
*/
static bool getRangesFromString( const rtl::OUString& i_rPageRange,
std::vector< sal_Int32 >& o_rPageVector,

View file

@ -831,16 +831,6 @@ bool StringRangeEnumerator::setRange( const rtl::OUString& i_rNewRange, bool i_b
mnCount = 0;
maSequence.clear();
// we love special cases
if( i_rNewRange.getLength() == 0 )
{
if( mnMin >= 0 && mnMax >= 0 )
{
insertRange( mnMin, mnMax, mnMin != mnMax, ! i_bStrict );
}
return true;
}
const sal_Unicode* pInput = i_rNewRange.getStr();
rtl::OUStringBuffer aNumberBuf( 16 );
std::vector< sal_Int32 > aNumbers;