LCOV - code coverage report
Current view: top level - forms/source/richtext - attributedispatcher.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 37 0.0 %
Date: 2012-08-25 Functions: 0 8 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 54 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 "attributedispatcher.hxx"
      30                 :            : 
      31                 :            : #include <editeng/editview.hxx>
      32                 :            : 
      33                 :            : //........................................................................
      34                 :            : namespace frm
      35                 :            : {
      36                 :            : //........................................................................
      37                 :            : 
      38                 :            :     using namespace ::com::sun::star::uno;
      39                 :            :     using namespace ::com::sun::star::frame;
      40                 :            :     using namespace ::com::sun::star::lang;
      41                 :            :     using namespace ::com::sun::star::util;
      42                 :            :     using namespace ::com::sun::star::beans;
      43                 :            : 
      44                 :            :     //====================================================================
      45                 :            :     //= OAttributeDispatcher
      46                 :            :     //====================================================================
      47                 :            :     //--------------------------------------------------------------------
      48                 :          0 :     OAttributeDispatcher::OAttributeDispatcher( EditView& _rView, AttributeId _nAttributeId, const URL& _rURL,
      49                 :            :             IMultiAttributeDispatcher* _pMasterDispatcher )
      50                 :            :         :ORichTextFeatureDispatcher( _rView, _rURL )
      51                 :            :         ,m_pMasterDispatcher( _pMasterDispatcher )
      52                 :          0 :         ,m_nAttributeId( _nAttributeId )
      53                 :            :     {
      54                 :            :         OSL_ENSURE( m_pMasterDispatcher, "OAttributeDispatcher::OAttributeDispatcher: invalid master dispatcher!" );
      55                 :          0 :     }
      56                 :            : 
      57                 :            :     //--------------------------------------------------------------------
      58                 :          0 :     OAttributeDispatcher::~OAttributeDispatcher( )
      59                 :            :     {
      60                 :          0 :         acquire();
      61         [ #  # ]:          0 :         dispose();
      62         [ #  # ]:          0 :     }
      63                 :            : 
      64                 :            :     //--------------------------------------------------------------------
      65                 :          0 :     void OAttributeDispatcher::disposing( ::osl::ClearableMutexGuard& _rClearBeforeNotify )
      66                 :            :     {
      67                 :          0 :         m_pMasterDispatcher = NULL;
      68                 :          0 :         ORichTextFeatureDispatcher::disposing( _rClearBeforeNotify );
      69                 :          0 :     }
      70                 :            : 
      71                 :            :     //--------------------------------------------------------------------
      72                 :          0 :     void OAttributeDispatcher::fillFeatureEventFromAttributeState( FeatureStateEvent& _rEvent, const AttributeState& _rState ) const
      73                 :            :     {
      74         [ #  # ]:          0 :         if ( _rState.eSimpleState == eChecked )
      75         [ #  # ]:          0 :             _rEvent.State <<= (sal_Bool)sal_True;
      76         [ #  # ]:          0 :         else if ( _rState.eSimpleState == eUnchecked )
      77         [ #  # ]:          0 :             _rEvent.State <<= (sal_Bool)sal_False;
      78                 :          0 :     }
      79                 :            : 
      80                 :            :     //--------------------------------------------------------------------
      81                 :          0 :     FeatureStateEvent OAttributeDispatcher::buildStatusEvent() const
      82                 :            :     {
      83         [ #  # ]:          0 :         FeatureStateEvent aEvent( ORichTextFeatureDispatcher::buildStatusEvent() );
      84 [ #  # ][ #  # ]:          0 :         aEvent.IsEnabled = getEditView() ? !getEditView()->IsReadOnly() : sal_False;
                 [ #  # ]
      85                 :            : 
      86                 :          0 :         AttributeState aState;
      87         [ #  # ]:          0 :         if ( m_pMasterDispatcher )
      88 [ #  # ][ #  # ]:          0 :             aState = m_pMasterDispatcher->getState( m_nAttributeId );
      89                 :            : 
      90         [ #  # ]:          0 :         fillFeatureEventFromAttributeState( aEvent, aState );
      91                 :            : 
      92                 :          0 :         return aEvent;
      93                 :            :     }
      94                 :            : 
      95                 :            :     //--------------------------------------------------------------------
      96                 :          0 :     void SAL_CALL OAttributeDispatcher::dispatch( const URL& _rURL, const Sequence< PropertyValue >& _rArguments ) throw (RuntimeException)
      97                 :            :     {
      98         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( m_aMutex );
      99                 :            : 
     100         [ #  # ]:          0 :         checkDisposed();
     101                 :            : 
     102                 :            :         (void)_rURL;
     103                 :            :         (void)_rArguments;
     104                 :            : 
     105                 :            :         OSL_ENSURE( _rURL.Complete == getFeatureURL().Complete, "OAttributeDispatcher::dispatch: invalid URL!" );
     106                 :            : #if OSL_DEBUG_LEVEL > 0
     107                 :            :         if ( _rArguments.getLength() )
     108                 :            :         {
     109                 :            :             ::rtl::OString sMessage( "OAttributeDispatcher::dispatch: found arguments, but can't handle arguments at all" );
     110                 :            :             sMessage += "\n (URL: ";
     111                 :            :             sMessage += ::rtl::OString( _rURL.Complete.getStr(), _rURL.Complete.getLength(), RTL_TEXTENCODING_ASCII_US );
     112                 :            :             sMessage += ")";
     113                 :            :             OSL_FAIL( sMessage.getStr() );
     114                 :            :         }
     115                 :            : #endif
     116                 :            : 
     117         [ #  # ]:          0 :         if ( m_pMasterDispatcher )
     118 [ #  # ][ #  # ]:          0 :             m_pMasterDispatcher->executeAttribute( m_nAttributeId, NULL );
     119                 :          0 :     }
     120                 :            : 
     121                 :            :     //--------------------------------------------------------------------
     122                 :          0 :     void OAttributeDispatcher::onAttributeStateChanged( AttributeId _nAttributeId, const AttributeState& /*_rState*/ )
     123                 :            :     {
     124                 :            :         OSL_ENSURE( _nAttributeId == m_nAttributeId, "OAttributeDispatcher::onAttributeStateChanged: wrong attribute!" );
     125                 :            :         (void)_nAttributeId;
     126                 :            : 
     127         [ #  # ]:          0 :         FeatureStateEvent aEvent( buildStatusEvent() );
     128         [ #  # ]:          0 :         ::cppu::OInterfaceIteratorHelper aIter( getStatusListeners() );
     129         [ #  # ]:          0 :         while ( aIter.hasMoreElements() )
     130 [ #  # ][ #  # ]:          0 :             doNotify( static_cast< XStatusListener* >( aIter.next() ), aEvent );
         [ #  # ][ #  # ]
                 [ #  # ]
     131                 :          0 :     }
     132                 :            : 
     133                 :            : //........................................................................
     134                 :            : }   // namespace frm
     135                 :            : //........................................................................
     136                 :            : 
     137                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10