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_RANGESELECTIONLISTENER_HXX
24 #define CHART2_RANGESELECTIONLISTENER_HXX
25 
26 #include "ControllerLockGuard.hxx"
27 #include <cppuhelper/implbase1.hxx>
28 #include <com/sun/star/frame/XModel.hpp>
29 #include <com/sun/star/sheet/XRangeSelectionListener.hpp>
30 
31 namespace chart
32 {
33 
34 class RangeSelectionListenerParent
35 {
36 public:
37     virtual void listeningFinished( const ::rtl::OUString & rNewRange ) = 0;
38     virtual void disposingRangeSelection() = 0;
39 };
40 
41 // ----------------------------------------
42 
43 class RangeSelectionListener : public
44     ::cppu::WeakImplHelper1<
45         ::com::sun::star::sheet::XRangeSelectionListener >
46 {
47 public:
48 	explicit RangeSelectionListener(
49         RangeSelectionListenerParent & rParent,
50         const ::rtl::OUString & rInitialRange,
51         const ::com::sun::star::uno::Reference<
52             ::com::sun::star::frame::XModel >& xModelToLockController );
53 	virtual ~RangeSelectionListener();
54 
55 protected:
56     // ____ XRangeSelectionListener ____
57     virtual void SAL_CALL done( const ::com::sun::star::sheet::RangeSelectionEvent& aEvent )
58         throw (::com::sun::star::uno::RuntimeException);
59     virtual void SAL_CALL aborted( const ::com::sun::star::sheet::RangeSelectionEvent& aEvent )
60         throw (::com::sun::star::uno::RuntimeException);
61 
62     // ____ XEventListener ____
63     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
64         throw (::com::sun::star::uno::RuntimeException);
65 
66 private:
67     RangeSelectionListenerParent & m_rParent;
68     ::rtl::OUString m_aRange;
69     ControllerLockGuard m_aControllerLockGuard;
70 };
71 
72 } //  namespace chart
73 
74 // CHART2_RANGESELECTIONLISTENER_HXX
75 #endif
76