LCOV - code coverage report
Current view: top level - sw/inc - fmtfsize.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 23 23 100.0 %
Date: 2014-11-03 Functions: 23 23 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_SW_INC_FMTFSIZE_HXX
      20             : #define INCLUDED_SW_INC_FMTFSIZE_HXX
      21             : 
      22             : #include <tools/gen.hxx>
      23             : #include <svl/poolitem.hxx>
      24             : #include "swdllapi.h"
      25             : #include <hintids.hxx>
      26             : #include <swtypes.hxx>
      27             : #include <format.hxx>
      28             : 
      29             : class IntlWrapper;
      30             : 
      31             : //Frame size.
      32             : 
      33             : enum SwFrmSize
      34             : {
      35             :     ATT_VAR_SIZE,       ///< Frame is variable in Var-direction.
      36             :     ATT_FIX_SIZE,       ///< Frame cannot be moved in Var-direction.
      37             :     ATT_MIN_SIZE        /**< Value in Var-direction gives minimum
      38             :                          (can be exceeded but not be less). */
      39             : };
      40             : 
      41      217398 : class SW_DLLPUBLIC SwFmtFrmSize: public SfxPoolItem
      42             : {
      43             :     Size      m_aSize;
      44             :     SwFrmSize m_eFrmHeightType;
      45             :     SwFrmSize m_eFrmWidthType;
      46             :     sal_uInt8 m_nWidthPercent;
      47             :     sal_Int16 m_eWidthPercentRelation;
      48             :     sal_uInt8 m_nHeightPercent;
      49             :     sal_Int16 m_eHeightPercentRelation;
      50             : 
      51             :     // For tables: width can be given in percent.
      52             : 
      53             :     // For frames: height and/or width may be given in percent.
      54             :     // If only one of these percentage values is given, the value 0xFF
      55             :     // used instead of the missing percentage value indicates this side
      56             :     // being proportional to the given one.
      57             :     // The calculation in this case is based upon the values in Size.
      58             :     // Percentages are always related to the environment in which
      59             :     // the object is placed (PrtArea) and to the screen width
      60             :     // minus borders in BrowseView if the environment is the page.
      61             : 
      62             : public:
      63             :     SwFmtFrmSize( SwFrmSize eSize = ATT_VAR_SIZE,
      64             :                   SwTwips nWidth = 0, SwTwips nHeight = 0 );
      65             :     SwFmtFrmSize& operator=( const SwFmtFrmSize& rCpy );
      66             : 
      67             :     /// "Pure virtual methods" of SfxPoolItem.
      68             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
      69             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
      70             :     virtual bool GetPresentation( SfxItemPresentation ePres,
      71             :                                     SfxMapUnit eCoreMetric,
      72             :                                     SfxMapUnit ePresMetric,
      73             :                                     OUString &rText,
      74             :                                     const IntlWrapper*    pIntl = 0 ) const SAL_OVERRIDE;
      75             :     virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
      76             :     virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
      77             : 
      78      165018 :     SwFrmSize GetHeightSizeType() const { return m_eFrmHeightType; }
      79        6214 :     void SetHeightSizeType( SwFrmSize eSize ) { m_eFrmHeightType = eSize; }
      80             : 
      81       27475 :     SwFrmSize GetWidthSizeType() const { return m_eFrmWidthType; }
      82         448 :     void SetWidthSizeType( SwFrmSize eSize ) { m_eFrmWidthType = eSize; }
      83             : 
      84     1176163 :     const Size& GetSize() const { return m_aSize; }
      85       20088 :           void  SetSize( const Size &rNew ) { m_aSize = rNew; }
      86             : 
      87       70230 :     SwTwips GetHeight() const { return m_aSize.Height(); }
      88      243720 :     SwTwips GetWidth()  const { return m_aSize.Width();  }
      89         700 :     void    SetHeight( const SwTwips nNew ) { m_aSize.Height() = nNew; }
      90       16152 :     void    SetWidth ( const SwTwips nNew ) { m_aSize.Width()  = nNew; }
      91             : 
      92      132462 :     sal_uInt8    GetHeightPercent() const{ return m_nHeightPercent; }
      93      113766 :     sal_Int16   GetHeightPercentRelation() const { return m_eHeightPercentRelation;  }
      94      141146 :     sal_uInt8   GetWidthPercent() const { return m_nWidthPercent;  }
      95      113774 :     sal_Int16   GetWidthPercentRelation() const { return m_eWidthPercentRelation;  }
      96         496 :     void    SetHeightPercent( sal_uInt8 n ) { m_nHeightPercent = n; }
      97          18 :     void    SetHeightPercentRelation ( sal_Int16 n ) { m_eHeightPercentRelation  = n; }
      98        1690 :     void    SetWidthPercent ( sal_uInt8 n ) { m_nWidthPercent  = n; }
      99          18 :     void    SetWidthPercentRelation ( sal_Int16 n ) { m_eWidthPercentRelation  = n; }
     100             : };
     101             : 
     102      653152 : inline const SwFmtFrmSize &SwAttrSet::GetFrmSize(bool bInP) const
     103      653152 :     { return (const SwFmtFrmSize&)Get( RES_FRM_SIZE,bInP); }
     104             : 
     105      482713 : inline const SwFmtFrmSize &SwFmt::GetFrmSize(bool bInP) const
     106      482713 :     { return aSet.GetFrmSize(bInP); }
     107             : 
     108             : #endif
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10