CWS-TOOLING: integrate CWS os150
[LibreOffice.git] / sd / source / ui / inc / ViewTabBar.hxx
blob9c6077936f2c328941f22788885c4dc0989ad3f6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #ifndef SD_VIEW_TAB_BAR_HXX
29 #define SD_VIEW_TAB_BAR_HXX
31 #include <com/sun/star/frame/XController.hpp>
32 #include <com/sun/star/drawing/framework/XPane.hpp>
33 #include <com/sun/star/drawing/framework/TabBarButton.hpp>
34 #include <com/sun/star/drawing/framework/XTabBar.hpp>
35 #include <com/sun/star/drawing/framework/XToolBar.hpp>
36 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
37 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
38 #include <com/sun/star/lang/XUnoTunnel.hpp>
39 #ifndef _VCL_TABCTRL_HXX_
40 #include <vcl/tabctrl.hxx>
41 #endif
42 #include <cppuhelper/compbase4.hxx>
43 #include "MutexOwner.hxx"
45 #include <vector>
46 #include <boost/scoped_ptr.hpp>
47 #include <boost/shared_ptr.hpp>
49 namespace sd { namespace tools {
50 class EventMultiplexerEvent;
51 } }
53 namespace sd {
54 class ViewShellBase;
55 class PaneManagerEvent;
58 namespace {
59 typedef ::cppu::WeakComponentImplHelper4 <
60 ::com::sun::star::drawing::framework::XToolBar,
61 ::com::sun::star::drawing::framework::XTabBar,
62 ::com::sun::star::drawing::framework::XConfigurationChangeListener,
63 ::com::sun::star::lang::XUnoTunnel
64 > ViewTabBarInterfaceBase;
70 namespace sd {
72 /** Tab control for switching between views in the center pane.
74 class ViewTabBar
75 : private sd::MutexOwner,
76 public ViewTabBarInterfaceBase
78 public:
79 ViewTabBar (
80 const ::com::sun::star::uno::Reference<
81 com::sun::star::drawing::framework::XResourceId>& rxViewTabBarId,
82 const ::com::sun::star::uno::Reference<
83 ::com::sun::star::frame::XController>& rxController);
84 virtual ~ViewTabBar (void);
86 virtual void SAL_CALL disposing (void);
88 ::boost::shared_ptr< ::TabControl> GetTabControl (void) const;
90 bool ActivatePage (void);
92 //----- drawing::framework::XConfigurationChangeListener ------------------
94 virtual void SAL_CALL
95 notifyConfigurationChange (
96 const ::com::sun::star::drawing::framework::ConfigurationChangeEvent& rEvent)
97 throw (::com::sun::star::uno::RuntimeException);
100 //----- XEventListener ----------------------------------------------------
102 virtual void SAL_CALL disposing(
103 const com::sun::star::lang::EventObject& rEvent)
104 throw (com::sun::star::uno::RuntimeException);
107 //----- XTabBar -----------------------------------------------------------
109 virtual void
110 SAL_CALL addTabBarButtonAfter (
111 const ::com::sun::star::drawing::framework::TabBarButton& rButton,
112 const ::com::sun::star::drawing::framework::TabBarButton& rAnchor)
113 throw (::com::sun::star::uno::RuntimeException);
115 virtual void
116 SAL_CALL appendTabBarButton (
117 const ::com::sun::star::drawing::framework::TabBarButton& rButton)
118 throw (::com::sun::star::uno::RuntimeException);
120 virtual void
121 SAL_CALL removeTabBarButton (
122 const ::com::sun::star::drawing::framework::TabBarButton& rButton)
123 throw (::com::sun::star::uno::RuntimeException);
125 virtual sal_Bool
126 SAL_CALL hasTabBarButton (
127 const ::com::sun::star::drawing::framework::TabBarButton& rButton)
128 throw (::com::sun::star::uno::RuntimeException);
130 virtual ::com::sun::star::uno::Sequence<com::sun::star::drawing::framework::TabBarButton>
131 SAL_CALL getTabBarButtons (void)
132 throw (::com::sun::star::uno::RuntimeException);
135 //----- XResource ---------------------------------------------------------
137 virtual ::com::sun::star::uno::Reference<
138 ::com::sun::star::drawing::framework::XResourceId> SAL_CALL getResourceId (void)
139 throw (::com::sun::star::uno::RuntimeException);
141 virtual sal_Bool SAL_CALL isAnchorOnly (void)
142 throw (com::sun::star::uno::RuntimeException);
145 //----- XUnoTunnel --------------------------------------------------------
147 virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
148 throw (com::sun::star::uno::RuntimeException);
150 // ------------------------------------------------------------------------
152 /** The returned value is calculated as the difference between the
153 total height of the control and the heigh of its first tab page.
154 This can be considered a hack.
155 This procedure works only when the control is visible. Calling this
156 method when the control is not visible results in returning a
157 default value.
158 To be on the safe side wait for this control to become visible and
159 the call this method again.
161 int GetHeight (void);
163 void AddTabBarButton (
164 const ::com::sun::star::drawing::framework::TabBarButton& rButton,
165 const ::com::sun::star::drawing::framework::TabBarButton& rAnchor);
166 void AddTabBarButton (
167 const ::com::sun::star::drawing::framework::TabBarButton& rButton);
168 void RemoveTabBarButton (
169 const ::com::sun::star::drawing::framework::TabBarButton& rButton);
170 bool HasTabBarButton (
171 const ::com::sun::star::drawing::framework::TabBarButton& rButton);
172 ::com::sun::star::uno::Sequence<com::sun::star::drawing::framework::TabBarButton>
173 GetTabBarButtons (void);
175 private:
176 ::boost::shared_ptr< ::TabControl> mpTabControl;
177 ::com::sun::star::uno::Reference<
178 ::com::sun::star::frame::XController> mxController;
179 ::com::sun::star::uno::Reference<
180 ::com::sun::star::drawing::framework::XConfigurationController> mxConfigurationController;
181 typedef ::std::vector<com::sun::star::drawing::framework::TabBarButton> TabBarButtonList;
182 TabBarButtonList maTabBarButtons;
183 ::boost::scoped_ptr<TabPage> mpTabPage;
184 ::com::sun::star::uno::Reference<
185 ::com::sun::star::drawing::framework::XResourceId> mxViewTabBarId;
186 ViewShellBase* mpViewShellBase;
188 void UpdateActiveButton (void);
189 void AddTabBarButton (
190 const ::com::sun::star::drawing::framework::TabBarButton& rButton,
191 sal_Int32 nPosition);
192 void UpdateTabBarButtons (void);
194 /** This method is called from the constructor to get the window for an
195 anchor ResourceId and pass it to our base class. It has to be
196 static because it must not access any of the, not yet initialized
197 members.
199 static ::Window* GetAnchorWindow(
200 const ::com::sun::star::uno::Reference<
201 ::com::sun::star::drawing::framework::XResourceId>& rxViewTabBarId,
202 const ::com::sun::star::uno::Reference<
203 ::com::sun::star::frame::XController>& rxController);
204 const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void);
207 } // end of namespace sd
209 #endif