xref: /aoo41x/main/sfx2/source/sidebar/TabBar.hxx (revision ff12d537)
122de8995SAndre Fischer /**************************************************************
222de8995SAndre Fischer  *
322de8995SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
422de8995SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
522de8995SAndre Fischer  * distributed with this work for additional information
622de8995SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
722de8995SAndre Fischer  * to you under the Apache License, Version 2.0 (the
822de8995SAndre Fischer  * "License"); you may not use this file except in compliance
922de8995SAndre Fischer  * with the License.  You may obtain a copy of the License at
1022de8995SAndre Fischer  *
1122de8995SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
1222de8995SAndre Fischer  *
1322de8995SAndre Fischer  * Unless required by applicable law or agreed to in writing,
1422de8995SAndre Fischer  * software distributed under the License is distributed on an
1522de8995SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1622de8995SAndre Fischer  * KIND, either express or implied.  See the License for the
1722de8995SAndre Fischer  * specific language governing permissions and limitations
1822de8995SAndre Fischer  * under the License.
1922de8995SAndre Fischer  *
2022de8995SAndre Fischer  *************************************************************/
2122de8995SAndre Fischer 
2222de8995SAndre Fischer #ifndef SFX_SIDEBAR_TAB_BAR_HXX
2322de8995SAndre Fischer #define SFX_SIDEBAR_TAB_BAR_HXX
2422de8995SAndre Fischer 
25*ff12d537SAndre Fischer #include "DeckDescriptor.hxx"
26*ff12d537SAndre Fischer #include "ResourceManager.hxx"
27*ff12d537SAndre Fischer 
2822de8995SAndre Fischer #include "vcl/window.hxx"
2922de8995SAndre Fischer 
30*ff12d537SAndre Fischer class Button;
31*ff12d537SAndre Fischer 
32*ff12d537SAndre Fischer namespace sfx2 { namespace sidebar {
3322de8995SAndre Fischer 
34*ff12d537SAndre Fischer class TabBarConfiguration;
35*ff12d537SAndre Fischer class TabItem;
3622de8995SAndre Fischer 
3722de8995SAndre Fischer /** The tab bar is the container for the individual tabs.
3822de8995SAndre Fischer */
3922de8995SAndre Fischer class TabBar
4022de8995SAndre Fischer     : public Window
4122de8995SAndre Fischer {
4222de8995SAndre Fischer public:
43*ff12d537SAndre Fischer     TabBar (
44*ff12d537SAndre Fischer         Window* pParentWindow,
45*ff12d537SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
46*ff12d537SAndre Fischer         const ::boost::function<void(const DeckDescriptor&)>& rDeckActivationFunctor,
47*ff12d537SAndre Fischer         const ::boost::function<void(const Rectangle&)>& rPopupMenuProvider);
4822de8995SAndre Fischer     virtual ~TabBar (void);
4922de8995SAndre Fischer 
5022de8995SAndre Fischer     virtual void Paint (const Rectangle& rUpdateArea);
51*ff12d537SAndre Fischer     virtual void DataChanged (const DataChangedEvent& rDataChangedEvent);
5222de8995SAndre Fischer 
5322de8995SAndre Fischer     static sal_Int32 GetDefaultWidth (void);
54*ff12d537SAndre Fischer 
55*ff12d537SAndre Fischer     void SetDecks (
56*ff12d537SAndre Fischer         const ResourceManager::DeckContainer& rDeckDescriptors);
57*ff12d537SAndre Fischer     void HighlightDeck (const ::rtl::OUString& rsDeckId);
58*ff12d537SAndre Fischer     void AddPopupMenuEntries (
59*ff12d537SAndre Fischer         PopupMenu& rMenu,
60*ff12d537SAndre Fischer         const sal_Int32 nFirstIndex);
61*ff12d537SAndre Fischer     void AddCustomizationMenuEntries (
62*ff12d537SAndre Fischer         PopupMenu& rMenu,
63*ff12d537SAndre Fischer         const sal_Int32 nFirstIndex);
64*ff12d537SAndre Fischer     const DeckDescriptor& GetDeckDescriptorForIndex (const sal_Int32 nIndex) const;
65*ff12d537SAndre Fischer     void ToggleHideFlag (const sal_Int32 nIndex);
66*ff12d537SAndre Fischer     void RestoreHideFlags (void);
67*ff12d537SAndre Fischer 
68*ff12d537SAndre Fischer private:
69*ff12d537SAndre Fischer     cssu::Reference<css::frame::XFrame> mxFrame;
70*ff12d537SAndre Fischer     Button* mpMenuButton;
71*ff12d537SAndre Fischer     class Item
72*ff12d537SAndre Fischer     {
73*ff12d537SAndre Fischer     public:
74*ff12d537SAndre Fischer         DECL_LINK(HandleClick, Button*);
75*ff12d537SAndre Fischer         RadioButton* mpButton;
76*ff12d537SAndre Fischer         DeckDescriptor maDeckDescriptor;
77*ff12d537SAndre Fischer         ::boost::function<void(const DeckDescriptor&)> maDeckActivationFunctor;
78*ff12d537SAndre Fischer         bool mbIsHidden;
79*ff12d537SAndre Fischer         bool mbIsHiddenByDefault;
80*ff12d537SAndre Fischer     };
81*ff12d537SAndre Fischer     typedef ::std::vector<Item> ItemContainer;
82*ff12d537SAndre Fischer     ItemContainer maItems;
83*ff12d537SAndre Fischer     const ::boost::function<void(const DeckDescriptor&)> maDeckActivationFunctor;
84*ff12d537SAndre Fischer     sal_Int32 mnMenuSeparatorY;
85*ff12d537SAndre Fischer     ::boost::function<void(const Rectangle&)> maPopupMenuProvider;
86*ff12d537SAndre Fischer 
87*ff12d537SAndre Fischer     RadioButton* CreateTabItem (const DeckDescriptor& rDeckDescriptor);
88*ff12d537SAndre Fischer     Image GetItemImage (const DeckDescriptor& rDeskDescriptor) const;
89*ff12d537SAndre Fischer     void Layout (void);
90*ff12d537SAndre Fischer     void UpdateButtonIcons (void);
91*ff12d537SAndre Fischer 
92*ff12d537SAndre Fischer     ::boost::shared_ptr<PopupMenu> CreatePopupMenu (void) const;
93*ff12d537SAndre Fischer     void ShowPopupMenu (void) const;
94*ff12d537SAndre Fischer     DECL_LINK(OnToolboxClicked, void*);
95*ff12d537SAndre Fischer 
9622de8995SAndre Fischer };
9722de8995SAndre Fischer 
9822de8995SAndre Fischer 
99*ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar
10022de8995SAndre Fischer 
10122de8995SAndre Fischer #endif
102