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_B1IRANGE_HXX 25 #define _BGFX_RANGE_B1IRANGE_HXX 26 27 #include <basegfx/range/basicrange.hxx> 28 29 30 namespace basegfx 31 { 32 class B1IRange 33 { 34 ::basegfx::BasicRange< sal_Int32, Int32Traits > maRange; 35 36 public: B1IRange()37 B1IRange() 38 { 39 } 40 B1IRange(sal_Int32 nStartValue)41 explicit B1IRange(sal_Int32 nStartValue) 42 : maRange(nStartValue) 43 { 44 } 45 B1IRange(sal_Int32 nStartValue1,sal_Int32 nStartValue2)46 B1IRange(sal_Int32 nStartValue1, sal_Int32 nStartValue2) 47 : maRange(nStartValue1) 48 { 49 expand(nStartValue2); 50 } 51 B1IRange(const B1IRange & rRange)52 B1IRange(const B1IRange& rRange) 53 : maRange(rRange.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 B1IRange & rRange) const67 bool operator==( const B1IRange& rRange ) const 68 { 69 return (maRange == rRange.maRange); 70 } 71 operator !=(const B1IRange & rRange) const72 bool operator!=( const B1IRange& rRange ) const 73 { 74 return (maRange != rRange.maRange); 75 } 76 operator =(const B1IRange & rRange)77 B1IRange& operator=(const B1IRange& rRange) 78 { 79 maRange = rRange.maRange; 80 return *this; 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 B1IRange & rRange) const108 bool isInside(const B1IRange& rRange) const 109 { 110 return maRange.isInside(rRange.maRange); 111 } 112 overlaps(const B1IRange & rRange) const113 bool overlaps(const B1IRange& rRange) const 114 { 115 return maRange.overlaps(rRange.maRange); 116 } 117 expand(sal_Int32 nValue)118 void expand(sal_Int32 nValue) 119 { 120 maRange.expand(nValue); 121 } 122 expand(const B1IRange & rRange)123 void expand(const B1IRange& rRange) 124 { 125 maRange.expand(rRange.maRange); 126 } 127 intersect(const B1IRange & rRange)128 void intersect(const B1IRange& rRange) 129 { 130 maRange.intersect(rRange.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_B1IRANGE_HXX */ 141