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

Generated by: LCOV version 1.10