bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / inc / ViewTabBar.hxx
blob3401966657a51e368226505a46bf6a36890febb5
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 INCLUDED_SD_SOURCE_UI_INC_VIEWTABBAR_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_VIEWTABBAR_HXX
23 #include <com/sun/star/drawing/framework/TabBarButton.hpp>
24 #include <com/sun/star/drawing/framework/XTabBar.hpp>
25 #include <com/sun/star/drawing/framework/XToolBar.hpp>
26 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
27 #include <com/sun/star/lang/XUnoTunnel.hpp>
28 #include <vcl/tabctrl.hxx>
29 #include <cppuhelper/compbase.hxx>
30 #include "MutexOwner.hxx"
32 #include <vector>
34 namespace com { namespace sun { namespace star { namespace drawing { namespace framework { class XConfigurationController; } } } } }
35 namespace com { namespace sun { namespace star { namespace drawing { namespace framework { class XResourceId; } } } } }
36 namespace com { namespace sun { namespace star { namespace drawing { namespace framework { struct ConfigurationChangeEvent; } } } } }
37 namespace com { namespace sun { namespace star { namespace frame { class XController; } } } }
38 namespace vcl { class Window; }
40 namespace sd {
41 class ViewShellBase;
44 namespace sd {
46 typedef ::cppu::WeakComponentImplHelper <
47 css::drawing::framework::XToolBar,
48 css::drawing::framework::XTabBar,
49 css::drawing::framework::XConfigurationChangeListener,
50 css::lang::XUnoTunnel
51 > ViewTabBarInterfaceBase;
53 /** Tab control for switching between views in the center pane.
55 class ViewTabBar
56 : private sd::MutexOwner,
57 public ViewTabBarInterfaceBase
59 public:
60 ViewTabBar (
61 const css::uno::Reference< css::drawing::framework::XResourceId>& rxViewTabBarId,
62 const css::uno::Reference< css::frame::XController>& rxController);
63 virtual ~ViewTabBar() override;
65 virtual void SAL_CALL disposing() override;
67 const VclPtr< ::TabControl>& GetTabControl() const { return mpTabControl;}
69 bool ActivatePage();
71 //----- drawing::framework::XConfigurationChangeListener ------------------
73 virtual void SAL_CALL
74 notifyConfigurationChange (
75 const css::drawing::framework::ConfigurationChangeEvent& rEvent) override;
77 //----- XEventListener ----------------------------------------------------
79 virtual void SAL_CALL disposing(
80 const css::lang::EventObject& rEvent) override;
82 //----- XTabBar -----------------------------------------------------------
84 virtual void
85 SAL_CALL addTabBarButtonAfter (
86 const css::drawing::framework::TabBarButton& rButton,
87 const css::drawing::framework::TabBarButton& rAnchor) override;
89 virtual void
90 SAL_CALL appendTabBarButton (
91 const css::drawing::framework::TabBarButton& rButton) override;
93 virtual void
94 SAL_CALL removeTabBarButton (
95 const css::drawing::framework::TabBarButton& rButton) override;
97 virtual sal_Bool
98 SAL_CALL hasTabBarButton (
99 const css::drawing::framework::TabBarButton& rButton) override;
101 virtual css::uno::Sequence<css::drawing::framework::TabBarButton>
102 SAL_CALL getTabBarButtons() override;
104 //----- XResource ---------------------------------------------------------
106 virtual css::uno::Reference<
107 css::drawing::framework::XResourceId> SAL_CALL getResourceId() override;
109 virtual sal_Bool SAL_CALL isAnchorOnly() override;
111 //----- XUnoTunnel --------------------------------------------------------
113 virtual sal_Int64 SAL_CALL getSomething (const css::uno::Sequence<sal_Int8>& rId) override;
115 /** The returned value is calculated as the difference between the
116 total height of the control and the height of its first tab page.
117 This can be considered a hack.
118 This procedure works only when the control is visible. Calling this
119 method when the control is not visible results in returning a
120 default value.
121 To be on the safe side wait for this control to become visible and
122 the call this method again.
124 int GetHeight();
126 void AddTabBarButton (
127 const css::drawing::framework::TabBarButton& rButton,
128 const css::drawing::framework::TabBarButton& rAnchor);
129 void AddTabBarButton (
130 const css::drawing::framework::TabBarButton& rButton);
131 void RemoveTabBarButton (
132 const css::drawing::framework::TabBarButton& rButton);
133 bool HasTabBarButton (
134 const css::drawing::framework::TabBarButton& rButton);
135 css::uno::Sequence<css::drawing::framework::TabBarButton>
136 GetTabBarButtons();
138 private:
139 VclPtr< ::TabControl> mpTabControl;
140 css::uno::Reference<css::frame::XController> mxController;
141 css::uno::Reference<css::drawing::framework::XConfigurationController> mxConfigurationController;
142 typedef ::std::vector<css::drawing::framework::TabBarButton> TabBarButtonList;
143 TabBarButtonList maTabBarButtons;
144 VclPtr<TabPage> mpTabPage;
145 css::uno::Reference<css::drawing::framework::XResourceId> mxViewTabBarId;
146 ViewShellBase* mpViewShellBase;
148 void UpdateActiveButton();
149 void AddTabBarButton (
150 const css::drawing::framework::TabBarButton& rButton,
151 sal_Int32 nPosition);
152 void UpdateTabBarButtons();
154 /** This method is called from the constructor to get the window for an
155 anchor ResourceId and pass it to our base class. It has to be
156 static because it must not access any of the, not yet initialized
157 members.
159 static vcl::Window* GetAnchorWindow(
160 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewTabBarId,
161 const css::uno::Reference<css::frame::XController>& rxController);
162 static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
165 } // end of namespace sd
167 #endif
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */