LCOV - code coverage report
Current view: top level - include/editeng - ulspitem.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 22 24 91.7 %
Date: 2014-04-11 Functions: 14 16 87.5 %
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             : #ifndef INCLUDED_EDITENG_ULSPITEM_HXX
      20             : #define INCLUDED_EDITENG_ULSPITEM_HXX
      21             : 
      22             : #include <svl/poolitem.hxx>
      23             : #include <editeng/editengdllapi.h>
      24             : 
      25             : 
      26             : // class SvxULSpaceItem --------------------------------------------------
      27             : 
      28             : /*  [Description]
      29             : 
      30             :     This item describes the Upper- and Lower space of a page or paragraph.
      31             : */
      32             : 
      33             : #define ULSPACE_16_VERSION  ((sal_uInt16)0x0001)
      34             : 
      35      223676 : class EDITENG_DLLPUBLIC SvxULSpaceItem : public SfxPoolItem
      36             : {
      37             :     sal_uInt16 nUpper;  // Upper space
      38             :     sal_uInt16 nLower;  // Lower space
      39             :     bool       bContext; // Contextual spacing?
      40             :     sal_uInt16 nPropUpper, nPropLower;      // relative or absolute (=100%)
      41             : public:
      42             :     TYPEINFO_OVERRIDE();
      43             : 
      44             :     explicit SvxULSpaceItem( const sal_uInt16 nId  );
      45             :     SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow,
      46             :                     const sal_uInt16 nId  );
      47             :     inline SvxULSpaceItem& operator=( const SvxULSpaceItem &rCpy );
      48             : 
      49             :     // "pure virtual Methods" from SfxPoolItem
      50             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
      51             : 
      52             :     virtual bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
      53             :     virtual bool            PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
      54             : 
      55             :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
      56             :                                     SfxMapUnit eCoreMetric,
      57             :                                     SfxMapUnit ePresMetric,
      58             :                                     OUString &rText, const IntlWrapper * = 0 ) const SAL_OVERRIDE;
      59             : 
      60             :     virtual SfxPoolItem*     Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
      61             :     virtual SfxPoolItem*     Create(SvStream &, sal_uInt16) const SAL_OVERRIDE;
      62             :     virtual SvStream&        Store(SvStream &, sal_uInt16 nItemVersion ) const SAL_OVERRIDE;
      63             :     virtual sal_uInt16           GetVersion( sal_uInt16 nFileVersion ) const SAL_OVERRIDE;
      64             :     virtual bool                 ScaleMetrics( long nMult, long nDiv ) SAL_OVERRIDE;
      65             :     virtual bool                 HasMetrics() const SAL_OVERRIDE;
      66             : 
      67             :     inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 );
      68             :     inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 );
      69             : 
      70         372 :     void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; }
      71         372 :     void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; }
      72        1057 :     void SetContextValue( const bool bC )     { bContext = bC; }
      73           0 :     void SetPropUpper( const sal_uInt16 nU )  { nPropUpper = nU; }
      74           0 :     void SetPropLower( const sal_uInt16 nL )  { nPropLower = nL; }
      75             : 
      76       89786 :     sal_uInt16 GetUpper() const { return nUpper; }
      77      441271 :     sal_uInt16 GetLower() const { return nLower; }
      78       70249 :     bool GetContext() const { return bContext; }
      79        6180 :     sal_uInt16 GetPropUpper() const { return nPropUpper; }
      80        6180 :     sal_uInt16 GetPropLower() const { return nPropLower; }
      81             : };
      82             : 
      83           6 : inline SvxULSpaceItem &SvxULSpaceItem::operator=( const SvxULSpaceItem &rCpy )
      84             : {
      85           6 :     nUpper = rCpy.GetUpper();
      86           6 :     nLower = rCpy.GetLower();
      87           6 :     bContext = rCpy.GetContext();
      88           6 :     nPropUpper = rCpy.GetPropUpper();
      89           6 :     nPropLower = rCpy.GetPropLower();
      90           6 :     return *this;
      91             : }
      92             : 
      93       20363 : inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp )
      94             : {
      95       20363 :     nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp;
      96       20363 : }
      97       28744 : inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nProp )
      98             : {
      99       28744 :     nLower = sal_uInt16((sal_uInt32(nL) * nProp ) / 100); nPropLower = nProp;
     100       28744 : }
     101             : 
     102             : #endif
     103             : 
     104             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10