fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / main / FeatureCommandDispatchBase.cxx
blobe9721f1d738ea6e7a603cf8bde3e3ce420a01121
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "FeatureCommandDispatchBase.hxx"
22 using namespace ::com::sun::star;
24 using ::com::sun::star::uno::Reference;
25 using ::com::sun::star::uno::Sequence;
27 namespace chart
30 FeatureCommandDispatchBase::FeatureCommandDispatchBase( const Reference< uno::XComponentContext >& rxContext )
31 :CommandDispatch( rxContext )
32 ,m_nFeatureId( 0 )
36 FeatureCommandDispatchBase::~FeatureCommandDispatchBase()
40 void FeatureCommandDispatchBase::initialize()
42 CommandDispatch::initialize();
43 fillSupportedFeatures();
46 bool FeatureCommandDispatchBase::isFeatureSupported( const OUString& rCommandURL )
48 SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( rCommandURL );
49 if ( aIter != m_aSupportedFeatures.end() )
51 return true;
53 return false;
56 void FeatureCommandDispatchBase::fireStatusEvent( const OUString& rURL,
57 const Reference< frame::XStatusListener >& xSingleListener /* = 0 */ )
59 if ( rURL.isEmpty() )
61 SupportedFeatures::const_iterator aEnd( m_aSupportedFeatures.end() );
62 for ( SupportedFeatures::const_iterator aIter( m_aSupportedFeatures.begin() ); aIter != aEnd; ++aIter )
64 FeatureState aFeatureState( getState( aIter->first ) );
65 fireStatusEventForURL( aIter->first, aFeatureState.aState, aFeatureState.bEnabled, xSingleListener );
68 else
70 FeatureState aFeatureState( getState( rURL ) );
71 fireStatusEventForURL( rURL, aFeatureState.aState, aFeatureState.bEnabled, xSingleListener );
75 // XDispatch
76 void FeatureCommandDispatchBase::dispatch( const util::URL& URL,
77 const Sequence< beans::PropertyValue >& Arguments )
78 throw (uno::RuntimeException, std::exception)
80 OUString aCommand( URL.Complete );
81 if ( getState( aCommand ).bEnabled )
83 execute( aCommand, Arguments );
87 void FeatureCommandDispatchBase::implDescribeSupportedFeature( const sal_Char* pAsciiCommandURL,
88 sal_uInt16 nId, sal_Int16 nGroup )
90 ControllerFeature aFeature;
91 aFeature.Command = OUString::createFromAscii( pAsciiCommandURL );
92 aFeature.nFeatureId = nId;
93 aFeature.GroupId = nGroup;
95 m_aSupportedFeatures[ aFeature.Command ] = aFeature;
98 void FeatureCommandDispatchBase::fillSupportedFeatures()
100 describeSupportedFeatures();
103 } // namespace chart
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */