LCOV - code coverage report
Current view: top level - include/editeng - fhgtitem.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 15 15 100.0 %
Date: 2014-04-11 Functions: 9 9 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             : #ifndef INCLUDED_EDITENG_FHGTITEM_HXX
      20             : #define INCLUDED_EDITENG_FHGTITEM_HXX
      21             : 
      22             : #include <svl/poolitem.hxx>
      23             : #include <editeng/editengdllapi.h>
      24             : 
      25             : class SvXMLUnitConverter;
      26             : 
      27             : // class SvxFontHeightItem -----------------------------------------------
      28             : 
      29             : // Warning: twips values
      30             : 
      31             : /*  [Description]
      32             : 
      33             :     This item describes the font height
      34             : */
      35             : 
      36             : #define FONTHEIGHT_16_VERSION   ((sal_uInt16)0x0001)
      37             : #define FONTHEIGHT_UNIT_VERSION ((sal_uInt16)0x0002)
      38             : 
      39      888180 : class EDITENG_DLLPUBLIC SvxFontHeightItem : public SfxPoolItem
      40             : {
      41             :     sal_uInt32  nHeight;
      42             :     sal_uInt16  nProp;              // default 100%
      43             :     SfxMapUnit ePropUnit;       // Percent, Twip, ...
      44             : public:
      45             :     TYPEINFO_OVERRIDE();
      46             : 
      47             :     SvxFontHeightItem( const sal_uLong nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/,
      48             :                        const sal_uInt16 nId  );
      49             : 
      50             :     // "pure virtual Methods" from SfxPoolItem
      51             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
      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 nItemVersion) const SAL_OVERRIDE;
      64             :     virtual bool                 ScaleMetrics( long nMult, long nDiv ) SAL_OVERRIDE;
      65             :     virtual bool                 HasMetrics() const SAL_OVERRIDE;
      66             : 
      67         822 :     inline SvxFontHeightItem& operator=(const SvxFontHeightItem& rSize)
      68             :         {
      69         822 :             SetHeightValue( rSize.GetHeight() );
      70         822 :             SetProp( rSize.GetProp(), ePropUnit );
      71         822 :             return *this;
      72             :         }
      73             : 
      74             :     void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100,
      75             :                      SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE );
      76             : 
      77             :     void SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
      78             :                      SfxMapUnit eUnit, SfxMapUnit eCoreUnit );
      79             : 
      80     4287806 :     sal_uInt32 GetHeight() const { return nHeight; }
      81             : 
      82         822 :     void SetHeightValue( sal_uInt32 nNewHeight )
      83             :         {
      84             :             DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
      85         822 :             nHeight = nNewHeight;
      86         822 :         }
      87             : 
      88        1590 :     void SetProp( const sal_uInt16 nNewProp,
      89             :                     SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE )
      90             :         {
      91             :             DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
      92        1590 :             nProp = nNewProp;
      93        1590 :             ePropUnit = eUnit;
      94        1590 :         }
      95             : 
      96      724807 :     sal_uInt16 GetProp() const { return nProp; }
      97             : 
      98      723917 :     SfxMapUnit GetPropUnit() const { return ePropUnit;  }   // Percent, Twip, ...
      99             : };
     100             : 
     101             : #endif
     102             : 
     103             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10