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 <framework/fwkdllapi.h>
23 #include <com/sun/star/uno/Reference.hxx>
25 namespace com::sun::star::awt
{ class XPopupMenu
; }
26 namespace com::sun::star::container
{ class XIndexContainer
; }
30 class FWK_DLLPUBLIC ActionTriggerHelper
33 // Fills the submitted menu with the structure contained in the second
34 // parameter rActionTriggerContainer
35 // @param pNewMenu = must be a valid and empty menu
36 // @param rActionTriggerContainer = must be an instance of service "com.sun.star.ui.ActionTriggerContainer"
38 CreateMenuFromActionTriggerContainer(
39 const css::uno::Reference
<css::awt::XPopupMenu
>& rNewMenu
,
40 const css::uno::Reference
<css::container::XIndexContainer
>& rActionTriggerContainer
);
42 // Creates a "css::ui::ActionTriggerContainer" with the structure of the menu
43 // provided as a parameter. The implementation class stores the menu pointer
44 // to optimize the time of creation of a menu from an actiontrigger structure.
45 // IMPORTANT: The caller must ensure that the menu pointer is valid through the
46 // life time of the XIndexContainer object!!!
47 // @param rMenu = Must be a valid menu. Please be aware that this implementation is based on
48 // the above mentioned restriction!!!
50 static css::uno::Reference
< css::container::XIndexContainer
> CreateActionTriggerContainerFromMenu(
51 const css::uno::Reference
<css::awt::XPopupMenu
>& rMenu
, const OUString
* pMenuIdentifier
);
53 // Fills the submitted rActionTriggerContainer with the structure of the menu
54 // provided as the second parameter
55 // @param rActionTriggerContainer = must be an instance of service "com.sun.star.ui.ActionTriggerContainer"
56 // @param rMenu = must be a valid menu
58 FillActionTriggerContainerFromMenu(
59 css::uno::Reference
< css::container::XIndexContainer
> const & rActionTriggerContainer
,
60 const css::uno::Reference
<css::awt::XPopupMenu
>& rMenu
);
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */