1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef CHART2_STATUSBARCOMMANDDISPATCH_HXX
28 #define CHART2_STATUSBARCOMMANDDISPATCH_HXX
29 
30 #include "CommandDispatch.hxx"
31 #include "ObjectIdentifier.hxx"
32 #include <cppuhelper/implbase1.hxx>
33 #include <com/sun/star/frame/XModel.hpp>
34 #include <com/sun/star/view/XSelectionSupplier.hpp>
35 #include <com/sun/star/util/XModifiable.hpp>
36 
37 namespace chart
38 {
39 
40 /** This is a CommandDispatch implementation for all commands the status bar offers
41 
42     This class reads the information needed from the XModel passed here.
43  */
44 
45 namespace impl
46 {
47 typedef ::cppu::ImplInheritanceHelper1<
48         CommandDispatch,
49         ::com::sun::star::view::XSelectionChangeListener >
50     StatusBarCommandDispatch_Base;
51 }
52 
53 class StatusBarCommandDispatch : public impl::StatusBarCommandDispatch_Base
54 {
55 public:
56 	explicit StatusBarCommandDispatch(
57         const ::com::sun::star::uno::Reference<
58             ::com::sun::star::uno::XComponentContext > & xContext,
59         const ::com::sun::star::uno::Reference<
60             ::com::sun::star::frame::XModel > & xModel,
61         const ::com::sun::star::uno::Reference<
62             ::com::sun::star::view::XSelectionSupplier > & xSelSupp );
63 	virtual ~StatusBarCommandDispatch();
64 
65     // late initialisation, especially for adding as listener
66     virtual void initialize();
67 
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);
74 
75     // ____ WeakComponentImplHelperBase ____
76     /// is called when this is disposed
77     virtual void SAL_CALL disposing();
78 
79     // ____ XModifyListener (override from CommandDispatch) ____
80     virtual void SAL_CALL modified(
81         const ::com::sun::star::lang::EventObject& aEvent )
82         throw (::com::sun::star::uno::RuntimeException);
83 
84     // ____ XEventListener (base of XModifyListener) ____
85     virtual void SAL_CALL disposing(
86         const ::com::sun::star::lang::EventObject& Source )
87         throw (::com::sun::star::uno::RuntimeException);
88 
89     virtual void fireStatusEvent(
90         const ::rtl::OUString & rURL,
91         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener );
92 
93     // ____ XSelectionChangeListener ____
94     virtual void SAL_CALL selectionChanged(
95         const ::com::sun::star::lang::EventObject& aEvent )
96         throw (::com::sun::star::uno::RuntimeException);
97 
98 private:
99     ::com::sun::star::uno::Reference<
100             ::com::sun::star::util::XModifiable > m_xModifiable;
101     ::com::sun::star::uno::Reference<
102             ::com::sun::star::view::XSelectionSupplier > m_xSelectionSupplier;
103     bool m_bIsModified;
104     ObjectIdentifier m_aSelectedOID;
105 };
106 
107 } //  namespace chart
108 
109 // CHART2_STATUSBARCOMMANDDISPATCH_HXX
110 #endif
111