summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorIvan Timofeev <timofeev.i.s@gmail.com>2011-10-08 22:25:09 +0400
committerIvan Timofeev <timofeev.i.s@gmail.com>2011-10-08 22:25:09 +0400
commite0ffea7232fe4bd52424b321562baa809686fb09 (patch)
tree41b0fd2ec3665e3c9417df248e5d5bff0d25fb2c /basctl
parent9cbc1c3253f1c7ac7507ec89ed879d157c809bb6 (diff)
migrate to StringRangeEnumerator in Basic
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/basicrenderable.cxx30
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 );