1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
13 #include <basegfx/tuple/Tuple2D.hxx>
17 template <typename TYPE
> class Size2D
: protected Tuple2D
<TYPE
>
20 Size2D(TYPE width
, TYPE height
)
21 : Tuple2D
<TYPE
>(width
, height
)
25 Size2D(Tuple2D
<TYPE
> const& rTuple
)
26 : Tuple2D
<TYPE
>(rTuple
.getX(), rTuple
.getY())
30 TYPE
getWidth() const { return Tuple2D
<TYPE
>::getX(); }
32 TYPE
getHeight() const { return Tuple2D
<TYPE
>::getY(); }
34 void setWidth(TYPE
const& rWidth
) { Tuple2D
<TYPE
>::setX(rWidth
); }
36 void setHeight(TYPE
const& rHeight
) { Tuple2D
<TYPE
>::setY(rHeight
); }
38 bool operator==(Size2D
<TYPE
> const& rSize
) const { return Tuple2D
<TYPE
>::operator==(rSize
); }
40 bool operator!=(Size2D
<TYPE
> const& rSize
) const { return Tuple2D
<TYPE
>::operator!=(rSize
); }
42 Size2D
<TYPE
>& operator-=(Size2D
<TYPE
> const& rSize
)
44 Tuple2D
<TYPE
>::operator-=(rSize
);
48 Size2D
<TYPE
>& operator+=(Size2D
<TYPE
> const& rSize
)
50 Tuple2D
<TYPE
>::operator+=(rSize
);
54 Size2D
<TYPE
>& operator/=(Size2D
<TYPE
> const& rSize
)
56 Tuple2D
<TYPE
>::operator/=(rSize
);
60 Size2D
<TYPE
>& operator*=(Size2D
<TYPE
> const& rSize
)
62 Tuple2D
<TYPE
>::operator*=(rSize
);
66 Size2D
<TYPE
>& operator*=(TYPE value
)
68 Tuple2D
<TYPE
>::operator*=(value
);
72 Size2D
<TYPE
>& operator/=(TYPE value
)
74 Tuple2D
<TYPE
>::operator/=(value
);
78 Size2D
<TYPE
> operator-(void) const { return Tuple2D
<TYPE
>::operator-(); }
81 template <typename TYPE
>
82 inline Size2D
<TYPE
> operator-(const Size2D
<TYPE
>& rSizeA
, const Size2D
<TYPE
>& rSizeB
)
84 Size2D
<TYPE
> aNew(rSizeA
);
89 template <typename TYPE
>
90 inline Size2D
<TYPE
> operator+(const Size2D
<TYPE
>& rSizeA
, const Size2D
<TYPE
>& rSizeB
)
92 Size2D
<TYPE
> aNew(rSizeA
);
97 template <typename TYPE
>
98 inline Size2D
<TYPE
> operator*(const Size2D
<TYPE
>& rSizeA
, const Size2D
<TYPE
>& rSizeB
)
100 Size2D
<TYPE
> aNew(rSizeA
);
105 template <typename TYPE
>
106 inline Size2D
<TYPE
> operator/(const Size2D
<TYPE
>& rSizeA
, const Size2D
<TYPE
>& rSizeB
)
108 Size2D
<TYPE
> aNew(rSizeA
);
113 } // end of namespace gfx
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */