You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by le...@apache.org on 2012/10/11 05:39:31 UTC

svn commit: r1396896 - in /incubator/ooo/trunk/main: sc/inc/chartuno.hxx sc/source/ui/unoobj/chartuno.cxx sc/source/ui/vba/vbachartobject.cxx sc/source/ui/vba/vbachartobject.hxx udkapi/com/sun/star/container/XNamed.idl

Author: leiw
Date: Thu Oct 11 03:39:30 2012
New Revision: 1396896

URL: http://svn.apache.org/viewvc?rev=1396896&view=rev
Log:
#i121178 Chart name in Excel is different with the name in AOO 

          Patch by: Clarence GUO
          Review by: Wang Lei

Modified:
    incubator/ooo/trunk/main/sc/inc/chartuno.hxx
    incubator/ooo/trunk/main/sc/source/ui/unoobj/chartuno.cxx
    incubator/ooo/trunk/main/sc/source/ui/vba/vbachartobject.cxx
    incubator/ooo/trunk/main/sc/source/ui/vba/vbachartobject.hxx
    incubator/ooo/trunk/main/udkapi/com/sun/star/container/XNamed.idl

Modified: incubator/ooo/trunk/main/sc/inc/chartuno.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/inc/chartuno.hxx?rev=1396896&r1=1396895&r2=1396896&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/inc/chartuno.hxx (original)
+++ incubator/ooo/trunk/main/sc/inc/chartuno.hxx Thu Oct 11 03:39:30 2012
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef SC_CHARTUNO_HXX
 #define SC_CHARTUNO_HXX
 
@@ -36,7 +34,7 @@
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/container/XEnumerationAccess.hpp>
 #include <com/sun/star/container/XIndexAccess.hpp>
-#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XNamedEx.hpp>
 #include <cppuhelper/compbase4.hxx>
 #include <cppuhelper/implbase4.hxx>
 
@@ -115,7 +113,7 @@ public:
 typedef ::cppu::WeakComponentImplHelper4<
     ::com::sun::star::table::XTableChart,
     ::com::sun::star::document::XEmbeddedObjectSupplier,
-    ::com::sun::star::container::XNamed,
+    ::com::sun::star::container::XNamedEx,  // #i121178#: support displaying name
     ::com::sun::star::lang::XServiceInfo > ScChartObj_Base;
 
 typedef ::comphelper::OPropertyContainer ScChartObj_PBase;
@@ -131,6 +129,7 @@ private:
 	ScDocShell*				pDocShell;
 	SCTAB					nTab;			// Charts sind pro Sheet
 	String					aChartName;
+	String					aObjectName;    // #i121178#: the OLE object's name(displaying name)
 
 	void	Update_Impl( const ScRangeListRef& rRanges, bool bColHeaders, bool bRowHeaders );
 	void	GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool& rRowHeaders ) const;
@@ -183,6 +182,11 @@ public:
 	virtual void SAL_CALL	setName( const ::rtl::OUString& aName )
 								throw(::com::sun::star::uno::RuntimeException);
 
+							// 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);
+
 							// XServiceInfo
 	virtual ::rtl::OUString SAL_CALL getImplementationName()
 								throw(::com::sun::star::uno::RuntimeException);

Modified: incubator/ooo/trunk/main/sc/source/ui/unoobj/chartuno.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/ui/unoobj/chartuno.cxx?rev=1396896&r1=1396895&r2=1396896&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/ui/unoobj/chartuno.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/ui/unoobj/chartuno.cxx Thu Oct 11 03:39:30 2012
@@ -19,12 +19,9 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sc.hxx"
 
-
 #include <com/sun/star/embed/Aspects.hpp>
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -460,8 +457,10 @@ ScChartObj::ScChartObj(ScDocShell* pDocS
 	,nTab( nT )
 	,aChartName( rN )
 {
-	pDocShell->GetDocument()->AddUnoObject(*this);
-
+    pDocShell->GetDocument()->AddUnoObject(*this);
+    SdrOle2Obj* pObject = lcl_FindChartObj( pDocShell, nTab, aChartName );
+    if ( pObject && svt::EmbeddedObjectRef::TryRunningState( pObject->GetObjRef() ) )
+        aObjectName = pObject->GetName();   // #i121178#: keep the OLE object's name
     uno::Sequence< table::CellRangeAddress > aInitialPropValue;
     registerPropertyNoMember( ::rtl::OUString::createFromAscii( "RelatedCellRanges" ),
         PROP_HANDLE_RELATED_CELLRANGES, beans::PropertyAttribute::MAYBEVOID,
@@ -801,6 +800,20 @@ void SAL_CALL ScChartObj::setName( const
 	throw uno::RuntimeException();		// name cannot be changed
 }
 
+// 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;
+}
+
 // XPropertySet
 
 uno::Reference< beans::XPropertySetInfo > ScChartObj::getPropertySetInfo() throw (uno::RuntimeException)

Modified: incubator/ooo/trunk/main/sc/source/ui/vba/vbachartobject.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/ui/vba/vbachartobject.cxx?rev=1396896&r1=1396895&r2=1396896&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/ui/vba/vbachartobject.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/ui/vba/vbachartobject.cxx Thu Oct 11 03:39:30 2012
@@ -19,7 +19,6 @@
  * 
  *************************************************************/
 
-
 #include "vbachart.hxx"
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
@@ -37,13 +36,15 @@ const rtl::OUString PERSIST_NAME( RTL_CO
 
 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's name(displaying name)
+//    setName(sPersistName);
+    setName(xNamed->getDisplayName());
+    oShapeHelper.reset(new ShapeHelper(xShape));
 }
 
 rtl::OUString ScVbaChartObject::getPersistName()
@@ -88,7 +89,6 @@ ScVbaChartObject::setName( const rtl::OU
 	xNamedShape->setName(sName);
 }
 
-
 ::rtl::OUString SAL_CALL 
 ScVbaChartObject::getName() throw (css::uno::RuntimeException)
 {

Modified: incubator/ooo/trunk/main/sc/source/ui/vba/vbachartobject.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/ui/vba/vbachartobject.hxx?rev=1396896&r1=1396895&r2=1396896&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/ui/vba/vbachartobject.hxx (original)
+++ incubator/ooo/trunk/main/sc/source/ui/vba/vbachartobject.hxx Thu Oct 11 03:39:30 2012
@@ -19,14 +19,13 @@
  * 
  *************************************************************/
 
-
 #ifndef SC_VBA_CHARTOBJECT_HXX
 #define SC_VBA_CHARTOBJECT_HXX
 #include <cppuhelper/implbase1.hxx>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/table/XTableChart.hpp>
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XNamedEx.hpp>
 #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
 #include <ooo/vba/excel/XChartObject.hpp>
 #include <vbahelper/vbahelperinterface.hxx>
@@ -36,14 +35,13 @@ typedef InheritedHelperInterfaceImpl1<ov
 
 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;
+	css::uno::Reference< css::container::XNamedEx > xNamed;
 	rtl::OUString sPersistName;
 	std::auto_ptr<ov::ShapeHelper> oShapeHelper;
 	css::uno::Reference< css::container::XNamed > xNamedShape;

Modified: incubator/ooo/trunk/main/udkapi/com/sun/star/container/XNamed.idl
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/udkapi/com/sun/star/container/XNamed.idl?rev=1396896&r1=1396895&r2=1396896&view=diff
==============================================================================
--- incubator/ooo/trunk/main/udkapi/com/sun/star/container/XNamed.idl (original)
+++ incubator/ooo/trunk/main/udkapi/com/sun/star/container/XNamed.idl Thu Oct 11 03:39:30 2012
@@ -56,6 +56,27 @@ published interface XNamed: com::sun::st
  
 //============================================================================= 
  
+/** specifies the display name of the object.
+	
+	<p>The name is generally unique in the container of the object.</p>
+ */
+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