Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _CHART2_MINIMUMANDMAXIMUMSUPPLIER_HXX
21 : #define _CHART2_MINIMUMANDMAXIMUMSUPPLIER_HXX
22 :
23 : #include <sal/types.h>
24 : #include <tools/date.hxx>
25 : #include <set>
26 :
27 : //.............................................................................
28 : namespace chart
29 : {
30 : //.............................................................................
31 :
32 : //-----------------------------------------------------------------------------
33 : /**
34 : */
35 :
36 82 : class MinimumAndMaximumSupplier
37 : {
38 : public:
39 : virtual double getMinimumX() = 0;
40 : virtual double getMaximumX() = 0;
41 :
42 : //problem y maybe not is always the second border to ask for
43 : virtual double getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex ) = 0;
44 : virtual double getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex ) = 0;
45 :
46 : //problem: z maybe not independent in future
47 : virtual double getMinimumZ() = 0;
48 : virtual double getMaximumZ() = 0;
49 :
50 : virtual bool isExpandBorderToIncrementRhythm( sal_Int32 nDimensionIndex ) = 0;
51 : virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex ) = 0;
52 : virtual bool isExpandWideValuesToZero( sal_Int32 nDimensionIndex ) = 0;
53 : virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex ) = 0;
54 : virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex ) = 0;
55 :
56 : //return a constant out of ::com::sun::star::chart::TimeUnit that allows to display the smallest distance between occuring dates
57 : virtual long calculateTimeResolutionOnXAxis() = 0;
58 : virtual void setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate ) = 0;
59 :
60 : protected:
61 82 : ~MinimumAndMaximumSupplier() {}
62 : };
63 :
64 : class MergedMinimumAndMaximumSupplier : public MinimumAndMaximumSupplier
65 : {
66 : public:
67 : MergedMinimumAndMaximumSupplier();
68 : virtual ~MergedMinimumAndMaximumSupplier();
69 :
70 : void addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
71 : bool hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
72 : void clearMinimumAndMaximumSupplierList();
73 :
74 : //--MinimumAndMaximumSupplier
75 : virtual double getMinimumX();
76 : virtual double getMaximumX();
77 : virtual double getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex );
78 : virtual double getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex );
79 : virtual double getMinimumZ();
80 : virtual double getMaximumZ();
81 :
82 : virtual bool isExpandBorderToIncrementRhythm( sal_Int32 nDimensionIndex );
83 : virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex );
84 : virtual bool isExpandWideValuesToZero( sal_Int32 nDimensionIndex );
85 : virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex );
86 : virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
87 :
88 : virtual long calculateTimeResolutionOnXAxis();
89 : virtual void setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate );
90 :
91 : private:
92 : typedef ::std::set< MinimumAndMaximumSupplier* > MinimumAndMaximumSupplierSet;
93 : MinimumAndMaximumSupplierSet m_aMinimumAndMaximumSupplierList;
94 :
95 984 : inline MinimumAndMaximumSupplierSet::iterator begin() { return m_aMinimumAndMaximumSupplierList.begin(); }
96 984 : inline MinimumAndMaximumSupplierSet::iterator end() { return m_aMinimumAndMaximumSupplierList.end(); }
97 : };
98 :
99 : //.............................................................................
100 : } //namespace chart
101 : //.............................................................................
102 : #endif
103 :
104 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|