LCOV - code coverage report
Current view: top level - sfx2/source/sidebar - TabBar.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 1 2 50.0 %
Date: 2014-04-11 Functions: 2 6 33.3 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_TABBAR_HXX
      20             : #define INCLUDED_SFX2_SOURCE_SIDEBAR_TABBAR_HXX
      21             : 
      22             : #include "DeckDescriptor.hxx"
      23             : #include "ResourceManager.hxx"
      24             : 
      25             : #include <vcl/menu.hxx>
      26             : #include <vcl/window.hxx>
      27             : 
      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>
      32             : 
      33             : class Button;
      34             : class CheckBox;
      35             : class RadioButton;
      36             : 
      37             : namespace cssu = ::com::sun::star::uno;
      38             : 
      39             : 
      40             : namespace sfx2 { namespace sidebar {
      41             : 
      42             : class FocusManager;
      43             : class TabBarConfiguration;
      44             : class TabItem;
      45             : 
      46             : /** The tab bar is the container for the individual tabs.
      47             : */
      48             : class TabBar
      49             :     : public Window
      50             : {
      51             : public:
      52             :     /** DeckMenuData has entries for display name, deck id, and a flag:
      53             :          - isCurrentDeck for the deck selection data
      54             :          - isEnabled     for the show/hide menu
      55             :     */
      56           0 :     class DeckMenuData
      57             :     {
      58             :     public:
      59             :         ::rtl::OUString msDisplayName;
      60             :         ::rtl::OUString msDeckId;
      61             :         bool mbIsCurrentDeck;
      62             :         bool mbIsActive;
      63             :         bool mbIsEnabled;
      64             :     };
      65             :     typedef ::boost::function<void(
      66             :             const Rectangle&,
      67             :             const ::std::vector<DeckMenuData>& rMenuData)> PopupMenuProvider;
      68             :     TabBar (
      69             :         Window* pParentWindow,
      70             :         const cssu::Reference<css::frame::XFrame>& rxFrame,
      71             :         const ::boost::function<void(const ::rtl::OUString&rsDeckId)>& rDeckActivationFunctor,
      72             :         const PopupMenuProvider& rPopupMenuProvider);
      73             :     virtual ~TabBar (void);
      74             : 
      75             :     virtual void Paint (const Rectangle& rUpdateArea) SAL_OVERRIDE;
      76             :     virtual void DataChanged (const DataChangedEvent& rDataChangedEvent) SAL_OVERRIDE;
      77             :     virtual bool Notify (NotifyEvent& rEvent) SAL_OVERRIDE;
      78             : 
      79             :     static sal_Int32 GetDefaultWidth (void);
      80             : 
      81             :     void SetDecks (
      82             :         const ResourceManager::DeckContextDescriptorContainer& rDecks);
      83             :     void HighlightDeck (const ::rtl::OUString& rsDeckId);
      84             :     void AddPopupMenuEntries (
      85             :         PopupMenu& rMenu,
      86             :         const sal_Int32 nFirstIndex);
      87             :     void AddCustomizationMenuEntries (
      88             :         PopupMenu& rMenu,
      89             :         const sal_Int32 nFirstIndex);
      90             :     const ::rtl::OUString GetDeckIdForIndex (const sal_Int32 nIndex) const;
      91             :     void ToggleHideFlag (const sal_Int32 nIndex);
      92             :     void RestoreHideFlags (void);
      93             : 
      94             :     void UpdateFocusManager (FocusManager& rFocusManager);
      95             : 
      96             : private:
      97             :     cssu::Reference<css::frame::XFrame> mxFrame;
      98             :     ::boost::scoped_ptr<CheckBox> mpMenuButton;
      99         154 :     class Item
     100             :     {
     101             :     public:
     102             :         DECL_LINK(HandleClick, Button*);
     103             :         ::boost::shared_ptr<RadioButton> mpButton;
     104             :         ::rtl::OUString msDeckId;
     105             :         ::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
     106             :         bool mbIsHidden;
     107             :         bool mbIsHiddenByDefault;
     108             :     };
     109             :     typedef ::std::vector<Item> ItemContainer;
     110             :     ItemContainer maItems;
     111             :     const ::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
     112             :     sal_Int32 mnMenuSeparatorY;
     113             :     PopupMenuProvider maPopupMenuProvider;
     114             : 
     115             :     RadioButton* CreateTabItem (const DeckDescriptor& rDeckDescriptor);
     116             :     Image GetItemImage (const DeckDescriptor& rDeskDescriptor) const;
     117             :     void Layout (void);
     118             :     void UpdateButtonIcons (void);
     119             : 
     120             :     ::boost::shared_ptr<PopupMenu> CreatePopupMenu (void) const;
     121             :     void ShowPopupMenu (void) const;
     122             :     DECL_LINK(OnToolboxClicked, void*);
     123             : 
     124             : };
     125             : 
     126             : 
     127             : } } // end of namespace sfx2::sidebar
     128             : 
     129             : #endif
     130             : 
     131             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10