summaryrefslogtreecommitdiff
path: root/scratch/sc-vba/vbaapplication.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'scratch/sc-vba/vbaapplication.cxx')
-rw-r--r--scratch/sc-vba/vbaapplication.cxx46
1 files changed, 2 insertions, 44 deletions
diff --git a/scratch/sc-vba/vbaapplication.cxx b/scratch/sc-vba/vbaapplication.cxx
index 841a5f1cc..b1f2e84a3 100644
--- a/scratch/sc-vba/vbaapplication.cxx
+++ b/scratch/sc-vba/vbaapplication.cxx
@@ -333,50 +333,8 @@ ScVbaApplication::wait( double time ) throw (css::uno::RuntimeException)
uno::Any SAL_CALL
ScVbaApplication::Range( const uno::Any& Cell1, const uno::Any& Cell2 ) throw (uno::RuntimeException)
{
- // Althought the documentation seems clear that Range without a
- // qualifier then its a shortcut for ActiveSheet.Range
- // however, similarly Application.Range is apparently also a
- // shortcut for ActiveSheet.Range
- // The is however a subtle behavioural difference I've come across
- // wrt to named ranges.
- // If a named range "test" exists { Sheet1!$A1 } and the active sheet
- // is Sheet2 then the following will fail
- // msgbox ActiveSheet.Range("test").Address ' failes
- // msgbox WorkSheets("Sheet2").Range("test").Address
- // but !!!
- // msgbox Range("test").Address ' works
- // msgbox Application.Range("test").Address ' works
-
- // Single param Range
- rtl::OUString sRangeName;
- Cell1 >>= sRangeName;
- if ( Cell1.hasValue() && !Cell2.hasValue() && sRangeName.getLength() )
- {
- const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
- uno::Reference< beans::XPropertySet > xPropSet( getCurrentDocument(), uno::UNO_QUERY_THROW );
-
- uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XCellRangeReferrer > xReferrer;
- try
- {
- xReferrer.set ( xNamed->getByName( sRangeName ), uno::UNO_QUERY );
- }
- catch( uno::Exception& e )
- {
- // do nothing
- }
- if ( xReferrer.is() )
- {
- uno::Reference< table::XCellRange > xRange = xReferrer->getReferredCells();
- if ( xRange.is() )
- {
- uno::Reference< vba::XRange > xVbRange = new ScVbaRange( m_xContext, xRange );
- return uno::makeAny( xVbRange );
- }
- }
- }
- uno::Reference< vba::XRange > xVbRange;
- return uno::makeAny( ScVbaRange::ApplicationRange( m_xContext, Cell1, Cell2 ) );
+ uno::Reference< vba::XRange > xVbRange = ScVbaRange::ApplicationRange( m_xContext, Cell1, Cell2 );
+ return uno::makeAny( xVbRange );
}
uno::Reference< vba::XWorksheet > SAL_CALL