LCOV - code coverage report
Current view: top level - include/editeng - adjustitem.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 33 35 94.3 %
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_ADJUSTITEM_HXX
      20             : #define INCLUDED_EDITENG_ADJUSTITEM_HXX
      21             : 
      22             : #include <svl/eitem.hxx>
      23             : #include <editeng/svxenum.hxx>
      24             : #include <editeng/eeitem.hxx>
      25             : #include <editeng/editengdllapi.h>
      26             : 
      27             : class SvXMLUnitConverter;
      28             : 
      29             : // class SvxAdjustItem ---------------------------------------------------
      30             : 
      31             : /*
      32             : [Description]
      33             : This item describes the row orientation.
      34             : */
      35             : #define ADJUST_LASTBLOCK_VERSION        ((sal_uInt16)0x0001)
      36             : 
      37      105361 : class EDITENG_DLLPUBLIC SvxAdjustItem : public SfxEnumItemInterface
      38             : {
      39             :     bool    bLeft      : 1;
      40             :     bool    bRight     : 1;
      41             :     bool    bCenter    : 1;
      42             :     bool    bBlock     : 1;
      43             : 
      44             :     // only activ when bBlock
      45             :     bool    bOneBlock : 1;
      46             :     bool    bLastCenter : 1;
      47             :     bool    bLastBlock : 1;
      48             : 
      49             :     friend SvStream& WriteSvxAdjustItem( SvStream&, SvxAdjustItem& ); //$ ostream
      50             : public:
      51             :     TYPEINFO_OVERRIDE();
      52             : 
      53             :     SvxAdjustItem( const SvxAdjust eAdjst /*= SVX_ADJUST_LEFT*/,
      54             :                    const sal_uInt16 nId );
      55             : 
      56             :     // "pure virtual Methods" from SfxPoolItem
      57             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
      58             : 
      59             :     virtual bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
      60             :     virtual bool            PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
      61             : 
      62             :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
      63             :                                     SfxMapUnit eCoreMetric,
      64             :                                     SfxMapUnit ePresMetric,
      65             :                                     OUString &rText, const IntlWrapper * = 0 ) const SAL_OVERRIDE;
      66             :     virtual sal_uInt16       GetValueCount() const SAL_OVERRIDE;
      67             :     virtual OUString    GetValueTextByPos( sal_uInt16 nPos ) const SAL_OVERRIDE;
      68             :     virtual sal_uInt16       GetEnumValue() const SAL_OVERRIDE;
      69             :     virtual void             SetEnumValue( sal_uInt16 nNewVal ) SAL_OVERRIDE;
      70             :     virtual SfxPoolItem*     Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
      71             :     virtual SfxPoolItem*     Create(SvStream &, sal_uInt16) const SAL_OVERRIDE;
      72             :     virtual SvStream&        Store(SvStream &, sal_uInt16 nItemVersion ) const SAL_OVERRIDE;
      73             :     virtual sal_uInt16       GetVersion( sal_uInt16 nFileVersion ) const SAL_OVERRIDE;
      74             : 
      75         256 :     inline void SetOneWord( const SvxAdjust eType )
      76             :     {
      77         256 :         bOneBlock  = eType == SVX_ADJUST_BLOCK;
      78         256 :     }
      79             : 
      80        6689 :     inline void SetLastBlock( const SvxAdjust eType )
      81             :     {
      82        6689 :         bLastBlock = eType == SVX_ADJUST_BLOCK;
      83        6689 :         bLastCenter = eType == SVX_ADJUST_CENTER;
      84        6689 :     }
      85             : 
      86       38734 :     inline void SetAdjust( const SvxAdjust eType )
      87             :     {
      88       38734 :         bLeft = eType == SVX_ADJUST_LEFT;
      89       38734 :         bRight = eType == SVX_ADJUST_RIGHT;
      90       38734 :         bCenter = eType == SVX_ADJUST_CENTER;
      91       38734 :         bBlock = eType == SVX_ADJUST_BLOCK;
      92       38734 :     }
      93             : 
      94      224932 :     inline SvxAdjust GetLastBlock() const
      95             :     {
      96      224932 :         SvxAdjust eRet = SVX_ADJUST_LEFT;
      97             : 
      98      224932 :         if ( bLastBlock )
      99          10 :             eRet = SVX_ADJUST_BLOCK;
     100      224922 :         else if( bLastCenter )
     101           0 :             eRet = SVX_ADJUST_CENTER;
     102      224932 :         return eRet;
     103             :     }
     104             : 
     105      112458 :     inline SvxAdjust GetOneWord() const
     106             :     {
     107      112458 :         SvxAdjust eRet = SVX_ADJUST_LEFT;
     108             : 
     109      112458 :         if ( bBlock && bOneBlock )
     110           0 :             eRet = SVX_ADJUST_BLOCK;
     111      112458 :         return eRet;
     112             :     }
     113             : 
     114      875522 :     inline SvxAdjust GetAdjust() const
     115             :     {
     116      875522 :         SvxAdjust eRet = SVX_ADJUST_LEFT;
     117             : 
     118      875522 :         if ( bRight )
     119       23691 :             eRet = SVX_ADJUST_RIGHT;
     120      851831 :         else if ( bCenter )
     121      141703 :             eRet = SVX_ADJUST_CENTER;
     122      710128 :         else if ( bBlock )
     123       41365 :             eRet = SVX_ADJUST_BLOCK;
     124      875522 :         return eRet;
     125             :     }
     126             : };
     127             : 
     128             : #endif
     129             : 
     130             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10