LCOV - code coverage report
Current view: top level - svx/source/tbxctrls - tbxcolor.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 27 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 3 0.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             : 
      21             : #include "svx/tbxcolor.hxx"
      22             : #include <sfx2/viewfrm.hxx>
      23             : #include <com/sun/star/beans/XPropertySet.hpp>
      24             : 
      25             : 
      26             : namespace svx
      27             : {
      28             : 
      29             : 
      30             :     using namespace ::com::sun::star::uno;
      31             :     using namespace ::com::sun::star::frame;
      32             :     using namespace ::com::sun::star::beans;
      33             : 
      34             :     #define TOOLBAR_RESNAME         "private:resource/toolbar/"
      35             :     #define PROPNAME_LAYOUTMANAGER  "LayoutManager"
      36             : 
      37           0 :     ToolboxAccess::ToolboxAccess( const ::rtl::OUString& rToolboxName ) :
      38             : 
      39             :         m_bDocking          ( false ),
      40           0 :         m_sToolboxResName   ( TOOLBAR_RESNAME )
      41             : 
      42             :     {
      43           0 :         m_sToolboxResName += rToolboxName;
      44             : 
      45             :         // the layout manager
      46           0 :         if ( SfxViewFrame::Current() )
      47             :         {
      48             :             try
      49             :             {
      50           0 :                 Reference< XFrame > xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
      51           0 :                 Reference< XPropertySet > xFrameProps( xFrame, UNO_QUERY );
      52           0 :                 if ( xFrameProps.is() )
      53           0 :                     xFrameProps->getPropertyValue( PROPNAME_LAYOUTMANAGER ) >>= m_xLayouter;
      54             :             }
      55           0 :             catch ( Exception& )
      56             :             {
      57             :                 SAL_WARN( "svx.tbxcrtls", "ToolboxAccess::Ctor(): exception" );
      58             :             }
      59             :         }
      60           0 :     }
      61             : 
      62             : 
      63           0 :     void ToolboxAccess::toggleToolbox() const
      64             :     {
      65             :         try
      66             :         {
      67           0 :             Reference< XLayoutManager > xManager( m_xLayouter );
      68             :             OSL_ENSURE( xManager. is(), "ToolboxAccess::toggleToolbox: couldn't obtain the layout manager!" );
      69           0 :             if ( xManager. is() )
      70             :             {
      71           0 :                 if ( xManager->isElementVisible( m_sToolboxResName ) )
      72             :                 {
      73           0 :                     xManager->hideElement( m_sToolboxResName );
      74           0 :                     xManager->destroyElement( m_sToolboxResName );
      75             :                 }
      76             :                 else
      77             :                 {
      78           0 :                     xManager->createElement( m_sToolboxResName );
      79           0 :                     xManager->showElement( m_sToolboxResName );
      80           0 :                     ::com::sun::star::awt::Point aPos;
      81             : 
      82           0 :                     if ( m_bDocking )
      83           0 :                         xManager->dockWindow( m_sToolboxResName,
      84           0 :                             ::com::sun::star::ui::DockingArea_DOCKINGAREA_BOTTOM, aPos );
      85             :                 }
      86           0 :             }
      87             :         }
      88           0 :         catch( const Exception& )
      89             :         {
      90             :             OSL_FAIL( "ToolboxAccess::toggleToolbox: caught an exception!" );
      91             :         }
      92           0 :     }
      93             : 
      94             : 
      95           0 :     bool ToolboxAccess::isToolboxVisible() const
      96             :     {
      97           0 :         return ( m_xLayouter.is() && m_xLayouter->isElementVisible( m_sToolboxResName ) );
      98             :     }
      99             : 
     100             : 
     101             : }
     102             : 
     103             : 
     104             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11