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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_TOOLS_SVBORDER_HXX
21 #define INCLUDED_TOOLS_SVBORDER_HXX
23 #include <tools/toolsdllapi.h>
24 #include <tools/gen.hxx>
26 class TOOLS_DLLPUBLIC SvBorder
28 long nTop
, nRight
, nBottom
, nLeft
;
33 nTop
= nRight
= nBottom
= nLeft
= 0;
35 SvBorder( const Size
& rSz
)
37 nTop
= nBottom
= rSz
.Height();
38 nRight
= nLeft
= rSz
.Width();
40 SvBorder( long nLeftP
, long nTopP
, long nRightP
, long nBottomP
)
47 bool operator == ( const SvBorder
& rObj
) const
49 return nTop
== rObj
.nTop
&& nRight
== rObj
.nRight
&&
50 nBottom
== rObj
.nBottom
&& nLeft
== rObj
.nLeft
;
52 bool operator != ( const SvBorder
& rObj
) const
53 { return !(*this == rObj
); }
54 SvBorder
& operator = ( const SvBorder
& rBorder
)
56 Left() = rBorder
.Left();
57 Top() = rBorder
.Top();
58 Right() = rBorder
.Right();
59 Bottom() = rBorder
.Bottom();
62 SvBorder
& operator += ( const SvBorder
& rBorder
)
64 Left() += rBorder
.Left();
65 Top() += rBorder
.Top();
66 Right() += rBorder
.Right();
67 Bottom() += rBorder
.Bottom();
70 SvBorder
& operator -= ( const SvBorder
& rBorder
)
72 Left() -= rBorder
.Left();
73 Top() -= rBorder
.Top();
74 Right() -= rBorder
.Right();
75 Bottom() -= rBorder
.Bottom();
78 bool IsInside( const SvBorder
& rInside
)
80 return nTop
>= rInside
.nTop
&& nRight
>= rInside
.nRight
&&
81 nBottom
>= rInside
.nBottom
&& nLeft
>= rInside
.nLeft
;
83 long & Top() { return nTop
; }
84 long & Right() { return nRight
; }
85 long & Bottom() { return nBottom
; }
86 long & Left() { return nLeft
; }
87 long Top() const { return nTop
; }
88 long Right() const { return nRight
; }
89 long Bottom() const { return nBottom
; }
90 long Left() const { return nLeft
; }
93 TOOLS_DLLPUBLIC Rectangle
& operator += ( Rectangle
& rRect
, const SvBorder
& rBorder
);
94 TOOLS_DLLPUBLIC Rectangle
& operator -= ( Rectangle
& rRect
, const SvBorder
& rBorder
);
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */