1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SD_FRAMEWORK_VIEW_TAB_BAR_MODULE_HXX
29 #define SD_FRAMEWORK_VIEW_TAB_BAR_MODULE_HXX
30 
31 #include "MutexOwner.hxx"
32 
33 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
34 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
35 #include <com/sun/star/drawing/framework/XTabBar.hpp>
36 #include <com/sun/star/frame/XController.hpp>
37 #include <osl/mutex.hxx>
38 #include <cppuhelper/compbase1.hxx>
39 
40 namespace css = ::com::sun::star;
41 
42 namespace {
43 
44 typedef ::cppu::WeakComponentImplHelper1 <
45     ::css::drawing::framework::XConfigurationChangeListener
46     > ViewTabBarModuleInterfaceBase;
47 
48 } // end of anonymous namespace.
49 
50 
51 
52 
53 namespace sd { namespace framework {
54 
55 /** This module is responsible for showing the ViewTabBar above the view in
56     the center pane.
57 */
58 class ViewTabBarModule
59     : private sd::MutexOwner,
60       public ViewTabBarModuleInterfaceBase
61 {
62 public:
63     /** Create a new module that controlls the view tab bar above the view
64         in the specified pane.
65         @param rxController
66             This is the access point to the drawing framework.
67         @param rxViewTabBarId
68             This ResourceId specifies which tab bar is to be managed by the
69             new module.
70     */
71     ViewTabBarModule (
72         const css::uno::Reference<css::frame::XController>& rxController,
73         const css::uno::Reference<
74             css::drawing::framework::XResourceId>& rxViewTabBarId);
75     virtual ~ViewTabBarModule (void);
76 
77     virtual void SAL_CALL disposing (void);
78 
79 
80     // XConfigurationChangeListener
81 
82     virtual void SAL_CALL notifyConfigurationChange (
83         const css::drawing::framework::ConfigurationChangeEvent& rEvent)
84         throw (css::uno::RuntimeException);
85 
86     // XEventListener
87 
88     virtual void SAL_CALL disposing (
89         const css::lang::EventObject& rEvent)
90         throw (css::uno::RuntimeException);
91 
92 private:
93     css::uno::Reference<
94         css::drawing::framework::XConfigurationController> mxConfigurationController;
95     css::uno::Reference<css::drawing::framework::XResourceId> mxViewTabBarId;
96 
97     /** This is the place where the view tab bar is filled.  Only missing
98         buttons are added, so it is safe to call this method multiple
99         times.
100     */
101     void UpdateViewTabBar (
102         const css::uno::Reference<css::drawing::framework::XTabBar>& rxTabBar);
103 };
104 
105 } } // end of namespace sd::framework
106 
107 #endif
108