summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-11-19 11:35:41 +0100
committersb <sb@openoffice.org>2010-11-19 11:35:41 +0100
commit57b8301053c0ddc2c98d0d481fd937e5f5cb8511 (patch)
tree725e9f60932e5d891fbb1c5daf6daf6509358b83 /scripting
parent8c20b6ce4f161ff931457dd81c6febce4c5f8457 (diff)
parentafd1b3a9ac844273b5c2c59016102c7eb594b5d0 (diff)
sb131: merged in re/DEV300_next towards DEV300_m94
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/basprov/basscript.cxx22
-rw-r--r--scripting/source/basprov/basscript.hxx6
-rw-r--r--scripting/source/basprov/makefile.mk1
3 files changed, 28 insertions, 1 deletions
diff --git a/scripting/source/basprov/basscript.cxx b/scripting/source/basprov/basscript.cxx
index 620e249362..06f58b94bf 100644
--- a/scripting/source/basprov/basscript.cxx
+++ b/scripting/source/basprov/basscript.cxx
@@ -80,11 +80,33 @@ namespace basprov
,m_documentBasicManager( &documentBasicManager )
,m_xDocumentScriptContext( documentScriptContext )
{
+ StartListening( *m_documentBasicManager );
}
// -----------------------------------------------------------------------------
BasicScriptImpl::~BasicScriptImpl()
{
+ if ( m_documentBasicManager )
+ EndListening( *m_documentBasicManager );
+ }
+
+ // -----------------------------------------------------------------------------
+ // SfxListener
+ // -----------------------------------------------------------------------------
+ void BasicScriptImpl::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+ {
+ if ( &rBC != m_documentBasicManager )
+ {
+ OSL_ENSURE( false, "BasicScriptImpl::Notify: where does this come from?" );
+ // not interested in
+ return;
+ }
+ const SfxSimpleHint* pSimpleHint = PTR_CAST( SfxSimpleHint, &rHint );
+ if ( pSimpleHint && ( pSimpleHint->GetId() == SFX_HINT_DYING ) )
+ {
+ m_documentBasicManager = NULL;
+ EndListening( rBC ); // prevent multiple notifications
+ }
}
// -----------------------------------------------------------------------------
diff --git a/scripting/source/basprov/basscript.hxx b/scripting/source/basprov/basscript.hxx
index a524c186b2..99d351ee51 100644
--- a/scripting/source/basprov/basscript.hxx
+++ b/scripting/source/basprov/basscript.hxx
@@ -32,6 +32,7 @@
#include <com/sun/star/document/XScriptInvocationContext.hpp>
#include <cppuhelper/implbase1.hxx>
#include <basic/sbmeth.hxx>
+#include <svl/lstner.hxx>
class BasicManager;
@@ -49,7 +50,7 @@ namespace basprov
::com::sun::star::script::provider::XScript > BasicScriptImpl_BASE;
- class BasicScriptImpl : public BasicScriptImpl_BASE
+ class BasicScriptImpl : public BasicScriptImpl_BASE, public SfxListener
{
private:
SbMethodRef m_xMethod;
@@ -80,6 +81,9 @@ namespace basprov
::com::sun::star::script::provider::ScriptFrameworkErrorException,
::com::sun::star::reflection::InvocationTargetException,
::com::sun::star::uno::RuntimeException );
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
};
//.........................................................................
diff --git a/scripting/source/basprov/makefile.mk b/scripting/source/basprov/makefile.mk
index c98f961e6b..bde15f95d5 100644
--- a/scripting/source/basprov/makefile.mk
+++ b/scripting/source/basprov/makefile.mk
@@ -58,6 +58,7 @@ SHL1STDLIBS= \
$(SFX2LIB) \
$(BASICLIB) \
$(VCLLIB) \
+ $(SVLLIB) \
$(TOOLSLIB) \
$(UCBHELPERLIB) \
$(COMPHELPERLIB) \