diff options
author | Ivan Timofeev <timofeev.i.s@gmail.com> | 2011-10-08 22:25:09 +0400 |
---|---|---|
committer | Ivan Timofeev <timofeev.i.s@gmail.com> | 2011-10-08 22:25:09 +0400 |
commit | e0ffea7232fe4bd52424b321562baa809686fb09 (patch) | |
tree | 41b0fd2ec3665e3c9417df248e5d5bff0d25fb2c /basctl | |
parent | no need to return size_t instead of sal_Int32 (diff) | |
download | core-e0ffea7232fe4bd52424b321562baa809686fb09.tar.gz core-e0ffea7232fe4bd52424b321562baa809686fb09.zip |
migrate to StringRangeEnumerator in Basic
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/basicrenderable.cxx | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/basctl/source/basicide/basicrenderable.cxx b/basctl/source/basicide/basicrenderable.cxx index 16712383ab3d..b3e787dda46c 100644 --- a/basctl/source/basicide/basicrenderable.cxx +++ b/basctl/source/basicide/basicrenderable.cxx @@ -121,10 +121,13 @@ sal_Int32 SAL_CALL BasicRenderable::getRendererCount ( if( nContent == 1 ) { rtl::OUString aPageRange( getStringValue( "PageRange" ) ); - MultiSelection aSel( aPageRange ); - long nSelCount = aSel.GetSelectCount(); - if( nSelCount >= 0 && nSelCount < nCount ) - nCount = nSelCount; + if( aPageRange.getLength() ) + { + StringRangeEnumerator aRangeEnum( aPageRange, 0, nCount-1 ); + sal_Int32 nSelCount = aRangeEnum.size(); + if( nSelCount >= 0 ) + nCount = nSelCount; + } } } else @@ -177,12 +180,19 @@ void SAL_CALL BasicRenderable::render ( if( nContent == 1 ) { rtl::OUString aPageRange( getStringValue( "PageRange" ) ); - MultiSelection aSel( aPageRange ); - long nSelect = aSel.FirstSelected(); - while( nSelect != long(SFX_ENDOFSELECTION) && nRenderer-- ) - nSelect = aSel.NextSelected(); - if( nSelect != long(SFX_ENDOFSELECTION) ) - mpWindow->printPage( sal_Int32(nSelect-1), pPrinter ); + if( aPageRange.getLength() ) + { + sal_Int32 nPageCount = mpWindow->countPages( pPrinter ); + StringRangeEnumerator aRangeEnum( aPageRange, 0, nPageCount-1 ); + StringRangeEnumerator::Iterator it = aRangeEnum.begin(); + for( ; it != aRangeEnum.end() && nRenderer; --nRenderer ) + ++it; + + sal_Int32 nPage = ( it != aRangeEnum.end() ) ? *it : nRenderer; + mpWindow->printPage( nPage, pPrinter ); + } + else + mpWindow->printPage( nRenderer, pPrinter ); } else mpWindow->printPage( nRenderer, pPrinter ); |