Index: sc/inc/chartuno.hxx =================================================================== --- sc/inc/chartuno.hxx (revision 1395456) +++ sc/inc/chartuno.hxx (working copy) @@ -19,8 +19,6 @@ * *************************************************************/ - - #ifndef SC_CHARTUNO_HXX #define SC_CHARTUNO_HXX @@ -36,7 +34,10 @@ #include #include #include -#include +//-> #i121178# +//#include +#include +//<- #i121178# #include #include @@ -115,7 +116,10 @@ typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::table::XTableChart, ::com::sun::star::document::XEmbeddedObjectSupplier, - ::com::sun::star::container::XNamed, +//-> #i121178# +// ::com::sun::star::container::XNamed, + ::com::sun::star::container::XNamedEx, +//<- #i121178# ::com::sun::star::lang::XServiceInfo > ScChartObj_Base; typedef ::comphelper::OPropertyContainer ScChartObj_PBase; @@ -131,6 +135,7 @@ ScDocShell* pDocShell; SCTAB nTab; // Charts sind pro Sheet String aChartName; + String aObjectName; // #i121178# void Update_Impl( const ScRangeListRef& rRanges, bool bColHeaders, bool bRowHeaders ); void GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool& rRowHeaders ) const; @@ -182,7 +187,12 @@ virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); - +//-> #i121178# + // XNamedEx + virtual ::rtl::OUString SAL_CALL getDisplayName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDisplayName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); +//<- #i121178# // XServiceInfo virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); Index: sc/source/ui/unoobj/chartuno.cxx =================================================================== --- sc/source/ui/unoobj/chartuno.cxx (revision 1395456) +++ sc/source/ui/unoobj/chartuno.cxx (working copy) @@ -460,8 +460,12 @@ ,nTab( nT ) ,aChartName( rN ) { - pDocShell->GetDocument()->AddUnoObject(*this); - + pDocShell->GetDocument()->AddUnoObject(*this); +//-> #i121178# + SdrOle2Obj* pObject = lcl_FindChartObj( pDocShell, nTab, aChartName ); + if ( pObject && svt::EmbeddedObjectRef::TryRunningState( pObject->GetObjRef() ) ) + aObjectName = pObject->GetName(); +//<- #i121178# uno::Sequence< table::CellRangeAddress > aInitialPropValue; registerPropertyNoMember( ::rtl::OUString::createFromAscii( "RelatedCellRanges" ), PROP_HANDLE_RELATED_CELLRANGES, beans::PropertyAttribute::MAYBEVOID, @@ -801,6 +805,22 @@ throw uno::RuntimeException(); // name cannot be changed } +//-> #i121178# +// XNamedEx + +rtl::OUString SAL_CALL ScChartObj::getDisplayName() throw(uno::RuntimeException) +{ + ScUnoGuard aGuard; + return aObjectName; +} + +void SAL_CALL ScChartObj::setDisplayName( const rtl::OUString& aName ) throw(uno::RuntimeException) +{ + ScUnoGuard aGuard; + aObjectName = aName; +} +//<- #i121178# + // XPropertySet uno::Reference< beans::XPropertySetInfo > ScChartObj::getPropertySetInfo() throw (uno::RuntimeException) Index: sc/source/ui/vba/vbachartobject.cxx =================================================================== --- sc/source/ui/vba/vbachartobject.cxx (revision 1395456) +++ sc/source/ui/vba/vbachartobject.cxx (working copy) @@ -37,13 +37,16 @@ ScVbaChartObject::ScVbaChartObject( const css::uno::Reference< ov::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::table::XTableChart >& _xTableChart, const css::uno::Reference< css::drawing::XDrawPageSupplier >& _xDrawPageSupplier ) : ChartObjectImpl_BASE( _xParent, _xContext ), xTableChart( _xTableChart ), xDrawPageSupplier( _xDrawPageSupplier ) { - xDrawPage = xDrawPageSupplier->getDrawPage(); - xEmbeddedObjectSupplier.set( xTableChart, uno::UNO_QUERY_THROW ); - xNamed.set( xTableChart, uno::UNO_QUERY_THROW ); - sPersistName = getPersistName(); - xShape = setShape(); - setName(sPersistName); - oShapeHelper.reset(new ShapeHelper(xShape)); + xDrawPage = xDrawPageSupplier->getDrawPage(); + xEmbeddedObjectSupplier.set( xTableChart, uno::UNO_QUERY_THROW ); + xNamed.set( xTableChart, uno::UNO_QUERY_THROW ); + sPersistName = getPersistName(); + xShape = setShape(); +//-> #i121178#: don't set the persist name to the object but the OLE object name +// setName(sPersistName); + setName( xNamed->getDisplayName() ); +//<- #i121178# + oShapeHelper.reset(new ShapeHelper(xShape)); } rtl::OUString ScVbaChartObject::getPersistName() @@ -88,7 +91,6 @@ xNamedShape->setName(sName); } - ::rtl::OUString SAL_CALL ScVbaChartObject::getName() throw (css::uno::RuntimeException) { Index: sc/source/ui/vba/vbachartobject.hxx =================================================================== --- sc/source/ui/vba/vbachartobject.hxx (revision 1395456) +++ sc/source/ui/vba/vbachartobject.hxx (working copy) @@ -27,6 +27,7 @@ #include #include #include +#include // #i121178# #include #include #include @@ -36,14 +37,16 @@ class ScVbaChartObject : public ChartObjectImpl_BASE { - css::uno::Reference< css::table::XTableChart > xTableChart; css::uno::Reference< css::document::XEmbeddedObjectSupplier > xEmbeddedObjectSupplier; css::uno::Reference< css::beans::XPropertySet > xPropertySet; css::uno::Reference< css::drawing::XDrawPageSupplier > xDrawPageSupplier; css::uno::Reference< css::drawing::XDrawPage > xDrawPage; css::uno::Reference< css::drawing::XShape > xShape; - css::uno::Reference< css::container::XNamed > xNamed; +//-> #i121178# +// css::uno::Reference< css::container::XNamed > xNamed; + css::uno::Reference< css::container::XNamedEx > xNamed; +//<- #i121178# rtl::OUString sPersistName; std::auto_ptr oShapeHelper; css::uno::Reference< css::container::XNamed > xNamedShape; Index: udkapi/com/sun/star/container/XNamed.idl =================================================================== --- udkapi/com/sun/star/container/XNamed.idl (revision 1384195) +++ udkapi/com/sun/star/container/XNamed.idl (working copy) @@ -56,6 +56,27 @@ //============================================================================= +/** specifies the display name of the object. + +

The name is generally unique in the container of the object.

+ */ +published interface XNamedEx: XNamed +{ + //------------------------------------------------------------------------- + + /** @returns + the display name of the object. + */ + string getDisplayName(); + + //------------------------------------------------------------------------- + + /** sets the display name of the object. + */ + [oneway] void setDisplayName( [in] string aName ); + +}; + }; }; }; }; #endif