xref: /AOO41X/main/basegfx/inc/basegfx/range/b1ibox.hxx (revision ce9c7ef7bd056b6da7d6eeebb749fbf2160d647b)
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 
24 #ifndef _BGFX_RANGE_B1IBOX_HXX
25 #define _BGFX_RANGE_B1IBOX_HXX
26 
27 #include <basegfx/range/basicbox.hxx>
28 
29 
30 namespace basegfx
31 {
32     class B1IBox
33     {
34         ::basegfx::BasicBox maRange;
35 
36     public:
B1IBox()37         B1IBox()
38         {
39         }
40 
B1IBox(sal_Int32 nStartValue)41         explicit B1IBox(sal_Int32 nStartValue)
42         :   maRange(nStartValue)
43         {
44         }
45 
B1IBox(sal_Int32 nStartValue1,sal_Int32 nStartValue2)46         B1IBox(sal_Int32 nStartValue1, sal_Int32 nStartValue2)
47         :   maRange(nStartValue1)
48         {
49             expand(nStartValue2);
50         }
51 
B1IBox(const B1IBox & rBox)52         B1IBox(const B1IBox& rBox)
53         :   maRange(rBox.maRange)
54         {
55         }
56 
isEmpty() const57         bool isEmpty() const
58         {
59             return maRange.isEmpty();
60         }
61 
reset()62         void reset()
63         {
64             maRange.reset();
65         }
66 
operator ==(const B1IBox & rBox) const67         bool operator==( const B1IBox& rBox ) const
68         {
69             return (maRange == rBox.maRange);
70         }
71 
operator !=(const B1IBox & rBox) const72         bool operator!=( const B1IBox& rBox ) const
73         {
74             return (maRange != rBox.maRange);
75         }
76 
operator =(const B1IBox & rBox)77         void operator=(const B1IBox& rBox)
78         {
79             maRange = rBox.maRange;
80         }
81 
getMinimum() const82         sal_Int32 getMinimum() const
83         {
84             return maRange.getMinimum();
85         }
86 
getMaximum() const87         sal_Int32 getMaximum() const
88         {
89             return maRange.getMaximum();
90         }
91 
getRange() const92         Int32Traits::DifferenceType getRange() const
93         {
94             return maRange.getRange();
95         }
96 
getCenter() const97         double getCenter() const
98         {
99             return maRange.getCenter();
100         }
101 
isInside(sal_Int32 nValue) const102         bool isInside(sal_Int32 nValue) const
103         {
104             return maRange.isInside(nValue);
105         }
106 
isInside(const B1IBox & rBox) const107         bool isInside(const B1IBox& rBox) const
108         {
109             return maRange.isInside(rBox.maRange);
110         }
111 
overlaps(const B1IBox & rBox) const112         bool overlaps(const B1IBox& rBox) const
113         {
114             return maRange.overlaps(rBox.maRange);
115         }
116 
expand(sal_Int32 nValue)117         void expand(sal_Int32 nValue)
118         {
119             maRange.expand(nValue);
120         }
121 
expand(const B1IBox & rBox)122         void expand(const B1IBox& rBox)
123         {
124             maRange.expand(rBox.maRange);
125         }
126 
intersect(const B1IBox & rBox)127         void intersect(const B1IBox& rBox)
128         {
129             maRange.intersect(rBox.maRange);
130         }
131 
grow(sal_Int32 nValue)132         void grow(sal_Int32 nValue)
133         {
134             maRange.grow(nValue);
135         }
136     };
137 } // end of namespace basegfx
138 
139 #endif /* _BGFX_RANGE_B1IBOX_HXX */
140