diff options
author | Noel Power <npower@openoffice.org> | 2003-10-15 07:35:32 +0000 |
---|---|---|
committer | Noel Power <npower@openoffice.org> | 2003-10-15 07:35:32 +0000 |
commit | 523410191cee137ccea76c603525add921282538 (patch) | |
tree | cd0405089e57a2253aa4f21d4876baf0dfefb816 /scripting/source/basprov/basmethnode.cxx | |
parent | 690c84cb8b109199a028d7f3b8992ef68da96a6f (diff) |
#i21213#
#i21214#
changes to basic provider to ensure that scripts get displayed ( implemented XPropertySet on script node implementation basmethnode. Also changed basprov ( basic provider ) to handle application context invoke requests ( also display of share scripts ). Now when basic provider is created ( regardless of context ) it will always be able to execute a script, whatever the location.
Diffstat (limited to 'scripting/source/basprov/basmethnode.cxx')
-rw-r--r-- | scripting/source/basprov/basmethnode.cxx | 122 |
1 files changed, 117 insertions, 5 deletions
diff --git a/scripting/source/basprov/basmethnode.cxx b/scripting/source/basprov/basmethnode.cxx index d540d78ec73e..45c09f7f3203 100644 --- a/scripting/source/basprov/basmethnode.cxx +++ b/scripting/source/basprov/basmethnode.cxx @@ -2,9 +2,9 @@ * * $RCSfile: basmethnode.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: tbe $ $Date: 2003-09-23 10:09:14 $ + * last change: $Author: npower $ $Date: 2003-10-15 08:35:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,7 +73,9 @@ #ifndef _SB_SBMETH_HXX #include <basic/sbmeth.hxx> #endif - +#ifndef _SB_SBMOD_HXX +#include <basic/sbmod.hxx> +#endif using namespace ::com::sun::star; using namespace ::com::sun::star::lang; @@ -90,9 +92,40 @@ namespace basprov // BasicMethodNodeImpl // ============================================================================= - BasicMethodNodeImpl::BasicMethodNodeImpl( SbMethod* pMethod ) - :m_pMethod( pMethod ) + BasicMethodNodeImpl::BasicMethodNodeImpl( SbMethod* pMethod, bool isAppScript ) + :m_pMethod( pMethod ), m_bIsAppScript( isAppScript ) { + // TO DO ( needs changing to vnd...script::// syntax ) + String sModName = m_pMethod->GetModule()->GetName(); + String sLibName = m_pMethod->GetModule()->GetParent()->GetName(); + String sMethName = m_pMethod->GetName(); + String sTmp = String::CreateFromAscii("script://"); + sTmp += sLibName; + sTmp += '.'; + sTmp += sModName; + sTmp += '.'; + sTmp += sMethName; + sTmp += String::CreateFromAscii("?language=Basic&location="); + if ( m_bIsAppScript ) + { + sTmp += String::CreateFromAscii("application"); + } + else + { + sTmp += String::CreateFromAscii("document"); + } + rtl::OUString sUrl( sTmp ); + try + { + Any aURIVal; + aURIVal <<= sUrl; + setPropertyValue( ::rtl::OUString::createFromAscii("URI"), aURIVal); + } + catch ( RuntimeException& re ) + { + OSL_TRACE("caught exception trying to set property %s", + ::rtl::OUStringToOString( re.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer ); + } } // ----------------------------------------------------------------------------- @@ -145,6 +178,85 @@ namespace basprov // ----------------------------------------------------------------------------- + +//************************************************************************* +// XPropertySet implementation +//************************************************************************* +Reference< beans::XPropertySetInfo > SAL_CALL BasicMethodNodeImpl::getPropertySetInfo( ) + throw ( RuntimeException ) +{ + return Reference< beans::XPropertySetInfo > (); // Not supported +} + +//************************************************************************* +void SAL_CALL BasicMethodNodeImpl::setPropertyValue( const ::rtl::OUString& aPropertyName, + const Any& aValue ) + throw ( beans::UnknownPropertyException, beans::PropertyVetoException, + lang::IllegalArgumentException, lang::WrappedTargetException, + RuntimeException ) +{ + m_hProps[ aPropertyName ] = aValue; +} + +//************************************************************************* +Any SAL_CALL BasicMethodNodeImpl::getPropertyValue( const ::rtl::OUString& PropertyName ) + throw ( beans::UnknownPropertyException, + lang::WrappedTargetException, RuntimeException ) +{ + Any returnValue = m_hProps[ PropertyName ]; + + return returnValue; +} + +//************************************************************************* +void SAL_CALL BasicMethodNodeImpl::addPropertyChangeListener( + const ::rtl::OUString& aPropertyName, + const Reference< beans::XPropertyChangeListener >& xListener ) + throw ( beans::UnknownPropertyException, lang::WrappedTargetException, + RuntimeException ) +{ + throw RuntimeException( + ::rtl::OUString::createFromAscii( "BasicMethodNodeImpl::addPropertyChangeListener: method not supported" ), + Reference< XInterface >() ); +} + +//************************************************************************* +void SAL_CALL BasicMethodNodeImpl::removePropertyChangeListener( + const ::rtl::OUString& aPropertyName, + const Reference< beans::XPropertyChangeListener >& aListener ) + throw ( beans::UnknownPropertyException, lang::WrappedTargetException, + RuntimeException ) +{ + throw RuntimeException( + ::rtl::OUString::createFromAscii( "BasicMethodNodeImpl::removePropertyChangeListener: method not supported" ), + Reference< XInterface >() ); +} + +//************************************************************************* +void SAL_CALL BasicMethodNodeImpl::addVetoableChangeListener( + const ::rtl::OUString& PropertyName, + const Reference< beans::XVetoableChangeListener >& aListener ) + throw ( beans::UnknownPropertyException, lang::WrappedTargetException, + RuntimeException ) +{ + throw RuntimeException( + ::rtl::OUString::createFromAscii( "BasicMethodNodeImpl::addVetoableChangeListener: method not supported" ), + Reference< XInterface >() ); +} + +//************************************************************************* +void SAL_CALL BasicMethodNodeImpl::removeVetoableChangeListener( + const ::rtl::OUString& PropertyName, + const Reference< beans::XVetoableChangeListener >& aListener ) + throw ( beans::UnknownPropertyException, lang::WrappedTargetException, + RuntimeException ) +{ + throw RuntimeException( + ::rtl::OUString::createFromAscii( "BasicMethodNodeImpl::removeVetoableChangeListener: method not supported" ), + Reference< XInterface >() ); +} + + //......................................................................... } // namespace basprov //......................................................................... |