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