LCOV - code coverage report
Current view: top level - include/tools - svborder.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 34 34 100.0 %
Date: 2014-11-03 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      101029 :     SvBorder()
      32             :     {
      33      101029 :         nTop = nRight = nBottom = nLeft = 0;
      34      101029 :     }
      35             :     SvBorder( const Size & rSz )
      36             :     {
      37             :         nTop = nBottom = rSz.Height();
      38             :         nRight = nLeft = rSz.Width();
      39             :     }
      40       26285 :     SvBorder( long nLeftP, long nTopP, long nRightP, long nBottomP )
      41             :     {
      42       26285 :         nLeft = nLeftP;
      43       26285 :         nTop = nTopP;
      44       26285 :         nRight = nRightP;
      45       26285 :         nBottom = nBottomP;
      46       26285 :     }
      47         901 :     bool    operator == ( const SvBorder & rObj ) const
      48             :             {
      49        2213 :                 return nTop == rObj.nTop && nRight == rObj.nRight &&
      50        2213 :                        nBottom == rObj.nBottom && nLeft == rObj.nLeft;
      51             :             }
      52         901 :     bool    operator != ( const SvBorder & rObj ) const
      53         901 :             { return !(*this == rObj); }
      54       97619 :     SvBorder & operator = ( const SvBorder & rBorder )
      55             :             {
      56       97619 :                 Left()   = rBorder.Left();
      57       97619 :                 Top()    = rBorder.Top();
      58       97619 :                 Right()  = rBorder.Right();
      59       97619 :                 Bottom() = rBorder.Bottom();
      60       97619 :                 return *this;
      61             :             }
      62         901 :     SvBorder & operator += ( const SvBorder & rBorder )
      63             :             {
      64         901 :                 Left()   += rBorder.Left();
      65         901 :                 Top()    += rBorder.Top();
      66         901 :                 Right()  += rBorder.Right();
      67         901 :                 Bottom() += rBorder.Bottom();
      68         901 :                 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      226212 :     long &  Top()    { return nTop; }
      84      229881 :     long &  Right()  { return nRight; }
      85      206128 :     long &  Bottom() { return nBottom; }
      86      207478 :     long &  Left()   { return nLeft; }
      87      284589 :     long    Top()    const { return nTop; }
      88      216066 :     long    Right()  const { return nRight; }
      89      238945 :     long    Bottom() const { return nBottom; }
      90      264926 :     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