LCOV - code coverage report
Current view: top level - sd/source/ui/inc - ViewTabBar.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 1 100.0 %
Date: 2014-11-03 Functions: 1 1 100.0 %
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             : 
      20             : #ifndef INCLUDED_SD_SOURCE_UI_INC_VIEWTABBAR_HXX
      21             : #define INCLUDED_SD_SOURCE_UI_INC_VIEWTABBAR_HXX
      22             : 
      23             : #include <com/sun/star/frame/XController.hpp>
      24             : #include <com/sun/star/drawing/framework/XPane.hpp>
      25             : #include <com/sun/star/drawing/framework/TabBarButton.hpp>
      26             : #include <com/sun/star/drawing/framework/XTabBar.hpp>
      27             : #include <com/sun/star/drawing/framework/XToolBar.hpp>
      28             : #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
      29             : #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
      30             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      31             : #include <vcl/tabctrl.hxx>
      32             : #include <cppuhelper/compbase4.hxx>
      33             : #include "MutexOwner.hxx"
      34             : 
      35             : #include <vector>
      36             : #include <boost/scoped_ptr.hpp>
      37             : #include <boost/shared_ptr.hpp>
      38             : 
      39             : namespace sd {
      40             :     class ViewShellBase;
      41             : }
      42             : 
      43             : namespace {
      44             :     typedef ::cppu::WeakComponentImplHelper4 <
      45             :         ::com::sun::star::drawing::framework::XToolBar,
      46             :         ::com::sun::star::drawing::framework::XTabBar,
      47             :         ::com::sun::star::drawing::framework::XConfigurationChangeListener,
      48             :         ::com::sun::star::lang::XUnoTunnel
      49             :         > ViewTabBarInterfaceBase;
      50             : }
      51             : 
      52             : namespace sd {
      53             : 
      54             : /** Tab control for switching between views in the center pane.
      55             : */
      56             : class ViewTabBar
      57             :     : private sd::MutexOwner,
      58             :       public ViewTabBarInterfaceBase
      59             : {
      60             : public:
      61             :     ViewTabBar (
      62             :         const ::com::sun::star::uno::Reference<
      63             :             com::sun::star::drawing::framework::XResourceId>& rxViewTabBarId,
      64             :         const ::com::sun::star::uno::Reference<
      65             :         ::com::sun::star::frame::XController>& rxController);
      66             :     virtual ~ViewTabBar (void);
      67             : 
      68             :     virtual void SAL_CALL disposing (void) SAL_OVERRIDE;
      69             : 
      70        1092 :     ::boost::shared_ptr< ::TabControl> GetTabControl (void) const { return mpTabControl;}
      71             : 
      72             :     bool ActivatePage (void);
      73             : 
      74             :     //----- drawing::framework::XConfigurationChangeListener ------------------
      75             : 
      76             :     virtual void SAL_CALL
      77             :         notifyConfigurationChange (
      78             :             const ::com::sun::star::drawing::framework::ConfigurationChangeEvent& rEvent)
      79             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      80             : 
      81             :     //----- XEventListener ----------------------------------------------------
      82             : 
      83             :     virtual void SAL_CALL disposing(
      84             :         const com::sun::star::lang::EventObject& rEvent)
      85             :         throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      86             : 
      87             :     //----- XTabBar -----------------------------------------------------------
      88             : 
      89             :     virtual void
      90             :         SAL_CALL addTabBarButtonAfter (
      91             :             const ::com::sun::star::drawing::framework::TabBarButton& rButton,
      92             :             const ::com::sun::star::drawing::framework::TabBarButton& rAnchor)
      93             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      94             : 
      95             :     virtual void
      96             :         SAL_CALL appendTabBarButton (
      97             :             const ::com::sun::star::drawing::framework::TabBarButton& rButton)
      98             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      99             : 
     100             :     virtual void
     101             :         SAL_CALL removeTabBarButton (
     102             :             const ::com::sun::star::drawing::framework::TabBarButton& rButton)
     103             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     104             : 
     105             :     virtual sal_Bool
     106             :         SAL_CALL hasTabBarButton (
     107             :             const ::com::sun::star::drawing::framework::TabBarButton& rButton)
     108             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     109             : 
     110             :     virtual ::com::sun::star::uno::Sequence<com::sun::star::drawing::framework::TabBarButton>
     111             :         SAL_CALL getTabBarButtons (void)
     112             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     113             : 
     114             :     //----- XResource ---------------------------------------------------------
     115             : 
     116             :     virtual ::com::sun::star::uno::Reference<
     117             :         ::com::sun::star::drawing::framework::XResourceId> SAL_CALL getResourceId (void)
     118             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             : 
     120             :     virtual sal_Bool SAL_CALL isAnchorOnly (void)
     121             :         throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     122             : 
     123             :     //----- XUnoTunnel --------------------------------------------------------
     124             : 
     125             :     virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
     126             :         throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     127             : 
     128             :     /** The returned value is calculated as the difference between the
     129             :         total height of the control and the heigh of its first tab page.
     130             :         This can be considered a hack.
     131             :         This procedure works only when the control is visible.  Calling this
     132             :         method when the control is not visible results in returning a
     133             :         default value.
     134             :         To be on the safe side wait for this control to become visible and
     135             :         the call this method again.
     136             :     */
     137             :     int GetHeight (void);
     138             : 
     139             :     void AddTabBarButton (
     140             :         const ::com::sun::star::drawing::framework::TabBarButton& rButton,
     141             :         const ::com::sun::star::drawing::framework::TabBarButton& rAnchor);
     142             :     void AddTabBarButton (
     143             :         const ::com::sun::star::drawing::framework::TabBarButton& rButton);
     144             :     void RemoveTabBarButton (
     145             :         const ::com::sun::star::drawing::framework::TabBarButton& rButton);
     146             :     bool HasTabBarButton (
     147             :         const ::com::sun::star::drawing::framework::TabBarButton& rButton);
     148             :     ::com::sun::star::uno::Sequence<com::sun::star::drawing::framework::TabBarButton>
     149             :         GetTabBarButtons (void);
     150             : 
     151             : private:
     152             :     ::boost::shared_ptr< ::TabControl> mpTabControl;
     153             :     ::com::sun::star::uno::Reference<
     154             :         ::com::sun::star::frame::XController> mxController;
     155             :     ::com::sun::star::uno::Reference<
     156             :         ::com::sun::star::drawing::framework::XConfigurationController> mxConfigurationController;
     157             :     typedef ::std::vector<com::sun::star::drawing::framework::TabBarButton> TabBarButtonList;
     158             :     TabBarButtonList maTabBarButtons;
     159             :     ::boost::scoped_ptr<TabPage> mpTabPage;
     160             :     ::com::sun::star::uno::Reference<
     161             :         ::com::sun::star::drawing::framework::XResourceId> mxViewTabBarId;
     162             :     ViewShellBase* mpViewShellBase;
     163             : 
     164             :     void UpdateActiveButton (void);
     165             :     void AddTabBarButton (
     166             :         const ::com::sun::star::drawing::framework::TabBarButton& rButton,
     167             :         sal_Int32 nPosition);
     168             :     void UpdateTabBarButtons (void);
     169             : 
     170             :     /** This method is called from the constructor to get the window for an
     171             :         anchor ResourceId and pass it to our base class.  It has to be
     172             :         static because it must not access any of the, not yet initialized
     173             :         members.
     174             :     */
     175             :     static vcl::Window* GetAnchorWindow(
     176             :         const ::com::sun::star::uno::Reference<
     177             :             ::com::sun::star::drawing::framework::XResourceId>& rxViewTabBarId,
     178             :         const ::com::sun::star::uno::Reference<
     179             :             ::com::sun::star::frame::XController>& rxController);
     180             :     const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void);
     181             : };
     182             : 
     183             : } // end of namespace sd
     184             : 
     185             : #endif
     186             : 
     187             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10