LCOV - code coverage report
Current view: top level - chart2/source/controller/main - FeatureCommandDispatchBase.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 28 40 70.0 %
Date: 2014-11-03 Functions: 7 9 77.8 %
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          68 : FeatureCommandDispatchBase::FeatureCommandDispatchBase( const Reference< uno::XComponentContext >& rxContext )
      31             :     :CommandDispatch( rxContext )
      32          68 :     ,m_nFeatureId( 0 )
      33             : {
      34          68 : }
      35             : 
      36          68 : FeatureCommandDispatchBase::~FeatureCommandDispatchBase()
      37             : {
      38          68 : }
      39             : 
      40          68 : void FeatureCommandDispatchBase::initialize()
      41             : {
      42          68 :     CommandDispatch::initialize();
      43          68 :     fillSupportedFeatures();
      44          68 : }
      45             : 
      46         231 : bool FeatureCommandDispatchBase::isFeatureSupported( const OUString& rCommandURL )
      47             : {
      48         231 :     SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( rCommandURL );
      49         231 :     if ( aIter != m_aSupportedFeatures.end() )
      50             :     {
      51           0 :         return true;
      52             :     }
      53         231 :     return false;
      54             : }
      55             : 
      56         378 : void FeatureCommandDispatchBase::fireStatusEvent( const OUString& rURL,
      57             :     const Reference< frame::XStatusListener >& xSingleListener /* = 0 */ )
      58             : {
      59         378 :     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         378 :         FeatureState aFeatureState( getState( rURL ) );
      71         378 :         fireStatusEventForURL( rURL, aFeatureState.aState, aFeatureState.bEnabled, xSingleListener );
      72             :     }
      73         378 : }
      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         884 : void FeatureCommandDispatchBase::implDescribeSupportedFeature( const sal_Char* pAsciiCommandURL,
      88             :     sal_uInt16 nId, sal_Int16 nGroup )
      89             : {
      90         884 :     ControllerFeature aFeature;
      91         884 :     aFeature.Command = OUString::createFromAscii( pAsciiCommandURL );
      92         884 :     aFeature.nFeatureId = nId;
      93         884 :     aFeature.GroupId = nGroup;
      94             : 
      95         884 :     m_aSupportedFeatures[ aFeature.Command ] = aFeature;
      96         884 : }
      97             : 
      98          68 : void FeatureCommandDispatchBase::fillSupportedFeatures()
      99             : {
     100          68 :     describeSupportedFeatures();
     101          68 : }
     102             : 
     103             : } //  namespace chart
     104             : 
     105             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10