LCOV - code coverage report
Current view: top level - chart2/source/controller/main - FeatureCommandDispatchBase.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 23 40 57.5 %
Date: 2015-06-13 12:38:46 Functions: 6 9 66.7 %
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 "FeatureCommandDispatchBase.hxx"
      21             : 
      22             : using namespace ::com::sun::star;
      23             : 
      24             : using ::com::sun::star::uno::Reference;
      25             : using ::com::sun::star::uno::Sequence;
      26             : 
      27             : namespace chart
      28             : {
      29             : 
      30          34 : FeatureCommandDispatchBase::FeatureCommandDispatchBase( const Reference< uno::XComponentContext >& rxContext )
      31             :     :CommandDispatch( rxContext )
      32          34 :     ,m_nFeatureId( 0 )
      33             : {
      34          34 : }
      35             : 
      36          34 : FeatureCommandDispatchBase::~FeatureCommandDispatchBase()
      37             : {
      38          34 : }
      39             : 
      40          34 : void FeatureCommandDispatchBase::initialize()
      41             : {
      42          34 :     CommandDispatch::initialize();
      43          34 :     fillSupportedFeatures();
      44          34 : }
      45             : 
      46         119 : bool FeatureCommandDispatchBase::isFeatureSupported( const OUString& rCommandURL )
      47             : {
      48         119 :     SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( rCommandURL );
      49         119 :     if ( aIter != m_aSupportedFeatures.end() )
      50             :     {
      51           0 :         return true;
      52             :     }
      53         119 :     return false;
      54             : }
      55             : 
      56           0 : void FeatureCommandDispatchBase::fireStatusEvent( const OUString& rURL,
      57             :     const Reference< frame::XStatusListener >& xSingleListener /* = 0 */ )
      58             : {
      59           0 :     if ( rURL.isEmpty() )
      60             :     {
      61           0 :         SupportedFeatures::const_iterator aEnd( m_aSupportedFeatures.end() );
      62           0 :         for ( SupportedFeatures::const_iterator aIter( m_aSupportedFeatures.begin() ); aIter != aEnd; ++aIter )
      63             :         {
      64           0 :             FeatureState aFeatureState( getState( aIter->first ) );
      65           0 :             fireStatusEventForURL( aIter->first, aFeatureState.aState, aFeatureState.bEnabled, xSingleListener );
      66           0 :         }
      67             :     }
      68             :     else
      69             :     {
      70           0 :         FeatureState aFeatureState( getState( rURL ) );
      71           0 :         fireStatusEventForURL( rURL, aFeatureState.aState, aFeatureState.bEnabled, xSingleListener );
      72             :     }
      73           0 : }
      74             : 
      75             : // XDispatch
      76           0 : void FeatureCommandDispatchBase::dispatch( const util::URL& URL,
      77             :     const Sequence< beans::PropertyValue >& Arguments )
      78             :     throw (uno::RuntimeException, std::exception)
      79             : {
      80           0 :     OUString aCommand( URL.Complete );
      81           0 :     if ( getState( aCommand ).bEnabled )
      82             :     {
      83           0 :         execute( aCommand, Arguments );
      84           0 :     }
      85           0 : }
      86             : 
      87         442 : void FeatureCommandDispatchBase::implDescribeSupportedFeature( const sal_Char* pAsciiCommandURL,
      88             :     sal_uInt16 nId, sal_Int16 nGroup )
      89             : {
      90         442 :     ControllerFeature aFeature;
      91         442 :     aFeature.Command = OUString::createFromAscii( pAsciiCommandURL );
      92         442 :     aFeature.nFeatureId = nId;
      93         442 :     aFeature.GroupId = nGroup;
      94             : 
      95         442 :     m_aSupportedFeatures[ aFeature.Command ] = aFeature;
      96         442 : }
      97             : 
      98          34 : void FeatureCommandDispatchBase::fillSupportedFeatures()
      99             : {
     100          34 :     describeSupportedFeatures();
     101          34 : }
     102             : 
     103             : } //  namespace chart
     104             : 
     105             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11