fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / main / ControllerCommandDispatch.hxx
blob049c0f20ce9a7939303aca659a4a884c27a6acd7
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_CONTROLLERCOMMANDDISPATCH_HXX
20 #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CONTROLLERCOMMANDDISPATCH_HXX
22 #include "CommandDispatch.hxx"
23 #include <com/sun/star/frame/XModel.hpp>
24 #include <com/sun/star/frame/XController.hpp>
25 #include <com/sun/star/view/XSelectionSupplier.hpp>
26 #include <cppuhelper/implbase1.hxx>
28 #include <memory>
30 namespace chart
33 class ChartController;
34 class CommandDispatchContainer;
36 namespace impl
38 struct ModelState;
39 struct ControllerState;
41 // #i63017# : need to implement the XSelectionChangeListener in order
42 // to update the ControllerState when the selection changes.
43 typedef ::cppu::ImplInheritanceHelper1<
44 CommandDispatch,
45 ::com::sun::star::view::XSelectionChangeListener >
46 ControllerCommandDispatch_Base;
49 /** This class is a CommandDispatch that is responsible for all commands that
50 the ChartController supports.
52 This class determines which commands are currently available (via the model
53 state) and if an available command is called forwards it to the
54 ChartController.
56 class ControllerCommandDispatch : public impl::ControllerCommandDispatch_Base
58 public:
59 explicit ControllerCommandDispatch(
60 const ::com::sun::star::uno::Reference<
61 ::com::sun::star::uno::XComponentContext > & xContext,
62 ChartController* pController, CommandDispatchContainer* pContainer );
63 virtual ~ControllerCommandDispatch();
65 // late initialisation, especially for adding as listener
66 virtual void initialize() SAL_OVERRIDE;
68 protected:
69 // ____ XDispatch ____
70 virtual void SAL_CALL dispatch(
71 const ::com::sun::star::util::URL& URL,
72 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments )
73 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
75 // ____ WeakComponentImplHelperBase ____
76 /// is called when this is disposed
77 virtual void SAL_CALL disposing() SAL_OVERRIDE;
79 // ____ XEventListener (base of XModifyListener) ____
80 virtual void SAL_CALL disposing(
81 const ::com::sun::star::lang::EventObject& Source )
82 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 virtual void fireStatusEvent(
85 const OUString & rURL,
86 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener ) SAL_OVERRIDE;
88 // ____ XModifyListener ____
89 virtual void SAL_CALL modified(
90 const ::com::sun::star::lang::EventObject& aEvent )
91 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 // ____ XSelectionChangeListener ____
94 virtual void SAL_CALL selectionChanged(
95 const ::com::sun::star::lang::EventObject& aEvent )
96 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
98 private:
99 void fireStatusEventForURLImpl(
100 const OUString & rURL,
101 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener );
103 bool commandAvailable( const OUString & rCommand );
104 void updateCommandAvailability();
106 bool isShapeControllerCommandAvailable( const OUString& rCommand );
108 ChartController* m_pChartController;
109 ::com::sun::star::uno::Reference<
110 ::com::sun::star::frame::XController > m_xController;
111 ::com::sun::star::uno::Reference<
112 ::com::sun::star::view::XSelectionSupplier > m_xSelectionSupplier;
113 ::com::sun::star::uno::Reference<
114 ::com::sun::star::frame::XDispatch > m_xDispatch;
116 ::std::unique_ptr< impl::ModelState > m_apModelState;
117 ::std::unique_ptr< impl::ControllerState > m_apControllerState;
119 mutable ::std::map< OUString, bool > m_aCommandAvailability;
120 mutable ::std::map< OUString, ::com::sun::star::uno::Any > m_aCommandArguments;
122 CommandDispatchContainer* m_pDispatchContainer;
125 } // namespace chart
127 // INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CONTROLLERCOMMANDDISPATCH_HXX
128 #endif
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */