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 #ifndef _SVX_SIDEBAR_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_
23 #define _SVX_SIDEBAR_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_
24 
25 #include "svx/svxdllapi.h"
26 #include <sfx2/sidebar/EnumContext.hxx>
27 #include <com/sun/star/frame/XController.hpp>
28 #include <com/sun/star/frame/XFrame.hpp>
29 
30 namespace css = ::com::sun::star;
31 namespace cssu = ::com::sun::star::uno;
32 
33 class SfxViewShell;
34 
35 /** Convenience frontend for com::sun::star::ui::ContextChangeEventMultiplexer
36 */
37 class SVX_DLLPUBLIC ContextChangeEventMultiplexer
38 {
39 public:
40     /** Notify the activation of a context.
41         @param rxController
42             This controller is used to determine the module (ie
43             application like Writer or Calc).
44         @param eContext
45             The activated context.
46     */
47     static void NotifyContextChange (
48         const cssu::Reference<css::frame::XController>& rxController,
49         const ::sfx2::sidebar::EnumContext::Context eContext);
50 
51     /** Notify the activation of a context.
52         @param pViewShell
53             This view shell is used to determine the module (ie
54             application like Writer or Calc).  When <NULL/> then no
55             notification is made.
56         @param eContext
57             The activated context.
58     */
59     static void NotifyContextChange (
60         SfxViewShell* pViewShell,
61         const ::sfx2::sidebar::EnumContext::Context eContext);
62 
63 private:
64     static ::rtl::OUString GetModuleName (
65         const cssu::Reference<css::frame::XFrame>& rxFrame);
66 };
67 
68 #endif
69 
70