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 SD_FRAMEWORK_VIEW_TAB_BAR_MODULE_HXX
25 #define SD_FRAMEWORK_VIEW_TAB_BAR_MODULE_HXX
26 
27 #include "MutexOwner.hxx"
28 
29 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
30 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
31 #include <com/sun/star/drawing/framework/XTabBar.hpp>
32 #include <com/sun/star/frame/XController.hpp>
33 #include <osl/mutex.hxx>
34 #include <cppuhelper/compbase1.hxx>
35 
36 namespace css = ::com::sun::star;
37 
38 namespace {
39 
40 typedef ::cppu::WeakComponentImplHelper1 <
41     ::css::drawing::framework::XConfigurationChangeListener
42     > ViewTabBarModuleInterfaceBase;
43 
44 } // end of anonymous namespace.
45 
46 
47 
48 
49 namespace sd { namespace framework {
50 
51 /** This module is responsible for showing the ViewTabBar above the view in
52     the center pane.
53 */
54 class ViewTabBarModule
55     : private sd::MutexOwner,
56       public ViewTabBarModuleInterfaceBase
57 {
58 public:
59     /** Create a new module that controls the view tab bar above the view
60         in the specified pane.
61         @param rxController
62             This is the access point to the drawing framework.
63         @param rxViewTabBarId
64             This ResourceId specifies which tab bar is to be managed by the
65             new module.
66     */
67     ViewTabBarModule (
68         const css::uno::Reference<css::frame::XController>& rxController,
69         const css::uno::Reference<
70             css::drawing::framework::XResourceId>& rxViewTabBarId);
71     virtual ~ViewTabBarModule (void);
72 
73     virtual void SAL_CALL disposing (void);
74 
75 
76     // XConfigurationChangeListener
77 
78     virtual void SAL_CALL notifyConfigurationChange (
79         const css::drawing::framework::ConfigurationChangeEvent& rEvent)
80         throw (css::uno::RuntimeException);
81 
82     // XEventListener
83 
84     virtual void SAL_CALL disposing (
85         const css::lang::EventObject& rEvent)
86         throw (css::uno::RuntimeException);
87 
88 private:
89     css::uno::Reference<
90         css::drawing::framework::XConfigurationController> mxConfigurationController;
91     css::uno::Reference<css::drawing::framework::XResourceId> mxViewTabBarId;
92 
93     /** This is the place where the view tab bar is filled.  Only missing
94         buttons are added, so it is safe to call this method multiple
95         times.
96     */
97     void UpdateViewTabBar (
98         const css::uno::Reference<css::drawing::framework::XTabBar>& rxTabBar);
99 };
100 
101 } } // end of namespace sd::framework
102 
103 #endif
104