LCOV - code coverage report
Current view: top level - svx/source/tbxctrls - tbxcolor.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 27 0.0 %
Date: 2012-08-25 Functions: 0 3 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 62 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "svx/tbxcolor.hxx"
      31                 :            : #include <sfx2/viewfrm.hxx>
      32                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      33                 :            : 
      34                 :            : //........................................................................
      35                 :            : namespace svx
      36                 :            : {
      37                 :            : //........................................................................
      38                 :            : 
      39                 :            :     using namespace ::com::sun::star::uno;
      40                 :            :     using namespace ::com::sun::star::frame;
      41                 :            :     using namespace ::com::sun::star::beans;
      42                 :            :     using namespace ::com::sun::star::frame;
      43                 :            : 
      44                 :            :     #define DECLARE_ASCII(s)        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(s) )
      45                 :            :     #define TOOLBAR_RESNAME         DECLARE_ASCII("private:resource/toolbar/")
      46                 :            :     #define PROPNAME_LAYOUTMANAGER  DECLARE_ASCII("LayoutManager")
      47                 :            : 
      48                 :            :     //====================================================================
      49                 :            :     //= ToolboxAccess
      50                 :            :     //====================================================================
      51                 :          0 :     ToolboxAccess::ToolboxAccess( const ::rtl::OUString& rToolboxName ) :
      52                 :            : 
      53                 :            :         m_bDocking          ( false ),
      54                 :          0 :         m_sToolboxResName   ( TOOLBAR_RESNAME )
      55                 :            : 
      56                 :            :     {
      57                 :          0 :         m_sToolboxResName += rToolboxName;
      58                 :            : 
      59                 :            :         // the layout manager
      60 [ #  # ][ #  # ]:          0 :         if ( SfxViewFrame::Current() )
      61                 :            :         {
      62                 :            :             try
      63                 :            :             {
      64 [ #  # ][ #  # ]:          0 :                 Reference< XFrame > xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
                 [ #  # ]
      65         [ #  # ]:          0 :                 Reference< XPropertySet > xFrameProps( xFrame, UNO_QUERY );
      66         [ #  # ]:          0 :                 if ( xFrameProps.is() )
      67 [ #  # ][ #  # ]:          0 :                     xFrameProps->getPropertyValue( PROPNAME_LAYOUTMANAGER ) >>= m_xLayouter;
         [ #  # ][ #  # ]
                 [ #  # ]
      68                 :            :             }
      69         [ #  # ]:          0 :             catch ( Exception& )
      70                 :            :             {
      71                 :            :                 SAL_WARN( "svx.tbxcrtls", "ToolboxAccess::Ctor(): exception" );
      72                 :            :             }
      73                 :            :         }
      74                 :          0 :     }
      75                 :            : 
      76                 :            :     //--------------------------------------------------------------------
      77                 :          0 :     void ToolboxAccess::toggleToolbox() const
      78                 :            :     {
      79                 :            :         try
      80                 :            :         {
      81                 :          0 :             Reference< XLayoutManager > xManager( m_xLayouter );
      82                 :            :             OSL_ENSURE( xManager. is(), "ToolboxAccess::toggleToolbox: couldn't obtain the layout manager!" );
      83         [ #  # ]:          0 :             if ( xManager. is() )
      84                 :            :             {
      85 [ #  # ][ #  # ]:          0 :                 if ( xManager->isElementVisible( m_sToolboxResName ) )
                 [ #  # ]
      86                 :            :                 {
      87 [ #  # ][ #  # ]:          0 :                     xManager->hideElement( m_sToolboxResName );
      88 [ #  # ][ #  # ]:          0 :                     xManager->destroyElement( m_sToolboxResName );
      89                 :            :                 }
      90                 :            :                 else
      91                 :            :                 {
      92 [ #  # ][ #  # ]:          0 :                     xManager->createElement( m_sToolboxResName );
      93 [ #  # ][ #  # ]:          0 :                     xManager->showElement( m_sToolboxResName );
      94                 :          0 :                     ::com::sun::star::awt::Point aPos;
      95                 :            : 
      96         [ #  # ]:          0 :                     if ( m_bDocking )
      97         [ #  # ]:          0 :                         xManager->dockWindow( m_sToolboxResName,
      98         [ #  # ]:          0 :                             ::com::sun::star::ui::DockingArea_DOCKINGAREA_BOTTOM, aPos );
      99                 :            :                 }
     100         [ #  # ]:          0 :             }
     101                 :            :         }
     102                 :          0 :         catch( const Exception& )
     103                 :            :         {
     104                 :            :             OSL_FAIL( "ToolboxAccess::toggleToolbox: caught an exception!" );
     105                 :            :         }
     106                 :          0 :     }
     107                 :            : 
     108                 :            :     //--------------------------------------------------------------------
     109                 :          0 :     bool ToolboxAccess::isToolboxVisible() const
     110                 :            :     {
     111 [ #  # ][ #  # ]:          0 :         return ( m_xLayouter.is() && m_xLayouter->isElementVisible( m_sToolboxResName ) );
     112                 :            :     }
     113                 :            : 
     114                 :            : //........................................................................
     115                 :            : } // namespace svx
     116                 :            : //........................................................................
     117                 :            : 
     118                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10