1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef CHART2_FEATURECOMMANDDISPATCHBASE_HXX
28 #define CHART2_FEATURECOMMANDDISPATCHBASE_HXX
30 #include "CommandDispatch.hxx"
32 #include <com/sun/star/frame/CommandGroup.hpp>
33 #include <com/sun/star/frame/DispatchInformation.hpp>
34 #include <com/sun/star/util/URL.hpp>
39 struct ControllerFeature
: public ::com::sun::star::frame::DispatchInformation
41 sal_uInt16 nFeatureId
;
44 typedef ::std::map
< ::rtl::OUString
,
46 ::std::less
< ::rtl::OUString
> > SupportedFeatures
;
51 ::com::sun::star::uno::Any aState
;
53 FeatureState() : bEnabled( false ) { }
56 /** This is a base class for CommandDispatch implementations with feature support.
58 class FeatureCommandDispatchBase
: public CommandDispatch
61 FeatureCommandDispatchBase( const ::com::sun::star::uno::Reference
<
62 ::com::sun::star::uno::XComponentContext
>& rxContext
);
63 virtual ~FeatureCommandDispatchBase();
65 // late initialisation, especially for adding as listener
66 virtual void initialize();
68 virtual bool isFeatureSupported( const ::rtl::OUString
& rCommandURL
);
72 virtual void SAL_CALL
dispatch( const ::com::sun::star::util::URL
& URL
,
73 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& Arguments
)
74 throw (::com::sun::star::uno::RuntimeException
);
76 virtual void fireStatusEvent( const ::rtl::OUString
& rURL
,
77 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XStatusListener
>& xSingleListener
);
80 virtual FeatureState
getState( const ::rtl::OUString
& rCommand
) = 0;
83 virtual void execute( const ::rtl::OUString
& rCommand
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& rArgs
) = 0;
85 // all the features which should be handled by this class
86 virtual void describeSupportedFeatures() = 0;
88 /** describes a feature supported by the controller
90 Must not be called outside <member>describeSupportedFeatures</member>.
92 @param pAsciiCommandURL
93 the URL of the feature command
95 the id of the feature. Later references to this feature usually happen by id, not by
98 the command group of the feature. This is important for configuring the controller UI
99 by the user, see also <type scope="com::sun::star::frame">CommandGroup</type>.
101 void implDescribeSupportedFeature( const sal_Char
* pAsciiCommandURL
, sal_uInt16 nId
,
102 sal_Int16 nGroup
= ::com::sun::star::frame::CommandGroup::INTERNAL
);
104 mutable SupportedFeatures m_aSupportedFeatures
;
106 sal_uInt16 m_nFeatureId
;
109 void fillSupportedFeatures();
114 // CHART2_FEATURECOMMANDDISPATCHBASE_HXX