update credits
[LibreOffice.git] / include / filter / msfilter / msvbahelper.hxx
blobbafcc461a598ca0275fc88708163dc8eec889466
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _MSVBAHELPER_HXX
20 #define _MSVBAHELPER_HXX
22 #include <sfx2/objsh.hxx>
23 #include <cppuhelper/implbase3.hxx>
24 #include <com/sun/star/lang/XInitialization.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/script/vba/XVBAMacroResolver.hpp>
27 #include <com/sun/star/awt/KeyEvent.hpp>
28 #include <com/sun/star/frame/XModel.hpp>
29 #include "filter/msfilter/msfilterdllapi.h"
30 namespace ooo {
31 namespace vba {
33 // ============================================================================
35 struct MSFILTER_DLLPUBLIC MacroResolvedInfo
37 SfxObjectShell* mpDocContext;
38 OUString msResolvedMacro;
39 bool mbFound;
41 inline explicit MacroResolvedInfo( SfxObjectShell* pDocContext = 0 ) : mpDocContext( pDocContext ), mbFound( false ) {}
44 MSFILTER_DLLPUBLIC OUString makeMacroURL( const OUString& sMacroName );
45 MSFILTER_DLLPUBLIC OUString extractMacroName( const OUString& rMacroUrl );
46 MSFILTER_DLLPUBLIC OUString getDefaultProjectName( SfxObjectShell* pShell );
47 MSFILTER_DLLPUBLIC OUString resolveVBAMacro( SfxObjectShell* pShell, const OUString& rLibName, const OUString& rModuleName, const OUString& rMacroName );
48 MSFILTER_DLLPUBLIC MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& rMacroName, bool bSearchGlobalTemplates = false );
49 MSFILTER_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const OUString& 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 );
50 MSFILTER_DLLPUBLIC ::com::sun::star::awt::KeyEvent parseKeyEvent( const OUString& sKey ) throw (::com::sun::star::uno::RuntimeException);
51 MSFILTER_DLLPUBLIC void applyShortCutKeyBinding ( const ::com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxDoc, const ::com::sun::star::awt::KeyEvent& rKeyEvent, const OUString& sMacro ) throw (::com::sun::star::uno::RuntimeException);
52 // ============================================================================
54 typedef ::cppu::WeakImplHelper3<
55 ::com::sun::star::lang::XServiceInfo,
56 ::com::sun::star::lang::XInitialization,
57 ::com::sun::star::script::vba::XVBAMacroResolver > VBAMacroResolverBase;
59 class VBAMacroResolver : public VBAMacroResolverBase
61 public:
62 explicit VBAMacroResolver();
63 virtual ~VBAMacroResolver();
65 // com.sun.star.lang.XServiceInfo interface -------------------------------
67 virtual OUString SAL_CALL
68 getImplementationName() throw (::com::sun::star::uno::RuntimeException);
70 virtual sal_Bool SAL_CALL
71 supportsService( const OUString& rService )
72 throw (::com::sun::star::uno::RuntimeException);
74 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
75 getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
77 // com.sun.star.lang.XInitialization interface ----------------------------
79 virtual void SAL_CALL initialize(
80 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs )
81 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
83 // com.sun.star.script.vba.XVBAMacroResolver interface --------------------
85 virtual OUString SAL_CALL
86 resolveVBAMacroToScriptURL( const OUString& rVBAMacroName )
87 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
89 virtual OUString SAL_CALL
90 resolveScriptURLtoVBAMacro( const OUString& rScriptURL )
91 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
93 private:
94 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
95 SfxObjectShell* mpObjShell;
96 OUString maProjectName;
99 // ============================================================================
101 } // namespace vba
102 } // namespace ooo
104 #endif
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */