tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / chart2 / source / controller / main / FeatureCommandDispatchBase.hxx
blob3ceb35ad1268bc710a2c79a74a9c7fae3057be51
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 #pragma once
21 #include "CommandDispatch.hxx"
23 #include <com/sun/star/frame/DispatchInformation.hpp>
25 enum class ChartCommandID
27 NONE = 0,
29 //Draw Command Ids:
30 DrawObjectSelect = 1,
31 DrawLine = 2,
32 DrawLineArrowEnd = 3,
33 DrawRect = 4,
34 DrawEllipse = 5,
35 DrawFreelineNoFill = 6,
36 DrawText = 7,
37 DrawTextVertical = 8,
38 DrawCaption = 9,
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:
48 ShapeFormatLine = 21,
49 ShapeFormatArea = 22,
50 ShapeTextAttributes = 23,
51 ShapeTransformDialog = 24,
52 ShapeObjectTitleDescription = 25,
53 ShapeRenameObject = 26,
54 ShapeBringToFront = 28,
55 ShapeForward = 29,
56 ShapeBackward = 30,
57 ShapeSendToBack = 31,
58 ShapeFontDialog = 35,
59 ShapeParagraphDialog = 36
63 namespace chart
66 struct ControllerFeature: public css::frame::DispatchInformation
68 ChartCommandID nFeatureId;
71 typedef std::map< OUString,
72 ControllerFeature > SupportedFeatures;
74 struct FeatureState
76 bool bEnabled;
77 css::uno::Any aState;
79 FeatureState() : bEnabled( false ) { }
82 /** This is a base class for CommandDispatch implementations with feature support.
84 class FeatureCommandDispatchBase: public CommandDispatch
86 public:
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 );
95 protected:
96 // XDispatch
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;
106 // execute a feature
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
118 @param nId
119 the id of the feature. Later references to this feature usually happen by id, not by
120 URL.
121 @param nGroup
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,
126 sal_Int16 nGroup );
128 mutable SupportedFeatures m_aSupportedFeatures;
130 ChartCommandID m_nFeatureId;
133 } // namespace chart
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */