LibreOffice Module framework (master) 1
newmenucontroller.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
20#pragma once
21
22#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
23
25#include <rtl/ustring.hxx>
26#include <vcl/menu.hxx>
27
28namespace framework
29{
30 class NewMenuController final : public svt::PopupMenuControllerBase
31 {
32 using svt::PopupMenuControllerBase::disposing;
33
34 public:
35 NewMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext );
36 virtual ~NewMenuController() override;
37
38 /* interface XServiceInfo */
39 virtual OUString SAL_CALL getImplementationName() override;
40 virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override;
41 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
42
43 // XStatusListener
44 virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override;
45
46 // XMenuListener
47 virtual void SAL_CALL itemSelected( const css::awt::MenuEvent& rEvent ) override;
48 virtual void SAL_CALL itemActivated( const css::awt::MenuEvent& rEvent ) override;
49
50 // XEventListener
51 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
52
53 private:
54 // XInitialization
55 virtual void initializeImpl( std::unique_lock<std::mutex>& rGuard, const css::uno::Sequence< css::uno::Any >& aArguments ) override;
56
57 virtual void impl_setPopupMenu() override;
58
59 void fillPopupMenu( css::uno::Reference< css::awt::XPopupMenu > const & rPopupMenu );
60 void retrieveShortcutsFromConfiguration( const css::uno::Reference< css::ui::XAcceleratorConfiguration >& rAccelCfg,
61 const css::uno::Sequence< OUString >& rCommands,
62 std::vector< vcl::KeyCode >& aMenuShortCuts );
63 void setAccelerators();
64 void determineAndSetNewDocAccel(const css::awt::KeyEvent& rKeyCode);
65 void setMenuImages( PopupMenu* pPopupMenu, bool bSetImages );
66
67 private:
68 // members
69 bool m_bShowImages : 1,
73 OUString m_aIconTheme;
77 css::uno::Reference< css::uno::XComponentContext > m_xContext;
78 css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xDocAcceleratorManager;
79 css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager;
80 css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobalAcceleratorManager;
81 };
82}
83
84/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr OUStringLiteral sServiceName
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &Event) override
virtual ~NewMenuController() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void retrieveShortcutsFromConfiguration(const css::uno::Reference< css::ui::XAcceleratorConfiguration > &rAccelCfg, const css::uno::Sequence< OUString > &rCommands, std::vector< vcl::KeyCode > &aMenuShortCuts)
void setMenuImages(PopupMenu *pPopupMenu, bool bSetImages)
virtual void impl_setPopupMenu() override
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager
NewMenuController(const css::uno::Reference< css::uno::XComponentContext > &xContext)
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL itemSelected(const css::awt::MenuEvent &rEvent) override
void determineAndSetNewDocAccel(const css::awt::KeyEvent &rKeyCode)
virtual void initializeImpl(std::unique_lock< std::mutex > &rGuard, const css::uno::Sequence< css::uno::Any > &aArguments) override
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xDocAcceleratorManager
virtual void SAL_CALL itemActivated(const css::awt::MenuEvent &rEvent) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
void fillPopupMenu(css::uno::Reference< css::awt::XPopupMenu > const &rPopupMenu)
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobalAcceleratorManager
Sequence< PropertyValue > aArguments
unsigned char sal_Bool