xref: /trunk/main/basegfx/inc/basegfx/range/b1ibox.hxx (revision b63233d8)
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 #include <basegfx/basegfxdllapi.h>
29 
30 
31 namespace basegfx
32 {
33 	class BASEGFX_DLLPUBLIC B1IBox
34 	{
35 		::basegfx::BasicBox	maRange;
36 
37 	public:
B1IBox()38 		B1IBox()
39 		{
40 		}
41 
B1IBox(sal_Int32 nStartValue)42 		explicit B1IBox(sal_Int32 nStartValue)
43 		:	maRange(nStartValue)
44 		{
45 		}
46 
B1IBox(sal_Int32 nStartValue1,sal_Int32 nStartValue2)47 		B1IBox(sal_Int32 nStartValue1, sal_Int32 nStartValue2)
48 		:	maRange(nStartValue1)
49 		{
50             expand(nStartValue2);
51 		}
52 
B1IBox(const B1IBox & rBox)53 		B1IBox(const B1IBox& rBox)
54 		:	maRange(rBox.maRange)
55 		{
56 		}
57 
isEmpty() const58 		bool isEmpty() const
59 		{
60 			return maRange.isEmpty();
61 		}
62 
reset()63 		void reset()
64 		{
65 			maRange.reset();
66 		}
67 
operator ==(const B1IBox & rBox) const68 		bool operator==( const B1IBox& rBox ) const
69 		{
70 			return (maRange == rBox.maRange);
71 		}
72 
operator !=(const B1IBox & rBox) const73 		bool operator!=( const B1IBox& rBox ) const
74 		{
75 			return (maRange != rBox.maRange);
76 		}
77 
operator =(const B1IBox & rBox)78 		void operator=(const B1IBox& rBox)
79 		{
80 			maRange = rBox.maRange;
81 		}
82 
getMinimum() const83 		sal_Int32 getMinimum() const
84 		{
85 			return maRange.getMinimum();
86 		}
87 
getMaximum() const88 		sal_Int32 getMaximum() const
89 		{
90 			return maRange.getMaximum();
91 		}
92 
getRange() const93 		Int32Traits::DifferenceType getRange() const
94 		{
95 			return maRange.getRange();
96 		}
97 
getCenter() const98 		double getCenter() const
99 		{
100 			return maRange.getCenter();
101 		}
102 
isInside(sal_Int32 nValue) const103 		bool isInside(sal_Int32 nValue) const
104 		{
105 			return maRange.isInside(nValue);
106 		}
107 
isInside(const B1IBox & rBox) const108 		bool isInside(const B1IBox& rBox) const
109 		{
110 			return maRange.isInside(rBox.maRange);
111 		}
112 
overlaps(const B1IBox & rBox) const113 		bool overlaps(const B1IBox& rBox) const
114 		{
115 			return maRange.overlaps(rBox.maRange);
116 		}
117 
expand(sal_Int32 nValue)118 		void expand(sal_Int32 nValue)
119 		{
120 			maRange.expand(nValue);
121 		}
122 
expand(const B1IBox & rBox)123 		void expand(const B1IBox& rBox)
124 		{
125 			maRange.expand(rBox.maRange);
126 		}
127 
intersect(const B1IBox & rBox)128 		void intersect(const B1IBox& rBox)
129 		{
130 			maRange.intersect(rBox.maRange);
131 		}
132 
grow(sal_Int32 nValue)133 		void grow(sal_Int32 nValue)
134 		{
135 			maRange.grow(nValue);
136 		}
137 	};
138 } // end of namespace basegfx
139 
140 #endif /* _BGFX_RANGE_B1IBOX_HXX */
141