1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
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
; }
46 typedef ::cppu::WeakComponentImplHelper
<
47 css::drawing::framework::XToolBar
,
48 css::drawing::framework::XTabBar
,
49 css::drawing::framework::XConfigurationChangeListener
,
51 > ViewTabBarInterfaceBase
;
53 /** Tab control for switching between views in the center pane.
56 : private sd::MutexOwner
,
57 public ViewTabBarInterfaceBase
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
;}
71 //----- drawing::framework::XConfigurationChangeListener ------------------
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 -----------------------------------------------------------
85 SAL_CALL
addTabBarButtonAfter (
86 const css::drawing::framework::TabBarButton
& rButton
,
87 const css::drawing::framework::TabBarButton
& rAnchor
) override
;
90 SAL_CALL
appendTabBarButton (
91 const css::drawing::framework::TabBarButton
& rButton
) override
;
94 SAL_CALL
removeTabBarButton (
95 const css::drawing::framework::TabBarButton
& rButton
) override
;
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
121 To be on the safe side wait for this control to become visible and
122 the call this method again.
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
>
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
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
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */