LCOV - code coverage report
Current view: top level - libreoffice/sw/inc - fmtfsize.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 19 19 100.0 %
Date: 2012-12-27 Functions: 19 19 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 _FMTFSIZE_HXX
      20             : #define _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        7069 : class SW_DLLPUBLIC SwFmtFrmSize: public SfxPoolItem
      42             : {
      43             :     Size      aSize;
      44             :     SwFrmSize eFrmHeightType;
      45             :     SwFrmSize eFrmWidthType;
      46             :     sal_uInt8     nWidthPercent;
      47             :     sal_uInt8     nHeightPercent;
      48             : 
      49             :     // For tables: width can be given in percent.
      50             : 
      51             :     // For frames: height and/or width may be given in percent.
      52             :     // If only one of these percentage values is given, the value 0xFF
      53             :     // used instead of the missing percentage value indicates this side
      54             :     // being proportional to the given one.
      55             :     // The calculation in this case is based upon the values in Size.
      56             :     // Percentages are always related to the environment in which
      57             :     // the object is placed (PrtArea) and to the screen width
      58             :     // minus borders in BrowseView if the environment is the page.
      59             : 
      60             : 
      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 int             operator==( const SfxPoolItem& ) const;
      69             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
      70             :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
      71             :                                     SfxMapUnit eCoreMetric,
      72             :                                     SfxMapUnit ePresMetric,
      73             :                                     String &rText,
      74             :                                     const IntlWrapper*    pIntl = 0 ) const;
      75             :     virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
      76             :     virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
      77             : 
      78        3488 :     SwFrmSize GetHeightSizeType() const { return eFrmHeightType; }
      79          81 :     void SetHeightSizeType( SwFrmSize eSize ) { eFrmHeightType = eSize; }
      80             : 
      81         772 :     SwFrmSize GetWidthSizeType() const { return eFrmWidthType; }
      82          52 :     void SetWidthSizeType( SwFrmSize eSize ) { eFrmWidthType = eSize; }
      83             : 
      84       28042 :     const Size& GetSize() const { return aSize; }
      85         804 :           void  SetSize( const Size &rNew ) { aSize = rNew; }
      86             : 
      87        1340 :     SwTwips GetHeight() const { return aSize.Height(); }
      88        5516 :     SwTwips GetWidth()  const { return aSize.Width();  }
      89         170 :     void    SetHeight( const SwTwips nNew ) { aSize.Height() = nNew; }
      90         870 :     void    SetWidth ( const SwTwips nNew ) { aSize.Width()  = nNew; }
      91             : 
      92        3232 :     sal_uInt8    GetHeightPercent() const{ return nHeightPercent; }
      93        3382 :     sal_uInt8   GetWidthPercent() const { return nWidthPercent;  }
      94           4 :     void    SetHeightPercent( sal_uInt8 n ) { nHeightPercent = n; }
      95          51 :     void    SetWidthPercent ( sal_uInt8 n ) { nWidthPercent  = n; }
      96             : };
      97             : 
      98       13143 : inline const SwFmtFrmSize &SwAttrSet::GetFrmSize(sal_Bool bInP) const
      99       13143 :     { return (const SwFmtFrmSize&)Get( RES_FRM_SIZE,bInP); }
     100             : 
     101       10447 : inline const SwFmtFrmSize &SwFmt::GetFrmSize(sal_Bool bInP) const
     102       10447 :     { return aSet.GetFrmSize(bInP); }
     103             : 
     104             : #endif
     105             : 
     106             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10