LibreOffice Module filter (master) 1
msvbahelper.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#ifndef INCLUDED_FILTER_MSFILTER_MSVBAHELPER_HXX
20#define INCLUDED_FILTER_MSFILTER_MSVBAHELPER_HXX
21
22#include <sal/config.h>
23
24#include <string_view>
25
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>
35#include <rtl/ustring.hxx>
36#include <sal/types.h>
37
38namespace com::sun::star {
39 namespace frame { class XModel; }
40 namespace uno { class XComponentContext; }
41 namespace uno { class XInterface; }
42}
43
44class SfxObjectShell;
45
46namespace ooo::vba {
47
48
50{
53 bool mbFound;
54
55 explicit MacroResolvedInfo( SfxObjectShell* pDocContext = nullptr ) : mpDocContext( pDocContext ), mbFound( false ) {}
56};
57
58MSFILTER_DLLPUBLIC OUString makeMacroURL( std::u16string_view sMacroName );
59MSFILTER_DLLPUBLIC OUString extractMacroName( std::u16string_view rMacroUrl );
61MSFILTER_DLLPUBLIC OUString resolveVBAMacro(SfxObjectShell const* pShell, const OUString& rLibName,
62 const OUString& rModuleName,
63 const OUString& rMacroName, bool bOnlyPublic,
64 const OUString& sSkipModule);
65MSFILTER_DLLPUBLIC MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& rMacroName, bool bSearchGlobalTemplates = false );
66MSFILTER_DLLPUBLIC bool executeMacro( SfxObjectShell* pShell, const OUString& sMacroName, css::uno::Sequence< css::uno::Any >& aArgs, css::uno::Any& aRet, const css::uno::Any& aCaller );
68MSFILTER_DLLPUBLIC css::awt::KeyEvent parseKeyEvent( std::u16string_view sKey );
70MSFILTER_DLLPUBLIC void applyShortCutKeyBinding ( const css::uno::Reference< css::frame::XModel >& rxDoc, const css::awt::KeyEvent& rKeyEvent, const OUString& sMacro );
71
72
73typedef ::cppu::WeakImplHelper<
74 css::lang::XServiceInfo,
75 css::lang::XInitialization,
76 css::script::vba::XVBAMacroResolver > VBAMacroResolverBase;
77
79{
80public:
81 explicit VBAMacroResolver();
82 virtual ~VBAMacroResolver() override;
83
84 // com.sun.star.lang.XServiceInfo interface -------------------------------
85
86 virtual OUString SAL_CALL
87 getImplementationName() override;
88
89 virtual sal_Bool SAL_CALL
90 supportsService( const OUString& rService ) override;
91
92 virtual css::uno::Sequence< OUString > SAL_CALL
93 getSupportedServiceNames() override;
94
95 // com.sun.star.lang.XInitialization interface ----------------------------
96
97 virtual void SAL_CALL initialize(
98 const css::uno::Sequence< css::uno::Any >& rArgs ) override;
99
100 // com.sun.star.script.vba.XVBAMacroResolver interface --------------------
101
102 virtual OUString SAL_CALL
103 resolveVBAMacroToScriptURL( const OUString& rVBAMacroName ) override;
104
105 virtual OUString SAL_CALL
106 resolveScriptURLtoVBAMacro( const OUString& rScriptURL ) override;
107
108private:
109 css::uno::Reference< css::frame::XModel > mxModel;
112};
113
114
115} // namespace ooo::vba
116
117#endif
118
119/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString SAL_CALL resolveVBAMacroToScriptURL(const OUString &rVBAMacroName) override
SfxObjectShell * mpObjShell
virtual OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::frame::XModel > mxModel
virtual OUString SAL_CALL resolveScriptURLtoVBAMacro(const OUString &rScriptURL) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ~VBAMacroResolver() override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArgs) override
virtual sal_Bool SAL_CALL supportsService(const OUString &rService) override
#define MSFILTER_DLLPUBLIC
Shape IDs per cluster in DGG atom.
awt::KeyEvent parseKeyEvent(std::u16string_view Key)
OUString makeMacroURL(std::u16string_view sMacroName)
Definition: msvbahelper.cxx:56
bool executeMacro(SfxObjectShell *pShell, const OUString &sMacroName, uno::Sequence< uno::Any > &aArgs, uno::Any &aRet, const uno::Any &)
MSFILTER_DLLPUBLIC OUString getDefaultProjectName(SfxObjectShell const *pShell)
OUString extractMacroName(std::u16string_view rMacroUrl)
Definition: msvbahelper.cxx:61
OUString resolveVBAMacro(SfxObjectShell const *pShell, const OUString &rLibName, const OUString &rModuleName, const OUString &rMacroName, bool bOnlyPublic, const OUString &sSkipModule)
::cppu::WeakImplHelper< css::lang::XServiceInfo, css::lang::XInitialization, css::script::vba::XVBAMacroResolver > VBAMacroResolverBase
Definition: msvbahelper.hxx:76
void applyShortCutKeyBinding(const uno::Reference< frame::XModel > &rxModel, const awt::KeyEvent &rKeyEvent, const OUString &rMacroName)
MacroResolvedInfo(SfxObjectShell *pDocContext=nullptr)
Definition: msvbahelper.hxx:55
SfxObjectShell * mpDocContext
Definition: msvbahelper.hxx:51
unsigned char sal_Bool