fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / ui / inc / ViewTabBar.hxx
blob45447d63d4fc91001d686676bad4e82b0c558651
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SD_VIEW_TAB_BAR_HXX
21 #define SD_VIEW_TAB_BAR_HXX
23 #include <com/sun/star/frame/XController.hpp>
24 #include <com/sun/star/drawing/framework/XPane.hpp>
25 #include <com/sun/star/drawing/framework/TabBarButton.hpp>
26 #include <com/sun/star/drawing/framework/XTabBar.hpp>
27 #include <com/sun/star/drawing/framework/XToolBar.hpp>
28 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
29 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
30 #include <com/sun/star/lang/XUnoTunnel.hpp>
31 #include <vcl/tabctrl.hxx>
32 #include <cppuhelper/compbase4.hxx>
33 #include "MutexOwner.hxx"
35 #include <vector>
36 #include <boost/scoped_ptr.hpp>
37 #include <boost/shared_ptr.hpp>
39 namespace sd {
40 class ViewShellBase;
43 namespace {
44 typedef ::cppu::WeakComponentImplHelper4 <
45 ::com::sun::star::drawing::framework::XToolBar,
46 ::com::sun::star::drawing::framework::XTabBar,
47 ::com::sun::star::drawing::framework::XConfigurationChangeListener,
48 ::com::sun::star::lang::XUnoTunnel
49 > ViewTabBarInterfaceBase;
55 namespace sd {
57 /** Tab control for switching between views in the center pane.
59 class ViewTabBar
60 : private sd::MutexOwner,
61 public ViewTabBarInterfaceBase
63 public:
64 ViewTabBar (
65 const ::com::sun::star::uno::Reference<
66 com::sun::star::drawing::framework::XResourceId>& rxViewTabBarId,
67 const ::com::sun::star::uno::Reference<
68 ::com::sun::star::frame::XController>& rxController);
69 virtual ~ViewTabBar (void);
71 virtual void SAL_CALL disposing (void);
73 ::boost::shared_ptr< ::TabControl> GetTabControl (void) const;
75 bool ActivatePage (void);
77 //----- drawing::framework::XConfigurationChangeListener ------------------
79 virtual void SAL_CALL
80 notifyConfigurationChange (
81 const ::com::sun::star::drawing::framework::ConfigurationChangeEvent& rEvent)
82 throw (::com::sun::star::uno::RuntimeException);
85 //----- XEventListener ----------------------------------------------------
87 virtual void SAL_CALL disposing(
88 const com::sun::star::lang::EventObject& rEvent)
89 throw (com::sun::star::uno::RuntimeException);
92 //----- XTabBar -----------------------------------------------------------
94 virtual void
95 SAL_CALL addTabBarButtonAfter (
96 const ::com::sun::star::drawing::framework::TabBarButton& rButton,
97 const ::com::sun::star::drawing::framework::TabBarButton& rAnchor)
98 throw (::com::sun::star::uno::RuntimeException);
100 virtual void
101 SAL_CALL appendTabBarButton (
102 const ::com::sun::star::drawing::framework::TabBarButton& rButton)
103 throw (::com::sun::star::uno::RuntimeException);
105 virtual void
106 SAL_CALL removeTabBarButton (
107 const ::com::sun::star::drawing::framework::TabBarButton& rButton)
108 throw (::com::sun::star::uno::RuntimeException);
110 virtual sal_Bool
111 SAL_CALL hasTabBarButton (
112 const ::com::sun::star::drawing::framework::TabBarButton& rButton)
113 throw (::com::sun::star::uno::RuntimeException);
115 virtual ::com::sun::star::uno::Sequence<com::sun::star::drawing::framework::TabBarButton>
116 SAL_CALL getTabBarButtons (void)
117 throw (::com::sun::star::uno::RuntimeException);
120 //----- XResource ---------------------------------------------------------
122 virtual ::com::sun::star::uno::Reference<
123 ::com::sun::star::drawing::framework::XResourceId> SAL_CALL getResourceId (void)
124 throw (::com::sun::star::uno::RuntimeException);
126 virtual sal_Bool SAL_CALL isAnchorOnly (void)
127 throw (com::sun::star::uno::RuntimeException);
130 //----- XUnoTunnel --------------------------------------------------------
132 virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
133 throw (com::sun::star::uno::RuntimeException);
135 // ------------------------------------------------------------------------
137 /** The returned value is calculated as the difference between the
138 total height of the control and the heigh of its first tab page.
139 This can be considered a hack.
140 This procedure works only when the control is visible. Calling this
141 method when the control is not visible results in returning a
142 default value.
143 To be on the safe side wait for this control to become visible and
144 the call this method again.
146 int GetHeight (void);
148 void AddTabBarButton (
149 const ::com::sun::star::drawing::framework::TabBarButton& rButton,
150 const ::com::sun::star::drawing::framework::TabBarButton& rAnchor);
151 void AddTabBarButton (
152 const ::com::sun::star::drawing::framework::TabBarButton& rButton);
153 void RemoveTabBarButton (
154 const ::com::sun::star::drawing::framework::TabBarButton& rButton);
155 bool HasTabBarButton (
156 const ::com::sun::star::drawing::framework::TabBarButton& rButton);
157 ::com::sun::star::uno::Sequence<com::sun::star::drawing::framework::TabBarButton>
158 GetTabBarButtons (void);
160 private:
161 ::boost::shared_ptr< ::TabControl> mpTabControl;
162 ::com::sun::star::uno::Reference<
163 ::com::sun::star::frame::XController> mxController;
164 ::com::sun::star::uno::Reference<
165 ::com::sun::star::drawing::framework::XConfigurationController> mxConfigurationController;
166 typedef ::std::vector<com::sun::star::drawing::framework::TabBarButton> TabBarButtonList;
167 TabBarButtonList maTabBarButtons;
168 ::boost::scoped_ptr<TabPage> mpTabPage;
169 ::com::sun::star::uno::Reference<
170 ::com::sun::star::drawing::framework::XResourceId> mxViewTabBarId;
171 ViewShellBase* mpViewShellBase;
173 void UpdateActiveButton (void);
174 void AddTabBarButton (
175 const ::com::sun::star::drawing::framework::TabBarButton& rButton,
176 sal_Int32 nPosition);
177 void UpdateTabBarButtons (void);
179 /** This method is called from the constructor to get the window for an
180 anchor ResourceId and pass it to our base class. It has to be
181 static because it must not access any of the, not yet initialized
182 members.
184 static ::Window* GetAnchorWindow(
185 const ::com::sun::star::uno::Reference<
186 ::com::sun::star::drawing::framework::XResourceId>& rxViewTabBarId,
187 const ::com::sun::star::uno::Reference<
188 ::com::sun::star::frame::XController>& rxController);
189 const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void);
192 } // end of namespace sd
194 #endif
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */