diff options
Diffstat (limited to 'scripting')
70 files changed, 709 insertions, 193 deletions
diff --git a/scripting/inc/pch/precompiled_scripting.cxx b/scripting/inc/pch/precompiled_scripting.cxx index bb356b6fc81c..2f6b52f752ab 100644 --- a/scripting/inc/pch/precompiled_scripting.cxx +++ b/scripting/inc/pch/precompiled_scripting.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,3 +28,4 @@ #include "precompiled_scripting.hxx" +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/inc/pch/precompiled_scripting.hxx b/scripting/inc/pch/precompiled_scripting.hxx index f2d1b0498324..32ba177675fc 100644 --- a/scripting/inc/pch/precompiled_scripting.hxx +++ b/scripting/inc/pch/precompiled_scripting.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,3 +31,4 @@ #ifdef PRECOMPILED_HEADERS #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/basprov/baslibnode.cxx b/scripting/source/basprov/baslibnode.cxx index d955d75cca4a..acec5ae07bef 100644 --- a/scripting/source/basprov/baslibnode.cxx +++ b/scripting/source/basprov/baslibnode.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,7 @@ #include "baslibnode.hxx" #include "basmodnode.hxx" #include <com/sun/star/script/browse/BrowseNodeTypes.hpp> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <basic/basmgr.hxx> #include <basic/sbstar.hxx> @@ -80,7 +81,7 @@ namespace basprov ::rtl::OUString BasicLibraryNodeImpl::getName( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return m_sLibName; } @@ -89,7 +90,7 @@ namespace basprov Sequence< Reference< browse::XBrowseNode > > BasicLibraryNodeImpl::getChildNodes( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Sequence< Reference< browse::XBrowseNode > > aChildNodes; @@ -123,7 +124,7 @@ namespace basprov sal_Bool BasicLibraryNodeImpl::hasChildNodes( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Bool bReturn = sal_False; if ( m_xLibrary.is() ) @@ -136,7 +137,7 @@ namespace basprov sal_Int16 BasicLibraryNodeImpl::getType( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return browse::BrowseNodeTypes::CONTAINER; } @@ -146,3 +147,5 @@ namespace basprov //......................................................................... } // namespace basprov //......................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/basprov/baslibnode.hxx b/scripting/source/basprov/baslibnode.hxx index 8843f4121306..ec28431105b3 100644 --- a/scripting/source/basprov/baslibnode.hxx +++ b/scripting/source/basprov/baslibnode.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -85,3 +86,5 @@ namespace basprov //......................................................................... #endif // SCRIPTING_BASLIBNODE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/basprov/basmethnode.cxx b/scripting/source/basprov/basmethnode.cxx index f27b612ce9cb..f87ee1759dd2 100644 --- a/scripting/source/basprov/basmethnode.cxx +++ b/scripting/source/basprov/basmethnode.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,7 +35,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/script/browse/BrowseNodeTypes.hpp> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <basic/sbstar.hxx> #include <basic/sbmeth.hxx> @@ -129,7 +130,7 @@ namespace basprov ::rtl::OUString BasicMethodNodeImpl::getName( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ::rtl::OUString sMethodName; if ( m_pMethod ) @@ -142,7 +143,7 @@ namespace basprov Sequence< Reference< browse::XBrowseNode > > BasicMethodNodeImpl::getChildNodes( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return Sequence< Reference< browse::XBrowseNode > >(); } @@ -151,7 +152,7 @@ namespace basprov sal_Bool BasicMethodNodeImpl::hasChildNodes( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return sal_False; } @@ -160,7 +161,7 @@ namespace basprov sal_Int16 BasicMethodNodeImpl::getType( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return browse::BrowseNodeTypes::SCRIPT; } @@ -356,3 +357,5 @@ namespace basprov //......................................................................... } // namespace basprov //......................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/basprov/basmethnode.hxx b/scripting/source/basprov/basmethnode.hxx index cd4f587c884f..0a19db15f863 100644 --- a/scripting/source/basprov/basmethnode.hxx +++ b/scripting/source/basprov/basmethnode.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -130,3 +131,5 @@ namespace basprov //......................................................................... #endif // SCRIPTING_BASMETHNODE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/basprov/basmodnode.cxx b/scripting/source/basprov/basmodnode.cxx index fe6ed69fccab..d64cdac165d4 100644 --- a/scripting/source/basprov/basmodnode.cxx +++ b/scripting/source/basprov/basmodnode.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,7 @@ #include "basmodnode.hxx" #include "basmethnode.hxx" #include <com/sun/star/script/browse/BrowseNodeTypes.hpp> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <basic/sbx.hxx> #include <basic/sbstar.hxx> @@ -74,7 +75,7 @@ namespace basprov ::rtl::OUString BasicModuleNodeImpl::getName( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ::rtl::OUString sModuleName; if ( m_pModule ) @@ -87,7 +88,7 @@ namespace basprov Sequence< Reference< browse::XBrowseNode > > BasicModuleNodeImpl::getChildNodes( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Sequence< Reference< browse::XBrowseNode > > aChildNodes; @@ -124,7 +125,7 @@ namespace basprov sal_Bool BasicModuleNodeImpl::hasChildNodes( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Bool bReturn = sal_False; if ( m_pModule ) @@ -141,7 +142,7 @@ namespace basprov sal_Int16 BasicModuleNodeImpl::getType( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return browse::BrowseNodeTypes::CONTAINER; } @@ -151,3 +152,5 @@ namespace basprov //......................................................................... } // namespace basprov //......................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/basprov/basmodnode.hxx b/scripting/source/basprov/basmodnode.hxx index 6f3ef3263e51..cc909f0ab162 100644 --- a/scripting/source/basprov/basmodnode.hxx +++ b/scripting/source/basprov/basmodnode.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -79,3 +80,5 @@ namespace basprov //......................................................................... #endif // SCRIPTING_BASMODNODE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx index 73f6abd1c87d..5cb4e1425f7b 100644 --- a/scripting/source/basprov/basprov.cxx +++ b/scripting/source/basprov/basprov.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,7 +40,7 @@ #include <rtl/uri.hxx> #include <osl/process.h> #include <osl/file.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <basic/sbx.hxx> #include <basic/basmgr.hxx> @@ -239,7 +240,7 @@ namespace basprov { // TODO - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( aArguments.getLength() != 1 ) { @@ -332,7 +333,7 @@ namespace basprov { // TODO - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Reference< provider::XScript > xScript; Reference< lang::XMultiComponentFactory > xMcFac ( m_xContext->getServiceManager() ); @@ -369,7 +370,33 @@ namespace basprov ::rtl::OUString::createFromAscii( "location" ) ); sal_Int32 nIndex = 0; - ::rtl::OUString aLibrary = aDescription.getToken( 0, (sal_Unicode)'.', nIndex ); + // In some strange circumstances the Library name can have an + // apparantly illegal '.' in it ( in imported VBA ) + + BasicManager* pBasicMgr = NULL; + if ( aLocation.equals( ::rtl::OUString::createFromAscii("document") ) ) + { + pBasicMgr = m_pDocBasicManager; + } + else if ( aLocation.equals( ::rtl::OUString::createFromAscii("application") ) ) + { + pBasicMgr = m_pAppBasicManager; + } + rtl::OUString sProjectName; + if ( pBasicMgr ) + sProjectName = pBasicMgr->GetName(); + + ::rtl::OUString aLibrary; + if ( sProjectName.getLength() && aDescription.match( sProjectName ) ) + { + OSL_TRACE("LibraryName %s is part of the url %s", + rtl::OUStringToOString( sProjectName, RTL_TEXTENCODING_UTF8 ).getStr(), + rtl::OUStringToOString( aDescription, RTL_TEXTENCODING_UTF8 ).getStr() ); + aLibrary = sProjectName; + nIndex = sProjectName.getLength() + 1; + } + else + aLibrary = aDescription.getToken( 0, (sal_Unicode)'.', nIndex ); ::rtl::OUString aModule; if ( nIndex != -1 ) aModule = aDescription.getToken( 0, (sal_Unicode)'.', nIndex ); @@ -379,15 +406,6 @@ namespace basprov if ( aLibrary.getLength() != 0 && aModule.getLength() != 0 && aMethod.getLength() != 0 && aLocation.getLength() != 0 ) { - BasicManager* pBasicMgr = NULL; - if ( aLocation.equals( ::rtl::OUString::createFromAscii("document") ) ) - { - pBasicMgr = m_pDocBasicManager; - } - else if ( aLocation.equals( ::rtl::OUString::createFromAscii("application") ) ) - { - pBasicMgr = m_pAppBasicManager; - } if ( pBasicMgr ) { @@ -449,7 +467,7 @@ namespace basprov { // TODO - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return ::rtl::OUString::createFromAscii( "Basic" ); } @@ -458,7 +476,7 @@ namespace basprov Sequence< Reference< browse::XBrowseNode > > BasicProviderImpl::getChildNodes( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Reference< script::XLibraryContainer > xLibContainer; BasicManager* pBasicManager = NULL; @@ -516,7 +534,7 @@ namespace basprov sal_Bool BasicProviderImpl::hasChildNodes( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Bool bReturn = sal_False; Reference< script::XLibraryContainer > xLibContainer; @@ -538,7 +556,7 @@ namespace basprov sal_Int16 BasicProviderImpl::getType( ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return browse::BrowseNodeTypes::CONTAINER; } @@ -602,3 +620,5 @@ extern "C" pImplName, pServiceManager, pRegistryKey, ::basprov::s_component_entries ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/basprov/basprov.hxx b/scripting/source/basprov/basprov.hxx index 6cef4488fb43..7f7893ee1296 100644 --- a/scripting/source/basprov/basprov.hxx +++ b/scripting/source/basprov/basprov.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -113,3 +114,5 @@ namespace basprov //......................................................................... #endif // SCRIPTING_BASPROV_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/basprov/basscript.cxx b/scripting/source/basprov/basscript.cxx index c6de155e3ed0..978065053d5d 100644 --- a/scripting/source/basprov/basscript.cxx +++ b/scripting/source/basprov/basscript.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_scripting.hxx" #include "basscript.hxx" -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <basic/sbx.hxx> #include <basic/sbstar.hxx> @@ -36,7 +37,10 @@ #include <basic/sbmeth.hxx> #include <basic/basmgr.hxx> #include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp> - +#include "bcholder.hxx" +#include <comphelper/proparrhlp.hxx> +#include <comphelper/propertycontainer.hxx> +#include <com/sun/star/beans/PropertyAttribute.hpp> #include <map> @@ -45,6 +49,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::script; using namespace ::com::sun::star::document; +using namespace ::com::sun::star::beans; extern ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar ); extern void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue ); @@ -54,6 +59,10 @@ extern void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& namespace basprov { //......................................................................... +#define BASSCRIPT_PROPERTY_ID_CALLER 1 +#define BASSCRIPT_PROPERTY_CALLER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Caller" ) ) + +#define BASSCRIPT_DEFAULT_ATTRIBS() PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap; @@ -64,22 +73,28 @@ namespace basprov // ----------------------------------------------------------------------------- BasicScriptImpl::BasicScriptImpl( const ::rtl::OUString& funcName, SbMethodRef xMethod ) - :m_xMethod( xMethod ) + : ::scripting_helper::OBroadcastHelperHolder( m_aMutex ) + ,OPropertyContainer( GetBroadcastHelper() ) + ,m_xMethod( xMethod ) ,m_funcName( funcName ) ,m_documentBasicManager( NULL ) ,m_xDocumentScriptContext() { + registerProperty( BASSCRIPT_PROPERTY_CALLER, BASSCRIPT_PROPERTY_ID_CALLER, BASSCRIPT_DEFAULT_ATTRIBS(), &m_caller, ::getCppuType( &m_caller ) ); } // ----------------------------------------------------------------------------- BasicScriptImpl::BasicScriptImpl( const ::rtl::OUString& funcName, SbMethodRef xMethod, - BasicManager& documentBasicManager, const Reference< XScriptInvocationContext >& documentScriptContext ) - :m_xMethod( xMethod ) + BasicManager& documentBasicManager, const Reference< XScriptInvocationContext >& documentScriptContext ) : ::scripting_helper::OBroadcastHelperHolder( m_aMutex ) + ,OPropertyContainer( GetBroadcastHelper() ) + ,m_xMethod( xMethod ) ,m_funcName( funcName ) ,m_documentBasicManager( &documentBasicManager ) ,m_xDocumentScriptContext( documentScriptContext ) { + // + registerProperty( BASSCRIPT_PROPERTY_CALLER, BASSCRIPT_PROPERTY_ID_CALLER, BASSCRIPT_DEFAULT_ATTRIBS(), &m_caller, ::getCppuType( &m_caller ) ); } // ----------------------------------------------------------------------------- @@ -88,6 +103,48 @@ namespace basprov } // ----------------------------------------------------------------------------- + // XInterface + // ----------------------------------------------------------------------------- + + IMPLEMENT_FORWARD_XINTERFACE2( BasicScriptImpl, BasicScriptImpl_BASE, OPropertyContainer ) + + // ----------------------------------------------------------------------------- + // XTypeProvider + // ----------------------------------------------------------------------------- + + IMPLEMENT_FORWARD_XTYPEPROVIDER2( BasicScriptImpl, BasicScriptImpl_BASE, OPropertyContainer ) + + // ----------------------------------------------------------------------------- + // OPropertySetHelper + // ----------------------------------------------------------------------------- + + ::cppu::IPropertyArrayHelper& BasicScriptImpl::getInfoHelper( ) + { + return *getArrayHelper(); + } + + // ----------------------------------------------------------------------------- + // OPropertyArrayUsageHelper + // ----------------------------------------------------------------------------- + + ::cppu::IPropertyArrayHelper* BasicScriptImpl::createArrayHelper( ) const + { + Sequence< Property > aProps; + describeProperties( aProps ); + return new ::cppu::OPropertyArrayHelper( aProps ); + } + + // ----------------------------------------------------------------------------- + // XPropertySet + // ----------------------------------------------------------------------------- + + Reference< XPropertySetInfo > BasicScriptImpl::getPropertySetInfo( ) throw (RuntimeException) + { + Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; + } + + // ----------------------------------------------------------------------------- // XScript // ----------------------------------------------------------------------------- @@ -97,7 +154,7 @@ namespace basprov // TODO: throw CannotConvertException // TODO: check length of aOutParamIndex, aOutParam - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Any aReturn; @@ -166,8 +223,14 @@ namespace basprov if ( m_documentBasicManager && m_xDocumentScriptContext.is() ) aOldThisComponent = m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( m_xDocumentScriptContext ) ); + if ( m_caller.getLength() && m_caller[ 0 ].hasValue() ) + { + SbxVariableRef xCallerVar = new SbxVariable( SbxVARIANT ); + unoToSbxValue( static_cast< SbxVariable* >( xCallerVar ), m_caller[ 0 ] ); + nErr = m_xMethod->Call( xReturn, xCallerVar ); + } + else nErr = m_xMethod->Call( xReturn ); - if ( m_documentBasicManager && m_xDocumentScriptContext.is() ) m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent ); } @@ -224,3 +287,5 @@ namespace basprov //......................................................................... } // namespace basprov //......................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/basprov/basscript.hxx b/scripting/source/basprov/basscript.hxx index 4a3d6f1ab61d..c3322e319164 100644 --- a/scripting/source/basprov/basscript.hxx +++ b/scripting/source/basprov/basscript.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,12 +29,14 @@ #ifndef SCRIPTING_BASSCRIPT_HXX #define SCRIPTING_BASSCRIPT_HXX +#include "bcholder.hxx" #include <com/sun/star/script/provider/XScript.hpp> #include <com/sun/star/document/XScriptInvocationContext.hpp> #include <cppuhelper/implbase1.hxx> +#include <comphelper/proparrhlp.hxx> +#include <comphelper/propertycontainer.hxx> #include <basic/sbmeth.hxx> - class BasicManager; //......................................................................... @@ -49,7 +52,11 @@ namespace basprov ::com::sun::star::script::provider::XScript > BasicScriptImpl_BASE; - class BasicScriptImpl : public BasicScriptImpl_BASE + class BasicScriptImpl : public BasicScriptImpl_BASE, + public ::scripting_helper::OMutexHolder, + public ::scripting_helper::OBroadcastHelperHolder, + public ::comphelper::OPropertyContainer, + public ::comphelper::OPropertyArrayUsageHelper< BasicScriptImpl > { private: SbMethodRef m_xMethod; @@ -57,6 +64,16 @@ namespace basprov BasicManager* m_documentBasicManager; ::com::sun::star::uno::Reference< ::com::sun::star::document::XScriptInvocationContext > m_xDocumentScriptContext; + // hack, OPropertyContainer doesn't allow you to define a property of unknown + // type ( I guess because an Any can't contain an Any... I've always wondered why? + // as its not unusual to do that in corba ) + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_caller; + protected: + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper( ); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; public: BasicScriptImpl( @@ -71,6 +88,12 @@ namespace basprov ); virtual ~BasicScriptImpl(); + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + // XScript virtual ::com::sun::star::uno::Any SAL_CALL invoke( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, @@ -80,6 +103,9 @@ namespace basprov ::com::sun::star::script::provider::ScriptFrameworkErrorException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException ); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) + throw (::com::sun::star::uno::RuntimeException); }; //......................................................................... @@ -87,3 +113,5 @@ namespace basprov //......................................................................... #endif // SCRIPTING_BASSCRIPT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx index 6c3694ea237d..836d723a14c1 100644 --- a/scripting/source/dlgprov/dlgevtatt.cxx +++ b/scripting/source/dlgprov/dlgevtatt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -108,13 +109,14 @@ namespace dlgprov { protected: rtl::OUString msDialogCodeName; + rtl::OUString msDialogLibName; Reference< script::XScriptListener > mxListener; virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet ); public: - DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel ); + DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const rtl::OUString& sDialogLibName ); }; - DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel ) : DialogScriptListenerImpl( rxContext ) + DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const rtl::OUString& sDialogLibName ) : DialogScriptListenerImpl( rxContext ), msDialogLibName( sDialogLibName ) { Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() ); Sequence< Any > args(1); @@ -145,7 +147,7 @@ namespace dlgprov if ( aScriptEvent.ScriptType.equals( rtl::OUString::createFromAscii("VBAInterop") ) && mxListener.is() ) { ScriptEvent aScriptEventCopy( aScriptEvent ); - aScriptEventCopy.ScriptCode = msDialogCodeName; + aScriptEventCopy.ScriptCode = msDialogLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( msDialogCodeName ); try { mxListener->firing( aScriptEventCopy ); @@ -163,7 +165,7 @@ namespace dlgprov // DialogEventsAttacherImpl // ============================================================================= - DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener ) + DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener, const rtl::OUString& sDialogLibName ) :mbUseFakeVBAEvents( false ), m_xContext( rxContext ) { // key listeners by protocol when ScriptType = 'Script' @@ -186,11 +188,11 @@ namespace dlgprov { pFoundShell = reinterpret_cast<SfxObjectShell*>( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId())); if ( pFoundShell ) - mbUseFakeVBAEvents = ooo::vba::isAlienExcelDoc( *pFoundShell ); + mbUseFakeVBAEvents = ooo::vba::isAlienExcelDoc( *pFoundShell ) || ooo::vba::isAlienWordDoc( *pFoundShell ) ; } } if ( mbUseFakeVBAEvents ) - listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel ); + listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel, sDialogLibName ); } // ----------------------------------------------------------------------------- @@ -217,6 +219,7 @@ namespace dlgprov Reference< ooo::vba::XVBAToOOEventDescGen > xVBAToOOEvtDesc( xSMgr->createInstanceWithContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAToOOEventDesc" ) ), m_xContext ), UNO_QUERY ); if ( xVBAToOOEvtDesc.is() ) xEventsSupplier.set( xVBAToOOEvtDesc->getEventSupplier( xControl, sControlName ), UNO_QUERY ); + } return xEventsSupplier; } @@ -409,7 +412,7 @@ namespace dlgprov void DialogAllListenerImpl::firing( const AllEventObject& Event ) throw ( RuntimeException ) { - ::osl::MutexGuard aGuard( getMutex() ); + //::osl::MutexGuard aGuard( getMutex() ); firing_impl( Event, NULL ); } @@ -419,7 +422,7 @@ namespace dlgprov Any DialogAllListenerImpl::approveFiring( const AllEventObject& Event ) throw ( reflection::InvocationTargetException, RuntimeException ) { - ::osl::MutexGuard aGuard( getMutex() ); + //::osl::MutexGuard aGuard( getMutex() ); Any aReturn; firing_impl( Event, &aReturn ); @@ -655,7 +658,7 @@ namespace dlgprov void DialogScriptListenerImpl::firing( const ScriptEvent& aScriptEvent ) throw ( RuntimeException ) { - ::osl::MutexGuard aGuard( getMutex() ); + //::osl::MutexGuard aGuard( getMutex() ); firing_impl( aScriptEvent, NULL ); } @@ -665,7 +668,7 @@ namespace dlgprov Any DialogScriptListenerImpl::approveFiring( const ScriptEvent& aScriptEvent ) throw ( reflection::InvocationTargetException, RuntimeException ) { - ::osl::MutexGuard aGuard( getMutex() ); + //::osl::MutexGuard aGuard( getMutex() ); Any aReturn; firing_impl( aScriptEvent, &aReturn ); @@ -677,3 +680,5 @@ namespace dlgprov //......................................................................... } // namespace dlgprov //......................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/dlgprov/dlgevtatt.hxx b/scripting/source/dlgprov/dlgevtatt.hxx index 838073a2f10a..437abc668838 100644 --- a/scripting/source/dlgprov/dlgevtatt.hxx +++ b/scripting/source/dlgprov/dlgevtatt.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -76,7 +77,7 @@ namespace dlgprov const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& xIntrospect, bool bProviderMode, - const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener ); + const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener ,const rtl::OUString& sDialogLibName ); virtual ~DialogEventsAttacherImpl(); // XScriptEventsAttacher @@ -160,3 +161,5 @@ namespace dlgprov //......................................................................... #endif // SCRIPTING_DLGEVT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index 0fc0778c71d9..8eeeb85a9ec1 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -189,7 +190,15 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY ); xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURL ); - ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext ); + // #TODO we really need to detect the source of the Dialog, is it + // located in the document or not. m_xModel need not be the location of + // the dialog. E.g. if the dialog was created from basic ( then we just + // can't tell where its from ) + // If we are happy to always substitute the form model for the awt + // one then maybe the presence of a document model is enough to trigger + // swapping out the models ( or perhaps we only want to do this + // for vba mode ) there are a number of feasible and valid possibilities + ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext, m_xModel ); // Set resource property if( xStringResourceManager.is() ) { @@ -403,6 +412,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs if ( xISP.is() ) xInput = xISP->createInputStream(); + msDialogLibName = sLibName; } // import dialog model @@ -520,7 +530,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs const Reference< XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< XIntrospectionAccess >& rxIntrospectionAccess, - bool bDialogProviderMode ) + bool bDialogProviderMode, const rtl::OUString& sDialogLibName ) { if ( rxControl.is() ) { @@ -544,7 +554,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs Reference< XScriptEventsAttacher > xScriptEventsAttacher = new DialogEventsAttacherImpl ( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess, - bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ) ); + bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ), msDialogLibName ); Any aHelper; xScriptEventsAttacher->attachEvents( aObjects, Reference< XScriptListener >(), aHelper ); @@ -649,7 +659,10 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs aArguments[0] >>= m_xModel; m_BasicInfo.reset( new BasicRTLParams() ); m_BasicInfo->mxInput.set( aArguments[ 1 ], UNO_QUERY_THROW ); - m_BasicInfo->mxDlgLib.set( aArguments[ 2 ], UNO_QUERY_THROW ); + // allow null mxDlgLib, a document dialog instantiated from + // from application basic is unable to provide ( or find ) it's + // Library + aArguments[ 2 ] >>= m_BasicInfo->mxDlgLib; // leave the possibility to optionally allow the old dialog creation // to use the new XScriptListener ( which converts the old style macro // to a SF url ) @@ -733,7 +746,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs { //xDialog = Reference< XDialog >( xCtrl, UNO_QUERY ); Reference< XIntrospectionAccess > xIntrospectionAccess = inspectHandler( xHandler ); - attachControlEvents( xCtrl, xHandler, xIntrospectionAccess, bDialogProviderMode ); + attachControlEvents( xCtrl, xHandler, xIntrospectionAccess, bDialogProviderMode, msDialogLibName ); } } @@ -868,3 +881,5 @@ extern "C" pImplName, pServiceManager, pRegistryKey, ::dlgprov::s_component_entries ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/dlgprov/dlgprov.hxx b/scripting/source/dlgprov/dlgprov.hxx index bc15831d2ff1..b4c057a8ff35 100644 --- a/scripting/source/dlgprov/dlgprov.hxx +++ b/scripting/source/dlgprov/dlgprov.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -81,7 +82,7 @@ namespace dlgprov ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel; - + rtl::OUString msDialogLibName; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModel( const ::rtl::OUString& sURL ); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > createDialogControl( @@ -91,7 +92,7 @@ namespace dlgprov void attachControlEvents( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxControlContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& rxIntrospectionAccess, - bool bDialogProviderMode ); + bool bDialogProviderMode, const rtl::OUString& ); ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > inspectHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler ); // helper methods @@ -155,3 +156,5 @@ namespace dlgprov //......................................................................... #endif // SCRIPTING_DLGPROV_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/inc/bcholder.hxx b/scripting/source/inc/bcholder.hxx index adb81074828a..4b1b7db84b7a 100644 --- a/scripting/source/inc/bcholder.hxx +++ b/scripting/source/inc/bcholder.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -68,3 +69,5 @@ namespace scripting_helper //......................................................................... #endif // SCRIPTING_BCHOLDER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/inc/util/MiscUtils.hxx b/scripting/source/inc/util/MiscUtils.hxx index fcb071700be0..149f46e8d53c 100644 --- a/scripting/source/inc/util/MiscUtils.hxx +++ b/scripting/source/inc/util/MiscUtils.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -175,3 +176,5 @@ static ::rtl::OUString parseLocationName( const ::rtl::OUString& location ) }; } // namespace sf_misc #endif // + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/inc/util/scriptingconstants.hxx b/scripting/source/inc/util/scriptingconstants.hxx index c390b4c815fe..ca880a5cc216 100644 --- a/scripting/source/inc/util/scriptingconstants.hxx +++ b/scripting/source/inc/util/scriptingconstants.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -77,3 +78,5 @@ private: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/inc/util/util.hxx b/scripting/source/inc/util/util.hxx index 27e5c19ccc91..da0fa56984f1 100644 --- a/scripting/source/inc/util/util.hxx +++ b/scripting/source/inc/util/util.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,3 +48,5 @@ namespace scripting_util } } #endif //_COM_SUN_STAR_SCRIPTING_UTIL_UTIL_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx index 1e6adb6e7804..c7289b993d2f 100644 --- a/scripting/source/protocolhandler/scripthandler.cxx +++ b/scripting/source/protocolhandler/scripthandler.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -599,3 +600,4 @@ extern "C" } // extern "C" +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/protocolhandler/scripthandler.hxx b/scripting/source/protocolhandler/scripthandler.hxx index 164a8bcfe593..cf3c68cc3341 100644 --- a/scripting/source/protocolhandler/scripthandler.hxx +++ b/scripting/source/protocolhandler/scripthandler.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -149,3 +150,5 @@ public: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/ActiveMSPList.cxx b/scripting/source/provider/ActiveMSPList.cxx index 3c6206d8d051..c60e81a590ca 100644 --- a/scripting/source/provider/ActiveMSPList.cxx +++ b/scripting/source/provider/ActiveMSPList.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -322,3 +323,4 @@ ActiveMSPList::createNonDocMSPs() } // namespace func_provider +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/ActiveMSPList.hxx b/scripting/source/provider/ActiveMSPList.hxx index b127f3c41b16..22f7409c2280 100644 --- a/scripting/source/provider/ActiveMSPList.hxx +++ b/scripting/source/provider/ActiveMSPList.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -112,3 +113,5 @@ private: }; } // func_provider #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx index 763b1d739d37..bcc48dae1894 100644 --- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx +++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -795,3 +796,5 @@ sal_Bool BrowseNodeFactoryImpl::supportsService( } } // namespace browsenodefactory + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.hxx b/scripting/source/provider/BrowseNodeFactoryImpl.hxx index 29a97e2f2bf5..9594b6f6f067 100644 --- a/scripting/source/provider/BrowseNodeFactoryImpl.hxx +++ b/scripting/source/provider/BrowseNodeFactoryImpl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -86,3 +87,5 @@ public: } // namespace browsenodefactory + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx index dbade7172e6e..de359380b461 100644 --- a/scripting/source/provider/MasterScriptProvider.cxx +++ b/scripting/source/provider/MasterScriptProvider.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1035,3 +1036,5 @@ extern "C" pRegistryKey, ::scripting_runtimemgr::s_entries ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/MasterScriptProvider.hxx b/scripting/source/provider/MasterScriptProvider.hxx index 76deec00ab8f..89336a9dadb9 100644 --- a/scripting/source/provider/MasterScriptProvider.hxx +++ b/scripting/source/provider/MasterScriptProvider.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -155,3 +156,5 @@ private: }; } // namespace func_provider #endif //_FRAMEWORK_SCRIPT_PROVIDER_XFUNCTIONPROVIDER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/MasterScriptProviderFactory.cxx b/scripting/source/provider/MasterScriptProviderFactory.cxx index cd1aa83da3c7..dac81770dcd6 100644 --- a/scripting/source/provider/MasterScriptProviderFactory.cxx +++ b/scripting/source/provider/MasterScriptProviderFactory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -151,3 +152,5 @@ sal_Bool MasterScriptProviderFactory::supportsService( } } // namespace browsenodefactory + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/MasterScriptProviderFactory.hxx b/scripting/source/provider/MasterScriptProviderFactory.hxx index 16018bf13a54..9db031e2e87e 100644 --- a/scripting/source/provider/MasterScriptProviderFactory.hxx +++ b/scripting/source/provider/MasterScriptProviderFactory.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -83,3 +84,5 @@ public: } // namespace func_provider + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/ProviderCache.cxx b/scripting/source/provider/ProviderCache.cxx index 5d3350f635e3..e11de9b14d47 100644 --- a/scripting/source/provider/ProviderCache.cxx +++ b/scripting/source/provider/ProviderCache.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -220,3 +221,5 @@ ProviderCache::createProvider( ProviderDetails& details ) throw ( RuntimeExcepti return details.provider; } } //end namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/ProviderCache.hxx b/scripting/source/provider/ProviderCache.hxx index f747c067ac3d..694d435d9aab 100644 --- a/scripting/source/provider/ProviderCache.hxx +++ b/scripting/source/provider/ProviderCache.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -106,3 +107,5 @@ private: }; } // func_provider #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/ScriptImpl.cxx b/scripting/source/provider/ScriptImpl.cxx index f5b93a802138..45c030d6c3ec 100644 --- a/scripting/source/provider/ScriptImpl.cxx +++ b/scripting/source/provider/ScriptImpl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -120,3 +121,5 @@ throw ( lang::IllegalArgumentException, script::CannotConvertException, return result; } } // namespace func_provider + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/ScriptImpl.hxx b/scripting/source/provider/ScriptImpl.hxx index fddaf11a35df..be90c11631e8 100644 --- a/scripting/source/provider/ScriptImpl.hxx +++ b/scripting/source/provider/ScriptImpl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -111,3 +112,5 @@ private: }; } // namespace func_provider #endif //_FRAMEWORK_SCRIPT_PROVIDER_FUNCTIONIMPL_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/ScriptingContext.cxx b/scripting/source/provider/ScriptingContext.cxx index 08a27a19562f..788e4df432e2 100644 --- a/scripting/source/provider/ScriptingContext.cxx +++ b/scripting/source/provider/ScriptingContext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -114,3 +115,5 @@ css::uno::Sequence< css::uno::Type > SAL_CALL ScriptingContext::getTypes( ) thr return OPropertyContainer::getTypes(); } } // namespace func_provider + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/ScriptingContext.hxx b/scripting/source/provider/ScriptingContext.hxx index 8c0b25814142..97998c25ade5 100644 --- a/scripting/source/provider/ScriptingContext.hxx +++ b/scripting/source/provider/ScriptingContext.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -89,3 +90,5 @@ private: }; } // func_provider #endif //_FRAMEWORK_SCRIPT_PROVIDER_XFUNCTIONPROVIDER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/URIHelper.cxx b/scripting/source/provider/URIHelper.cxx index d6d8e9d01337..e59e24147618 100644 --- a/scripting/source/provider/URIHelper.cxx +++ b/scripting/source/provider/URIHelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -320,3 +321,5 @@ ScriptingFrameworkURIHelper::getSupportedServiceNames() return serviceNames; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/provider/URIHelper.hxx b/scripting/source/provider/URIHelper.hxx index 2b0b38a4de0e..25683dcbb916 100644 --- a/scripting/source/provider/URIHelper.hxx +++ b/scripting/source/provider/URIHelper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -106,3 +107,5 @@ public: } // namespace func_provider #endif //_FRAMEWORK_SCRIPT_PROVIDER_XSCRIPTURIHELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx b/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx index 48b960c6c9aa..5a45a29b731b 100644 --- a/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx +++ b/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -658,3 +659,5 @@ OUString scriptnri_getImplementationName() SAL_THROW( () ) return nrs_implName; } } // namespace scripting_runtimemgr + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/runtimemgr/ScriptNameResolverImpl.hxx b/scripting/source/runtimemgr/ScriptNameResolverImpl.hxx index 18c62bb65841..09611e4bc0a0 100644 --- a/scripting/source/runtimemgr/ScriptNameResolverImpl.hxx +++ b/scripting/source/runtimemgr/ScriptNameResolverImpl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -108,3 +109,5 @@ private: } // scripting_runtimemgr #endif //_FRAMEWORK_SCRIPT_SCRIPTNAMERESOLVERIMPL_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/runtimemgr/ScriptRuntimeManager.cxx b/scripting/source/runtimemgr/ScriptRuntimeManager.cxx index 94f2fd72b4a6..113c08bc63b4 100644 --- a/scripting/source/runtimemgr/ScriptRuntimeManager.cxx +++ b/scripting/source/runtimemgr/ScriptRuntimeManager.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -562,3 +563,5 @@ extern "C" pRegistryKey, ::scripting_runtimemgr::s_entries ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/runtimemgr/ScriptRuntimeManager.hxx b/scripting/source/runtimemgr/ScriptRuntimeManager.hxx index 0351aedaa1cc..0358ce7659ab 100644 --- a/scripting/source/runtimemgr/ScriptRuntimeManager.hxx +++ b/scripting/source/runtimemgr/ScriptRuntimeManager.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -147,3 +148,5 @@ private: } // scripting_runtimemgr #endif //_FRAMEWORK_SCRIPT_SCRIPTRUNTIMEMANAGER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/runtimemgr/StorageBridge.cxx b/scripting/source/runtimemgr/StorageBridge.cxx index d1915afba9e5..e441389f2b05 100644 --- a/scripting/source/runtimemgr/StorageBridge.cxx +++ b/scripting/source/runtimemgr/StorageBridge.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -150,3 +151,5 @@ throw ( lang::IllegalArgumentException, RuntimeException ) return results; } }// namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/runtimemgr/StorageBridge.hxx b/scripting/source/runtimemgr/StorageBridge.hxx index 2130fe3d2eea..052102de1ab7 100644 --- a/scripting/source/runtimemgr/StorageBridge.hxx +++ b/scripting/source/runtimemgr/StorageBridge.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -83,3 +84,5 @@ private: } #endif //_COM_SUN_STAR_SCRIPTING_STORAGEBRIDGE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/runtimemgr/StorageBridgeFactory.cxx b/scripting/source/runtimemgr/StorageBridgeFactory.cxx index d88bc66c1a0a..88b0fdac3ef8 100644 --- a/scripting/source/runtimemgr/StorageBridgeFactory.cxx +++ b/scripting/source/runtimemgr/StorageBridgeFactory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -67,3 +68,5 @@ StorageBridgeFactory::getStorageInstance( sal_Int32 sid ) return storage; } } //scripting_runtimemgr + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/runtimemgr/StorageBridgeFactory.hxx b/scripting/source/runtimemgr/StorageBridgeFactory.hxx index 382f705cf944..591fe6de4e83 100644 --- a/scripting/source/runtimemgr/StorageBridgeFactory.hxx +++ b/scripting/source/runtimemgr/StorageBridgeFactory.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,3 +57,5 @@ private: }; } // scripting_runtimemgr #endif //_FRAMEWORK_SCRIPT_NAMERESOLVER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptData.hxx b/scripting/source/storage/ScriptData.hxx index 925380021919..6154b7428c49 100644 --- a/scripting/source/storage/ScriptData.hxx +++ b/scripting/source/storage/ScriptData.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -89,3 +90,4 @@ struct ScriptData } // namespace scripting_impl #endif // _SCRIPTING_STORAGE_ScriptData_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptElement.cxx b/scripting/source/storage/ScriptElement.cxx index 335110118507..422e62aab361 100644 --- a/scripting/source/storage/ScriptElement.cxx +++ b/scripting/source/storage/ScriptElement.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -159,3 +160,5 @@ ScriptElement::~ScriptElement() SAL_THROW(()) } } // namespace scripting_impl + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptElement.hxx b/scripting/source/storage/ScriptElement.hxx index 70c7ab5276ec..50cde2732413 100644 --- a/scripting/source/storage/ScriptElement.hxx +++ b/scripting/source/storage/ScriptElement.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -59,3 +60,5 @@ private: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptInfo.cxx b/scripting/source/storage/ScriptInfo.cxx index bbe21f3546ec..1511d9ff5644 100644 --- a/scripting/source/storage/ScriptInfo.cxx +++ b/scripting/source/storage/ScriptInfo.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -371,3 +372,5 @@ throw ( css::uno::RuntimeException ) } //************************************************************************* } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptInfo.hxx b/scripting/source/storage/ScriptInfo.hxx index a61126db8789..c4db0142daec 100644 --- a/scripting/source/storage/ScriptInfo.hxx +++ b/scripting/source/storage/ScriptInfo.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -73,3 +74,5 @@ private: } #endif // define __SCRIPTING_STORAGE... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptInfoImpl.hxx b/scripting/source/storage/ScriptInfoImpl.hxx index c02ee1b57db2..3b038535dee7 100644 --- a/scripting/source/storage/ScriptInfoImpl.hxx +++ b/scripting/source/storage/ScriptInfoImpl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -91,3 +92,4 @@ struct ScriptInfoImpl #endif // _SCRIPTING_STORAGE_SCRIPTINFOIMPL_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptMetadataImporter.cxx b/scripting/source/storage/ScriptMetadataImporter.cxx index 64dd87b2546b..f46d87b7ceae 100644 --- a/scripting/source/storage/ScriptMetadataImporter.cxx +++ b/scripting/source/storage/ScriptMetadataImporter.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -530,3 +531,5 @@ void ScriptMetadataImporter::setState( const ::rtl::OUString & tagName ) } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptMetadataImporter.hxx b/scripting/source/storage/ScriptMetadataImporter.hxx index cb00833b7187..3c94bff75d26 100644 --- a/scripting/source/storage/ScriptMetadataImporter.hxx +++ b/scripting/source/storage/ScriptMetadataImporter.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -249,3 +250,5 @@ private: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptSecurityManager.cxx b/scripting/source/storage/ScriptSecurityManager.cxx index 3fde4e466974..42fa362e0e85 100644 --- a/scripting/source/storage/ScriptSecurityManager.cxx +++ b/scripting/source/storage/ScriptSecurityManager.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -603,3 +604,5 @@ ScriptSecurityManager::~ScriptSecurityManager() } } // Namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptSecurityManager.hxx b/scripting/source/storage/ScriptSecurityManager.hxx index 29ca511f88f3..525d1a4eb8d9 100644 --- a/scripting/source/storage/ScriptSecurityManager.hxx +++ b/scripting/source/storage/ScriptSecurityManager.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -97,3 +98,5 @@ private: } // scripting_securitymgr #endif //_FRAMEWORK_SCRIPT_SCRIPTSECURITYMANAGER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptStorage.cxx b/scripting/source/storage/ScriptStorage.cxx index 7315e9d35dd5..957532185866 100644 --- a/scripting/source/storage/ScriptStorage.cxx +++ b/scripting/source/storage/ScriptStorage.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -893,3 +894,5 @@ SAL_THROW( () ) return ::scripting_impl::ss_implName; } }//end namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptStorage.hxx b/scripting/source/storage/ScriptStorage.hxx index a94e2abc3027..0f19a948bb2c 100644 --- a/scripting/source/storage/ScriptStorage.hxx +++ b/scripting/source/storage/ScriptStorage.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -203,3 +204,5 @@ private: } // namespace scripting_impl #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptStorageManager.cxx b/scripting/source/storage/ScriptStorageManager.cxx index 77ca5a45dd15..ae05ff7cd57d 100644 --- a/scripting/source/storage/ScriptStorageManager.cxx +++ b/scripting/source/storage/ScriptStorageManager.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -571,3 +572,5 @@ SAL_THROW( () ) return ::scripting_impl::s_implName; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptStorageManager.hxx b/scripting/source/storage/ScriptStorageManager.hxx index 2c2563971511..32d10bb09db0 100644 --- a/scripting/source/storage/ScriptStorageManager.hxx +++ b/scripting/source/storage/ScriptStorageManager.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -223,3 +224,5 @@ private: } // scripting_impl #endif //_COM_SUN_STAR_SCRIPTING_STORAGE_SCRIPTSTORAGEMANAGER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptURI.cxx b/scripting/source/storage/ScriptURI.cxx index 0b9159ec03af..ead8b99f9f68 100644 --- a/scripting/source/storage/ScriptURI.cxx +++ b/scripting/source/storage/ScriptURI.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -225,3 +226,5 @@ Uri ScriptURI::parseIt() } } // namespace script_uri + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/ScriptURI.hxx b/scripting/source/storage/ScriptURI.hxx index d4387f5dee10..24de44a00597 100644 --- a/scripting/source/storage/ScriptURI.hxx +++ b/scripting/source/storage/ScriptURI.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -118,3 +119,5 @@ private: } //namespace script_uri #endif // define __FRAMEWORK_STORAGE_SCRIPTURI_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/XMLElement.cxx b/scripting/source/storage/XMLElement.cxx index 0f8346476fc0..6d9ff7bc195f 100644 --- a/scripting/source/storage/XMLElement.cxx +++ b/scripting/source/storage/XMLElement.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -167,3 +168,5 @@ throw ( RuntimeException ) } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/storage/XMLElement.hxx b/scripting/source/storage/XMLElement.hxx index c5798454a556..aae705d9b2ea 100644 --- a/scripting/source/storage/XMLElement.hxx +++ b/scripting/source/storage/XMLElement.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -138,3 +139,5 @@ protected: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index 49c124d4b019..2f9201f4fb3d 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -3093,3 +3094,5 @@ extern "C" pImplName, pServiceManager, pRegistryKey, ::stringresource::s_component_entries ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/stringresource/stringresource.hxx b/scripting/source/stringresource/stringresource.hxx index 56b6ce48de3c..b18ed3cab04d 100644 --- a/scripting/source/stringresource/stringresource.hxx +++ b/scripting/source/stringresource/stringresource.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -685,3 +686,5 @@ public: //......................................................................... #endif // SCRIPTING_DLGPROV_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx index 838d89d49c89..cfd1dad6b6cc 100644 --- a/scripting/source/vbaevents/eventhelper.cxx +++ b/scripting/source/vbaevents/eventhelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,6 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_scripting.hxx" +#include <sal/macros.h> #include <comphelper/processfactory.hxx> #include <comphelper/uno3.hxx> #include <comphelper/proparrhlp.hxx> @@ -46,24 +48,30 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/util/XCloseListener.hpp> +#include <com/sun/star/util/XCloseBroadcaster.hpp> + #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/script/XLibraryContainer.hpp> #include <com/sun/star/script/ScriptEventDescriptor.hpp> #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp> +#include <com/sun/star/container/XNamed.hpp> + #include <com/sun/star/drawing/XControlShape.hpp> #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/XDialog.hpp> #include <com/sun/star/awt/KeyEvent.hpp> #include <com/sun/star/awt/MouseEvent.hpp> -#include <com/sun/star/awt/XFixedText.hpp> //liuchen 2009-6-5 -#include <com/sun/star/awt/XTextComponent.hpp> //liuchen 2009-6-5 -#include <com/sun/star/awt/XComboBox.hpp> //liuchen 2009-6-18 -#include <com/sun/star/awt/XRadioButton.hpp> //liuchen 2009-7-30 +#include <com/sun/star/awt/XFixedText.hpp> +#include <com/sun/star/awt/XTextComponent.hpp> +#include <com/sun/star/awt/XComboBox.hpp> +#include <com/sun/star/awt/XRadioButton.hpp> +#include <com/sun/star/awt/XListBox.hpp> -#include <msforms/ReturnInteger.hpp> +#include "vbamsformreturntypes.hxx" #include <sfx2/objsh.hxx> #include <basic/sbstar.hxx> @@ -71,6 +79,7 @@ #include <basic/sbmeth.hxx> #include <basic/sbmod.hxx> #include <basic/sbx.hxx> +#include <filter/msfilter/msvbahelper.hxx> @@ -82,98 +91,43 @@ #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/script/XScriptListener.hpp> #include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase3.hxx> #include <cppuhelper/implbase2.hxx> #include <comphelper/evtmethodhelper.hxx> #include <set> #include <list> #include <hash_map> +#define ASYNC 0 + +// primitive support for asynchronous handling of +// events from controls ( all event will be processed asynchronously +// in the application thread ) +#if ASYNC +#include <vcl/svapp.hxx> +#endif using namespace ::com::sun::star; using namespace ::com::sun::star::script; using namespace ::com::sun::star::uno; using namespace ::ooo::vba; -#define MAP_CHAR_LEN(x) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x))//liuchen 2009-6-8 +#define MAP_CHAR_LEN(x) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x)) #define GET_TYPE(x) ::getCppuType((uno::Reference< x > *)0); // Some constants const static rtl::OUString DELIM = rtl::OUString::createFromAscii( "::" ); const static sal_Int32 DELIMLEN = DELIM.getLength(); -#if 0 -void dumpListeners( const Reference< beans::XIntrospection >& xIntrospection, const Reference<XInterface>& xIfc) -{ - Reference< beans::XIntrospectionAccess > xIntrospectionAccess; - if ( xIntrospection.is() ) - { - xIntrospectionAccess = xIntrospection->inspect( - makeAny( xIfc ) ); - Sequence< Type > aControlListeners = - xIntrospectionAccess->getSupportedListeners(); - sal_Int32 nLength = aControlListeners.getLength(); - - for ( sal_Int32 i = 0; i< nLength; ++i ) - { - Type& listType = aControlListeners[ i ]; - rtl::OUString sFullTypeName = listType.getTypeName(); - rtl::OUString sTypeName = listType.getTypeName(); - sal_Int32 lastDotIndex = -1; - if ( ( lastDotIndex = sFullTypeName.lastIndexOf( '.' ) ) > -1 ) - { - sTypeName = sFullTypeName.copy( lastDotIndex + 1 ); - } - Sequence< ::rtl::OUString > sMeths = comphelper::getEventMethodsForType( listType ); - sal_Int32 sMethLen = sMeths.getLength(); - for ( sal_Int32 j=0 ; j < sMethLen; ++j ) - { - OSL_TRACE("**Listener [%d] Type[%s] Method[%s]",j, - rtl::OUStringToOString( sTypeName, - RTL_TEXTENCODING_UTF8 ).getStr(), - rtl::OUStringToOString( sMeths[ j ], - RTL_TEXTENCODING_UTF8 ).getStr() ); - } - } - - } -} - -void dumpEvent( const ScriptEvent& evt ) +bool isKeyEventOk( awt::KeyEvent& evt, const Sequence< Any >& params ) { - OSL_TRACE("dumpEvent: Source %s", - rtl::OUStringToOString( comphelper::anyToString( makeAny(evt.Source)), - RTL_TEXTENCODING_UTF8 ).getStr() ); - - OSL_TRACE("dumpEvent: ScriptType %s", - rtl::OUStringToOString( evt.ScriptType, - RTL_TEXTENCODING_UTF8 ).getStr() ); - - OSL_TRACE("dumpEvent: ScriptCode %s", - rtl::OUStringToOString( evt.ScriptCode, - RTL_TEXTENCODING_UTF8 ).getStr() ); - - OSL_TRACE("dumpEvent: ListenerType %s", - rtl::OUStringToOString( evt.ListenerType.getTypeName(), - RTL_TEXTENCODING_UTF8 ).getStr() ); - - OSL_TRACE("dumpEvent: Listener methodname %s", - rtl::OUStringToOString( evt.MethodName, - RTL_TEXTENCODING_UTF8 ).getStr() ); - - OSL_TRACE("dumpEvent: arguments;"); - sal_Int32 nLen = evt.Arguments.getLength(); - for ( sal_Int32 index=0; index < nLen; ++index ) - { - OSL_TRACE("\t [%d] %s", index, - rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[ index ] ), - RTL_TEXTENCODING_UTF8 ).getStr() ); - - } + if ( !( params.getLength() > 0 ) || + !( params[ 0 ] >>= evt ) ) + return false; + return true; } -#endif - -bool isKeyEventOk( awt::KeyEvent& evt, const Sequence< Any >& params ) +bool isMouseEventOk( awt::MouseEvent& evt, const Sequence< Any >& params ) { if ( !( params.getLength() > 0 ) || !( params[ 0 ] >>= evt ) ) @@ -181,7 +135,7 @@ bool isKeyEventOk( awt::KeyEvent& evt, const Sequence< Any >& params ) return true; } -bool isMouseEventOk( awt::MouseEvent& evt, const Sequence< Any >& params ) +bool isFocusEventOk( awt::FocusEvent& evt, const Sequence< Any >& params ) { if ( !( params.getLength() > 0 ) || !( params[ 0 ] >>= evt ) ) @@ -232,9 +186,14 @@ Sequence< Any > ooKeyPressedToVBAKeyPressed( const Sequence< Any >& params ) translatedParams.realloc(1); - msforms::ReturnInteger keyCode; - keyCode.Value = evt.KeyCode; - translatedParams[0] <<= keyCode; + //The VBA events such as ComboBox_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) may cause an error because + //the original input parameter data structure -- msforms::ReturnInteger -- is a struct, it cannot support default value. + //So the newly defined VbaReturnIntege class is used here to support default value. + VbaReturnInteger* pKeyCode = new VbaReturnInteger(); + pKeyCode->Value = evt.KeyChar; + ::uno::Reference< msforms::XReturnInteger > xInteger = + static_cast< ::uno::Reference< msforms::XReturnInteger > > (pKeyCode); + translatedParams[0] <<= xInteger; return translatedParams; } @@ -248,19 +207,41 @@ Sequence< Any > ooKeyPressedToVBAKeyUpDown( const Sequence< Any >& params ) translatedParams.realloc(2); - msforms::ReturnInteger keyCode; - sal_Int8 shift = sal::static_int_cast<sal_Int8>( evt.Modifiers ); + //The VBA events such as ComboBox_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) may cause an error because + //the original input parameter data structure -- msforms::ReturnInteger -- is a struct, it cannot support default value. + //So the newly defined VbaReturnIntege class is used here to support default value. + VbaReturnInteger* pKeyCode = new VbaReturnInteger(); + sal_Int8 shift = evt.Modifiers; - // #TODO check whether values from OOO conform to values generated from vba - keyCode.Value = evt.KeyCode; - translatedParams[0] <<= keyCode; + pKeyCode->Value = evt.KeyChar; + ::uno::Reference< msforms::XReturnInteger > xInteger = static_cast< ::uno::Reference< msforms::XReturnInteger > > (pKeyCode); + translatedParams[0] <<= xInteger; translatedParams[1] <<= shift; return translatedParams; } +Sequence< Any > ooFocusLostToVBAExit( const Sequence< Any >& params ) +{ + Sequence< Any > translatedParams; + awt::FocusEvent evt; + + if ( !isFocusEventOk( evt, params ) ) + return Sequence< Any >(); + + translatedParams.realloc(1); + + VbaReturnBoolean* pCancel = new VbaReturnBoolean(); + + ::uno::Reference< msforms::XReturnBoolean > xBoolean= + static_cast< ::uno::Reference< msforms::XReturnBoolean > > (pCancel); + translatedParams[0] <<= xBoolean; + return translatedParams; +} + + typedef Sequence< Any > (*Translator)(const Sequence< Any >&); -//liuchen 2009-6-23 + //expand the "TranslateInfo" struct to support more kinds of events struct TranslateInfo { @@ -276,7 +257,7 @@ std::list< TranslateInfo >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventInfoHash; -//liuchen 2009-6-23 + struct TranslatePropMap { rtl::OUString sEventInfo; //OO event name @@ -287,6 +268,7 @@ bool ApproveAll(const ScriptEvent& evt, void* pPara); //allow all types of contr bool ApproveType(const ScriptEvent& evt, void* pPara); //certain types of controls should execute the event, those types are given by pPara bool DenyType(const ScriptEvent& evt, void* pPara); //certain types of controls should not execute the event, those types are given by pPara bool DenyMouseDrag(const ScriptEvent& evt, void* pPara); //used for VBA MouseMove event when "Shift" key is pressed +bool DenyKeys(const ScriptEvent& evt, void* pPara); //For some keys, press them will cause Symphony keyPressed event, but will not cause any events in Excel, so deny these key events struct TypeList { @@ -294,28 +276,30 @@ struct TypeList int nListLength; }; -Type typeXFixedText = GET_TYPE(awt::XFixedText) -Type typeXTextComponent = GET_TYPE(awt::XTextComponent) -Type typeXComboBox = GET_TYPE(awt::XComboBox) -Type typeXRadioButton = GET_TYPE(awt::XRadioButton) +Type typeXFixedText = GET_TYPE(awt::XFixedText); +Type typeXTextComponent = GET_TYPE(awt::XTextComponent); +Type typeXComboBox = GET_TYPE(awt::XComboBox); +Type typeXRadioButton = GET_TYPE(awt::XRadioButton); +Type typeXListBox = GET_TYPE(awt::XListBox); TypeList fixedTextList = {&typeXFixedText, 1}; TypeList textCompList = {&typeXTextComponent, 1}; TypeList radioButtonList = {&typeXRadioButton, 1}; TypeList comboBoxList = {&typeXComboBox, 1}; +TypeList listBoxList = {&typeXListBox, 1}; //this array stores the OO event to VBA event translation info static TranslatePropMap aTranslatePropMap_Impl[] = { + { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Change"), NULL, DenyType, (void*)(&radioButtonList) } }, // actionPerformed ooo event { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Click"), NULL, ApproveAll, NULL } }, - { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Change"), NULL, DenyType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event is not the same as OptionalButton_Click event - + { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Change"), NULL, ApproveType, (void*)(&radioButtonList) } }, // itemStateChanged ooo event - { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Click"), NULL, ApproveType, (void*)(&comboBoxList) } }, //liuchen, add to support VBA ComboBox_Click event - { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Change"), NULL, ApproveType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event should be triggered when the button state is changed + { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Click"), NULL, ApproveType, (void*)(&comboBoxList) } }, + { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Click"), NULL, ApproveType, (void*)(&listBoxList) } }, // changed ooo event { MAP_CHAR_LEN("changed"), { MAP_CHAR_LEN("_Change"), NULL, ApproveAll, NULL } }, @@ -324,7 +308,7 @@ static TranslatePropMap aTranslatePropMap_Impl[] = // focusLost ooo event { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_LostFocus"), NULL, ApproveAll, NULL } }, - { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_Exit"), NULL, ApproveType, (void*)(&textCompList) } }, //liuchen, add to support VBA TextBox_Exit event + { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_Exit"), ooFocusLostToVBAExit, ApproveType, (void*)(&textCompList) } }, // adjustmentValueChanged ooo event { MAP_CHAR_LEN("adjustmentValueChanged"), { MAP_CHAR_LEN("_Scroll"), NULL, ApproveAll, NULL } }, @@ -337,7 +321,7 @@ static TranslatePropMap aTranslatePropMap_Impl[] = { MAP_CHAR_LEN("keyReleased"), { MAP_CHAR_LEN("_KeyUp"), ooKeyPressedToVBAKeyUpDown, ApproveAll, NULL } }, // mouseReleased ooo event - { MAP_CHAR_LEN("mouseReleased"), { MAP_CHAR_LEN("_Click"), ooMouseEvtToVBAMouseEvt, ApproveType, (void*)(&fixedTextList) } }, //liuchen, add to support VBA Label_Click event + { MAP_CHAR_LEN("mouseReleased"), { MAP_CHAR_LEN("_Click"), ooMouseEvtToVBAMouseEvt, ApproveType, (void*)(&fixedTextList) } }, { MAP_CHAR_LEN("mouseReleased"), { MAP_CHAR_LEN("_MouseUp"), ooMouseEvtToVBAMouseEvt, ApproveAll, NULL } }, // mousePressed ooo event @@ -346,11 +330,11 @@ static TranslatePropMap aTranslatePropMap_Impl[] = // mouseMoved ooo event { MAP_CHAR_LEN("mouseMoved"), { MAP_CHAR_LEN("_MouseMove"), ooMouseEvtToVBAMouseEvt, ApproveAll, NULL } }, - { MAP_CHAR_LEN("mouseDragged"), { MAP_CHAR_LEN("_MouseMove"), ooMouseEvtToVBAMouseEvt, DenyMouseDrag, NULL } }, //liuchen, add to support VBA MouseMove event when the "Shift" key is pressed + { MAP_CHAR_LEN("mouseDragged"), { MAP_CHAR_LEN("_MouseMove"), ooMouseEvtToVBAMouseEvt, DenyMouseDrag, NULL } }, // keyPressed ooo event - { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyDown"), ooKeyPressedToVBAKeyPressed, ApproveAll, NULL } }, - { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyPress"), ooKeyPressedToVBAKeyPressed, ApproveAll, NULL } } + { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyDown"), ooKeyPressedToVBAKeyUpDown, ApproveAll, NULL } }, + { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyPress"), ooKeyPressedToVBAKeyUpDown, DenyKeys, NULL } } }; EventInfoHash& getEventTransInfo() @@ -361,7 +345,7 @@ EventInfoHash& getEventTransInfo() { rtl::OUString sEventInfo = MAP_CHAR_LEN(""); TranslatePropMap* pTransProp = aTranslatePropMap_Impl; - int nCount = sizeof(aTranslatePropMap_Impl) / sizeof(aTranslatePropMap_Impl[0]); + int nCount = SAL_N_ELEMENTS(aTranslatePropMap_Impl); int i = 0; while (i < nCount) @@ -380,7 +364,7 @@ EventInfoHash& getEventTransInfo() } return eventTransInfo; } -//liuchen 2009-6-23 end + // Helper class @@ -458,10 +442,7 @@ ScriptEventHelper::getEventListeners() Reference< beans::XIntrospection > xIntrospection( xMFac->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.Introspection" ) ), m_xCtx ), UNO_QUERY ); -#if 0 - dumpListeners( xIntrospection, m_xControl ); - dumpListeners( xIntrospection, m_xControl->getModel() ); -#endif + Reference< beans::XIntrospectionAccess > xIntrospectionAccess; if ( xIntrospection.is() ) { @@ -632,7 +613,7 @@ private: Reference< container::XNameContainer > m_xNameContainer; }; -typedef ::cppu::WeakImplHelper2< XScriptListener, lang::XInitialization > EventListener_BASE; +typedef ::cppu::WeakImplHelper3< XScriptListener, util::XCloseListener, lang::XInitialization > EventListener_BASE; #define EVENTLSTNR_PROPERTY_ID_MODEL 1 #define EVENTLSTNR_PROPERTY_MODEL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ) @@ -653,6 +634,9 @@ public: // XScriptListener virtual void SAL_CALL firing(const ScriptEvent& evt) throw(RuntimeException); virtual Any SAL_CALL approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException); + // XCloseListener + virtual void SAL_CALL queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException); + virtual void SAL_CALL notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException); // XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException); // XInitialization @@ -664,6 +648,25 @@ public: DECLARE_XTYPEPROVIDER() virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { + if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL ) + { + uno::Reference< frame::XModel > xModel( rValue, uno::UNO_QUERY ); + if( xModel != m_xModel) + { + // Remove the listener from the old XCloseBroadcaster. + uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY ); + if (xCloseBroadcaster.is()) + { + xCloseBroadcaster->removeCloseListener( this ); + } + // Add the listener into the new XCloseBroadcaster. + xCloseBroadcaster = uno::Reference< util::XCloseBroadcaster >( xModel, uno::UNO_QUERY ); + if (xCloseBroadcaster.is()) + { + xCloseBroadcaster->addCloseListener( this ); + } + } + } OPropertyContainer::setFastPropertyValue( nHandle, rValue ); if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL ) setShellFromModel(); @@ -677,17 +680,21 @@ protected: virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; private: +#if ASYNC + DECL_LINK( OnAsyncScriptEvent, ScriptEvent* ); +#endif void setShellFromModel(); void firing_Impl( const ScriptEvent& evt, Any *pSyncRet=NULL ) throw( RuntimeException ); Reference< XComponentContext > m_xContext; Reference< frame::XModel > m_xModel; SfxObjectShell* mpShell; + sal_Bool m_bDocClosed; }; EventListener::EventListener( const Reference< XComponentContext >& rxContext ) : -OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), mpShell( 0 ) +OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), m_bDocClosed(sal_False), mpShell( 0 ) { registerProperty( EVENTLSTNR_PROPERTY_MODEL, EVENTLSTNR_PROPERTY_ID_MODEL, beans::PropertyAttribute::TRANSIENT, &m_xModel, ::getCppuType( &m_xModel ) ); @@ -722,9 +729,39 @@ EventListener::disposing(const lang::EventObject&) throw( RuntimeException ) void SAL_CALL EventListener::firing(const ScriptEvent& evt) throw(RuntimeException) { +#if ASYNC + // needs some logic to check if the event handler is oneway or not + // if not oneway then firing_Impl otherwise... as below + acquire(); + Application::PostUserEvent( LINK( this, EventListener, OnAsyncScriptEvent ), new ScriptEvent( evt ) ); +#else firing_Impl( evt ); +#endif } +#if ASYNC +IMPL_LINK( EventListener, OnAsyncScriptEvent, ScriptEvent*, _pEvent ) +{ + if ( !_pEvent ) + return 1L; + + { + // #FIXME if we enable ASYNC we probably need something like + // below + //::osl::ClearableMutexGuard aGuard( m_aMutex ); + + //if ( !impl_isDisposed_nothrow() ) + // impl_doFireScriptEvent_nothrow( aGuard, *_pEvent, NULL ); + firing_Impl( *_pEvent, NULL ); + } + + delete _pEvent; + // we acquired ourself immediately before posting the event + release(); + return 0L; + } +#endif + Any SAL_CALL EventListener::approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException) { @@ -733,6 +770,24 @@ EventListener::approveFiring(const ScriptEvent& evt) throw(reflection::Invocatio return ret; } +// XCloseListener +void SAL_CALL +EventListener::queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException) +{ + //Nothing to do +} + +void SAL_CALL +EventListener::notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException) +{ + m_bDocClosed = sal_True; + uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY ); + if (xCloseBroadcaster.is()) + { + xCloseBroadcaster->removeCloseListener( this ); + } +} + // XInitialization void SAL_CALL EventListener::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException) @@ -776,7 +831,7 @@ EventListener::getPropertySetInfo( ) throw (RuntimeException) return xInfo; } -//liuchen 2009-6-23 + //decide if the control should execute the event bool ApproveAll(const ScriptEvent&, void* ) { @@ -835,13 +890,28 @@ bool DenyMouseDrag(const ScriptEvent& evt, void* ) } } +//For some keys, press them will cause Symphony keyPressed event, but will not cause any events in Excel, so deny these key events +bool DenyKeys(const ScriptEvent& evt, void* /*pPara*/) +{ + awt::KeyEvent aEvent; + evt.Arguments[ 0 ] >>= aEvent; + if (aEvent.KeyChar == 0 || aEvent.KeyChar == 8) + { + return false; + } + else + { + return true; + } +} + + -//liuchen 2009-6-23 // EventListener void -EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(RuntimeException) +EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeException) { OSL_TRACE("EventListener::firing_Impl( FAKE VBA_EVENTS )"); static const ::rtl::OUString vbaInterOp = @@ -852,18 +922,46 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime return; lang::EventObject aEvent; evt.Arguments[ 0 ] >>= aEvent; + OSL_TRACE("evt.MethodName is %s", rtl::OUStringToOString( evt.MethodName, RTL_TEXTENCODING_UTF8 ).getStr() ); OSL_TRACE("Argument[0] is %s", rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[0] ), RTL_TEXTENCODING_UTF8 ).getStr() ); OSL_TRACE("Getting Control"); - uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY_THROW ); - OSL_TRACE("Getting properties"); - uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW ); - rtl::OUString sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserForm") ); OSL_TRACE("Getting Name"); uno::Reference< awt::XDialog > xDlg( aEvent.Source, uno::UNO_QUERY ); if ( !xDlg.is() ) + { + OSL_TRACE("Getting Control"); + // evt.Source is + // a) Dialog + // b) xShapeControl ( from api (sheet control) ) + // c) eventmanager ( I guess ) + // d) vba control ( from api also ) + uno::Reference< drawing::XControlShape > xCntrlShape( evt.Source, uno::UNO_QUERY ); + uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY ); + if ( xCntrlShape.is() ) + { + // for sheet controls ( that fire from the api ) we don't + // have the real control ( thats only available from the view ) + // api code creates just a control instance that is transferred + // via aEvent.Arguments[ 0 ] that control though has no + // info like name etc. + uno::Reference< drawing::XControlShape > xCntrlShape( evt.Source, UNO_QUERY_THROW ); + OSL_TRACE("Got control shape"); + uno::Reference< container::XNamed > xName( xCntrlShape->getControl(), uno::UNO_QUERY_THROW ); + OSL_TRACE("Got xnamed "); + sName = xName->getName(); + } + else + { + // Userform control ( fired from the api or from event manager ) + uno::Reference< beans::XPropertySet > xProps; + OSL_TRACE("Getting properties"); + xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW ); xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sName; + } + + } //dumpEvent( evt ); EventInfoHash& infos = getEventTransInfo(); EventInfoHash::const_iterator eventInfo_it = infos.find( evt.MethodName ); @@ -885,27 +983,56 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime std::list< TranslateInfo >::const_iterator txInfo = eventInfo_it->second.begin(); std::list< TranslateInfo >::const_iterator txInfo_end = eventInfo_it->second.end(); - rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Standard.").concat( evt.ScriptCode ).concat( rtl::OUString::createFromAscii(".") ); StarBASIC* pBasic = mpShell->GetBasic(); - SbModule* pModule = pBasic->FindModule( evt.ScriptCode ); - for ( ; pModule && txInfo != txInfo_end; ++txInfo ) + BasicManager* pBasicManager = mpShell->GetBasicManager(); + rtl::OUString sProject; + rtl::OUString sScriptCode( evt.ScriptCode ); + // dialogs pass their own library, presence of Dot determines that + if ( sScriptCode.indexOf( '.' ) == -1 ) + { + //'Project' is a better default but I want to force failures + //rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Project"); + sProject = rtl::OUString::createFromAscii("Standard"); + + if ( pBasicManager->GetName().Len() > 0 ) + sProject = pBasicManager->GetName(); + } + else + { + sal_Int32 nIndex = sScriptCode.indexOf( '.' ); + sProject = sScriptCode.copy( 0, nIndex ); + sScriptCode = sScriptCode.copy( nIndex + 1 ); + } + rtl::OUString sMacroLoc = sProject; + sMacroLoc = sMacroLoc.concat( rtl::OUString::createFromAscii(".") ); + sMacroLoc = sMacroLoc.concat( sScriptCode ).concat( rtl::OUString::createFromAscii(".") ); + + OSL_TRACE("sMacroLoc is %s", rtl::OUStringToOString( sMacroLoc, RTL_TEXTENCODING_UTF8 ).getStr() ); + for ( ; txInfo != txInfo_end; ++txInfo ) { + // If the document is closed, we should not execute macro. + if (m_bDocClosed) + { + break; + } + + rtl::OUString sTemp = sName.concat( (*txInfo).sVBAName ); // see if we have a match for the handlerextension // where ScriptCode is methodname_handlerextension - rtl::OUString sTemp = sName.concat( (*txInfo).sVBAName ); + rtl::OUString sToResolve = sMacroLoc.concat( sTemp ); OSL_TRACE("*** trying to invoke %s ", - rtl::OUStringToOString( sTemp, RTL_TEXTENCODING_UTF8 ).getStr() ); - SbMethod* pMeth = static_cast< SbMethod* >( pModule->Find( sTemp, SbxCLASS_METHOD ) ); - if ( pMeth ) + rtl::OUStringToOString( sToResolve, RTL_TEXTENCODING_UTF8 ).getStr() ); + ooo::vba::VBAMacroResolvedInfo aMacroResolvedInfo = ooo::vba::resolveVBAMacro( mpShell, sToResolve ); + if ( aMacroResolvedInfo.IsResolved() ) { - //liuchen 2009-6-8 + if (! txInfo->ApproveRule(evt, txInfo->pPara) ) { continue; } - //liuchen 2009-6-8 + // !! translate arguments & emulate events where necessary Sequence< Any > aArguments; if ( (*txInfo).toVBA ) @@ -916,24 +1043,21 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime { // call basic event handlers for event - static rtl::OUString part1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:"); - static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document"); - // create script url - rtl::OUString url = part1 + sMacroLoc + sTemp + part2; + rtl::OUString url = aMacroResolvedInfo.ResolvedMacro(); - OSL_TRACE("script url = %s", + OSL_TRACE("resolved script = %s", rtl::OUStringToOString( url, RTL_TEXTENCODING_UTF8 ).getStr() ); - Sequence< sal_Int16 > aOutArgsIndex; - Sequence< Any > aOutArgs; try { - if ( mpShell ) + uno::Any aDummyCaller = uno::makeAny( rtl::OUString::createFromAscii("Error") ); + if ( pRet ) + ooo::vba::executeMacro( mpShell, url, aArguments, *pRet, aDummyCaller ); + else { uno::Any aRet; - mpShell->CallXScript( url, - aArguments, aRet, aOutArgsIndex, aOutArgs, false ); + ooo::vba::executeMacro( mpShell, url, aArguments, aRet, aDummyCaller ); } } catch ( uno::Exception& e ) @@ -1043,3 +1167,5 @@ namespace ooevtdescgen return Sequence< ::rtl::OUString >( &strName, 1 ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/vbaevents/makefile.mk b/scripting/source/vbaevents/makefile.mk index 1946c61d1e0b..4784985e8aec 100644 --- a/scripting/source/vbaevents/makefile.mk +++ b/scripting/source/vbaevents/makefile.mk @@ -69,6 +69,7 @@ SHL1STDLIBS= \ $(BASICLIB) \ $(COMPHELPERLIB) \ $(SFXLIB) \ + $(MSFILTERLIB) \ $(CPPULIB) \ $(TOOLSLIB) \ $(SALLIB) diff --git a/scripting/source/vbaevents/service.cxx b/scripting/source/vbaevents/service.cxx index 9f38acb7e2a6..c5808b8a8d9f 100644 --- a/scripting/source/vbaevents/service.cxx +++ b/scripting/source/vbaevents/service.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -129,3 +130,5 @@ extern "C" pImplName, pServiceManager, pRegistryKey, s_component_entries ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/vbaevents/vbamsformreturntypes.hxx b/scripting/source/vbaevents/vbamsformreturntypes.hxx new file mode 100644 index 000000000000..4f3e26b32fa4 --- /dev/null +++ b/scripting/source/vbaevents/vbamsformreturntypes.hxx @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright IBM Corporation 2009, 2010. + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef VBA_MSFORM_RETURNTYPES_HXX +#define VBA_MSFORM_RETURNTYPES_HXX + +#include <cppuhelper/implbase1.hxx> +#include <msforms/XReturnBoolean.hpp> +#include <msforms/XReturnInteger.hpp> + + +typedef ::cppu::WeakImplHelper1<msforms::XReturnBoolean> ReturnBoolean_BASE; + +class SAL_DLLPUBLIC_EXPORT VbaReturnBoolean : public ReturnBoolean_BASE +{ +public: + sal_Bool Value; + +public: + VbaReturnBoolean() : Value(false) {} ; + + // XReturnBoolean + virtual ::sal_Bool SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException) { return Value; } + virtual void SAL_CALL setValue( ::sal_Bool _value ) throw (::com::sun::star::uno::RuntimeException) { Value = _value; } + + // XDefaultProperty + ::rtl::OUString SAL_CALL getDefaultPropertyName() throw (com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } +}; + + +typedef ::cppu::WeakImplHelper1<msforms::XReturnInteger> ReturnInteger_BASE; + +class SAL_DLLPUBLIC_EXPORT VbaReturnInteger : public ReturnInteger_BASE +{ +public: + sal_Int32 Value; + +public: + VbaReturnInteger() : Value(0) {} ; + + // XReturnInteger + virtual ::sal_Int32 SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException) { return Value; } + virtual void SAL_CALL setValue( ::sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException) { Value = _value; } + + // XDefaultProperty + ::rtl::OUString SAL_CALL getDefaultPropertyName() throw (com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |