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_RANGEHIGHLIGHTER_HXX 24 #define CHART2_RANGEHIGHLIGHTER_HXX 25 26 #include "MutexContainer.hxx" 27 #include <cppuhelper/compbase2.hxx> 28 #include <com/sun/star/chart2/data/XRangeHighlighter.hpp> 29 #include <com/sun/star/view/XSelectionSupplier.hpp> 30 #include <com/sun/star/beans/XPropertySet.hpp> 31 32 namespace com { namespace sun { namespace star { 33 namespace chart2 { 34 class XDiagram; 35 class XDataSeries; 36 class XAxis; 37 }}}} 38 39 namespace chart 40 { 41 42 namespace impl 43 { 44 typedef ::cppu::WeakComponentImplHelper2< 45 ::com::sun::star::chart2::data::XRangeHighlighter, 46 ::com::sun::star::view::XSelectionChangeListener 47 > 48 RangeHighlighter_Base; 49 } 50 51 class RangeHighlighter : 52 public MutexContainer, 53 public impl::RangeHighlighter_Base 54 { 55 public: 56 explicit RangeHighlighter( 57 const ::com::sun::star::uno::Reference< 58 ::com::sun::star::view::XSelectionSupplier > & xSelectionSupplier ); 59 virtual ~RangeHighlighter(); 60 61 protected: 62 // ____ XRangeHighlighter ____ 63 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::data::HighlightedRange > SAL_CALL getSelectedRanges() 64 throw (::com::sun::star::uno::RuntimeException); 65 virtual void SAL_CALL addSelectionChangeListener( 66 const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) 67 throw (::com::sun::star::uno::RuntimeException); 68 virtual void SAL_CALL removeSelectionChangeListener( 69 const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) 70 throw (::com::sun::star::uno::RuntimeException); 71 72 // ____ XSelectionChangeListener ____ 73 virtual void SAL_CALL selectionChanged( 74 const ::com::sun::star::lang::EventObject& aEvent ) 75 throw (::com::sun::star::uno::RuntimeException); 76 77 // ____ XEventListener (base of XSelectionChangeListener) ____ 78 virtual void SAL_CALL disposing( 79 const ::com::sun::star::lang::EventObject& Source ) 80 throw (::com::sun::star::uno::RuntimeException); 81 82 // ____ WeakComponentImplHelperBase ____ 83 // is called when dispose() is called at this component 84 virtual void SAL_CALL disposing(); 85 86 private: 87 void fireSelectionEvent(); 88 void startListening(); 89 void stopListening(); 90 void determineRanges(); 91 92 void fillRangesForDiagram( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > & xDiagram ); 93 void fillRangesForDataSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries ); 94 void fillRangesForCategories( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > & xAxis ); 95 void fillRangesForDataPoint( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xDataSeries, sal_Int32 nIndex ); 96 void fillRangesForErrorBars( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xErrorBar, 97 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xDataSeries ); 98 99 ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier > 100 m_xSelectionSupplier; 101 ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener > 102 m_xListener; 103 ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::data::HighlightedRange > 104 m_aSelectedRanges; 105 sal_Int32 m_nAddedListenerCount; 106 bool m_bIncludeHiddenCells; 107 }; 108 109 } // namespace chart 110 111 // CHART2_RANGEHIGHLIGHTER_HXX 112 #endif 113