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 .
19 #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_TABBAR_HXX
20 #define INCLUDED_SFX2_SOURCE_SIDEBAR_TABBAR_HXX
22 #include "DeckDescriptor.hxx"
23 #include "ResourceManager.hxx"
25 #include <vcl/menu.hxx>
26 #include <vcl/window.hxx>
28 #include <com/sun/star/frame/XFrame.hpp>
29 #include <boost/function.hpp>
30 #include <boost/tuple/tuple.hpp>
31 #include <boost/scoped_ptr.hpp>
37 namespace sfx2
{ namespace sidebar
{
40 class TabBarConfiguration
;
43 /** The tab bar is the container for the individual tabs.
49 /** DeckMenuData has entries for display name, deck id, and a flag:
50 - isCurrentDeck for the deck selection data
51 - isEnabled for the show/hide menu
56 ::rtl::OUString msDisplayName
;
57 ::rtl::OUString msDeckId
;
62 typedef ::boost::function
<void(
64 const ::std::vector
<DeckMenuData
>& rMenuData
)> PopupMenuProvider
;
66 vcl::Window
* pParentWindow
,
67 const css::uno::Reference
<css::frame::XFrame
>& rxFrame
,
68 const ::boost::function
<void(const ::rtl::OUString
&rsDeckId
)>& rDeckActivationFunctor
,
69 const PopupMenuProvider
& rPopupMenuProvider
);
71 virtual void dispose() SAL_OVERRIDE
;
73 virtual void Paint (vcl::RenderContext
& /*rRenderContext*/, const Rectangle
& rUpdateArea
) SAL_OVERRIDE
;
74 virtual void DataChanged (const DataChangedEvent
& rDataChangedEvent
) SAL_OVERRIDE
;
75 virtual bool Notify (NotifyEvent
& rEvent
) SAL_OVERRIDE
;
77 static sal_Int32
GetDefaultWidth();
80 const ResourceManager::DeckContextDescriptorContainer
& rDecks
);
81 void HighlightDeck (const ::rtl::OUString
& rsDeckId
);
82 void RemoveDeckHighlight ();
83 void AddPopupMenuEntries (
85 const sal_Int32 nFirstIndex
);
86 void AddCustomizationMenuEntries (
88 const sal_Int32 nFirstIndex
);
89 const ::rtl::OUString
GetDeckIdForIndex (const sal_Int32 nIndex
) const;
90 void ToggleHideFlag (const sal_Int32 nIndex
);
91 void RestoreHideFlags();
93 void UpdateFocusManager (FocusManager
& rFocusManager
);
96 css::uno::Reference
<css::frame::XFrame
> mxFrame
;
97 VclPtr
<CheckBox
> mpMenuButton
;
101 DECL_LINK(HandleClick
, Button
*);
102 VclPtr
<RadioButton
> mpButton
;
103 ::rtl::OUString msDeckId
;
104 ::boost::function
<void(const ::rtl::OUString
&rsDeckId
)> maDeckActivationFunctor
;
106 bool mbIsHiddenByDefault
;
108 typedef ::std::vector
<Item
> ItemContainer
;
109 ItemContainer maItems
;
110 const ::boost::function
<void(const ::rtl::OUString
&rsDeckId
)> maDeckActivationFunctor
;
111 sal_Int32 mnMenuSeparatorY
;
112 PopupMenuProvider maPopupMenuProvider
;
114 VclPtr
<RadioButton
> CreateTabItem (const DeckDescriptor
& rDeckDescriptor
);
115 Image
GetItemImage (const DeckDescriptor
& rDeskDescriptor
) const;
117 void UpdateButtonIcons();
119 ::boost::shared_ptr
<PopupMenu
> CreatePopupMenu() const;
120 void ShowPopupMenu() const;
121 DECL_LINK(OnToolboxClicked
, void*);
126 } } // end of namespace sfx2::sidebar
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */