LCOV - code coverage report
Current view: top level - include/tools - svborder.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 34 34 100.0 %
Date: 2014-04-11 Functions: 14 14 100.0 %
Legend: Lines: hit not hit

          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 INCLUDED_TOOLS_SVBORDER_HXX
      21             : #define INCLUDED_TOOLS_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       28656 :     SvBorder()
      32             :     {
      33       28656 :         nTop = nRight = nBottom = nLeft = 0;
      34       28656 :     }
      35             :     SvBorder( const Size & rSz )
      36             :     {
      37             :         nTop = nBottom = rSz.Height();
      38             :         nRight = nLeft = rSz.Width();
      39             :     }
      40         450 :     SvBorder( long nLeftP, long nTopP, long nRightP, long nBottomP )
      41             :     {
      42         450 :         nLeft = nLeftP;
      43         450 :         nTop = nTopP;
      44         450 :         nRight = nRightP;
      45         450 :         nBottom = nBottomP;
      46         450 :     }
      47         317 :     bool    operator == ( const SvBorder & rObj ) const
      48             :             {
      49         775 :                 return nTop == rObj.nTop && nRight == rObj.nRight &&
      50         775 :                        nBottom == rObj.nBottom && nLeft == rObj.nLeft;
      51             :             }
      52         317 :     bool    operator != ( const SvBorder & rObj ) const
      53         317 :             { return !(*this == rObj); }
      54       27300 :     SvBorder & operator = ( const SvBorder & rBorder )
      55             :             {
      56       27300 :                 Left()   = rBorder.Left();
      57       27300 :                 Top()    = rBorder.Top();
      58       27300 :                 Right()  = rBorder.Right();
      59       27300 :                 Bottom() = rBorder.Bottom();
      60       27300 :                 return *this;
      61             :             }
      62         317 :     SvBorder & operator += ( const SvBorder & rBorder )
      63             :             {
      64         317 :                 Left()   += rBorder.Left();
      65         317 :                 Top()    += rBorder.Top();
      66         317 :                 Right()  += rBorder.Right();
      67         317 :                 Bottom() += rBorder.Bottom();
      68         317 :                 return *this;
      69             :             }
      70             :     SvBorder & operator -= ( const SvBorder & rBorder )
      71             :             {
      72             :                 Left()   -= rBorder.Left();
      73             :                 Top()    -= rBorder.Top();
      74             :                 Right()  -= rBorder.Right();
      75             :                 Bottom() -= rBorder.Bottom();
      76             :                 return *this;
      77             :             }
      78             :     bool    IsInside( const SvBorder & rInside )
      79             :             {
      80             :                 return nTop >= rInside.nTop && nRight >= rInside.nRight &&
      81             :                        nBottom >= rInside.nBottom && nLeft >= rInside.nLeft;
      82             :             }
      83       57258 :     long &  Top()    { return nTop; }
      84       50581 :     long &  Right()  { return nRight; }
      85       50162 :     long &  Bottom() { return nBottom; }
      86       50956 :     long &  Left()   { return nLeft; }
      87       59920 :     long    Top()    const { return nTop; }
      88       47004 :     long    Right()  const { return nRight; }
      89       47060 :     long    Bottom() const { return nBottom; }
      90       59941 :     long    Left()   const { return nLeft; }
      91             : };
      92             : 
      93             : TOOLS_DLLPUBLIC Rectangle & operator += ( Rectangle & rRect, const SvBorder & rBorder );
      94             : TOOLS_DLLPUBLIC Rectangle & operator -= ( Rectangle & rRect, const SvBorder & rBorder );
      95             : 
      96             : #endif
      97             : 
      98             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10