LCOV - code coverage report
Current view: top level - sw/inc - fmtfsize.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 23 23 100.0 %
Date: 2015-06-13 12:38:46 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      191109 : class SW_DLLPUBLIC SwFormatFrmSize: 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             :     SwFormatFrmSize( SwFrmSize eSize = ATT_VAR_SIZE,
      64             :                   SwTwips nWidth = 0, SwTwips nHeight = 0 );
      65             :     SwFormatFrmSize& operator=( const SwFormatFrmSize& 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       88432 :     SwFrmSize GetHeightSizeType() const { return m_eFrmHeightType; }
      79        3653 :     void SetHeightSizeType( SwFrmSize eSize ) { m_eFrmHeightType = eSize; }
      80             : 
      81       14314 :     SwFrmSize GetWidthSizeType() const { return m_eFrmWidthType; }
      82         331 :     void SetWidthSizeType( SwFrmSize eSize ) { m_eFrmWidthType = eSize; }
      83             : 
      84      936496 :     const Size& GetSize() const { return m_aSize; }
      85       78440 :           void  SetSize( const Size &rNew ) { m_aSize = rNew; }
      86             : 
      87       33897 :     SwTwips GetHeight() const { return m_aSize.Height(); }
      88      139783 :     SwTwips GetWidth()  const { return m_aSize.Width();  }
      89         446 :     void    SetHeight( const SwTwips nNew ) { m_aSize.Height() = nNew; }
      90        9081 :     void    SetWidth ( const SwTwips nNew ) { m_aSize.Width()  = nNew; }
      91             : 
      92      338852 :     sal_uInt8    GetHeightPercent() const{ return m_nHeightPercent; }
      93      328762 :     sal_Int16   GetHeightPercentRelation() const { return m_eHeightPercentRelation;  }
      94      345052 :     sal_uInt8   GetWidthPercent() const { return m_nWidthPercent;  }
      95      328764 :     sal_Int16   GetWidthPercentRelation() const { return m_eWidthPercentRelation;  }
      96         380 :     void    SetHeightPercent( sal_uInt8 n ) { m_nHeightPercent = n; }
      97           9 :     void    SetHeightPercentRelation ( sal_Int16 n ) { m_eHeightPercentRelation  = n; }
      98        1099 :     void    SetWidthPercent ( sal_uInt8 n ) { m_nWidthPercent  = n; }
      99           9 :     void    SetWidthPercentRelation ( sal_Int16 n ) { m_eWidthPercentRelation  = n; }
     100             : 
     101             :     void dumpAsXml(struct _xmlTextWriter* pWriter) const SAL_OVERRIDE;
     102             : };
     103             : 
     104      354130 : inline const SwFormatFrmSize &SwAttrSet::GetFrmSize(bool bInP) const
     105      354130 :     { return static_cast<const SwFormatFrmSize&>(Get( RES_FRM_SIZE,bInP)); }
     106             : 
     107      272640 : inline const SwFormatFrmSize &SwFormat::GetFrmSize(bool bInP) const
     108      272640 :     { return m_aSet.GetFrmSize(bInP); }
     109             : 
     110             : #endif
     111             : 
     112             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11