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 25ff12d537SAndre Fischer #include "DeckDescriptor.hxx" 26ff12d537SAndre Fischer #include "ResourceManager.hxx" 27ff12d537SAndre Fischer 2895a18594SAndre Fischer #include <vcl/menu.hxx> 2995a18594SAndre Fischer #include <vcl/window.hxx> 3095a18594SAndre Fischer 317a32b0c8SAndre Fischer #include <com/sun/star/frame/XFrame.hpp> 3295a18594SAndre Fischer #include <boost/function.hpp> 3395a18594SAndre Fischer #include <boost/tuple/tuple.hpp> 347a32b0c8SAndre Fischer #include <boost/scoped_ptr.hpp> 3522de8995SAndre Fischer 36ff12d537SAndre Fischer class Button; 3795a18594SAndre Fischer class RadioButton; 38ff12d537SAndre Fischer 397a32b0c8SAndre Fischer namespace css = ::com::sun::star; 407a32b0c8SAndre Fischer namespace cssu = ::com::sun::star::uno; 417a32b0c8SAndre Fischer 427a32b0c8SAndre Fischer 43ff12d537SAndre Fischer namespace sfx2 { namespace sidebar { 4422de8995SAndre Fischer 45*65908a7eSAndre Fischer class FocusManager; 46ff12d537SAndre Fischer class TabBarConfiguration; 47ff12d537SAndre Fischer class TabItem; 4822de8995SAndre Fischer 4922de8995SAndre Fischer /** The tab bar is the container for the individual tabs. 5022de8995SAndre Fischer */ 5122de8995SAndre Fischer class TabBar 5222de8995SAndre Fischer : public Window 5322de8995SAndre Fischer { 5422de8995SAndre Fischer public: 5595a18594SAndre Fischer /** DeckMenuData has entries for display name, deck id, and a flag: 5695a18594SAndre Fischer - isCurrentDeck for the deck selection data 5795a18594SAndre Fischer - isEnabled for the show/hide menu 5895a18594SAndre Fischer */ 5995a18594SAndre Fischer typedef ::boost::tuple<rtl::OUString,rtl::OUString,bool> DeckMenuData; 6095a18594SAndre Fischer typedef ::boost::function<void( 6195a18594SAndre Fischer const Rectangle&, 6295a18594SAndre Fischer const ::std::vector<DeckMenuData>& rDeckSelectionData, 6395a18594SAndre Fischer const ::std::vector<DeckMenuData>& rDeckShowData)> PopupMenuProvider; 64ff12d537SAndre Fischer TabBar ( 65ff12d537SAndre Fischer Window* pParentWindow, 66ff12d537SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame, 6795a18594SAndre Fischer const ::boost::function<void(const ::rtl::OUString&rsDeckId)>& rDeckActivationFunctor, 6895a18594SAndre Fischer const PopupMenuProvider& rPopupMenuProvider); 6922de8995SAndre Fischer virtual ~TabBar (void); 7022de8995SAndre Fischer 7122de8995SAndre Fischer virtual void Paint (const Rectangle& rUpdateArea); 72ff12d537SAndre Fischer virtual void DataChanged (const DataChangedEvent& rDataChangedEvent); 7322de8995SAndre Fischer 7422de8995SAndre Fischer static sal_Int32 GetDefaultWidth (void); 75ff12d537SAndre Fischer 76ff12d537SAndre Fischer void SetDecks ( 7795a18594SAndre Fischer const ResourceManager::IdContainer& rDeckIds); 78ff12d537SAndre Fischer void HighlightDeck (const ::rtl::OUString& rsDeckId); 79ff12d537SAndre Fischer void AddPopupMenuEntries ( 80ff12d537SAndre Fischer PopupMenu& rMenu, 81ff12d537SAndre Fischer const sal_Int32 nFirstIndex); 82ff12d537SAndre Fischer void AddCustomizationMenuEntries ( 83ff12d537SAndre Fischer PopupMenu& rMenu, 84ff12d537SAndre Fischer const sal_Int32 nFirstIndex); 8595a18594SAndre Fischer const ::rtl::OUString GetDeckIdForIndex (const sal_Int32 nIndex) const; 86ff12d537SAndre Fischer void ToggleHideFlag (const sal_Int32 nIndex); 87ff12d537SAndre Fischer void RestoreHideFlags (void); 88*65908a7eSAndre Fischer 89*65908a7eSAndre Fischer void UpdateFocusManager (FocusManager& rFocusManager); 90*65908a7eSAndre Fischer 91ff12d537SAndre Fischer private: 92ff12d537SAndre Fischer cssu::Reference<css::frame::XFrame> mxFrame; 937a32b0c8SAndre Fischer ::boost::scoped_ptr<Button> mpMenuButton; 94ff12d537SAndre Fischer class Item 95ff12d537SAndre Fischer { 96ff12d537SAndre Fischer public: 97ff12d537SAndre Fischer DECL_LINK(HandleClick, Button*); 987a32b0c8SAndre Fischer ::boost::shared_ptr<RadioButton> mpButton; 9995a18594SAndre Fischer ::rtl::OUString msDeckId; 10095a18594SAndre Fischer ::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor; 101ff12d537SAndre Fischer bool mbIsHidden; 102ff12d537SAndre Fischer bool mbIsHiddenByDefault; 103ff12d537SAndre Fischer }; 104ff12d537SAndre Fischer typedef ::std::vector<Item> ItemContainer; 105ff12d537SAndre Fischer ItemContainer maItems; 10695a18594SAndre Fischer const ::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor; 107ff12d537SAndre Fischer sal_Int32 mnMenuSeparatorY; 10895a18594SAndre Fischer PopupMenuProvider maPopupMenuProvider; 109ff12d537SAndre Fischer 110ff12d537SAndre Fischer RadioButton* CreateTabItem (const DeckDescriptor& rDeckDescriptor); 111ff12d537SAndre Fischer Image GetItemImage (const DeckDescriptor& rDeskDescriptor) const; 112ff12d537SAndre Fischer void Layout (void); 113ff12d537SAndre Fischer void UpdateButtonIcons (void); 114ff12d537SAndre Fischer 115ff12d537SAndre Fischer ::boost::shared_ptr<PopupMenu> CreatePopupMenu (void) const; 116ff12d537SAndre Fischer void ShowPopupMenu (void) const; 117ff12d537SAndre Fischer DECL_LINK(OnToolboxClicked, void*); 118ff12d537SAndre Fischer 11922de8995SAndre Fischer }; 12022de8995SAndre Fischer 12122de8995SAndre Fischer 122ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar 12322de8995SAndre Fischer 12422de8995SAndre Fischer #endif 125