ooo-build r14097 - in trunk: . patches/vba
- From: pflin svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r14097 - in trunk: . patches/vba
- Date: Fri, 26 Sep 2008 07:41:37 +0000 (UTC)
Author: pflin
Date: Fri Sep 26 07:41:36 2008
New Revision: 14097
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14097&view=rev
Log:
2008-09-26 Fong Lin <pflin novell com>
* patches/vba/vba-basic-macrochoose-dialog.diff: display the object
modules name like "Sheet1 (Example1)" . Fixed some issues.
Modified:
trunk/ChangeLog
trunk/patches/vba/vba-basic-macrochoose-dialog.diff
Modified: trunk/patches/vba/vba-basic-macrochoose-dialog.diff
==============================================================================
--- trunk/patches/vba/vba-basic-macrochoose-dialog.diff (original)
+++ trunk/patches/vba/vba-basic-macrochoose-dialog.diff Fri Sep 26 07:41:36 2008
@@ -1,6 +1,6 @@
diff -urp basicide.bk/baside2.cxx basctl/source/basicide/baside2.cxx
--- basicide.bk/baside2.cxx 2008-09-22 11:33:04.000000000 +0800
-+++ basctl/source/basicide/baside2.cxx 2008-09-25 14:56:46.000000000 +0800
++++ basctl/source/basicide/baside2.cxx 2008-09-26 15:28:36.000000000 +0800
@@ -49,6 +49,7 @@
#include <com/sun/star/script/XLibraryContainer2.hpp>
#endif
@@ -9,19 +9,41 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <sfx2/docfile.hxx>
#include <basic/basrdll.hxx>
-@@ -1347,7 +1348,26 @@ BasicEntryDescriptor ModulWindow::Create
+@@ -110,6 +111,8 @@ DBG_NAME( ModulWindow )
+
+ TYPEINIT1( ModulWindow , IDEBaseWindow );
+
++void lcl_getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName );
++
+ void lcl_PrintHeader( Printer* pPrinter, USHORT nPages, USHORT nCurPage, const String& rTitle )
+ {
+ short nLeftMargin = LMARGPRN;
+@@ -1347,7 +1350,39 @@ BasicEntryDescriptor ModulWindow::Create
ScriptDocument aDocument( GetDocument() );
String aLibName( GetLibName() );
LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
- return BasicEntryDescriptor( aDocument, eLocation, aLibName, GetName(), OBJ_TYPE_MODULE );
++ String aModName( GetName() );
+ String aLibSubName;
+ if( xBasic.Is() && xBasic->isVBAEnabled() && xModule.Is() )
+ {
+ switch( xModule->GetModuleType() )
+ {
+ case script::ModuleType::Document:
++ {
+ aLibSubName = String::CreateFromAscii("Document Objects");
++ uno::Reference< container::XNameContainer > xLib = aDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
++ if( xLib.is() )
++ {
++ String sObjName;
++ lcl_getObjectName( xLib, aModName, sObjName );
++ if( sObjName.Len() )
++ {
++ aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
++ }
++ }
+ break;
++ }
+ case script::ModuleType::Form:
+ aLibSubName = String::CreateFromAscii("Forms");
+ break;
@@ -33,7 +55,7 @@
+ break;
+ }
+ }
-+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, GetName(), OBJ_TYPE_MODULE );
++ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aModName, OBJ_TYPE_MODULE );
}
void ModulWindow::SetReadOnly( BOOL b )
@@ -53,13 +75,15 @@
void DialogWindow::SetReadOnly( BOOL b )
diff -urp basicide.bk/bastype2.cxx basctl/source/basicide/bastype2.cxx
--- basicide.bk/bastype2.cxx 2008-09-22 11:33:04.000000000 +0800
-+++ basctl/source/basicide/bastype2.cxx 2008-09-25 15:51:18.000000000 +0800
-@@ -53,10 +53,25 @@
++++ basctl/source/basicide/bastype2.cxx 2008-09-26 15:07:53.000000000 +0800
+@@ -53,10 +53,30 @@
#include <com/sun/star/frame/XModuleManager.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/componentcontext.hxx>
+#include <map>
+#include <com/sun/star/script/ModuleType.hpp>
++#include <com/sun/star/script/ModuleInfo.hpp>
++#include <com/sun/star/container/XNameContainer.hpp>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
@@ -69,18 +93,21 @@
+static const rtl::OUString sModules( rtl::OUString::createFromAscii("Modules") );
+static const rtl::OUString sClassModules( rtl::OUString::createFromAscii("Class Modules") );
+
-+sal_Int32 lcl_getModuleType( StarBASIC* pBasic, const String& rName )
++void lcl_getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName );
++
++sal_Int32 lcl_getModuleType( const uno::Reference< container::XNameContainer >& rLib, const String& rModName )
+{
+ sal_Int32 nType = com::sun::star::script::ModuleType::Unknown;
-+ SbModule* pModule = (SbModule*)pBasic->FindModule( rName );
-+ if( pModule )
-+ nType = pModule->GetModuleType();
++ uno::Any aElement( rLib->getByName( rModName ) );
++ script::ModuleInfo aModuleInfo;
++ if( aElement >>= aModuleInfo )
++ nType = aModuleInfo.ModuleType;
+ return nType;
+}
BasicEntry::~BasicEntry()
{
-@@ -91,20 +106,22 @@ BasicEntryDescriptor::BasicEntryDescript
+@@ -91,20 +111,22 @@ BasicEntryDescriptor::BasicEntryDescript
{
}
@@ -105,7 +132,7 @@
,m_aName( rName )
,m_aMethodName( rMethodName )
,m_eType( eType )
-@@ -120,6 +137,7 @@ BasicEntryDescriptor::BasicEntryDescript
+@@ -120,6 +142,7 @@ BasicEntryDescriptor::BasicEntryDescript
:m_aDocument( rDesc.m_aDocument )
,m_eLocation( rDesc.m_eLocation )
,m_aLibName( rDesc.m_aLibName )
@@ -113,7 +140,7 @@
,m_aName( rDesc.m_aName )
,m_aMethodName( rDesc.m_aMethodName )
,m_eType( rDesc.m_eType )
-@@ -131,6 +149,7 @@ BasicEntryDescriptor& BasicEntryDescript
+@@ -131,6 +154,7 @@ BasicEntryDescriptor& BasicEntryDescript
m_aDocument = rDesc.m_aDocument;
m_eLocation = rDesc.m_eLocation;
m_aLibName = rDesc.m_aLibName;
@@ -121,7 +148,7 @@
m_aName = rDesc.m_aName;
m_aMethodName = rDesc.m_aMethodName;
m_eType = rDesc.m_eType;
-@@ -143,6 +162,7 @@ bool BasicEntryDescriptor::operator==( c
+@@ -143,6 +167,7 @@ bool BasicEntryDescriptor::operator==( c
return m_aDocument == rDesc.m_aDocument &&
m_eLocation == rDesc.m_eLocation &&
m_aLibName == rDesc.m_aLibName &&
@@ -129,7 +156,7 @@
m_aName == rDesc.m_aName &&
m_aMethodName == rDesc.m_aMethodName &&
m_eType == rDesc.m_eType;
-@@ -286,50 +306,58 @@ void BasicTreeListBox::ImpCreateLibSubEn
+@@ -286,50 +311,58 @@ void BasicTreeListBox::ImpCreateLibSubEn
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryLoaded( aOULibName ) )
{
try
@@ -230,7 +257,7 @@
}
}
-@@ -368,6 +396,129 @@ void BasicTreeListBox::ImpCreateLibSubEn
+@@ -368,6 +401,139 @@ void BasicTreeListBox::ImpCreateLibSubEn
}
}
@@ -268,10 +295,8 @@
+
+void BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName )
+{
-+ BasicManager* pBasMgr = rDocument.getBasicManager();
-+ StarBASIC* pBasic = pBasMgr ? pBasMgr->GetLib( rLibName ) : 0;
-+ OSL_ENSURE( pBasic, "BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode: StartBASIC is NULL!" );
-+ if( !pBasic )
++ uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, rLibName );
++ if( !xLib.is() )
+ return;
+
+ try
@@ -288,7 +313,7 @@
+ {
+ String aModName = pModNames[ i ];
+ BasicEntryType eType = OBJ_TYPE_UNKNOWN;
-+ switch( lcl_getModuleType( pBasic, aModName ) )
++ switch( lcl_getModuleType( xLib, aModName ) )
+ {
+ case script::ModuleType::Document:
+ eType = OBJ_TYPE_DOCUMENT_OBJECTS;
@@ -306,10 +331,22 @@
+ if( eType != eCurrentType )
+ continue;
+
-+ SvLBoxEntry* pModuleEntry = FindEntry( pLibSubRootEntry, aModName, OBJ_TYPE_MODULE );
++ // display a nice friendly name in the ObjectModule tab,
++ // combining the objectname and module name, e.g. Sheet1 ( Financials )
++ String aEntryName( aModName );
++ if( eType == OBJ_TYPE_DOCUMENT_OBJECTS )
++ {
++ String sObjName;
++ lcl_getObjectName( xLib, aModName, sObjName );
++ if( sObjName.Len() )
++ {
++ aEntryName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
++ }
++ }
++ SvLBoxEntry* pModuleEntry = FindEntry( pLibSubRootEntry, aEntryName, OBJ_TYPE_MODULE );
+ if ( !pModuleEntry )
+ pModuleEntry = AddEntry(
-+ aModName,
++ aEntryName,
+ Image( IDEResId( RID_IMG_MODULE ) ),
+ Image( IDEResId( RID_IMG_MODULE_HC ) ),
+ pLibSubRootEntry, false,
@@ -360,7 +397,7 @@
void BasicTreeListBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
{
UpdateEntries();
-@@ -480,10 +631,11 @@ long BasicTreeListBox::ExpandingHdl()
+@@ -480,10 +646,11 @@ long BasicTreeListBox::ExpandingHdl()
if ( aDocument.isAlive() )
{
String aLibName( aDesc.GetLibName() );
@@ -373,7 +410,7 @@
{
// check password, if library is password protected and not verified
::rtl::OUString aOULibName( aLibName );
-@@ -636,7 +788,7 @@ void BasicTreeListBox::SetCurrentEntry(
+@@ -636,7 +803,7 @@ void BasicTreeListBox::SetCurrentEntry(
aDesc = BasicEntryDescriptor(
ScriptDocument::getApplicationScriptDocument(),
LIBRARY_LOCATION_USER, String::CreateFromAscii( "Standard" ),
@@ -382,7 +419,7 @@
}
ScriptDocument aDocument( aDesc.GetDocument() );
OSL_ENSURE( aDocument.isValid(), "BasicTreeListBox::SetCurrentEntry: invalid document!" );
-@@ -653,14 +805,24 @@ void BasicTreeListBox::SetCurrentEntry(
+@@ -653,14 +820,24 @@ void BasicTreeListBox::SetCurrentEntry(
if ( pLibEntry )
{
pCurEntry = pLibEntry;
@@ -411,7 +448,7 @@
pCurEntry = pEntry;
diff -urp basicide.bk/bastype2.hxx basctl/source/basicide/bastype2.hxx
--- basicide.bk/bastype2.hxx 2008-09-22 11:33:04.000000000 +0800
-+++ basctl/source/basicide/bastype2.hxx 2008-09-25 15:50:13.000000000 +0800
++++ basctl/source/basicide/bastype2.hxx 2008-09-26 11:06:12.000000000 +0800
@@ -42,7 +42,7 @@
#include <sbxitem.hxx>
#include "basobj.hxx"
@@ -461,7 +498,7 @@
virtual void onDocumentCreated( const ScriptDocument& _rDocument );
diff -urp basicide.bk/bastype3.cxx basctl/source/basicide/bastype3.cxx
--- basicide.bk/bastype3.cxx 2008-09-22 11:33:04.000000000 +0800
-+++ basctl/source/basicide/bastype3.cxx 2008-09-25 13:50:37.000000000 +0800
++++ basctl/source/basicide/bastype3.cxx 2008-09-26 13:43:19.000000000 +0800
@@ -134,6 +134,14 @@ void __EXPORT BasicTreeListBox::Requesti
}
}
@@ -477,11 +514,32 @@
else {
DBG_ERROR( "BasicTreeListBox::RequestingChilds: Unknown Type!" );
}
-@@ -240,6 +248,14 @@ SbxVariable* BasicTreeListBox::FindVaria
+@@ -204,6 +212,7 @@ SbxVariable* BasicTreeListBox::FindVaria
+ }
+
+ SbxVariable* pVar = 0;
++ bool bDocumentObjects = false;
+ if ( aEntries.Count() )
+ {
+ for ( USHORT n = 0; n < aEntries.Count(); n++ )
+@@ -226,6 +235,11 @@ SbxVariable* BasicTreeListBox::FindVaria
+ case OBJ_TYPE_MODULE:
+ {
+ DBG_ASSERT( pVar && pVar->IsA( TYPE(StarBASIC) ), "FindVariable: Ungueltiges Basic" );
++ // extract the module name from the string like "Sheet1 (Example1)"
++ if( bDocumentObjects )
++ {
++ aName = aName.Copy( 0, aName.SearchAscii(" ") );
++ }
+ pVar = ((StarBASIC*)pVar)->FindModule( aName );
+ }
+ break;
+@@ -240,6 +254,15 @@ SbxVariable* BasicTreeListBox::FindVaria
// sbx dialogs removed
}
break;
+ case OBJ_TYPE_DOCUMENT_OBJECTS:
++ bDocumentObjects = true;
+ case OBJ_TYPE_FORMS:
+ case OBJ_TYPE_NORMAL_MODULES:
+ case OBJ_TYPE_CLASS_MODULES:
@@ -492,7 +550,7 @@
default:
{
DBG_ERROR( "FindVariable: Unbekannter Typ!" );
-@@ -260,12 +276,13 @@ BasicEntryDescriptor BasicTreeListBox::G
+@@ -260,12 +283,13 @@ BasicEntryDescriptor BasicTreeListBox::G
ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() );
LibraryLocation eLocation = LIBRARY_LOCATION_UNKNOWN;
String aLibName;
@@ -507,7 +565,7 @@
EntryArray aEntries;
-@@ -332,6 +349,15 @@ BasicEntryDescriptor BasicTreeListBox::G
+@@ -332,6 +356,15 @@ BasicEntryDescriptor BasicTreeListBox::G
eType = pBE->GetType();
}
break;
@@ -523,7 +581,7 @@
default:
{
DBG_ERROR( "GetEntryDescriptor: Unbekannter Typ!" );
-@@ -345,7 +371,7 @@ BasicEntryDescriptor BasicTreeListBox::G
+@@ -345,7 +378,7 @@ BasicEntryDescriptor BasicTreeListBox::G
}
}
@@ -532,7 +590,7 @@
}
USHORT BasicTreeListBox::ConvertType( BasicEntryType eType )
-@@ -427,6 +453,14 @@ bool BasicTreeListBox::IsValidEntry( SvL
+@@ -427,6 +460,14 @@ bool BasicTreeListBox::IsValidEntry( SvL
bIsValid = BasicIDE::HasMethod( aDocument, aLibName, aName, aMethodName );
}
break;
@@ -547,9 +605,35 @@
default: ;
}
+diff -urp basicide.bk/macrodlg.cxx basctl/source/basicide/macrodlg.cxx
+--- basicide.bk/macrodlg.cxx 2008-09-22 11:33:04.000000000 +0800
++++ basctl/source/basicide/macrodlg.cxx 2008-09-26 14:13:02.000000000 +0800
+@@ -385,7 +385,12 @@ SbMethod* MacroChooser::CreateMacro()
+ SbModule* pModule = 0;
+ String aModName( aDesc.GetName() );
+ if ( aModName.Len() )
++ {
++ // extract the module name from the string like "Sheet1 (Example1)"
++ if( aDesc.GetLibSubName().EqualsAscii("Document Objects") )
++ aModName = aModName.Copy( 0, aModName.SearchAscii(" ") );
+ pModule = pBasic->FindModule( aModName );
++ }
+ else if ( pBasic->GetModules()->Count() )
+ pModule = (SbModule*)pBasic->GetModules()->Get( 0 );
+
+@@ -713,6 +718,9 @@ IMPL_LINK( MacroChooser, ButtonHdl, Butt
+ BasicManager* pBasMgr = aDocument.getBasicManager();
+ String aLib( aDesc.GetLibName() );
+ String aMod( aDesc.GetName() );
++ // extract the module name from the string like "Sheet1 (Example1)"
++ if( aDesc.GetLibSubName().EqualsAscii("Document Objects") )
++ aMod = aMod.Copy( 0, aMod.SearchAscii(" ") );
+ String aSub( aDesc.GetMethodName() );
+ SfxMacroInfoItem aInfoItem( SID_BASICIDE_ARG_MACROINFO, pBasMgr, aLib, aMod, aSub, String() );
+ if ( pButton == &aEditButton )
diff -urp basicide.bk/moduldlg.cxx basctl/source/basicide/moduldlg.cxx
--- basicide.bk/moduldlg.cxx 2008-09-22 11:33:04.000000000 +0800
-+++ basctl/source/basicide/moduldlg.cxx 2008-09-25 17:05:55.000000000 +0800
++++ basctl/source/basicide/moduldlg.cxx 2008-09-26 14:54:30.000000000 +0800
@@ -87,7 +87,7 @@ BOOL __EXPORT ExtBasicTreeListBox::Editi
if ( pEntry )
{
@@ -629,7 +713,7 @@
aDelButton.Enable();
else
aDelButton.Disable();
-@@ -688,7 +696,7 @@ IMPL_LINK( ObjectPage, ButtonHdl, Button
+@@ -688,13 +696,17 @@ IMPL_LINK( ObjectPage, ButtonHdl, Button
SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
DBG_ASSERT( pCurEntry, "Entry?!" );
@@ -638,3 +722,65 @@
{
BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
if ( pDispatcher )
+ {
++ String aModName( aDesc.GetName() );
++ // extract the module name from the string like "Sheet1 (Example1)"
++ if( aDesc.GetLibSubName().EqualsAscii("Document Objects") )
++ aModName = aModName.Copy( 0, aModName.SearchAscii(" ") );
+ SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDesc.GetDocument(), aDesc.GetLibName(),
+- aDesc.GetName(), aBasicBox.ConvertType( aDesc.GetType() ) );
++ aModName, aBasicBox.ConvertType( aDesc.GetType() ) );
+ pDispatcher->Execute( SID_BASICIDE_SHOWSBX, SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
+ }
+ }
+@@ -976,14 +988,14 @@ SbModule* createModImpl( Window* pWin, c
+ try
+ {
+ ::rtl::OUString sModuleCode;
++ // the module has existed
++ if( rDocument.hasModule( aLibName, aModName ) )
++ return NULL;
+ rDocument.createModule( aLibName, aModName, bMain, sModuleCode );
+ BasicManager* pBasMgr = rDocument.getBasicManager();
+- if ( pBasMgr )
+- {
+- StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
+- if ( pBasic )
+- pModule = pBasic->FindModule( aModName );
+- }
++ StarBASIC* pBasic = pBasMgr? pBasMgr->GetLib( aLibName ) : 0;
++ if ( pBasic )
++ pModule = pBasic->FindModule( aModName );
+ SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, aModName, BASICIDE_TYPE_MODULE );
+ BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
+ SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
+@@ -1005,14 +1017,27 @@ SbModule* createModImpl( Window* pWin, c
+ {
+ if ( !rBasicBox.IsExpanded( pLibEntry ) )
+ rBasicBox.Expand( pLibEntry );
+- SvLBoxEntry* pEntry = rBasicBox.FindEntry( pLibEntry, aModName, OBJ_TYPE_MODULE );
++ SvLBoxEntry* pSubRootEntry = pLibEntry;
++ if( pBasic && pBasic->isVBAEnabled() )
++ {
++ // add the new module in the "Modules" entry
++ SvLBoxEntry* pLibSubEntry = rBasicBox.FindEntry( pLibEntry, String::CreateFromAscii("Modules") , OBJ_TYPE_NORMAL_MODULES );
++ if( pLibSubEntry )
++ {
++ if( !rBasicBox.IsExpanded( pLibSubEntry ) )
++ rBasicBox.Expand( pLibSubEntry );
++ pSubRootEntry = pLibSubEntry;
++ }
++ }
++
++ SvLBoxEntry* pEntry = rBasicBox.FindEntry( pSubRootEntry, aModName, OBJ_TYPE_MODULE );
+ if ( !pEntry )
+ {
+ pEntry = rBasicBox.AddEntry(
+ aModName,
+ Image( IDEResId( RID_IMG_MODULE ) ),
+ Image( IDEResId( RID_IMG_MODULE_HC ) ),
+- pLibEntry, false,
++ pSubRootEntry, false,
+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
+ DBG_ASSERT( pEntry, "InsertEntry fehlgeschlagen!" );
+ }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]