diff options
Diffstat (limited to 'sc/source/ui/vba/vbarange.cxx')
-rw-r--r-- | sc/source/ui/vba/vbarange.cxx | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 8527b04ad739..9fed6fb83aed 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -413,9 +413,9 @@ getDocShellFromRange( const uno::Reference< table::XCellRange >& xRange ) throw ScDocShell* getDocShellFromRanges( const uno::Reference< sheet::XSheetCellRangeContainer >& xRanges ) throw ( uno::RuntimeException ) { - // need the ScCellRangesBase to get docshell + // need the ScCellRangesBase to get docshell uno::Reference< uno::XInterface > xIf( xRanges ); - return getDocShellFromIf(xIf ); + return getDocShellFromIf(xIf ); } uno::Reference< frame::XModel > getModelFromXIf( const uno::Reference< uno::XInterface >& xIf ) throw ( uno::RuntimeException ) @@ -1493,9 +1493,9 @@ uno::Reference< XCollection >& ScVbaRange::getBorders() void ScVbaRange::visitArray( ArrayVisitor& visitor ) { - uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, uno::UNO_QUERY_THROW ); - sal_Int32 nRowCount = xColumnRowRange->getRows()->getCount(); - sal_Int32 nColCount = xColumnRowRange->getColumns()->getCount(); + table::CellRangeAddress aRangeAddr = lclGetRangeAddress( mxRange ); + sal_Int32 nRowCount = aRangeAddr.EndRow - aRangeAddr.StartRow + 1; + sal_Int32 nColCount = aRangeAddr.EndColumn - aRangeAddr.StartColumn + 1; for ( sal_Int32 i=0; i<nRowCount; ++i ) { for ( sal_Int32 j=0; j<nColCount; ++j ) @@ -3591,9 +3591,12 @@ ScVbaRange::End( ::sal_Int32 Direction ) throw (uno::RuntimeException) bool ScVbaRange::isSingleCellRange() { - uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, uno::UNO_QUERY); - if ( xColumnRowRange.is() && xColumnRowRange->getRows()->getCount() == 1 && xColumnRowRange->getColumns()->getCount() == 1 ) - return true; + uno::Reference< sheet::XCellRangeAddressable > xAddressable( mxRange, uno::UNO_QUERY ); + if ( xAddressable.is() ) + { + table::CellRangeAddress aRangeAddr = xAddressable->getRangeAddress(); + return ( aRangeAddr.EndColumn == aRangeAddr.StartColumn && aRangeAddr.EndRow == aRangeAddr.StartRow ); + } return false; } |