LCOV - code coverage report
Current view: top level - sfx2/source/sidebar - TabBar.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 2 50.0 %
Date: 2014-11-03 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             : 
      38             : 
      39             : namespace sfx2 { namespace sidebar {
      40             : 
      41             : class FocusManager;
      42             : class TabBarConfiguration;
      43             : class TabItem;
      44             : 
      45             : /** The tab bar is the container for the individual tabs.
      46             : */
      47             : class TabBar
      48             :     : public vcl::Window
      49             : {
      50             : public:
      51             :     /** DeckMenuData has entries for display name, deck id, and a flag:
      52             :          - isCurrentDeck for the deck selection data
      53             :          - isEnabled     for the show/hide menu
      54             :     */
      55           0 :     class DeckMenuData
      56             :     {
      57             :     public:
      58             :         ::rtl::OUString msDisplayName;
      59             :         ::rtl::OUString msDeckId;
      60             :         bool mbIsCurrentDeck;
      61             :         bool mbIsActive;
      62             :         bool mbIsEnabled;
      63             :     };
      64             :     typedef ::boost::function<void(
      65             :             const Rectangle&,
      66             :             const ::std::vector<DeckMenuData>& rMenuData)> PopupMenuProvider;
      67             :     TabBar (
      68             :         vcl::Window* pParentWindow,
      69             :         const css::uno::Reference<css::frame::XFrame>& rxFrame,
      70             :         const ::boost::function<void(const ::rtl::OUString&rsDeckId)>& rDeckActivationFunctor,
      71             :         const PopupMenuProvider& rPopupMenuProvider);
      72             :     virtual ~TabBar (void);
      73             : 
      74             :     virtual void Paint (const Rectangle& rUpdateArea) SAL_OVERRIDE;
      75             :     virtual void DataChanged (const DataChangedEvent& rDataChangedEvent) SAL_OVERRIDE;
      76             :     virtual bool Notify (NotifyEvent& rEvent) SAL_OVERRIDE;
      77             : 
      78             :     static sal_Int32 GetDefaultWidth (void);
      79             : 
      80             :     void SetDecks (
      81             :         const ResourceManager::DeckContextDescriptorContainer& rDecks);
      82             :     void HighlightDeck (const ::rtl::OUString& rsDeckId);
      83             :     void RemoveDeckHighlight ();
      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             :     css::uno::Reference<css::frame::XFrame> mxFrame;
      98             :     ::boost::scoped_ptr<CheckBox> mpMenuButton;
      99        6432 :     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