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

Generated by: LCOV version 1.11