xref: /AOO41X/main/framework/inc/framework/actiontriggerhelper.hxx (revision f8e07b45f7e1fb69563504f404bb0b75210f0be6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef __FRAMEWORK_HELPER_ACTIONTRIGGERHELPER_HXX_
25 #define __FRAMEWORK_HELPER_ACTIONTRIGGERHELPER_HXX_
26 
27 #include <com/sun/star/container/XIndexContainer.hpp>
28 
29 // #110897#
30 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
31 #include <vcl/menu.hxx>
32 #include <framework/fwedllapi.h>
33 
34 
35 namespace framework
36 {
37     class FWE_DLLPUBLIC ActionTriggerHelper
38     {
39         public:
40             // Fills the submitted menu with the structure contained in the second
41             // parameter rActionTriggerContainer
42             // @param pNewMenu = must be a valid and empty menu
43             // @param rActionTriggerContainer = must be an instance of service "com.sun.star.ui.ActionTriggerContaienr"
44             static void
45                 CreateMenuFromActionTriggerContainer(
46                     Menu* pNewMenu,
47                     const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& rActionTriggerContainer );
48 
49             // Creates a "com::sun::star::ui::ActionTriggerContainer" with the structure of the menu
50             // provided as a parameter. The implementation class stores the menu pointer
51             // to optimize the time of creation of a menu from a actiontrigger structure.
52             // IMPORTANT: The caller must ensure that the menu pointer is valid through the
53             //            life time of the XIndexContainer object!!!
54             //
55             // @param pNewMenu = Must be a valid menu. Please be aware that this implementation is based on
56             //                   the above mentioned restriction!!!
57 
58             // #110897#
59             static com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > CreateActionTriggerContainerFromMenu(
60                 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
61                 const Menu* pMenu, const ::rtl::OUString* pMenuIdentifier );
62 
63             // Fills the submitted rActionTriggerContainer with the structure of the menu
64             // provided as the second parameter
65             // @param rActionTriggerContainer = must be an instance of service "com.sun.star.ui.ActionTriggerContainer"
66             // @param pNewMenu = must be a valid menu
67             static void
68                 FillActionTriggerContainerFromMenu(
69                     com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& rActionTriggerContainer,
70                     const Menu* pMenu );
71 
72     };
73 }
74 
75 #endif // __FRAMEWORK_HELPER_ACTIONTRIGGERHELPER_HXX_
76