ooo-build r13687 - in trunk: . patches/vba



Author: pflin
Date: Wed Aug 27 03:40:49 2008
New Revision: 13687
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13687&view=rev

Log:
2008-08-27  Fong Lin  <pflin novell com>
	* patches/vba/basic-ide-module-object-name-combile.diff: tweak to get
	sheet name in basctl directly.



Modified:
   trunk/ChangeLog
   trunk/patches/vba/basic-ide-module-object-name-combile.diff

Modified: trunk/patches/vba/basic-ide-module-object-name-combile.diff
==============================================================================
--- trunk/patches/vba/basic-ide-module-object-name-combile.diff	(original)
+++ trunk/patches/vba/basic-ide-module-object-name-combile.diff	Wed Aug 27 03:40:49 2008
@@ -1,5 +1,5 @@
---- ../ooo300-m3.bak/oovbaapi/org/openoffice/excel/XWorksheet.idl	2008-08-21 15:26:00.000000000 +0800
-+++ oovbaapi/org/openoffice/excel/XWorksheet.idl	2008-08-23 16:09:13.000000000 +0800
+--- oovbaapi/org/openoffice/excel/XWorksheet.idl.orig	2008-08-27 11:22:16.000000000 +0800
++++ oovbaapi/org/openoffice/excel/XWorksheet.idl	2008-08-27 11:22:34.000000000 +0800
 @@ -42,6 +42,9 @@
  #include <com/sun/star/script/XInvocation.idl>
  #endif
@@ -10,19 +10,18 @@
  //=============================================================================
  
  module org {  module openoffice {  module excel { 
-@@ -57,8 +60,9 @@ interface XWorksheet
+@@ -57,8 +60,8 @@ interface XWorksheet
  {
  	interface ::org::openoffice::vba::XHelperInterface;
  	interface ::com::sun::star::script::XInvocation;
 +	interface ::com::sun::star::container::XNamed;
  
 -	[attribute] string Name;
-+//	[attribute] string Name;
  	[attribute] boolean Visible; 
  	[attribute, readonly] long StandardHeight;
  	[attribute, readonly] long StandardWidth;
---- ../ooo300-m3.bak/sc/source/ui/vba/vbaworksheet.hxx	2008-08-21 15:26:00.000000000 +0800
-+++ sc/source/ui/vba/vbaworksheet.hxx	2008-08-23 15:44:48.000000000 +0800
+--- sc/source/ui/vba/vbaworksheet.hxx.orig	2008-08-27 11:22:16.000000000 +0800
++++ sc/source/ui/vba/vbaworksheet.hxx	2008-08-27 11:22:23.000000000 +0800
 @@ -45,6 +45,7 @@
  #include <org/openoffice/excel/XPageSetup.hpp>
  #include <org/openoffice/excel/XHPageBreaks.hpp>
@@ -31,90 +30,64 @@
  
  #include "vbahelperinterface.hxx"
  
---- ../ooo300-m3.bak/basic/inc/basic/sbobjmod.hxx	2008-08-21 15:25:58.000000000 +0800
-+++ basic/inc/basic/sbobjmod.hxx	2008-08-23 16:10:54.000000000 +0800
-@@ -56,6 +56,7 @@ public:
-     SbObjModule( const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible );
-     virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
-     SbxVariable* GetObject();
-+	const String GetObjectName();
- };
- 
- class SbUserFormModule : public SbObjModule
---- ../ooo300-m3.bak/basic/source/classes/sbxmod.cxx	2008-08-21 15:26:00.000000000 +0800
-+++ basic/source/classes/sbxmod.cxx	2008-08-23 16:48:45.000000000 +0800
-@@ -53,6 +53,7 @@
- #include <vos/mutex.hxx>
- #include <basic/sbobjmod.hxx>
- #include <com/sun/star/lang/XServiceInfo.hpp>
+--- basctl/source/basicide/basides2.cxx.orig	2008-08-27 10:28:31.000000000 +0800
++++ basctl/source/basicide/basides2.cxx	2008-08-27 11:16:56.000000000 +0800
+@@ -55,11 +55,32 @@
+ #include <tools/diagnose_ex.h>
+ #include <sfx2/sfxdefs.hxx>
+ #include <sfx2/signaturestate.hxx>
++#include <com/sun/star/script/ModuleInfo.hpp>
++#include <com/sun/star/container/XNameContainer.hpp>
 +#include <com/sun/star/container/XNamed.hpp>
++#include <com/sun/star/lang/XServiceInfo.hpp>
  
- // for the bsearch
- #ifdef WNT
-@@ -2260,6 +2261,21 @@ SbObjModule::GetObject() 
- {
-     return pDocObject;
- }
-+
-+const String SbObjModule::GetObjectName()
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+ namespace css = ::com::sun::star;
+ 
++void lcl_getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName )
 +{
-+	String sName;
-+	SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject, (SbxObject*)pDocObject);
-+	if( pUnoObj )
++	uno::Any aElement( rLib->getByName( rModName ) );
++	script::ModuleInfo aModuleInfo;
++	if( aElement >>= aModuleInfo )
 +	{
-+		com::sun::star::uno::Reference< com::sun::star::container::XNamed > xNamed ( pUnoObj->getUnoAny(), com::sun::star::uno::UNO_QUERY_THROW );
-+		if( xNamed.is() )
-+			sName = xNamed->getName();
-+	}
-+	OSL_TRACE(" SbObjModule:GetObjectName: %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr());
-+	return sName;
++		uno::Any aObject( aModuleInfo.ModuleObject );
++		uno::Reference< lang::XServiceInfo > xServiceInfo( aObject, uno::UNO_QUERY );
++		if( xServiceInfo.is() && xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Worksheet" ) ) )
++		{
++			uno::Reference< container::XNamed > xNamed( aObject, uno::UNO_QUERY );
++			if( xNamed.is() )
++				rObjName = xNamed->getName();
++		}
++	}	
 +}
 +
- SbxVariable*
- SbObjModule::Find( const XubString& rName, SbxClassType t )
+ IMPL_LINK_INLINE_START( BasicIDEShell, ObjectDialogCancelHdl, ObjectCatalog *, EMPTYARG )
  {
---- ../ooo300-m3.bak/basic/prj/d.lst	2007-05-11 19:42:43.000000000 +0800
-+++ basic/prj/d.lst	2008-08-21 17:18:21.000000000 +0800
-@@ -27,6 +27,7 @@ mkdir: %_DEST%\inc%_EXT%\basic
- 
- ..\inc\basic\sbdef.hxx %_DEST%\inc%_EXT%\basic\sbdef.hxx
- ..\inc\basic\sbmod.hxx %_DEST%\inc%_EXT%\basic\sbmod.hxx
-+..\inc\basic\sbobjmod.hxx %_DEST%\inc%_EXT%\basic\sbobjmod.hxx
- ..\inc\basic\sbjsmod.hxx %_DEST%\inc%_EXT%\basic\sbjsmod.hxx
- ..\inc\basic\sbmeth.hxx %_DEST%\inc%_EXT%\basic\sbmeth.hxx
- ..\inc\basic\sbprop.hxx %_DEST%\inc%_EXT%\basic\sbprop.hxx
---- ../ooo300-m3.bak/basctl/source/basicide/basides2.cxx	2008-08-21 15:25:58.000000000 +0800
-+++ basctl/source/basicide/basides2.cxx	2008-08-24 18:14:46.000000000 +0800
-@@ -55,6 +55,7 @@
- #include <tools/diagnose_ex.h>
- #include <sfx2/sfxdefs.hxx>
- #include <sfx2/signaturestate.hxx>
-+#include <basic/sbobjmod.hxx>
- 
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-@@ -272,7 +273,28 @@ ModulWindow* BasicIDEShell::CreateBasWin
+ 	ShowObjectDialog( FALSE, TRUE );
+@@ -232,7 +253,7 @@ ModulWindow* BasicIDEShell::CreateBasWin
+     if ( !aLibName.Len() )
+         aLibName = String::CreateFromAscii( "Standard" );
+ 
+-    rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
++    uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
+ 
+ 	if ( !aModName.Len() )
+         aModName = rDocument.createObjectName( E_SCRIPTS, aLibName );
+@@ -272,7 +293,20 @@ ModulWindow* BasicIDEShell::CreateBasWin
  		DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" );
  	}
      if( nKey )
 +	{
-+		BasicManager* pBasMgr = rDocument.getBasicManager();
-+		if( pBasMgr )
++		if( xLib.is() )
 +		{
 +			// display a nice friendly name in the ObjectModule tab,
 +			// combining the objectname and module name, e.g. Sheet1 ( Financials )
-+			StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
-+			if( pBasic )
++			String sObjName;
++			lcl_getObjectName( xLib, rModName, sObjName );
++			if( sObjName.Len() )
 +			{
-+				SbModule* pModule = (SbModule*)pBasic->FindModule( aModName );
-+				if( pModule && ( pModule->ISA( SbObjModule )) && ( pModule->GetClassName().EqualsIgnoreCaseAscii("Worksheet") ))
-+				{
-+					String sObjName = ((SbObjModule*)pModule)->GetObjectName();
-+					if( sObjName.Len() )
-+					{
-+						aModName.AppendAscii(" ( ").Append(sObjName).AppendAscii(" )");
-+					}
-+				}
++				aModName.AppendAscii(" ( ").Append(sObjName).AppendAscii(" )");
 +			}
 +		}
  	    pTabBar->InsertPage( (USHORT)nKey, aModName );



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]