diff options
-rw-r--r-- | oovbaapi/ooo/vba/excel/XRange.idl | 2 | ||||
-rw-r--r-- | sc/source/ui/vba/vbarange.cxx | 23 | ||||
-rw-r--r-- | sc/source/ui/vba/vbarange.hxx | 1 |
3 files changed, 25 insertions, 1 deletions
diff --git a/oovbaapi/ooo/vba/excel/XRange.idl b/oovbaapi/ooo/vba/excel/XRange.idl index 62a0994beb68..015c68c9c90d 100644 --- a/oovbaapi/ooo/vba/excel/XRange.idl +++ b/oovbaapi/ooo/vba/excel/XRange.idl @@ -64,7 +64,7 @@ interface XRange interface ::ooo::vba::excel::XFormat; //interface ::ooo::vba::XHelperInterface; - [attribute, readonly] any Name; + [attribute] any Name; [attribute] any Value; [attribute] any Formula; [attribute] any FormulaArray; 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) { diff --git a/sc/source/ui/vba/vbarange.hxx b/sc/source/ui/vba/vbarange.hxx index db4e49d3bf0b..26f639f10b4e 100644 --- a/sc/source/ui/vba/vbarange.hxx +++ b/sc/source/ui/vba/vbarange.hxx @@ -167,6 +167,7 @@ public: // Attributes virtual css::uno::Any SAL_CALL getName() throw (css::uno::RuntimeException); + virtual void SAL_CALL setName( const css::uno::Any& aName ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); virtual void SAL_CALL setValue( const css::uno::Any& aValue ) throw ( css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getFormula() throw (css::uno::RuntimeException); |