Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _SVBORDER_HXX
21 : #define _SVBORDER_HXX
22 :
23 : #include "tools/toolsdllapi.h"
24 : #include <tools/gen.hxx>
25 :
26 : class TOOLS_DLLPUBLIC SvBorder
27 : {
28 : long nTop, nRight, nBottom, nLeft;
29 :
30 : public:
31 3131 : SvBorder()
32 3131 : { nTop = nRight = nBottom = nLeft = 0; }
33 : SvBorder( const Size & rSz )
34 : { nTop = nBottom = rSz.Height(); nRight = nLeft = rSz.Width(); }
35 0 : SvBorder( long nLeftP, long nTopP, long nRightP, long nBottomP )
36 0 : { nLeft = nLeftP; nTop = nTopP; nRight = nRightP; nBottom = nBottomP; }
37 0 : sal_Bool operator == ( const SvBorder & rObj ) const
38 : {
39 : return nTop == rObj.nTop && nRight == rObj.nRight &&
40 0 : nBottom == rObj.nBottom && nLeft == rObj.nLeft;
41 : }
42 0 : sal_Bool operator != ( const SvBorder & rObj ) const
43 0 : { return !(*this == rObj); }
44 2974 : SvBorder & operator = ( const SvBorder & rBorder )
45 : {
46 2974 : Left() = rBorder.Left();
47 2974 : Top() = rBorder.Top();
48 2974 : Right() = rBorder.Right();
49 2974 : Bottom() = rBorder.Bottom();
50 2974 : return *this;
51 : }
52 0 : SvBorder & operator += ( const SvBorder & rBorder )
53 : {
54 0 : Left() += rBorder.Left();
55 0 : Top() += rBorder.Top();
56 0 : Right() += rBorder.Right();
57 0 : Bottom() += rBorder.Bottom();
58 0 : return *this;
59 : }
60 : SvBorder & operator -= ( const SvBorder & rBorder )
61 : {
62 : Left() -= rBorder.Left();
63 : Top() -= rBorder.Top();
64 : Right() -= rBorder.Right();
65 : Bottom() -= rBorder.Bottom();
66 : return *this;
67 : }
68 : sal_Bool IsInside( const SvBorder & rInside )
69 : {
70 : return nTop >= rInside.nTop && nRight >= rInside.nRight &&
71 : nBottom >= rInside.nBottom && nLeft >= rInside.nLeft;
72 : }
73 6213 : long & Top() { return nTop; }
74 5386 : long & Right() { return nRight; }
75 5380 : long & Bottom() { return nBottom; }
76 5388 : long & Left() { return nLeft; }
77 6653 : long Top() const { return nTop; }
78 5123 : long Right() const { return nRight; }
79 5123 : long Bottom() const { return nBottom; }
80 6653 : long Left() const { return nLeft; }
81 : };
82 :
83 : TOOLS_DLLPUBLIC Rectangle & operator += ( Rectangle & rRect, const SvBorder & rBorder );
84 : TOOLS_DLLPUBLIC Rectangle & operator -= ( Rectangle & rRect, const SvBorder & rBorder );
85 :
86 : #endif
87 :
88 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|