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

Generated by: LCOV version 1.10