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