summaryrefslogtreecommitdiff
path: root/sc/source/ui/vba/vbarange.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/vba/vbarange.cxx')
-rw-r--r--sc/source/ui/vba/vbarange.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index fe8c9df928f1..659bff8bc42c 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -1569,6 +1569,29 @@ uno::Any SAL_CALL ScVbaRange::getName() throw (uno::RuntimeException)
return uno::makeAny( xName );
}
+void
+ScVbaRange::setName( const uno::Any& aName ) throw (uno::RuntimeException)
+{
+ uno::Reference< excel::XName > xName;
+
+ ScDocShell* pDocShell = getScDocShell();
+ uno::Reference< frame::XModel > xModel = pDocShell ? pDocShell->GetModel() : NULL;
+ if ( !xModel.is() )
+ {
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid document" )), uno::Reference< uno::XInterface >() );
+ }
+ uno::Reference< beans::XPropertySet > xPropertySet( xModel, uno::UNO_QUERY_THROW );
+ uno::Reference< sheet::XNamedRanges > xNamedRanges( xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"))) , uno::UNO_QUERY_THROW );
+
+ uno::Reference< excel::XNames > xNames( new ScVbaNames( uno::Reference< XHelperInterface >(), mxContext , xNamedRanges , xModel ) );
+
+ uno::Any aDummy;
+ //uno::Any aRefersTo;
+ // aRefersTo <<= uno::Reference< excel::XRange >(this, uno::UNO_QUERY);
+ xNames->Add(aName, getCellRange(), aDummy, aDummy, aDummy, aDummy,
+ aDummy, aDummy, aDummy, aDummy, aDummy);
+}
+
uno::Any
ScVbaRange::getValue( ValueGetter& valueGetter) throw (uno::RuntimeException)
{