LibreOffice Module sd (master) 1
ViewTabBar.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <com/sun/star/drawing/framework/TabBarButton.hpp>
23#include <com/sun/star/drawing/framework/XTabBar.hpp>
24#include <com/sun/star/drawing/framework/XToolBar.hpp>
25#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
28
29#include <vector>
30
31namespace com::sun::star::drawing::framework { class XConfigurationController; }
32namespace com::sun::star::drawing::framework { class XResourceId; }
33namespace com::sun::star::drawing::framework { struct ConfigurationChangeEvent; }
34namespace com::sun::star::frame { class XController; }
35namespace vcl { class Window; }
36
37namespace sd {
38 class DrawController;
39 class ViewShellBase;
40 class ViewTabBar;
41}
42
43namespace sd {
44
45class TabBarControl final : public InterimItemWindow
46{
47public:
48 TabBarControl(vcl::Window* pParentWindow, ::rtl::Reference<ViewTabBar> pViewTabBar);
49 virtual void dispose() override;
50 virtual ~TabBarControl() override;
52 int GetAllocatedWidth() const { return mnAllocatedWidth; }
53private:
54 std::unique_ptr<weld::Notebook> mxTabControl;
57
58 DECL_LINK(ActivatePageHdl, const OUString&, void);
59 DECL_LINK(NotebookSizeAllocHdl, const Size&, void);
60};
61
63 css::drawing::framework::XToolBar,
64 css::drawing::framework::XTabBar,
65 css::drawing::framework::XConfigurationChangeListener
67
70class ViewTabBar final
72{
73public:
75 const css::uno::Reference< css::drawing::framework::XResourceId>& rxViewTabBarId,
76 const rtl::Reference< ::sd::DrawController>& rxController);
77 virtual ~ViewTabBar() override;
78
79 virtual void disposing(std::unique_lock<std::mutex>&) override;
80
82
83 bool ActivatePage(size_t nIndex);
84
85 //----- drawing::framework::XConfigurationChangeListener ------------------
86
87 virtual void SAL_CALL
89 const css::drawing::framework::ConfigurationChangeEvent& rEvent) override;
90
91 //----- XEventListener ----------------------------------------------------
92
93 virtual void SAL_CALL disposing(
94 const css::lang::EventObject& rEvent) override;
95
96 //----- XTabBar -----------------------------------------------------------
97
98 virtual void
99 SAL_CALL addTabBarButtonAfter (
100 const css::drawing::framework::TabBarButton& rButton,
101 const css::drawing::framework::TabBarButton& rAnchor) override;
102
103 virtual void
104 SAL_CALL appendTabBarButton (
105 const css::drawing::framework::TabBarButton& rButton) override;
106
107 virtual void
108 SAL_CALL removeTabBarButton (
109 const css::drawing::framework::TabBarButton& rButton) override;
110
111 virtual sal_Bool
112 SAL_CALL hasTabBarButton (
113 const css::drawing::framework::TabBarButton& rButton) override;
114
115 virtual css::uno::Sequence<css::drawing::framework::TabBarButton>
116 SAL_CALL getTabBarButtons() override;
117
118 //----- XResource ---------------------------------------------------------
119
120 virtual css::uno::Reference<
121 css::drawing::framework::XResourceId> SAL_CALL getResourceId() override;
122
123 virtual sal_Bool SAL_CALL isAnchorOnly() override;
124
134 int GetHeight() const;
135
136 void UpdateActiveButton();
137
138 void AddTabBarButton (
139 const css::drawing::framework::TabBarButton& rButton,
140 const css::drawing::framework::TabBarButton& rAnchor);
141 void AddTabBarButton (
142 const css::drawing::framework::TabBarButton& rButton);
143 void RemoveTabBarButton (
144 const css::drawing::framework::TabBarButton& rButton);
145 bool HasTabBarButton (
146 const css::drawing::framework::TabBarButton& rButton);
147 css::uno::Sequence<css::drawing::framework::TabBarButton>
149
150private:
153 css::uno::Reference<css::drawing::framework::XConfigurationController> mxConfigurationController;
154 typedef ::std::vector<css::drawing::framework::TabBarButton> TabBarButtonList;
156 css::uno::Reference<css::drawing::framework::XResourceId> mxViewTabBarId;
159
160 void AddTabBarButton (
161 const css::drawing::framework::TabBarButton& rButton,
162 sal_Int32 nPosition);
163 void UpdateTabBarButtons();
164
171 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewTabBarId,
172 const rtl::Reference<::sd::DrawController>& rxController);
173};
174
175} // end of namespace sd
176
177/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~TabBarControl() override
Definition: ViewTabBar.cxx:513
virtual void dispose() override
Definition: ViewTabBar.cxx:507
::rtl::Reference< ViewTabBar > mpViewTabBar
Definition: ViewTabBar.hxx:55
weld::Notebook & GetNotebook()
Definition: ViewTabBar.hxx:51
TabBarControl(vcl::Window *pParentWindow, ::rtl::Reference< ViewTabBar > pViewTabBar)
Definition: ViewTabBar.cxx:486
std::unique_ptr< weld::Notebook > mxTabControl
Definition: ViewTabBar.hxx:54
DECL_LINK(NotebookSizeAllocHdl, const Size &, void)
DECL_LINK(ActivatePageHdl, const OUString &, void)
int GetAllocatedWidth() const
Definition: ViewTabBar.hxx:52
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
Tab control for switching between views in the center pane.
Definition: ViewTabBar.hxx:72
int GetHeight() const
The returned value is calculated as the difference between the total height of the control and the he...
Definition: ViewTabBar.cxx:303
virtual ~ViewTabBar() override
Definition: ViewTabBar.cxx:102
void UpdateTabBarButtons()
Definition: ViewTabBar.cxx:444
virtual void SAL_CALL addTabBarButtonAfter(const css::drawing::framework::TabBarButton &rButton, const css::drawing::framework::TabBarButton &rAnchor) override
Definition: ViewTabBar.cxx:215
static vcl::Window * GetAnchorWindow(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewTabBarId, const rtl::Reference<::sd::DrawController > &rxController)
This method is called from the constructor to get the window for an anchor ResourceId and pass it to ...
Definition: ViewTabBar.cxx:138
virtual void SAL_CALL disposing(const css::lang::EventObject &rEvent) override
VclPtr< TabBarControl > mpTabControl
Definition: ViewTabBar.hxx:151
bool ActivatePage(size_t nIndex)
Definition: ViewTabBar.cxx:259
virtual sal_Bool SAL_CALL hasTabBarButton(const css::drawing::framework::TabBarButton &rButton) override
Definition: ViewTabBar.cxx:235
::std::vector< css::drawing::framework::TabBarButton > TabBarButtonList
Definition: ViewTabBar.hxx:154
const VclPtr< TabBarControl > & GetTabControl() const
Definition: ViewTabBar.hxx:81
TabBarButtonList maTabBarButtons
Definition: ViewTabBar.hxx:155
css::uno::Sequence< css::drawing::framework::TabBarButton > GetTabBarButtons()
Definition: ViewTabBar.cxx:419
ViewTabBar(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewTabBarId, const rtl::Reference< ::sd::DrawController > &rxController)
Definition: ViewTabBar.cxx:60
virtual void SAL_CALL removeTabBarButton(const css::drawing::framework::TabBarButton &rButton) override
Definition: ViewTabBar.cxx:229
virtual sal_Bool SAL_CALL isAnchorOnly() override
Definition: ViewTabBar.cxx:254
virtual css::uno::Reference< css::drawing::framework::XResourceId > SAL_CALL getResourceId() override
Definition: ViewTabBar.cxx:249
rtl::Reference<::sd::DrawController > mxController
Definition: ViewTabBar.hxx:152
css::uno::Reference< css::drawing::framework::XConfigurationController > mxConfigurationController
Definition: ViewTabBar.hxx:153
ViewShellBase * mpViewShellBase
Definition: ViewTabBar.hxx:157
virtual void SAL_CALL appendTabBarButton(const css::drawing::framework::TabBarButton &rButton) override
Definition: ViewTabBar.cxx:223
virtual void disposing(std::unique_lock< std::mutex > &) override
Definition: ViewTabBar.cxx:106
css::uno::Reference< css::drawing::framework::XResourceId > mxViewTabBarId
Definition: ViewTabBar.hxx:156
virtual css::uno::Sequence< css::drawing::framework::TabBarButton > SAL_CALL getTabBarButtons() override
Definition: ViewTabBar.cxx:241
void AddTabBarButton(const css::drawing::framework::TabBarButton &rButton, const css::drawing::framework::TabBarButton &rAnchor)
Definition: ViewTabBar.cxx:339
bool HasTabBarButton(const css::drawing::framework::TabBarButton &rButton)
Definition: ViewTabBar.cxx:401
int mnNoteBookWidthPadding
Definition: ViewTabBar.hxx:158
virtual void SAL_CALL notifyConfigurationChange(const css::drawing::framework::ConfigurationChangeEvent &rEvent) override
Definition: ViewTabBar.cxx:190
void UpdateActiveButton()
Definition: ViewTabBar.cxx:424
void RemoveTabBarButton(const css::drawing::framework::TabBarButton &rButton)
Definition: ViewTabBar.cxx:386
comphelper::WeakComponentImplHelper< css::drawing::framework::XToolBar, css::drawing::framework::XTabBar, css::drawing::framework::XConfigurationChangeListener > ViewTabBarInterfaceBase
Definition: ViewTabBar.hxx:66
unsigned char sal_Bool