1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef CHART2_STATUSBARCOMMANDDISPATCH_HXX
24 #define CHART2_STATUSBARCOMMANDDISPATCH_HXX
25 
26 #include "CommandDispatch.hxx"
27 #include "ObjectIdentifier.hxx"
28 #include <cppuhelper/implbase1.hxx>
29 #include <com/sun/star/frame/XModel.hpp>
30 #include <com/sun/star/view/XSelectionSupplier.hpp>
31 #include <com/sun/star/util/XModifiable.hpp>
32 
33 namespace chart
34 {
35 
36 /** This is a CommandDispatch implementation for all commands the status bar offers
37 
38     This class reads the information needed from the XModel passed here.
39  */
40 
41 namespace impl
42 {
43 typedef ::cppu::ImplInheritanceHelper1<
44         CommandDispatch,
45         ::com::sun::star::view::XSelectionChangeListener >
46     StatusBarCommandDispatch_Base;
47 }
48 
49 class StatusBarCommandDispatch : public impl::StatusBarCommandDispatch_Base
50 {
51 public:
52 	explicit StatusBarCommandDispatch(
53         const ::com::sun::star::uno::Reference<
54             ::com::sun::star::uno::XComponentContext > & xContext,
55         const ::com::sun::star::uno::Reference<
56             ::com::sun::star::frame::XModel > & xModel,
57         const ::com::sun::star::uno::Reference<
58             ::com::sun::star::view::XSelectionSupplier > & xSelSupp );
59 	virtual ~StatusBarCommandDispatch();
60 
61     // late initialisation, especially for adding as listener
62     virtual void initialize();
63 
64 protected:
65     // ____ XDispatch ____
66     virtual void SAL_CALL dispatch(
67         const ::com::sun::star::util::URL& URL,
68         const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments )
69         throw (::com::sun::star::uno::RuntimeException);
70 
71     // ____ WeakComponentImplHelperBase ____
72     /// is called when this is disposed
73     virtual void SAL_CALL disposing();
74 
75     // ____ XModifyListener (override from CommandDispatch) ____
76     virtual void SAL_CALL modified(
77         const ::com::sun::star::lang::EventObject& aEvent )
78         throw (::com::sun::star::uno::RuntimeException);
79 
80     // ____ XEventListener (base of XModifyListener) ____
81     virtual void SAL_CALL disposing(
82         const ::com::sun::star::lang::EventObject& Source )
83         throw (::com::sun::star::uno::RuntimeException);
84 
85     virtual void fireStatusEvent(
86         const ::rtl::OUString & rURL,
87         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener );
88 
89     // ____ XSelectionChangeListener ____
90     virtual void SAL_CALL selectionChanged(
91         const ::com::sun::star::lang::EventObject& aEvent )
92         throw (::com::sun::star::uno::RuntimeException);
93 
94 private:
95     ::com::sun::star::uno::Reference<
96             ::com::sun::star::util::XModifiable > m_xModifiable;
97     ::com::sun::star::uno::Reference<
98             ::com::sun::star::view::XSelectionSupplier > m_xSelectionSupplier;
99     bool m_bIsModified;
100     ObjectIdentifier m_aSelectedOID;
101 };
102 
103 } //  namespace chart
104 
105 // CHART2_STATUSBARCOMMANDDISPATCH_HXX
106 #endif
107