Bump for 3.6-28
[LibreOffice.git] / chart2 / source / controller / main / CommandDispatch.hxx
blob4eda320afd79e75d99a64df42245806462d51128
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef CHART2_COMMANDDISPATCH_HXX
29 #define CHART2_COMMANDDISPATCH_HXX
31 #include "MutexContainer.hxx"
32 #include <cppuhelper/compbase2.hxx>
33 #include <com/sun/star/frame/XDispatch.hpp>
34 #include <com/sun/star/util/XModifyListener.hpp>
35 #include <com/sun/star/uno/XComponentContext.hpp>
36 #include <com/sun/star/util/XURLTransformer.hpp>
38 #include <vector>
39 #include <map>
41 namespace chart
44 namespace impl
46 typedef ::cppu::WeakComponentImplHelper2<
47 ::com::sun::star::frame::XDispatch,
48 ::com::sun::star::util::XModifyListener >
49 CommandDispatch_Base;
52 /** This is the base class for an XDispatch.
54 class CommandDispatch :
55 public MutexContainer,
56 public impl::CommandDispatch_Base
58 public:
59 explicit CommandDispatch(
60 const ::com::sun::star::uno::Reference<
61 ::com::sun::star::uno::XComponentContext > & xContext );
62 virtual ~CommandDispatch();
64 // late initialisation, especially for adding as listener
65 virtual void initialize();
67 protected:
68 /** sends a status event for a specific command to all registered listeners
69 or only the one given when set.
71 This method should be overloaded. The implementation should call
72 fireStatusEventForURL and pass the xSingleListener argument to this
73 method unchanged.
75 @param rURL
76 If empty, all available status events must be fired, otherwise only
77 the one for the given command.
79 @param xSingleListener
80 If set, the event is only sent to this listener rather than to all
81 registered ones. Whenever a listener adds itself, this method is
82 called with this parameter set to give an initial state.
84 virtual void fireStatusEvent(
85 const ::rtl::OUString & rURL,
86 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener ) = 0;
88 /** calls fireStatusEvent( ::rtl::OUString, xSingleListener )
90 void fireAllStatusEvents(
91 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener );
93 /** sends a status event for a specific command to all registered listeners
94 or only the one given when set.
96 @param xSingleListener
97 If set, the event is only sent to this listener rather than to all
98 registered ones. Whenever a listener adds itself, this method is
99 called with this parameter set to give an initial state.
101 void fireStatusEventForURL(
102 const ::rtl::OUString & rURL,
103 const ::com::sun::star::uno::Any & rState,
104 bool bEnabled,
105 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener =
106 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >(),
107 const ::rtl::OUString & rFeatureDescriptor = ::rtl::OUString() );
109 // ____ XDispatch ____
110 virtual void SAL_CALL dispatch(
111 const ::com::sun::star::util::URL& URL,
112 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments )
113 throw (::com::sun::star::uno::RuntimeException);
114 virtual void SAL_CALL addStatusListener(
115 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& Control,
116 const ::com::sun::star::util::URL& URL )
117 throw (::com::sun::star::uno::RuntimeException);
118 virtual void SAL_CALL removeStatusListener(
119 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& Control,
120 const ::com::sun::star::util::URL& URL )
121 throw (::com::sun::star::uno::RuntimeException);
123 // ____ WeakComponentImplHelperBase ____
124 /// is called when this is disposed
125 virtual void SAL_CALL disposing();
127 // ____ XModifyListener ____
128 virtual void SAL_CALL modified(
129 const ::com::sun::star::lang::EventObject& aEvent )
130 throw (::com::sun::star::uno::RuntimeException);
132 // ____ XEventListener (base of XModifyListener) ____
133 virtual void SAL_CALL disposing(
134 const ::com::sun::star::lang::EventObject& Source )
135 throw (::com::sun::star::uno::RuntimeException);
137 protected:
138 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
139 ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
141 private:
142 typedef ::std::map< ::rtl::OUString, ::cppu::OInterfaceContainerHelper* >
143 tListenerMap;
145 tListenerMap m_aListeners;
149 } // namespace chart
151 // CHART2_COMMANDDISPATCH_HXX
152 #endif
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */