LCOV - code coverage report
Current view: top level - chart2/source/controller/main - FeatureCommandDispatchBase.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 40 0.0 %
Date: 2014-04-14 Functions: 0 9 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 "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           0 : FeatureCommandDispatchBase::FeatureCommandDispatchBase( const Reference< uno::XComponentContext >& rxContext )
      31             :     :CommandDispatch( rxContext )
      32           0 :     ,m_nFeatureId( 0 )
      33             : {
      34           0 : }
      35             : 
      36           0 : FeatureCommandDispatchBase::~FeatureCommandDispatchBase()
      37             : {
      38           0 : }
      39             : 
      40           0 : void FeatureCommandDispatchBase::initialize()
      41             : {
      42           0 :     CommandDispatch::initialize();
      43           0 :     fillSupportedFeatures();
      44           0 : }
      45             : 
      46           0 : bool FeatureCommandDispatchBase::isFeatureSupported( const OUString& rCommandURL )
      47             : {
      48           0 :     SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( rCommandURL );
      49           0 :     if ( aIter != m_aSupportedFeatures.end() )
      50             :     {
      51           0 :         return true;
      52             :     }
      53           0 :     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           0 : void FeatureCommandDispatchBase::implDescribeSupportedFeature( const sal_Char* pAsciiCommandURL,
      88             :     sal_uInt16 nId, sal_Int16 nGroup )
      89             : {
      90           0 :     ControllerFeature aFeature;
      91           0 :     aFeature.Command = OUString::createFromAscii( pAsciiCommandURL );
      92           0 :     aFeature.nFeatureId = nId;
      93           0 :     aFeature.GroupId = nGroup;
      94             : 
      95           0 :     m_aSupportedFeatures[ aFeature.Command ] = aFeature;
      96           0 : }
      97             : 
      98           0 : void FeatureCommandDispatchBase::fillSupportedFeatures()
      99             : {
     100           0 :     describeSupportedFeatures();
     101           0 : }
     102             : 
     103             : } //  namespace chart
     104             : 
     105             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10