tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / include / filter / msfilter / msvbahelper.hxx
blob90f1f8a2b90fe11236149c4eed9481412d0e920f
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 INCLUDED_FILTER_MSFILTER_MSVBAHELPER_HXX
20 #define INCLUDED_FILTER_MSFILTER_MSVBAHELPER_HXX
22 #include <sal/config.h>
24 #include <string_view>
26 #include <com/sun/star/awt/KeyEvent.hpp>
27 #include <com/sun/star/lang/XInitialization.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/script/vba/XVBAMacroResolver.hpp>
30 #include <com/sun/star/uno/Any.hxx>
31 #include <com/sun/star/uno/Reference.hxx>
32 #include <com/sun/star/uno/Sequence.hxx>
33 #include <cppuhelper/implbase.hxx>
34 #include <filter/msfilter/msfilterdllapi.h>
35 #include <rtl/ustring.hxx>
36 #include <sal/types.h>
38 namespace com::sun::star {
39 namespace frame { class XModel; }
40 namespace uno { class XComponentContext; }
41 namespace uno { class XInterface; }
44 class SfxObjectShell;
46 namespace ooo::vba {
49 struct MSFILTER_DLLPUBLIC MacroResolvedInfo
51 SfxObjectShell* mpDocContext;
52 OUString msResolvedMacro;
53 bool mbFound;
55 explicit MacroResolvedInfo( SfxObjectShell* pDocContext = nullptr ) : mpDocContext( pDocContext ), mbFound( false ) {}
58 MSFILTER_DLLPUBLIC OUString makeMacroURL( std::u16string_view sMacroName );
59 MSFILTER_DLLPUBLIC OUString extractMacroName( std::u16string_view rMacroUrl );
60 MSFILTER_DLLPUBLIC OUString getDefaultProjectName( SfxObjectShell const * pShell );
61 MSFILTER_DLLPUBLIC OUString resolveVBAMacro(SfxObjectShell const* pShell, const OUString& rLibName,
62 const OUString& rModuleName,
63 const OUString& rMacroName, bool bOnlyPublic,
64 const OUString& sSkipModule);
65 MSFILTER_DLLPUBLIC MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& rMacroName, bool bSearchGlobalTemplates = false );
66 MSFILTER_DLLPUBLIC bool executeMacro( SfxObjectShell* pShell, const OUString& sMacroName, css::uno::Sequence< css::uno::Any >& aArgs, css::uno::Any& aRet, const css::uno::Any& aCaller );
67 /// @throws css::uno::RuntimeException
68 MSFILTER_DLLPUBLIC css::awt::KeyEvent parseKeyEvent( std::u16string_view sKey );
69 /// @throws css::uno::RuntimeException
70 MSFILTER_DLLPUBLIC void applyShortCutKeyBinding ( const css::uno::Reference< css::frame::XModel >& rxDoc, const css::awt::KeyEvent& rKeyEvent, const OUString& sMacro );
73 typedef ::cppu::WeakImplHelper<
74 css::lang::XServiceInfo,
75 css::lang::XInitialization,
76 css::script::vba::XVBAMacroResolver > VBAMacroResolverBase;
78 class VBAMacroResolver final : public VBAMacroResolverBase
80 public:
81 explicit VBAMacroResolver();
82 virtual ~VBAMacroResolver() override;
84 // com.sun.star.lang.XServiceInfo interface -------------------------------
86 virtual OUString SAL_CALL
87 getImplementationName() override;
89 virtual sal_Bool SAL_CALL
90 supportsService( const OUString& rService ) override;
92 virtual css::uno::Sequence< OUString > SAL_CALL
93 getSupportedServiceNames() override;
95 // com.sun.star.lang.XInitialization interface ----------------------------
97 virtual void SAL_CALL initialize(
98 const css::uno::Sequence< css::uno::Any >& rArgs ) override;
100 // com.sun.star.script.vba.XVBAMacroResolver interface --------------------
102 virtual OUString SAL_CALL
103 resolveVBAMacroToScriptURL( const OUString& rVBAMacroName ) override;
105 virtual OUString SAL_CALL
106 resolveScriptURLtoVBAMacro( const OUString& rScriptURL ) override;
108 private:
109 css::uno::Reference< css::frame::XModel > mxModel;
110 SfxObjectShell* mpObjShell;
111 OUString maProjectName;
115 } // namespace ooo::vba
117 #endif
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */