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 SFX_SIDEBAR_CONTEXT_CHANGE_BROADCASTER_HXX
23 #define SFX_SIDEBAR_CONTEXT_CHANGE_BROADCASTER_HXX
24 
25 #include <com/sun/star/frame/XFrame.hpp>
26 
27 namespace css = ::com::sun::star;
28 namespace cssu = ::com::sun::star::uno;
29 
30 namespace sfx2 { namespace sidebar {
31 
32 
33 /** This class is a helper for broadcasting context changes that are
34     tied to shells being activated or deactivated.
35 */
36 class ContextChangeBroadcaster
37 {
38 public:
39     ContextChangeBroadcaster (void);
40     ~ContextChangeBroadcaster (void);
41 
42     void Initialize (const ::rtl::OUString& rsContextName);
43 
44     void Activate (const cssu::Reference<css::frame::XFrame>& rxFrame);
45     void Deactivate (const cssu::Reference<css::frame::XFrame>& rxFrame);
46 
47 private:
48     rtl::OUString msContextName;
49     bool mbIsContextActive;
50 
51     void BroadcastContextChange (
52         const cssu::Reference<css::frame::XFrame>& rxFrame,
53         const ::rtl::OUString& rsModuleName,
54         const ::rtl::OUString& rsContextName);
55     ::rtl::OUString GetModuleName (
56         const cssu::Reference<css::frame::XFrame>& rxFrame);
57 };
58 
59 
60 } } // end of namespace ::sd::sidebar
61 
62 #endif
63