fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / main / FeatureCommandDispatchBase.hxx
blob684c78b8c09d773cd621675e8a4e28eda0486612
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 .
19 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_FEATURECOMMANDDISPATCHBASE_HXX
20 #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_FEATURECOMMANDDISPATCHBASE_HXX
22 #include "CommandDispatch.hxx"
24 #include <com/sun/star/frame/CommandGroup.hpp>
25 #include <com/sun/star/frame/DispatchInformation.hpp>
26 #include <com/sun/star/util/URL.hpp>
28 namespace chart
31 struct ControllerFeature: public ::com::sun::star::frame::DispatchInformation
33 sal_uInt16 nFeatureId;
36 typedef ::std::map< OUString,
37 ControllerFeature,
38 ::std::less< OUString > > SupportedFeatures;
40 struct FeatureState
42 bool bEnabled;
43 ::com::sun::star::uno::Any aState;
45 FeatureState() : bEnabled( false ) { }
48 /** This is a base class for CommandDispatch implementations with feature support.
50 class FeatureCommandDispatchBase: public CommandDispatch
52 public:
53 FeatureCommandDispatchBase( const ::com::sun::star::uno::Reference<
54 ::com::sun::star::uno::XComponentContext >& rxContext );
55 virtual ~FeatureCommandDispatchBase();
57 // late initialisation, especially for adding as listener
58 virtual void initialize() SAL_OVERRIDE;
60 virtual bool isFeatureSupported( const OUString& rCommandURL );
62 protected:
63 // XDispatch
64 virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& URL,
65 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments )
66 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
68 virtual void fireStatusEvent( const OUString& rURL,
69 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xSingleListener ) SAL_OVERRIDE;
71 // state of a feature
72 virtual FeatureState getState( const OUString& rCommand ) = 0;
74 // execute a feature
75 virtual void execute( const OUString& rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs ) = 0;
77 // all the features which should be handled by this class
78 virtual void describeSupportedFeatures() = 0;
80 /** describes a feature supported by the controller
82 Must not be called outside <member>describeSupportedFeatures</member>.
84 @param pAsciiCommandURL
85 the URL of the feature command
86 @param nId
87 the id of the feature. Later references to this feature usually happen by id, not by
88 URL.
89 @param nGroup
90 the command group of the feature. This is important for configuring the controller UI
91 by the user, see also <type scope="com::sun::star::frame">CommandGroup</type>.
93 void implDescribeSupportedFeature( const sal_Char* pAsciiCommandURL, sal_uInt16 nId,
94 sal_Int16 nGroup = ::com::sun::star::frame::CommandGroup::INTERNAL );
96 mutable SupportedFeatures m_aSupportedFeatures;
98 sal_uInt16 m_nFeatureId;
100 private:
101 void fillSupportedFeatures();
104 } // namespace chart
106 // INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_FEATURECOMMANDDISPATCHBASE_HXX
107 #endif
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */