summaryrefslogtreecommitdiff
path: root/basctl/source
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2010-06-07 10:13:44 +0200
committerJoachim Lingner <jl@openoffice.org>2010-06-07 10:13:44 +0200
commitbab4ecd934179a7dc801f9cdfadf5ce28d1536bf (patch)
treef493b4aedd1c1df51b47ddeb3030e5edf90cd596 /basctl/source
parentafb4f3e8decfeec6b5201a11961c294712a1a8a1 (diff)
parente9a0e36fdad318a7b6b087392701a8b48f0c12e1 (diff)
jl152 merge with DEV300_m80
Diffstat (limited to 'basctl/source')
-rw-r--r--basctl/source/basicide/baside2.cxx129
-rw-r--r--basctl/source/basicide/baside2.hxx4
-rw-r--r--basctl/source/basicide/baside3.cxx3
-rw-r--r--basctl/source/basicide/basides1.cxx27
-rw-r--r--basctl/source/basicide/basides2.cxx29
-rw-r--r--basctl/source/basicide/basidesh.cxx103
-rw-r--r--basctl/source/basicide/basidesh.src16
-rw-r--r--basctl/source/basicide/basobj2.cxx2
-rw-r--r--basctl/source/basicide/bastype2.cxx270
-rw-r--r--basctl/source/basicide/bastype2.hxx13
-rw-r--r--basctl/source/basicide/bastype3.cxx46
-rw-r--r--basctl/source/basicide/bastypes.cxx25
-rw-r--r--basctl/source/basicide/macrodlg.cxx14
-rw-r--r--basctl/source/basicide/moduldlg.cxx70
-rw-r--r--basctl/source/basicide/scriptdocument.cxx36
-rw-r--r--basctl/source/inc/basidesh.hxx3
-rw-r--r--basctl/source/inc/bastypes.hxx10
-rw-r--r--basctl/source/inc/scriptdocument.hxx1
18 files changed, 684 insertions, 117 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index f4f35e135..1c9e37ad6 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -46,6 +46,7 @@
#include <com/sun/star/script/XLibraryContainer2.hpp>
#endif
#include <com/sun/star/document/MacroExecMode.hpp>
+#include <com/sun/star/script/ModuleType.hpp>
#include <toolkit/helper/vclunohelper.hxx>
#include <sfx2/docfile.hxx>
#include <basic/basrdll.hxx>
@@ -106,7 +107,7 @@ using namespace comphelper;
DBG_NAME( ModulWindow )
TYPEINIT1( ModulWindow , IDEBaseWindow );
-
+
void lcl_PrintHeader( Printer* pPrinter, USHORT nPages, USHORT nCurPage, const String& rTitle, bool bOutput )
{
short nLeftMargin = LMARGPRN;
@@ -202,21 +203,35 @@ ModulWindow::ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDoc
pLayout = pParent;
aXEditorWindow.Show();
- BasicManager* pBasMgr = rDocument.getBasicManager();
- if ( pBasMgr )
+ SetBackground();
+}
+
+SbModuleRef ModulWindow::XModule()
+{
+ // ModuleWindows can now be created as a result of the
+ // modules getting created via the api. This is a result of an
+ // elementInserted event from the BasicLibrary container.
+ // However the SbModule is also created from a different listener to
+ // the same event ( in basmgr ) Therefore it is possible when we look
+ // for xModule it may not yet be available, here we keep tring to access
+ // the module until such time as it exists
+
+ if ( !xModule.Is() )
{
- StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
- if ( pBasic )
+ BasicManager* pBasMgr = GetDocument().getBasicManager();
+ if ( pBasMgr )
{
- xBasic = pBasic;
- xModule = (SbModule*)pBasic->FindModule( aName );
+ StarBASIC* pBasic = pBasMgr->GetLib( GetLibName() );
+ if ( pBasic )
+ {
+ xBasic = pBasic;
+ xModule = (SbModule*)pBasic->FindModule( GetName() );
+ }
}
}
-
- SetBackground();
+ return xModule;
}
-
__EXPORT ModulWindow::~ModulWindow()
{
DBG_DTOR( ModulWindow, 0 );
@@ -266,7 +281,7 @@ void ModulWindow::CheckCompileBasic()
{
DBG_CHKTHIS( ModulWindow, 0 );
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
// Zur Laufzeit wird niemals compiliert!
BOOL bRunning = StarBASIC::IsRunning();
@@ -322,7 +337,7 @@ BOOL ModulWindow::BasicExecute()
CheckCompileBasic();
- if ( xModule.Is() && xModule->IsCompiled() && !aStatus.bError )
+ if ( XModule().Is() && xModule->IsCompiled() && !aStatus.bError )
{
if ( GetBreakPoints().Count() )
aStatus.nBasicFlags = aStatus.nBasicFlags | SbDEBUG_BREAK;
@@ -332,6 +347,9 @@ BOOL ModulWindow::BasicExecute()
DBG_ASSERT( xModule.Is(), "Kein Modul!" );
AddStatus( BASWIN_RUNNINGBASIC );
USHORT nStart, nEnd, nCurMethodStart = 0;
+ TextSelection aSel = GetEditView()->GetSelection();
+ if ( aDocument.isInVBAMode() )
+ nCurMethodStart = ( aSel.GetStart().GetPara() + 1 );
SbMethod* pMethod = 0;
// erstes Macro, sonst blind "Main" (ExtSearch?)
for ( USHORT nMacro = 0; nMacro < xModule->GetMethods()->Count(); nMacro++ )
@@ -339,15 +357,27 @@ BOOL ModulWindow::BasicExecute()
SbMethod* pM = (SbMethod*)xModule->GetMethods()->Get( nMacro );
DBG_ASSERT( pM, "Method?" );
pM->GetLineRange( nStart, nEnd );
- if ( !pMethod || ( nStart < nCurMethodStart ) )
+ if ( aDocument.isInVBAMode() )
+ {
+ if ( nCurMethodStart >= nStart && nCurMethodStart <= nEnd )
+ {
+ pMethod = pM;
+ break;
+ }
+ }
+ else if ( !pMethod || ( nStart < nCurMethodStart ) )
{
pMethod = pM;
nCurMethodStart = nStart;
}
}
if ( !pMethod )
- pMethod = (SbMethod*)xModule->Find( String( RTL_CONSTASCII_USTRINGPARAM( "Main" ) ), SbxCLASS_METHOD );
-
+ {
+ if ( aDocument.isInVBAMode() )
+ return ( BasicIDE::ChooseMacro( uno::Reference< frame::XModel >(), FALSE, rtl::OUString() ).getLength() > 0 ) ? TRUE : FALSE;
+ else
+ pMethod = (SbMethod*)xModule->Find( String( RTL_CONSTASCII_USTRINGPARAM( "Main" ) ), SbxCLASS_METHOD );
+ }
if ( pMethod )
{
pMethod->SetDebugFlags( aStatus.nBasicFlags );
@@ -374,7 +404,7 @@ BOOL ModulWindow::CompileBasic()
CheckCompileBasic();
BOOL bIsCompiled = FALSE;
- if ( xModule.Is() )
+ if ( XModule().Is() )
bIsCompiled = xModule->IsCompiled();
return bIsCompiled;
@@ -551,11 +581,11 @@ BOOL ModulWindow::ImportDialog()
BOOL ModulWindow::ToggleBreakPoint( ULONG nLine )
{
- DBG_ASSERT( xModule.Is(), "Kein Modul!" );
+ DBG_ASSERT( XModule().Is(), "Kein Modul!" );
BOOL bNewBreakPoint = FALSE;
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
CheckCompileBasic();
if ( aStatus.bError )
@@ -597,9 +627,9 @@ BOOL ModulWindow::ToggleBreakPoint( ULONG nLine )
void ModulWindow::UpdateBreakPoint( const BreakPoint& rBrk )
{
- DBG_ASSERT( xModule.Is(), "Kein Modul!" );
+ DBG_ASSERT( XModule().Is(), "Kein Modul!" );
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
CheckCompileBasic();
@@ -823,9 +853,9 @@ void ModulWindow::BasicRemoveWatch()
void ModulWindow::EditMacro( const String& rMacroName )
{
DBG_CHKTHIS( ModulWindow, 0 );
- DBG_ASSERT( xModule.Is(), "Kein Modul!" );
+ DBG_ASSERT( XModule().Is(), "Kein Modul!" );
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
CheckCompileBasic();
@@ -895,12 +925,12 @@ BOOL __EXPORT ModulWindow::AllowUndo()
void __EXPORT ModulWindow::UpdateData()
{
DBG_CHKTHIS( ModulWindow, 0 );
- DBG_ASSERT( xModule.Is(), "Kein Modul!" );
+ DBG_ASSERT( XModule().Is(), "Kein Modul!" );
// UpdateData wird gerufen, wenn sich der Source von aussen
// geaendert hat.
// => Keine Unterbrechungen erwuenscht!
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
SetModule( xModule->GetSource32() );
@@ -1193,19 +1223,6 @@ void __EXPORT ModulWindow::DoScroll( ScrollBar* pCurScrollBar )
}
-BOOL ModulWindow::RenameModule( const String& rNewName )
-{
- if ( !BasicIDE::RenameModule( this, GetDocument(), GetLibName(), GetName(), rNewName ) )
- return FALSE;
-
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_DOC_MODIFIED );
-
- return TRUE;
-}
-
-
BOOL __EXPORT ModulWindow::IsModified()
{
return GetEditEngine() ? GetEditEngine()->IsModified() : FALSE;
@@ -1221,7 +1238,7 @@ void __EXPORT ModulWindow::GoOnTop()
String ModulWindow::GetSbModuleName()
{
String aModuleName;
- if ( xModule.Is() )
+ if ( XModule().Is() )
aModuleName = xModule->GetName();
return aModuleName;
}
@@ -1343,7 +1360,7 @@ USHORT __EXPORT ModulWindow::GetSearchOptions()
void __EXPORT ModulWindow::BasicStarted()
{
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
aStatus.bIsRunning = TRUE;
BreakPointList& rList = GetBreakPoints();
@@ -1372,7 +1389,39 @@ BasicEntryDescriptor ModulWindow::CreateEntryDescriptor()
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() && aDocument.isInVBAMode() && XModule().Is() )
+ {
+ switch( xModule->GetModuleType() )
+ {
+ case script::ModuleType::DOCUMENT:
+ {
+ aLibSubName = String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) );
+ uno::Reference< container::XNameContainer > xLib = aDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
+ if( xLib.is() )
+ {
+ String sObjName;
+ ModuleInfoHelper::getObjectName( xLib, aModName, sObjName );
+ if( sObjName.Len() )
+ {
+ aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
+ }
+ }
+ break;
+ }
+ case script::ModuleType::FORM:
+ aLibSubName = String( IDEResId( RID_STR_USERFORMS ) );
+ break;
+ case script::ModuleType::NORMAL:
+ aLibSubName = String( IDEResId( RID_STR_NORMAL_MODULES ) );
+ break;
+ case script::ModuleType::CLASS:
+ aLibSubName = String( IDEResId( RID_STR_CLASS_MODULES ) );
+ break;
+ }
+ }
+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aModName, OBJ_TYPE_MODULE );
}
void ModulWindow::SetReadOnly( BOOL b )
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index b8b31d8f2..b78eaf8dd 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -357,6 +357,7 @@ private:
void AssertValidEditEngine();
sal_Int32 FormatAndPrint( Printer* pPrinter, sal_Int32 nPage = -1 );
+ SbModuleRef XModule();
protected:
virtual void Resize();
virtual void GetFocus();
@@ -389,7 +390,7 @@ public:
virtual void SetReadOnly( BOOL bReadOnly );
virtual BOOL IsReadOnly();
- StarBASIC* GetBasic() { return xBasic; }
+ StarBASIC* GetBasic() { XModule(); return xBasic; }
SbModule* GetSbModule() { return xModule; }
void SetSbModule( SbModule* pModule ) { xModule = pModule; }
@@ -417,7 +418,6 @@ public:
// void InsertFromObjectCatalog( ObjectCatalog* pObjDlg );
BOOL ToggleBreakPoint( ULONG nLine );
- BOOL RenameModule( const String& rNewName );
BasicStatus& GetBasicStatus() { return aStatus; }
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 67ee7d8b0..e307720fd 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -1297,8 +1297,9 @@ BasicEntryDescriptor DialogWindow::CreateEntryDescriptor()
{
ScriptDocument aDocument( GetDocument() );
String aLibName( GetLibName() );
+ String aLibSubName;
LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
- return BasicEntryDescriptor( aDocument, eLocation, aLibName, GetName(), OBJ_TYPE_DIALOG );
+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, GetName(), OBJ_TYPE_DIALOG );
}
void DialogWindow::SetReadOnly( BOOL b )
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index c6af09a89..cc4450168 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -109,7 +109,6 @@ void __EXPORT BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
{
if ( aDocument.removeModule( aLibName, aName ) )
{
- RemoveWindow( pCurWin, TRUE );
BasicIDE::MarkDocumentModified( aDocument );
}
}
@@ -430,11 +429,31 @@ void __EXPORT BasicIDEShell::ExecuteGlobal( SfxRequest& rReq )
{
String aNewName( rModName.GetValue() );
String aOldName( pWin->GetName() );
-
if ( aNewName != aOldName )
{
- if ( ( pWin->IsA( TYPE( ModulWindow ) ) && ((ModulWindow*)pWin)->RenameModule( aNewName ) )
- || ( pWin->IsA( TYPE( DialogWindow ) ) && ((DialogWindow*)pWin)->RenameDialog( aNewName ) ) )
+ bool bRenameOk = false;
+ if ( pWin->IsA( TYPE( ModulWindow ) ) )
+ {
+ ModulWindow* pModWin = (ModulWindow*)pWin;
+ String aLibName = ( pModWin->GetLibName() );
+ ScriptDocument aDocument( pWin->GetDocument() );
+
+ if ( BasicIDE::RenameModule( pModWin, aDocument, aLibName, aOldName, aNewName ) )
+ {
+ bRenameOk = true;
+ // Because we listen for container events for script
+ // modules, rename will delete the 'old' window
+ // pWin has been invalidated, restore now
+ pWin = FindBasWin( aDocument, aLibName, aNewName, TRUE );
+ }
+
+ }
+ else if ( pWin->IsA( TYPE( DialogWindow ) ) )
+ {
+ DialogWindow* pDlgWin = (DialogWindow*)pWin;
+ bRenameOk = pDlgWin->RenameDialog( aNewName );
+ }
+ if ( bRenameOk )
{
BasicIDE::MarkDocumentModified( pWin->GetDocument() );
}
diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx
index 1a07da142..393dd4e02 100644
--- a/basctl/source/basicide/basides2.cxx
+++ b/basctl/source/basicide/basides2.cxx
@@ -51,6 +51,10 @@
#include <tools/diagnose_ex.h>
#include <sfx2/sfxdefs.hxx>
#include <sfx2/signaturestate.hxx>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -235,7 +239,7 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const
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 );
@@ -254,9 +258,15 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const
if ( bSuccess )
{
- // new module window
- pWin = new ModulWindow( pModulLayout, rDocument, aLibName, aModName, aModule );
- nKey = InsertWindowInTable( pWin );
+ pWin = FindBasWin( rDocument, aLibName, aModName, FALSE, TRUE );
+ if( !pWin )
+ {
+ // new module window
+ pWin = new ModulWindow( pModulLayout, rDocument, aLibName, aModName, aModule );
+ nKey = InsertWindowInTable( pWin );
+ }
+ else // we've gotten called recursively ( via listener from createModule above ), get outta here
+ return pWin;
}
}
else
@@ -271,6 +281,17 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const
}
DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" );
}
+ if( nKey && xLib.is() && rDocument.isInVBAMode() )
+ {
+ // display a nice friendly name in the ObjectModule tab,
+ // combining the objectname and module name, e.g. Sheet1 ( Financials )
+ String sObjName;
+ ModuleInfoHelper::getObjectName( xLib, rModName, sObjName );
+ if( sObjName.Len() )
+ {
+ aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
+ }
+ }
pTabBar->InsertPage( (USHORT)nKey, aModName );
pTabBar->Sort();
pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar );
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 9a68ce94d..6e4e2cf9d 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -77,6 +77,9 @@
#include <com/sun/star/script/XLibraryContainer.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
#include <svx/xmlsecctrl.hxx>
@@ -84,6 +87,71 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
using ::rtl::OUString;
+static const rtl::OUString sStandardLibName( rtl::OUString::createFromAscii("Standard") );
+
+typedef ::cppu::WeakImplHelper1< container::XContainerListener > ContainerListenerBASE;
+
+class ContainerListenerImpl : public ContainerListenerBASE
+{
+ BasicIDEShell* mpShell;
+public:
+
+ ContainerListenerImpl( BasicIDEShell* pShell ) : mpShell( pShell ) {}
+
+ ~ContainerListenerImpl()
+ {
+ }
+
+ void addContainerListener( const ScriptDocument& rScriptDocument, const String& aLibName )
+ {
+ try
+ {
+ uno::Reference< container::XContainer > xContainer( rScriptDocument.getLibrary( E_SCRIPTS, aLibName, FALSE ), uno::UNO_QUERY );
+ if ( xContainer.is() )
+ {
+ uno::Reference< container::XContainerListener > xContainerListener( this );
+ xContainer->addContainerListener( xContainerListener );
+ }
+ }
+ catch( uno::Exception& ) {}
+ }
+ void removeContainerListener( const ScriptDocument& rScriptDocument, const String& aLibName )
+ {
+ try
+ {
+ uno::Reference< container::XContainer > xContainer( rScriptDocument.getLibrary( E_SCRIPTS, aLibName, FALSE ), uno::UNO_QUERY );
+ if ( xContainer.is() )
+ {
+ uno::Reference< container::XContainerListener > xContainerListener( this );
+ xContainer->removeContainerListener( xContainerListener );
+ }
+ }
+ catch( uno::Exception& ) {}
+ }
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const lang::EventObject& ) throw( uno::RuntimeException ) {}
+
+ // XContainerListener
+ virtual void SAL_CALL elementInserted( const container::ContainerEvent& Event ) throw( uno::RuntimeException )
+ {
+ rtl::OUString sModuleName;
+ if( mpShell && ( Event.Accessor >>= sModuleName ) )
+ mpShell->FindBasWin( mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, TRUE, FALSE );
+ }
+ virtual void SAL_CALL elementReplaced( const container::ContainerEvent& ) throw( com::sun::star::uno::RuntimeException ) { }
+ virtual void SAL_CALL elementRemoved( const container::ContainerEvent& Event ) throw( com::sun::star::uno::RuntimeException )
+ {
+ rtl::OUString sModuleName;
+ if( mpShell && ( Event.Accessor >>= sModuleName ) )
+ {
+ IDEBaseWindow* pWin = mpShell->FindWindow( mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, BASICIDE_TYPE_MODULE, TRUE );
+ if( pWin )
+ mpShell->RemoveWindow( pWin, TRUE, TRUE );
+ }
+ }
+
+};
TYPEINIT1( BasicIDEShell, SfxViewShell );
@@ -121,6 +189,7 @@ BasicIDEShell::BasicIDEShell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell
m_bAppBasicModified( FALSE ),
m_aNotifier( *this )
{
+ m_xLibListener = new ContainerListenerImpl( this );
Init();
GnBasicIDEShellCount++;
}
@@ -212,6 +281,12 @@ __EXPORT BasicIDEShell::~BasicIDEShell()
delete pTabBar;
delete pObjectCatalog;
DestroyModulWindowLayout();
+
+ ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() );
+ // Destroy all ContainerListeners for Basic Container.
+ if ( pListener )
+ pListener->removeContainerListener( m_aCurDocument, m_aCurLibName );
+
// MI: Das gab einen GPF im SDT beim Schliessen da dann der ViewFrame die
// ObjSh loslaesst. Es wusste auch keiner mehr wozu das gut war.
// GetViewFrame()->GetObjectShell()->Broadcast( SfxSimpleHint( SFX_HINT_DYING ) );
@@ -828,9 +903,22 @@ void BasicIDEShell::RemoveWindow( IDEBaseWindow* pWindow_, BOOL bDestroy, BOOL b
{
pWindow_->AddStatus( BASWIN_TOBEKILLED );
pWindow_->Hide();
- StarBASIC::Stop();
- // Es kommt kein Notify...
- pWindow_->BasicStopped();
+ // In normal mode stop basic in windows to be deleted
+ // In VBA stop basic only if the running script is trying to delete
+ // its parent module
+ bool bStop = true;
+ if ( pWindow_->GetDocument().isInVBAMode() )
+ {
+ SbModule* pMod = StarBASIC::GetActiveModule();
+ if ( !pMod || ( pMod && ( pMod->GetName() != pWindow_->GetName() ) ) )
+ bStop = false;
+ }
+ if ( bStop )
+ {
+ StarBASIC::Stop();
+ // Es kommt kein Notify...
+ pWindow_->BasicStopped();
+ }
aIDEWindowTable.Insert( nKey, pWindow_ ); // wieder einhaegen
}
}
@@ -918,8 +1006,17 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, String aLibName,
{
if ( !bCheck || ( rDocument != m_aCurDocument || aLibName != m_aCurLibName ) )
{
+ ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() );
+
+ if ( pListener )
+ pListener->removeContainerListener( m_aCurDocument, m_aCurLibName );
+
m_aCurDocument = rDocument;
+
+ pListener->addContainerListener( m_aCurDocument, aLibName );
+
m_aCurLibName = aLibName;
+
if ( bUpdateWindows )
UpdateWindows();
diff --git a/basctl/source/basicide/basidesh.src b/basctl/source/basicide/basidesh.src
index f2543b1f2..25c8c460d 100644
--- a/basctl/source/basicide/basidesh.src
+++ b/basctl/source/basicide/basidesh.src
@@ -636,6 +636,22 @@ String RID_STR_TRANSLATION_DEFAULT
{
Text [ en-US ] = "[Default Language]" ;
};
+String RID_STR_DOCUMENT_OBJECTS
+{
+ Text [ en-US ] = "Document Objects" ;
+};
+String RID_STR_USERFORMS
+{
+ Text [ en-US ] = "Forms" ;
+};
+String RID_STR_NORMAL_MODULES
+{
+ Text [ en-US ] = "Modules" ;
+};
+String RID_STR_CLASS_MODULES
+{
+ Text [ en-US ] = "Class Modules" ;
+};
String RID_STR_DLGIMP_CLASH_RENAME
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index 61d92297b..cf5386b1e 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -191,7 +191,7 @@ bool RenameModule( Window* pErrorParent, const ScriptDocument& rDocument, const
BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
if ( pIDEShell )
{
- IDEBaseWindow* pWin = pIDEShell->FindWindow( rDocument, rLibName, rOldName, BASICIDE_TYPE_MODULE, FALSE );
+ IDEBaseWindow* pWin = pIDEShell->FindWindow( rDocument, rLibName, rNewName, BASICIDE_TYPE_MODULE, TRUE );
if ( pWin )
{
// set new name in window
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 45c0d8147..f112d5a06 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -50,10 +50,51 @@
#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/XVBAModuleInfo.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XNamed.hpp>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
+void ModuleInfoHelper::getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName )
+{
+ try
+ {
+ uno::Reference< script::XVBAModuleInfo > xVBAModuleInfo( rLib, uno::UNO_QUERY );
+ if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( rModName ) )
+ {
+ script::ModuleInfo aModuleInfo = xVBAModuleInfo->getModuleInfo( rModName );
+ uno::Any aObject( aModuleInfo.ModuleObject );
+ uno::Reference< lang::XServiceInfo > xServiceInfo( aObject, uno::UNO_QUERY );
+ if( xServiceInfo.is() && xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Worksheet" ) ) )
+ {
+ uno::Reference< container::XNamed > xNamed( aObject, uno::UNO_QUERY );
+ if( xNamed.is() )
+ rObjName = xNamed->getName();
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+sal_Int32 ModuleInfoHelper::getModuleType( const uno::Reference< container::XNameContainer >& rLib, const String& rModName )
+{
+ sal_Int32 nType = com::sun::star::script::ModuleType::NORMAL;
+ uno::Reference< script::XVBAModuleInfo > xVBAModuleInfo( rLib, uno::UNO_QUERY );
+ if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( rModName ) )
+ {
+ script::ModuleInfo aModuleInfo = xVBAModuleInfo->getModuleInfo( rModName );
+ nType = aModuleInfo.ModuleType;
+ }
+ return nType;
+}
BasicEntry::~BasicEntry()
{
@@ -88,20 +129,22 @@ BasicEntryDescriptor::BasicEntryDescriptor()
{
}
-BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, BasicEntryType eType )
+BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, BasicEntryType eType )
:m_aDocument( rDocument )
,m_eLocation( eLocation )
,m_aLibName( rLibName )
+ ,m_aLibSubName( rLibSubName )
,m_aName( rName )
,m_eType( eType )
{
OSL_ENSURE( m_aDocument.isValid(), "BasicEntryDescriptor::BasicEntryDescriptor: invalid document!" );
}
-BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, const String& rMethodName, BasicEntryType eType )
+BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, const String& rMethodName, BasicEntryType eType )
:m_aDocument( rDocument )
,m_eLocation( eLocation )
,m_aLibName( rLibName )
+ ,m_aLibSubName( rLibSubName )
,m_aName( rName )
,m_aMethodName( rMethodName )
,m_eType( eType )
@@ -117,6 +160,7 @@ BasicEntryDescriptor::BasicEntryDescriptor( const BasicEntryDescriptor& rDesc )
:m_aDocument( rDesc.m_aDocument )
,m_eLocation( rDesc.m_eLocation )
,m_aLibName( rDesc.m_aLibName )
+ ,m_aLibSubName( rDesc.m_aLibSubName )
,m_aName( rDesc.m_aName )
,m_aMethodName( rDesc.m_aMethodName )
,m_eType( rDesc.m_eType )
@@ -128,6 +172,7 @@ BasicEntryDescriptor& BasicEntryDescriptor::operator=( const BasicEntryDescripto
m_aDocument = rDesc.m_aDocument;
m_eLocation = rDesc.m_eLocation;
m_aLibName = rDesc.m_aLibName;
+ m_aLibSubName = rDesc.m_aLibSubName;
m_aName = rDesc.m_aName;
m_aMethodName = rDesc.m_aMethodName;
m_eType = rDesc.m_eType;
@@ -140,6 +185,7 @@ bool BasicEntryDescriptor::operator==( const BasicEntryDescriptor& rDesc ) const
return m_aDocument == rDesc.m_aDocument &&
m_eLocation == rDesc.m_eLocation &&
m_aLibName == rDesc.m_aLibName &&
+ m_aLibSubName == rDesc.m_aLibSubName &&
m_aName == rDesc.m_aName &&
m_aMethodName == rDesc.m_aMethodName &&
m_eType == rDesc.m_eType;
@@ -284,41 +330,46 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const
{
try
{
- // get a sorted list of module names
- Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
- sal_Int32 nModCount = aModNames.getLength();
- const ::rtl::OUString* pModNames = aModNames.getConstArray();
-
- for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
+ if( rDocument.isInVBAMode() )
+ ImpCreateLibSubEntriesInVBAMode( pLibRootEntry, rDocument, rLibName );
+ else
{
- String aModName = pModNames[ i ];
- SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE );
- if ( !pModuleEntry )
- pModuleEntry = AddEntry(
- aModName,
- Image( IDEResId( RID_IMG_MODULE ) ),
- Image( IDEResId( RID_IMG_MODULE_HC ) ),
- pLibRootEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
+ // get a sorted list of module names
+ Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
+ sal_Int32 nModCount = aModNames.getLength();
+ const ::rtl::OUString* pModNames = aModNames.getConstArray();
- // methods
- if ( nMode & BROWSEMODE_SUBS )
+ for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
{
- Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
- sal_Int32 nCount = aNames.getLength();
- const ::rtl::OUString* pNames = aNames.getConstArray();
-
- for ( sal_Int32 j = 0 ; j < nCount ; j++ )
+ String aModName = pModNames[ i ];
+ SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE );
+ if ( !pModuleEntry )
+ pModuleEntry = AddEntry(
+ aModName,
+ Image( IDEResId( RID_IMG_MODULE ) ),
+ Image( IDEResId( RID_IMG_MODULE_HC ) ),
+ pLibRootEntry, false,
+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
+
+ // methods
+ if ( nMode & BROWSEMODE_SUBS )
{
- String aName = pNames[ j ];
- SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
- if ( !pEntry )
- pEntry = AddEntry(
- aName,
- Image( IDEResId( RID_IMG_MACRO ) ),
- Image( IDEResId( RID_IMG_MACRO_HC ) ),
- pModuleEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
+ Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
+ sal_Int32 nCount = aNames.getLength();
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+
+ for ( sal_Int32 j = 0 ; j < nCount ; j++ )
+ {
+ String aName = pNames[ j ];
+ SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
+ if ( !pEntry )
+ pEntry = AddEntry(
+ aName,
+ Image( IDEResId( RID_IMG_MACRO ) ),
+ Image( IDEResId( RID_IMG_MACRO_HC ) ),
+ pModuleEntry, false,
+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
+ }
}
}
}
@@ -365,6 +416,140 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const
}
}
+void BasicTreeListBox::ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName )
+{
+
+ ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > > aEntries;
+ aEntries.push_back( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) );
+ aEntries.push_back( ::std::make_pair( OBJ_TYPE_USERFORMS, String( IDEResId( RID_STR_USERFORMS ) ) ) );
+ aEntries.push_back( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, String( IDEResId( RID_STR_NORMAL_MODULES ) ) ) );
+ aEntries.push_back( ::std::make_pair( OBJ_TYPE_CLASS_MODULES, String( IDEResId( RID_STR_CLASS_MODULES ) ) ) );
+
+ ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > >::iterator iter;
+ for( iter = aEntries.begin(); iter != aEntries.end(); ++iter )
+ {
+ BasicEntryType eType = iter->first;
+ ::rtl::OUString aEntryName = iter->second;
+ SvLBoxEntry* pLibSubRootEntry = FindEntry( pLibRootEntry, aEntryName, eType );
+ if( pLibSubRootEntry )
+ {
+ SetEntryBitmaps( pLibSubRootEntry, Image( IDEResId( RID_IMG_MODLIB ) ), Image( IDEResId( RID_IMG_MODLIB_HC ) ) );
+ if ( IsExpanded( pLibSubRootEntry ) )
+ ImpCreateLibSubSubEntriesInVBAMode( pLibSubRootEntry, rDocument, rLibName );
+ }
+ else
+ {
+ pLibSubRootEntry = AddEntry(
+ aEntryName,
+ Image( IDEResId( RID_IMG_MODLIB ) ),
+ Image( IDEResId( RID_IMG_MODLIB_HC ) ),
+ pLibRootEntry, true,
+ std::auto_ptr< BasicEntry >( new BasicEntry( eType ) ) );
+ }
+ }
+}
+
+void BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName )
+{
+ uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, rLibName );
+ if( !xLib.is() )
+ return;
+
+ try
+ {
+ // get a sorted list of module names
+ Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
+ sal_Int32 nModCount = aModNames.getLength();
+ const ::rtl::OUString* pModNames = aModNames.getConstArray();
+
+ BasicEntryDescriptor aDesc( GetEntryDescriptor( pLibSubRootEntry ) );
+ BasicEntryType eCurrentType( aDesc.GetType() );
+
+ for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
+ {
+ String aModName = pModNames[ i ];
+ BasicEntryType eType = OBJ_TYPE_UNKNOWN;
+ switch( ModuleInfoHelper::getModuleType( xLib, aModName ) )
+ {
+ case script::ModuleType::DOCUMENT:
+ eType = OBJ_TYPE_DOCUMENT_OBJECTS;
+ break;
+ case script::ModuleType::FORM:
+ eType = OBJ_TYPE_USERFORMS;
+ break;
+ case script::ModuleType::NORMAL:
+ eType = OBJ_TYPE_NORMAL_MODULES;
+ break;
+ case script::ModuleType::CLASS:
+ eType = OBJ_TYPE_CLASS_MODULES;
+ break;
+ }
+ if( eType != eCurrentType )
+ continue;
+
+ // 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;
+ ModuleInfoHelper::getObjectName( xLib, aModName, sObjName );
+ if( sObjName.Len() )
+ {
+ aEntryName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
+ }
+ }
+ SvLBoxEntry* pModuleEntry = FindEntry( pLibSubRootEntry, aEntryName, OBJ_TYPE_MODULE );
+ if ( !pModuleEntry )
+ pModuleEntry = AddEntry(
+ aEntryName,
+ Image( IDEResId( RID_IMG_MODULE ) ),
+ Image( IDEResId( RID_IMG_MODULE_HC ) ),
+ pLibSubRootEntry, false,
+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
+
+ // methods
+ if ( nMode & BROWSEMODE_SUBS )
+ {
+ Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
+ sal_Int32 nCount = aNames.getLength();
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+
+ for ( sal_Int32 j = 0 ; j < nCount ; j++ )
+ {
+ String aName = pNames[ j ];
+ SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
+ if ( !pEntry )
+ pEntry = AddEntry(
+ aName,
+ Image( IDEResId( RID_IMG_MACRO ) ),
+ Image( IDEResId( RID_IMG_MACRO_HC ) ),
+ pModuleEntry, false,
+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
+ }
+ }
+ }
+ }
+ catch ( const container::NoSuchElementException& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+SvLBoxEntry* BasicTreeListBox::ImpFindEntry( SvLBoxEntry* pParent, const String& rText )
+{
+ ULONG nRootPos = 0;
+ SvLBoxEntry* pEntry = pParent ? FirstChild( pParent ) : GetEntry( nRootPos );
+ while ( pEntry )
+ {
+ if ( GetEntryText( pEntry ) == rText )
+ return pEntry;
+
+ pEntry = pParent ? NextSibling( pEntry ) : GetEntry( ++nRootPos );
+ }
+ return 0;
+}
+
void BasicTreeListBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
{
UpdateEntries();
@@ -477,10 +662,11 @@ long BasicTreeListBox::ExpandingHdl()
if ( aDocument.isAlive() )
{
String aLibName( aDesc.GetLibName() );
+ String aLibSubName( aDesc.GetLibSubName() );
String aName( aDesc.GetName() );
String aMethodName( aDesc.GetMethodName() );
- if ( aLibName.Len() && !aName.Len() && !aMethodName.Len() )
+ if ( aLibName.Len() && !aLibSubName.Len() && !aName.Len() && !aMethodName.Len() )
{
// check password, if library is password protected and not verified
::rtl::OUString aOULibName( aLibName );
@@ -633,7 +819,7 @@ void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc )
aDesc = BasicEntryDescriptor(
ScriptDocument::getApplicationScriptDocument(),
LIBRARY_LOCATION_USER, String::CreateFromAscii( "Standard" ),
- String::CreateFromAscii( "." ), OBJ_TYPE_UNKNOWN );
+ String(), String::CreateFromAscii( "." ), OBJ_TYPE_UNKNOWN );
}
ScriptDocument aDocument( aDesc.GetDocument() );
OSL_ENSURE( aDocument.isValid(), "BasicTreeListBox::SetCurrentEntry: invalid document!" );
@@ -650,14 +836,24 @@ void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc )
if ( pLibEntry )
{
pCurEntry = pLibEntry;
+ String aLibSubName( aDesc.GetLibSubName() );
+ if( aLibSubName.Len() )
+ {
+ Expand( pLibEntry );
+ SvLBoxEntry* pLibSubEntry = ImpFindEntry( pLibEntry, aLibSubName );
+ if( pLibSubEntry )
+ {
+ pCurEntry = pLibSubEntry;
+ }
+ }
String aName( aDesc.GetName() );
if ( aName.Len() )
{
- Expand( pLibEntry );
+ Expand( pCurEntry );
BasicEntryType eType = OBJ_TYPE_MODULE;
if ( aDesc.GetType() == OBJ_TYPE_DIALOG )
eType = OBJ_TYPE_DIALOG;
- SvLBoxEntry* pEntry = FindEntry( pLibEntry, aName, eType );
+ SvLBoxEntry* pEntry = FindEntry( pCurEntry, aName, eType );
if ( pEntry )
{
pCurEntry = pEntry;
diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx
index 26cfb7f17..8bfeba21e 100644
--- a/basctl/source/basicide/bastype2.hxx
+++ b/basctl/source/basicide/bastype2.hxx
@@ -39,7 +39,7 @@
#include <sbxitem.hxx>
#include "basobj.hxx"
-enum BasicEntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, OBJ_TYPE_LIBRARY, OBJ_TYPE_MODULE, OBJ_TYPE_DIALOG, OBJ_TYPE_METHOD };
+enum BasicEntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, OBJ_TYPE_LIBRARY, OBJ_TYPE_MODULE, OBJ_TYPE_DIALOG, OBJ_TYPE_METHOD, OBJ_TYPE_DOCUMENT_OBJECTS, OBJ_TYPE_USERFORMS, OBJ_TYPE_NORMAL_MODULES, OBJ_TYPE_CLASS_MODULES };
#define BROWSEMODE_MODULES 0x01
#define BROWSEMODE_SUBS 0x02
@@ -98,14 +98,15 @@ class BasicEntryDescriptor
ScriptDocument m_aDocument;
LibraryLocation m_eLocation;
String m_aLibName;
+ String m_aLibSubName; // for vba entry: Document Objects, Class Modules, Forms and Normal Modules
String m_aName;
String m_aMethodName;
BasicEntryType m_eType;
public:
BasicEntryDescriptor();
- BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, BasicEntryType eType );
- BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, const String& rMethodName, BasicEntryType eType );
+ BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, BasicEntryType eType );
+ BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, const String& rMethodName, BasicEntryType eType );
virtual ~BasicEntryDescriptor();
BasicEntryDescriptor( const BasicEntryDescriptor& rDesc );
@@ -122,6 +123,9 @@ public:
const String& GetLibName() const { return m_aLibName; }
void SetLibName( const String& aLibName ) { m_aLibName = aLibName; }
+ const String& GetLibSubName() const { return m_aLibSubName; }
+ void SetLibSubName( const String& aLibSubName ) { m_aLibSubName = aLibSubName; }
+
const String& GetName() const { return m_aName; }
void SetName( const String& aName ) { m_aName = aName; }
@@ -161,6 +165,9 @@ protected:
void ImpCreateLibEntries( SvLBoxEntry* pShellRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation );
void ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName );
+ void ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName );
+ void ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName );
+ SvLBoxEntry* ImpFindEntry( SvLBoxEntry* pParent, const String& rText );
// DocumentEventListener
virtual void onDocumentCreated( const ScriptDocument& _rDocument );
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index 727ffa2ed..4c2bc3061 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -131,6 +131,14 @@ void __EXPORT BasicTreeListBox::RequestingChilds( SvLBoxEntry* pEntry )
}
}
}
+ else if ( eType == OBJ_TYPE_DOCUMENT_OBJECTS
+ || eType == OBJ_TYPE_USERFORMS
+ || eType == OBJ_TYPE_NORMAL_MODULES
+ || eType == OBJ_TYPE_CLASS_MODULES )
+ {
+ String aLibName( aDesc.GetLibName() );
+ ImpCreateLibSubSubEntriesInVBAMode( pEntry, aDocument, aLibName );
+ }
else {
DBG_ERROR( "BasicTreeListBox::RequestingChilds: Unknown Type!" );
}
@@ -201,6 +209,7 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry )
}
SbxVariable* pVar = 0;
+ bool bDocumentObjects = false;
if ( aEntries.Count() )
{
for ( USHORT n = 0; n < aEntries.Count(); n++ )
@@ -223,6 +232,12 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry )
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 )
+ {
+ sal_uInt16 nIndex = 0;
+ aName = aName.GetToken( 0, ' ', nIndex );
+ }
pVar = ((StarBASIC*)pVar)->FindModule( aName );
}
break;
@@ -237,6 +252,15 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry )
// sbx dialogs removed
}
break;
+ case OBJ_TYPE_DOCUMENT_OBJECTS:
+ bDocumentObjects = true;
+ case OBJ_TYPE_USERFORMS:
+ case OBJ_TYPE_NORMAL_MODULES:
+ case OBJ_TYPE_CLASS_MODULES:
+ {
+ // skip, to find the child entry.
+ continue;
+ }
default:
{
DBG_ERROR( "FindVariable: Unbekannter Typ!" );
@@ -257,12 +281,13 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry )
ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() );
LibraryLocation eLocation = LIBRARY_LOCATION_UNKNOWN;
String aLibName;
+ String aLibSubName;
String aName;
String aMethodName;
BasicEntryType eType = OBJ_TYPE_UNKNOWN;
if ( !pEntry )
- return BasicEntryDescriptor( aDocument, eLocation, aLibName, aName, aMethodName, eType );
+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType );
EntryArray aEntries;
@@ -329,6 +354,15 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry )
eType = pBE->GetType();
}
break;
+ case OBJ_TYPE_DOCUMENT_OBJECTS:
+ case OBJ_TYPE_USERFORMS:
+ case OBJ_TYPE_NORMAL_MODULES:
+ case OBJ_TYPE_CLASS_MODULES:
+ {
+ aLibSubName = GetEntryText( pLE );
+ eType = pBE->GetType();
+ }
+ break;
default:
{
DBG_ERROR( "GetEntryDescriptor: Unbekannter Typ!" );
@@ -342,7 +376,7 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry )
}
}
- return BasicEntryDescriptor( aDocument, eLocation, aLibName, aName, aMethodName, eType );
+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType );
}
USHORT BasicTreeListBox::ConvertType( BasicEntryType eType )
@@ -424,6 +458,14 @@ bool BasicTreeListBox::IsValidEntry( SvLBoxEntry* pEntry )
bIsValid = BasicIDE::HasMethod( aDocument, aLibName, aName, aMethodName );
}
break;
+ case OBJ_TYPE_DOCUMENT_OBJECTS:
+ case OBJ_TYPE_USERFORMS:
+ case OBJ_TYPE_NORMAL_MODULES:
+ case OBJ_TYPE_CLASS_MODULES:
+ {
+ bIsValid = true;
+ }
+ break;
default: ;
}
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 7bffee8ba..88586d950 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -57,6 +57,7 @@
#include <com/sun/star/script/XLibraryContainer2.hpp>
#endif
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
+#include <com/sun/star/script/ModuleType.hpp>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
@@ -584,8 +585,32 @@ void __EXPORT BasicIDETabBar::Command( const CommandEvent& rCEvt )
aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE );
aPopup.RemoveDisabledEntries();
}
+ if ( aDocument.isInVBAMode() )
+ {
+ // disable to delete or remove object modules in IDE
+ BasicManager* pBasMgr = aDocument.getBasicManager();
+ if ( pBasMgr )
+ {
+ StarBASIC* pBasic = pBasMgr->GetLib( aOULibName );
+ if( pBasic )
+ {
+ IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable();
+ IDEBaseWindow* pWin = aIDEWindowTable.Get( GetCurPageId() );
+ if( pWin && pWin->ISA( ModulWindow ) )
+ {
+ SbModule* pActiveModule = (SbModule*)pBasic->FindModule( pWin->GetName() );
+ if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::DOCUMENT ) )
+ {
+ aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, FALSE );
+ aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE );
+ }
+ }
+ }
+ }
+ }
}
+
SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
if ( pDispatcher )
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index b8a7f6ba0..cfd9e06f4 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -382,7 +382,15 @@ 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().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
+ {
+ sal_uInt16 nIndex = 0;
+ aModName = aModName.GetToken( 0, ' ', nIndex );
+ }
pModule = pBasic->FindModule( aModName );
+ }
else if ( pBasic->GetModules()->Count() )
pModule = (SbModule*)pBasic->GetModules()->Get( 0 );
@@ -710,6 +718,12 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
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().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
+ {
+ sal_uInt16 nIndex = 0;
+ aMod = aMod.GetToken( 0, ' ', nIndex );
+ }
String aSub( aDesc.GetMethodName() );
SfxMacroInfoItem aInfoItem( SID_BASICIDE_ARG_MACROINFO, pBasMgr, aLib, aMod, aSub, String() );
if ( pButton == &aEditButton )
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 420f1f164..e2a2377e5 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -84,7 +84,7 @@ BOOL __EXPORT ExtBasicTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection&
if ( pEntry )
{
USHORT nDepth = GetModel()->GetDepth( pEntry );
- if ( nDepth == 2 )
+ if ( nDepth >= 2 )
{
BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
ScriptDocument aDocument( aDesc.GetDocument() );
@@ -162,7 +162,7 @@ DragDropMode __EXPORT ExtBasicTreeListBox::NotifyStartDrag( TransferDataContaine
if ( pEntry )
{
USHORT nDepth = GetModel()->GetDepth( pEntry );
- if ( nDepth == 2 )
+ if ( nDepth >= 2 )
{
nMode_ = SV_DRAGDROP_CTRL_COPY;
BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
@@ -210,7 +210,7 @@ BOOL __EXPORT ExtBasicTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry )
// don't drop on a library, which is not loaded, readonly or password protected
// or which already has a module/dialog with this name
- if ( bValid && ( nDepth == 1 || nDepth == 2 ) )
+ if ( bValid && ( nDepth > 0 ) )
{
// get source module/dialog name
BasicEntryDescriptor aSourceDesc( GetEntryDescriptor( pSelected ) );
@@ -348,7 +348,7 @@ BOOL __EXPORT ExtBasicTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, Sv
rpNewParent = pTarget;
rNewChildPos = 0;
}
- else if ( nDepth == 2 )
+ else if ( nDepth >= 2 )
{
// Target = Modul/Dialog => Modul/Dialog unter das uebergeordnete Basic haengen...
rpNewParent = GetParent( pTarget );
@@ -623,20 +623,29 @@ void ObjectPage::CheckButtons()
{
// enable/disable edit button
SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
+ BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
+ ScriptDocument aDocument( aDesc.GetDocument() );
+ ::rtl::OUString aOULibName( aDesc.GetLibName() );
+ String aLibSubName( aDesc.GetLibSubName() );
+ sal_Bool bVBAEnabled = aDocument.isInVBAMode();
+ USHORT nMode = aBasicBox.GetMode();
+
USHORT nDepth = pCurEntry ? aBasicBox.GetModel()->GetDepth( pCurEntry ) : 0;
- if ( nDepth == 2 )
+ if ( nDepth >= 2 )
+ {
+ if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( nDepth == 2 ) )
+ aEditButton.Disable();
+ else
aEditButton.Enable();
+ }
else
aEditButton.Disable();
// enable/disable new module/dialog buttons
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
LibraryLocation eLocation( aDesc.GetLocation() );
BOOL bReadOnly = FALSE;
- if ( nDepth == 1 || nDepth == 2 )
+ if ( nDepth > 0 )
{
- ScriptDocument aDocument( aDesc.GetDocument() );
- ::rtl::OUString aOULibName( aDesc.GetLibName() );
Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
@@ -657,8 +666,13 @@ void ObjectPage::CheckButtons()
}
// enable/disable delete button
- if ( nDepth == 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
+ if ( nDepth >= 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
+ {
+ if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( ( nDepth == 2 ) || aLibSubName.Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) )
+ aDelButton.Disable();
+ else
aDelButton.Enable();
+ }
else
aDelButton.Disable();
}
@@ -685,13 +699,20 @@ IMPL_LINK( ObjectPage, ButtonHdl, Button *, pButton )
SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
DBG_ASSERT( pCurEntry, "Entry?!" );
- if ( aBasicBox.GetModel()->GetDepth( pCurEntry ) == 2 )
+ if ( aBasicBox.GetModel()->GetDepth( pCurEntry ) >= 2 )
{
BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
if ( pDispatcher )
{
+ String aModName( aDesc.GetName() );
+ // extract the module name from the string like "Sheet1 (Example1)"
+ if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
+ {
+ sal_uInt16 nIndex = 0;
+ aModName = aModName.GetToken( 0, ' ', nIndex );
+ }
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 );
}
}
@@ -973,14 +994,14 @@ SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument,
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 );
+ 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;
@@ -1002,14 +1023,27 @@ SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument,
{
if ( !rBasicBox.IsExpanded( pLibEntry ) )
rBasicBox.Expand( pLibEntry );
- SvLBoxEntry* pEntry = rBasicBox.FindEntry( pLibEntry, aModName, OBJ_TYPE_MODULE );
+ SvLBoxEntry* pSubRootEntry = pLibEntry;
+ if( pBasic && rDocument.isInVBAMode() )
+ {
+ // add the new module in the "Modules" entry
+ SvLBoxEntry* pLibSubEntry = rBasicBox.FindEntry( pLibEntry, String( IDEResId( RID_STR_NORMAL_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!" );
}
diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx
index 462fa2d6b..5fc34d9f7 100644
--- a/basctl/source/basicide/scriptdocument.cxx
+++ b/basctl/source/basicide/scriptdocument.cxx
@@ -53,6 +53,8 @@
#include <com/sun/star/frame/XModel2.hpp>
#include <com/sun/star/awt/XWindow2.hpp>
#include <com/sun/star/document/XEmbeddedScripts.hpp>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/script/XVBACompat.hpp>
/** === end UNO includes === **/
#include <sfx2/objsh.hxx>
@@ -139,6 +141,9 @@ namespace basctl
using ::com::sun::star::uno::RuntimeException;
using ::com::sun::star::document::XEventBroadcaster;
using ::com::sun::star::document::XEmbeddedScripts;
+ using ::com::sun::star::script::ModuleInfo;
+ using ::com::sun::star::script::XVBAModuleInfo;
+ using ::com::sun::star::script::XVBACompat;
/** === end UNO using === **/
namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag;
@@ -272,6 +277,7 @@ namespace basctl
// versions with the same signature/semantics as in ScriptDocument itself
bool isReadOnly() const;
+ bool isInVBAMode() const;
BasicManager*
getBasicManager() const;
Reference< XModel >
@@ -444,6 +450,20 @@ namespace basctl
return bIsReadOnly;
}
+ bool ScriptDocument_Impl::isInVBAMode() const
+ {
+ bool bResult = false;
+#ifdef FUTURE_VBA_CWS
+ if ( !isApplication() )
+ {
+ Reference< XVBACompat > xVBACompat( getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
+ if ( xVBACompat.is() )
+ bResult = xVBACompat->getVBACompatModeOn();
+ }
+#endif
+ return bResult;
+ }
+
//--------------------------------------------------------------------
BasicManager* ScriptDocument_Impl::getBasicManager() const
{
@@ -671,6 +691,16 @@ namespace basctl
}
// insert element by new name in container
+ else if ( _eType == E_SCRIPTS )
+ {
+ Reference< XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY );
+ if ( xVBAModuleInfo->hasModuleInfo( _rOldName ) )
+ {
+ ModuleInfo sModuleInfo = xVBAModuleInfo->getModuleInfo( _rOldName );
+ xVBAModuleInfo->removeModuleInfo( _rOldName );
+ xVBAModuleInfo->insertModuleInfo( _rNewName, sModuleInfo );
+ }
+ }
xLib->insertByName( _rNewName, aElement );
return true;
}
@@ -735,7 +765,6 @@ namespace basctl
Reference< XNameContainer > xLib( getOrCreateLibrary( E_SCRIPTS, _rLibName ), UNO_QUERY_THROW );
if ( !xLib->hasByName( _rModName ) )
return false;
-
xLib->replaceByName( _rModName, makeAny( _rModuleCode ) );
return true;
}
@@ -1354,6 +1383,11 @@ namespace basctl
return m_pImpl->isApplication();
}
+ bool ScriptDocument::isInVBAMode() const
+ {
+ return m_pImpl->isInVBAMode();
+ }
+
//--------------------------------------------------------------------
BasicManager* ScriptDocument::getBasicManager() const
{
diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx
index a33bb1c72..56ce8e4d6 100644
--- a/basctl/source/inc/basidesh.hxx
+++ b/basctl/source/inc/basidesh.hxx
@@ -46,6 +46,7 @@
#include <com/sun/star/io/XInputStreamProvider.hpp>
#endif
+#include <com/sun/star/container/XContainerListener.hpp>
//----------------------------------------------------------------------------
@@ -105,6 +106,8 @@ friend bool BasicIDE::RemoveDialog( const ScriptDocument& rDocument, const Strin
BOOL m_bAppBasicModified;
::basctl::DocumentEventNotifier
m_aNotifier;
+friend class ContainerListenerImpl;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xLibListener;
#if _SOLAR__PRIVATE
void Init();
diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx
index 74d239f3c..034a46010 100644
--- a/basctl/source/inc/bastypes.hxx
+++ b/basctl/source/inc/bastypes.hxx
@@ -328,5 +328,13 @@ BOOL QueryDelModule( const String& rName, Window* pParent = 0 );
BOOL QueryDelLib( const String& rName, BOOL bRef = FALSE, Window* pParent = 0 );
BOOL QueryPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >& xLibContainer, const String& rLibName, String& rPassword, BOOL bRepeat = FALSE, BOOL bNewTitle = FALSE );
-
+class ModuleInfoHelper
+{
+ModuleInfoHelper();
+ModuleInfoHelper(const ModuleInfoHelper&);
+ModuleInfoHelper& operator = (const ModuleInfoHelper&);
+public:
+ static void getObjectName( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rLib, const String& rModName, String& rObjName );
+ static sal_Int32 getModuleType( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rLib, const String& rModName );
+};
#endif // _BASTYPES_HXX
diff --git a/basctl/source/inc/scriptdocument.hxx b/basctl/source/inc/scriptdocument.hxx
index 1f7d5dfda..3db8fa2c1 100644
--- a/basctl/source/inc/scriptdocument.hxx
+++ b/basctl/source/inc/scriptdocument.hxx
@@ -212,6 +212,7 @@ namespace basctl
*/
bool isAlive() const;
+ bool isInVBAMode() const;
/// returns the BasicManager associated with this instance
BasicManager*
getBasicManager() const;