diff options
author | Carsten Driesner <cd@openoffice.org> | 2011-01-21 17:18:37 +0100 |
---|---|---|
committer | Carsten Driesner <cd@openoffice.org> | 2011-01-21 17:18:37 +0100 |
commit | a02a1960569f3a1e31e52200bba075003b54027b (patch) | |
tree | b7a765a6fd053b86a958cdb1b0dbbd9826732dd2 /filter/inc | |
parent | 7351d5d7e755d0e9e07f030c7e3cc20e8b8463cb (diff) | |
parent | d5d0ee896715562758a4db4c024a59ac89ddd631 (diff) |
removetooltypes01: Rebase to DEV300m98
Diffstat (limited to 'filter/inc')
-rw-r--r-- | filter/inc/filter/msfilter/msvbahelper.hxx | 94 |
1 files changed, 73 insertions, 21 deletions
diff --git a/filter/inc/filter/msfilter/msvbahelper.hxx b/filter/inc/filter/msfilter/msvbahelper.hxx index 81607c9b296c..94ece293ee20 100644 --- a/filter/inc/filter/msfilter/msvbahelper.hxx +++ b/filter/inc/filter/msfilter/msvbahelper.hxx @@ -28,29 +28,81 @@ #define _MSVBAHELPER_HXX #include <sfx2/objsh.hxx> +#include <cppuhelper/implbase3.hxx> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/script/vba/XVBAMacroResolver.hpp> #include "filter/msfilter/msfilterdllapi.h" -namespace ooo { namespace vba +namespace ooo { +namespace vba { + +// ============================================================================ + +struct MSFILTER_DLLPUBLIC MacroResolvedInfo +{ + SfxObjectShell* mpDocContext; + String msResolvedMacro; + bool mbFound; + + inline explicit MacroResolvedInfo( SfxObjectShell* pDocContext = 0 ) : mpDocContext( pDocContext ), mbFound( false ) {} +}; + +MSFILTER_DLLPUBLIC String makeMacroURL( const String& sMacroName ); +MSFILTER_DLLPUBLIC ::rtl::OUString extractMacroName( const ::rtl::OUString& rMacroUrl ); +MSFILTER_DLLPUBLIC MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const ::rtl::OUString& rMacroName, bool bSearchGlobalTemplates = false ); +MSFILTER_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller ); + +// ============================================================================ + +typedef ::cppu::WeakImplHelper3< + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::script::vba::XVBAMacroResolver > VBAMacroResolverBase; + +class VBAMacroResolver : public VBAMacroResolverBase { - class MSFILTER_DLLPUBLIC VBAMacroResolvedInfo - { - SfxObjectShell* mpDocContext; - bool mbFound; - String msResolvedMacro; - public: - VBAMacroResolvedInfo() : mpDocContext(NULL), mbFound( false ){} - void SetResolved( bool bRes ) { mbFound = bRes; } - bool IsResolved() { return mbFound; } - void SetMacroDocContext(SfxObjectShell* pShell ) { mpDocContext = pShell; } - SfxObjectShell* MacroDocContext() { return mpDocContext; } - String ResolvedMacro() { return msResolvedMacro; } - void SetResolvedMacro(const String& sMacro ) { msResolvedMacro = sMacro; } - }; - - MSFILTER_DLLPUBLIC String makeMacroURL( const String& sMacroName ); - MSFILTER_DLLPUBLIC ::rtl::OUString extractMacroName( const ::rtl::OUString& rMacroUrl ); - MSFILTER_DLLPUBLIC VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& sMod, bool bSearchGlobalTemplates = false ); - MSFILTER_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller ); -} } +public: + explicit VBAMacroResolver(); + virtual ~VBAMacroResolver(); + + // com.sun.star.lang.XServiceInfo interface ------------------------------- + + virtual ::rtl::OUString SAL_CALL + getImplementationName() throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL + supportsService( const ::rtl::OUString& rService ) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // com.sun.star.lang.XInitialization interface ---------------------------- + + virtual void SAL_CALL initialize( + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // com.sun.star.script.vba.XVBAMacroResolver interface -------------------- + + virtual ::rtl::OUString SAL_CALL + resolveVBAMacroToScriptURL( const ::rtl::OUString& rVBAMacroName ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL + resolveScriptURLtoVBAMacro( const ::rtl::OUString& rScriptURL ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel; + SfxObjectShell* mpObjShell; + ::rtl::OUString maProjectName; +}; + +// ============================================================================ + +} // namespace vba +} // namespace ooo #endif |