1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
24 #include <svtools/popupmenucontrollerbase.hxx>
25 #include <rtl/ustring.hxx>
26 #include <vcl/menu.hxx>
30 class NewMenuController final
: public svt::PopupMenuControllerBase
32 using svt::PopupMenuControllerBase::disposing
;
35 NewMenuController( const css::uno::Reference
< css::uno::XComponentContext
>& xContext
);
36 virtual ~NewMenuController() override
;
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
;
44 virtual void SAL_CALL
statusChanged( const css::frame::FeatureStateEvent
& Event
) override
;
47 virtual void SAL_CALL
itemSelected( const css::awt::MenuEvent
& rEvent
) override
;
48 virtual void SAL_CALL
itemActivated( const css::awt::MenuEvent
& rEvent
) override
;
51 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
55 virtual void initializeImpl( std::unique_lock
<std::mutex
>& rGuard
, const css::uno::Sequence
< css::uno::Any
>& aArguments
) override
;
57 virtual void impl_setPopupMenu(std::unique_lock
<std::mutex
>& rGuard
) override
;
59 void fillPopupMenu( css::uno::Reference
< css::awt::XPopupMenu
> const & rPopupMenu
);
60 static 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
);
69 bool m_bShowImages
: 1,
71 m_bModuleIdentified
: 1,
72 m_bAcceleratorCfg
: 1;
73 OUString m_aIconTheme
;
74 OUString m_aTargetFrame
;
75 OUString m_aModuleIdentifier
;
76 OUString m_aEmptyDocURL
;
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
;
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */