LCOV - code coverage report
Current view: top level - include/tools - svborder.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 34 34 100.0 %
Date: 2015-06-13 12:38:46 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       61442 :     SvBorder()
      32             :     {
      33       61442 :         nTop = nRight = nBottom = nLeft = 0;
      34       61442 :     }
      35             :     SvBorder( const Size & rSz )
      36             :     {
      37             :         nTop = nBottom = rSz.Height();
      38             :         nRight = nLeft = rSz.Width();
      39             :     }
      40        4610 :     SvBorder( long nLeftP, long nTopP, long nRightP, long nBottomP )
      41             :     {
      42        4610 :         nLeft = nLeftP;
      43        4610 :         nTop = nTopP;
      44        4610 :         nRight = nRightP;
      45        4610 :         nBottom = nBottomP;
      46        4610 :     }
      47         505 :     bool    operator == ( const SvBorder & rObj ) const
      48             :             {
      49        1198 :                 return nTop == rObj.nTop && nRight == rObj.nRight &&
      50        1193 :                        nBottom == rObj.nBottom && nLeft == rObj.nLeft;
      51             :             }
      52         505 :     bool    operator != ( const SvBorder & rObj ) const
      53         505 :             { return !(*this == rObj); }
      54       59366 :     SvBorder & operator = ( const SvBorder & rBorder )
      55             :             {
      56       59366 :                 Left()   = rBorder.Left();
      57       59366 :                 Top()    = rBorder.Top();
      58       59366 :                 Right()  = rBorder.Right();
      59       59366 :                 Bottom() = rBorder.Bottom();
      60       59366 :                 return *this;
      61             :             }
      62         505 :     SvBorder & operator += ( const SvBorder & rBorder )
      63             :             {
      64         505 :                 Left()   += rBorder.Left();
      65         505 :                 Top()    += rBorder.Top();
      66         505 :                 Right()  += rBorder.Right();
      67         505 :                 Bottom() += rBorder.Bottom();
      68         505 :                 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      139237 :     long &  Top()    { return nTop; }
      84      142008 :     long &  Right()  { return nRight; }
      85      126523 :     long &  Bottom() { return nBottom; }
      86      113734 :     long &  Left()   { return nLeft; }
      87      131710 :     long    Top()    const { return nTop; }
      88      101706 :     long    Right()  const { return nRight; }
      89      104934 :     long    Bottom() const { return nBottom; }
      90      131502 :     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.11