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 28 #ifndef _CHART2_MINIMUMANDMAXIMUMSUPPLIER_HXX 29 #define _CHART2_MINIMUMANDMAXIMUMSUPPLIER_HXX 30 31 #include <sal/types.h> 32 #include <tools/date.hxx> 33 #include <set> 34 35 //............................................................................. 36 namespace chart 37 { 38 //............................................................................. 39 40 //----------------------------------------------------------------------------- 41 /** 42 */ 43 44 class MinimumAndMaximumSupplier 45 { 46 public: 47 virtual double getMinimumX() = 0; 48 virtual double getMaximumX() = 0; 49 50 //problem y maybe not is always the second border to ask for 51 virtual double getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex ) = 0; 52 virtual double getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex ) = 0; 53 54 //problem: z maybe not independent in future 55 virtual double getMinimumZ() = 0; 56 virtual double getMaximumZ() = 0; 57 58 virtual bool isExpandBorderToIncrementRhythm( sal_Int32 nDimensionIndex ) = 0; 59 virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex ) = 0; 60 virtual bool isExpandWideValuesToZero( sal_Int32 nDimensionIndex ) = 0; 61 virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex ) = 0; 62 virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex ) = 0; 63 64 //return a constant out of ::com::sun::star::chart::TimeUnit that allows to display the smallest distance between occuring dates 65 virtual long calculateTimeResolutionOnXAxis() = 0; 66 virtual void setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate ) = 0; 67 }; 68 69 class MergedMinimumAndMaximumSupplier : public MinimumAndMaximumSupplier 70 { 71 public: 72 MergedMinimumAndMaximumSupplier(); 73 virtual ~MergedMinimumAndMaximumSupplier(); 74 75 void addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier ); 76 bool hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier ); 77 void clearMinimumAndMaximumSupplierList(); 78 79 //--MinimumAndMaximumSupplier 80 virtual double getMinimumX(); 81 virtual double getMaximumX(); 82 virtual double getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex ); 83 virtual double getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex ); 84 virtual double getMinimumZ(); 85 virtual double getMaximumZ(); 86 87 virtual bool isExpandBorderToIncrementRhythm( sal_Int32 nDimensionIndex ); 88 virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex ); 89 virtual bool isExpandWideValuesToZero( sal_Int32 nDimensionIndex ); 90 virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex ); 91 virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex ); 92 93 virtual long calculateTimeResolutionOnXAxis(); 94 virtual void setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate ); 95 96 private: 97 typedef ::std::set< MinimumAndMaximumSupplier* > MinimumAndMaximumSupplierSet; 98 MinimumAndMaximumSupplierSet m_aMinimumAndMaximumSupplierList; 99 100 inline MinimumAndMaximumSupplierSet::iterator begin() { return m_aMinimumAndMaximumSupplierList.begin(); } 101 inline MinimumAndMaximumSupplierSet::iterator end() { return m_aMinimumAndMaximumSupplierList.end(); } 102 }; 103 104 //............................................................................. 105 } //namespace chart 106 //............................................................................. 107 #endif 108