1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/DispatchInformation.hpp>
29 struct ControllerFeature
: public css::frame::DispatchInformation
31 sal_uInt16 nFeatureId
;
34 typedef std::map
< OUString
,
35 ControllerFeature
> SupportedFeatures
;
42 FeatureState() : bEnabled( false ) { }
45 /** This is a base class for CommandDispatch implementations with feature support.
47 class FeatureCommandDispatchBase
: public CommandDispatch
50 explicit FeatureCommandDispatchBase( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
51 virtual ~FeatureCommandDispatchBase() override
;
53 // late initialisation, especially for adding as listener
54 virtual void initialize() override
;
56 virtual bool isFeatureSupported( const OUString
& rCommandURL
);
60 virtual void SAL_CALL
dispatch( const css::util::URL
& URL
,
61 const css::uno::Sequence
< css::beans::PropertyValue
>& Arguments
) override
;
63 virtual void fireStatusEvent( const OUString
& rURL
,
64 const css::uno::Reference
< css::frame::XStatusListener
>& xSingleListener
) override
;
67 virtual FeatureState
getState( const OUString
& rCommand
) = 0;
70 virtual void execute( const OUString
& rCommand
, const css::uno::Sequence
< css::beans::PropertyValue
>& rArgs
) = 0;
72 // all the features which should be handled by this class
73 virtual void describeSupportedFeatures() = 0;
75 /** describes a feature supported by the controller
77 Must not be called outside <member>describeSupportedFeatures</member>.
79 @param pAsciiCommandURL
80 the URL of the feature command
82 the id of the feature. Later references to this feature usually happen by id, not by
85 the command group of the feature. This is important for configuring the controller UI
86 by the user, see also <type scope="css::frame">CommandGroup</type>.
88 void implDescribeSupportedFeature( const sal_Char
* pAsciiCommandURL
, sal_uInt16 nId
,
91 mutable SupportedFeatures m_aSupportedFeatures
;
93 sal_uInt16 m_nFeatureId
;
98 // INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_FEATURECOMMANDDISPATCHBASE_HXX
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */