summaryrefslogtreecommitdiff
path: root/basctl/source/basicide/basidesh.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basctl/source/basicide/basidesh.cxx')
-rw-r--r--basctl/source/basicide/basidesh.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 9e698af58917..608cc51c1ff3 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -1008,17 +1008,23 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, String aLibName,
{
ContainerListenerImpl* pListener = NULL;
- if ( rDocument.isInVBAMode() )
- pListener = dynamic_cast< ContainerListenerImpl* >( m_xLibListener.get() );
+ pListener = dynamic_cast< ContainerListenerImpl* >( m_xLibListener.get() );
if ( pListener )
pListener->removeContainerListener( m_aCurDocument, m_aCurLibName );
m_aCurDocument = rDocument;
- if ( pListener )
- pListener->addContainerListener( m_aCurDocument, aLibName );
+ if ( m_aCurDocument.isInVBAMode() )
+ {
+ if ( !pListener )
+ {
+ pListener = new ContainerListenerImpl( this );
+ m_xLibListener = pListener;
+ }
+ pListener->addContainerListener( m_aCurDocument, aLibName );
+ }
m_aCurLibName = aLibName;
if ( bUpdateWindows )
UpdateWindows();