1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ViewTabBar.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SD_VIEW_TAB_BAR_HXX
32 #define SD_VIEW_TAB_BAR_HXX
34 #include <com/sun/star/frame/XController.hpp>
35 #include <com/sun/star/drawing/framework/XPane.hpp>
36 #include <com/sun/star/drawing/framework/TabBarButton.hpp>
37 #include <com/sun/star/drawing/framework/XTabBar.hpp>
38 #include <com/sun/star/drawing/framework/XToolBar.hpp>
39 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
40 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
41 #include <com/sun/star/lang/XUnoTunnel.hpp>
42 #ifndef _VCL_TABCTRL_HXX_
43 #include <vcl/tabctrl.hxx>
45 #include <cppuhelper/compbase4.hxx>
46 #include "MutexOwner.hxx"
49 #include <boost/scoped_ptr.hpp>
50 #include <boost/shared_ptr.hpp>
52 namespace sd
{ namespace tools
{
53 class EventMultiplexerEvent
;
58 class PaneManagerEvent
;
62 typedef ::cppu::WeakComponentImplHelper4
<
63 ::com::sun::star::drawing::framework::XToolBar
,
64 ::com::sun::star::drawing::framework::XTabBar
,
65 ::com::sun::star::drawing::framework::XConfigurationChangeListener
,
66 ::com::sun::star::lang::XUnoTunnel
67 > ViewTabBarInterfaceBase
;
75 /** Tab control for switching between views in the center pane.
78 : private sd::MutexOwner
,
79 public ViewTabBarInterfaceBase
83 const ::com::sun::star::uno::Reference
<
84 com::sun::star::drawing::framework::XResourceId
>& rxViewTabBarId
,
85 const ::com::sun::star::uno::Reference
<
86 ::com::sun::star::frame::XController
>& rxController
);
87 virtual ~ViewTabBar (void);
89 virtual void SAL_CALL
disposing (void);
91 ::boost::shared_ptr
< ::TabControl
> GetTabControl (void) const;
93 bool ActivatePage (void);
95 //----- drawing::framework::XConfigurationChangeListener ------------------
98 notifyConfigurationChange (
99 const ::com::sun::star::drawing::framework::ConfigurationChangeEvent
& rEvent
)
100 throw (::com::sun::star::uno::RuntimeException
);
103 //----- XEventListener ----------------------------------------------------
105 virtual void SAL_CALL
disposing(
106 const com::sun::star::lang::EventObject
& rEvent
)
107 throw (com::sun::star::uno::RuntimeException
);
110 //----- XTabBar -----------------------------------------------------------
113 SAL_CALL
addTabBarButtonAfter (
114 const ::com::sun::star::drawing::framework::TabBarButton
& rButton
,
115 const ::com::sun::star::drawing::framework::TabBarButton
& rAnchor
)
116 throw (::com::sun::star::uno::RuntimeException
);
119 SAL_CALL
appendTabBarButton (
120 const ::com::sun::star::drawing::framework::TabBarButton
& rButton
)
121 throw (::com::sun::star::uno::RuntimeException
);
124 SAL_CALL
removeTabBarButton (
125 const ::com::sun::star::drawing::framework::TabBarButton
& rButton
)
126 throw (::com::sun::star::uno::RuntimeException
);
129 SAL_CALL
hasTabBarButton (
130 const ::com::sun::star::drawing::framework::TabBarButton
& rButton
)
131 throw (::com::sun::star::uno::RuntimeException
);
133 virtual ::com::sun::star::uno::Sequence
<com::sun::star::drawing::framework::TabBarButton
>
134 SAL_CALL
getTabBarButtons (void)
135 throw (::com::sun::star::uno::RuntimeException
);
138 //----- XResource ---------------------------------------------------------
140 virtual ::com::sun::star::uno::Reference
<
141 ::com::sun::star::drawing::framework::XResourceId
> SAL_CALL
getResourceId (void)
142 throw (::com::sun::star::uno::RuntimeException
);
144 virtual sal_Bool SAL_CALL
isAnchorOnly (void)
145 throw (com::sun::star::uno::RuntimeException
);
148 //----- XUnoTunnel --------------------------------------------------------
150 virtual sal_Int64 SAL_CALL
getSomething (const com::sun::star::uno::Sequence
<sal_Int8
>& rId
)
151 throw (com::sun::star::uno::RuntimeException
);
153 // ------------------------------------------------------------------------
155 /** The returned value is calculated as the difference between the
156 total height of the control and the heigh of its first tab page.
157 This can be considered a hack.
158 This procedure works only when the control is visible. Calling this
159 method when the control is not visible results in returning a
161 To be on the safe side wait for this control to become visible and
162 the call this method again.
164 int GetHeight (void);
166 void AddTabBarButton (
167 const ::com::sun::star::drawing::framework::TabBarButton
& rButton
,
168 const ::com::sun::star::drawing::framework::TabBarButton
& rAnchor
);
169 void AddTabBarButton (
170 const ::com::sun::star::drawing::framework::TabBarButton
& rButton
);
171 void RemoveTabBarButton (
172 const ::com::sun::star::drawing::framework::TabBarButton
& rButton
);
173 bool HasTabBarButton (
174 const ::com::sun::star::drawing::framework::TabBarButton
& rButton
);
175 ::com::sun::star::uno::Sequence
<com::sun::star::drawing::framework::TabBarButton
>
176 GetTabBarButtons (void);
179 ::boost::shared_ptr
< ::TabControl
> mpTabControl
;
180 ::com::sun::star::uno::Reference
<
181 ::com::sun::star::frame::XController
> mxController
;
182 ::com::sun::star::uno::Reference
<
183 ::com::sun::star::drawing::framework::XConfigurationController
> mxConfigurationController
;
184 typedef ::std::vector
<com::sun::star::drawing::framework::TabBarButton
> TabBarButtonList
;
185 TabBarButtonList maTabBarButtons
;
186 ::boost::scoped_ptr
<TabPage
> mpTabPage
;
187 ::com::sun::star::uno::Reference
<
188 ::com::sun::star::drawing::framework::XResourceId
> mxViewTabBarId
;
189 ViewShellBase
* mpViewShellBase
;
191 void UpdateActiveButton (void);
192 void AddTabBarButton (
193 const ::com::sun::star::drawing::framework::TabBarButton
& rButton
,
194 sal_Int32 nPosition
);
195 void UpdateTabBarButtons (void);
197 /** This method is called from the constructor to get the window for an
198 anchor ResourceId and pass it to our base class. It has to be
199 static because it must not access any of the, not yet initialized
202 static ::Window
* GetAnchorWindow(
203 const ::com::sun::star::uno::Reference
<
204 ::com::sun::star::drawing::framework::XResourceId
>& rxViewTabBarId
,
205 const ::com::sun::star::uno::Reference
<
206 ::com::sun::star::frame::XController
>& rxController
);
207 const ::com::sun::star::uno::Sequence
<sal_Int8
>& getUnoTunnelId (void);
210 } // end of namespace sd