LCOV - code coverage report
Current view: top level - svx/source/form - formtoolbars.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 30 0.0 %
Date: 2012-08-25 Functions: 0 4 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 58 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                 :            : #include "formtoolbars.hxx"
      30                 :            : 
      31                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      32                 :            : 
      33                 :            : #include <svx/svxids.hrc>
      34                 :            : 
      35                 :            : //........................................................................
      36                 :            : namespace svxform
      37                 :            : {
      38                 :            : //........................................................................
      39                 :            : 
      40                 :            :     using namespace ::com::sun::star::uno;
      41                 :            :     using namespace ::com::sun::star::frame;
      42                 :            :     using namespace ::com::sun::star::beans;
      43                 :            :     using namespace ::com::sun::star::frame;
      44                 :            : 
      45                 :            :     //====================================================================
      46                 :            :     //= FormToolboxes
      47                 :            :     //====================================================================
      48                 :            :     //--------------------------------------------------------------------
      49                 :          0 :     FormToolboxes::FormToolboxes( const Reference< XFrame >& _rxFrame )
      50                 :            :     {
      51                 :            :         // the layout manager
      52         [ #  # ]:          0 :         Reference< XPropertySet > xFrameProps( _rxFrame, UNO_QUERY );
      53         [ #  # ]:          0 :         if ( xFrameProps.is() )
      54 [ #  # ][ #  # ]:          0 :             xFrameProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ) >>= m_xLayouter;
         [ #  # ][ #  # ]
      55                 :          0 :     }
      56                 :            : 
      57                 :            :     //--------------------------------------------------------------------
      58                 :          0 :     void FormToolboxes::toggleToolbox( sal_uInt16 _nSlotId ) const
      59                 :            :     {
      60                 :            :         try
      61                 :            :         {
      62                 :          0 :             Reference< XLayoutManager > xManager( m_xLayouter );
      63                 :            :             OSL_ENSURE( xManager. is(), "FormToolboxes::toggleToolbox: couldn't obtain the layout manager!" );
      64         [ #  # ]:          0 :             if ( xManager. is() )
      65                 :            :             {
      66         [ #  # ]:          0 :                 ::rtl::OUString sToolboxResource( getToolboxResourceName( _nSlotId ) );
      67 [ #  # ][ #  # ]:          0 :                 if ( xManager->isElementVisible( sToolboxResource ) )
                 [ #  # ]
      68                 :            :                 {
      69 [ #  # ][ #  # ]:          0 :                     xManager->hideElement( sToolboxResource );
      70 [ #  # ][ #  # ]:          0 :                     xManager->destroyElement( sToolboxResource );
      71                 :            :                 }
      72                 :            :                 else
      73                 :            :                 {
      74 [ #  # ][ #  # ]:          0 :                     xManager->createElement( sToolboxResource );
      75 [ #  # ][ #  # ]:          0 :                     xManager->showElement( sToolboxResource );
      76                 :          0 :                 }
      77         [ #  # ]:          0 :             }
      78                 :            :         }
      79                 :          0 :         catch( const Exception& )
      80                 :            :         {
      81                 :            :             OSL_FAIL( "FormToolboxes::toggleToolbox: caught an exception!" );
      82                 :            :         }
      83                 :          0 :     }
      84                 :            : 
      85                 :            :     //--------------------------------------------------------------------
      86                 :          0 :     bool FormToolboxes::isToolboxVisible( sal_uInt16 _nSlotId ) const
      87                 :            :     {
      88         [ #  # ]:          0 :         return m_xLayouter.is() && m_xLayouter->isElementVisible(
      89 [ #  # ][ #  # ]:          0 :             getToolboxResourceName( _nSlotId ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      90                 :            :     }
      91                 :            : 
      92                 :            :     //--------------------------------------------------------------------
      93                 :          0 :     ::rtl::OUString FormToolboxes::getToolboxResourceName( sal_uInt16 _nSlotId ) const
      94                 :            :     {
      95                 :            :         OSL_ENSURE( ( _nSlotId == SID_FM_MORE_CONTROLS ) || ( _nSlotId == SID_FM_FORM_DESIGN_TOOLS ) || ( _nSlotId == SID_FM_CONFIG ),
      96                 :            :             "FormToolboxes::getToolboxResourceName: unsupported slot!" );
      97                 :            : 
      98                 :          0 :         const sal_Char* pToolBarName = "formcontrols";
      99         [ #  # ]:          0 :         if ( _nSlotId == SID_FM_MORE_CONTROLS )
     100                 :          0 :             pToolBarName = "moreformcontrols";
     101         [ #  # ]:          0 :         else if ( _nSlotId == SID_FM_FORM_DESIGN_TOOLS )
     102                 :          0 :             pToolBarName = "formdesign";
     103                 :            : 
     104                 :          0 :         ::rtl::OUString aToolBarResStr( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/" ));
     105                 :          0 :         aToolBarResStr += ::rtl::OUString::createFromAscii( pToolBarName );
     106                 :          0 :         return aToolBarResStr;
     107                 :            :     }
     108                 :            : 
     109                 :            : //........................................................................
     110                 :            : } // namespace svxform
     111                 :            : //........................................................................
     112                 :            : 
     113                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10