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 .
21 #include "CommandDispatch.hxx"
23 #include <com/sun/star/frame/DispatchInformation.hpp>
25 enum class ChartCommandID
35 DrawFreelineNoFill
= 6,
39 DrawCaptionVertical
= 10,
40 DrawToolboxCsBasic
= 11,
41 DrawToolboxCsSymbol
= 12,
42 DrawToolboxCsArrow
= 13,
43 DrawToolboxCsFlowchart
= 14,
44 DrawToolboxCsCallout
= 15,
45 DrawToolboxCsStar
= 16,
47 //Shape Controller Command Ids:
50 ShapeTextAttributes
= 23,
51 ShapeTransformDialog
= 24,
52 ShapeObjectTitleDescription
= 25,
53 ShapeRenameObject
= 26,
54 ShapeBringToFront
= 28,
59 ShapeParagraphDialog
= 36
66 struct ControllerFeature
: public css::frame::DispatchInformation
68 ChartCommandID nFeatureId
;
71 typedef std::map
< OUString
,
72 ControllerFeature
> SupportedFeatures
;
79 FeatureState() : bEnabled( false ) { }
82 /** This is a base class for CommandDispatch implementations with feature support.
84 class FeatureCommandDispatchBase
: public CommandDispatch
87 explicit FeatureCommandDispatchBase( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
88 virtual ~FeatureCommandDispatchBase() override
;
90 // late initialisation, especially for adding as listener
91 virtual void initialize() override
;
93 virtual bool isFeatureSupported( const OUString
& rCommandURL
);
97 virtual void SAL_CALL
dispatch( const css::util::URL
& URL
,
98 const css::uno::Sequence
< css::beans::PropertyValue
>& Arguments
) override
;
100 virtual void fireStatusEvent( const OUString
& rURL
,
101 const css::uno::Reference
< css::frame::XStatusListener
>& xSingleListener
) override
;
103 // state of a feature
104 virtual FeatureState
getState( const OUString
& rCommand
) = 0;
107 virtual void execute( const OUString
& rCommand
, const css::uno::Sequence
< css::beans::PropertyValue
>& rArgs
) = 0;
109 // all the features which should be handled by this class
110 virtual void describeSupportedFeatures() = 0;
112 /** describes a feature supported by the controller
114 Must not be called outside <member>describeSupportedFeatures</member>.
116 @param pAsciiCommandURL
117 the URL of the feature command
119 the id of the feature. Later references to this feature usually happen by id, not by
122 the command group of the feature. This is important for configuring the controller UI
123 by the user, see also <type scope="css::frame">CommandGroup</type>.
125 void implDescribeSupportedFeature( const char* pAsciiCommandURL
, ChartCommandID nId
,
128 mutable SupportedFeatures m_aSupportedFeatures
;
130 ChartCommandID m_nFeatureId
;
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */