update credits
[LibreOffice.git] / sw / inc / fmtfsize.hxx
blob2cd26ba0e9abecaf3144928dfde18062ea836b51
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef _FMTFSIZE_HXX
20 #define _FMTFSIZE_HXX
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>
29 class IntlWrapper;
31 //Frame size.
33 enum SwFrmSize
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). */
41 class SW_DLLPUBLIC SwFmtFrmSize: public SfxPoolItem
43 Size aSize;
44 SwFrmSize eFrmHeightType;
45 SwFrmSize eFrmWidthType;
46 sal_uInt8 nWidthPercent;
47 sal_uInt8 nHeightPercent;
49 // For tables: width can be given in percent.
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.
62 public:
63 SwFmtFrmSize( SwFrmSize eSize = ATT_VAR_SIZE,
64 SwTwips nWidth = 0, SwTwips nHeight = 0 );
65 SwFmtFrmSize& operator=( const SwFmtFrmSize& rCpy );
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 OUString &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 );
78 SwFrmSize GetHeightSizeType() const { return eFrmHeightType; }
79 void SetHeightSizeType( SwFrmSize eSize ) { eFrmHeightType = eSize; }
81 SwFrmSize GetWidthSizeType() const { return eFrmWidthType; }
82 void SetWidthSizeType( SwFrmSize eSize ) { eFrmWidthType = eSize; }
84 const Size& GetSize() const { return aSize; }
85 void SetSize( const Size &rNew ) { aSize = rNew; }
87 SwTwips GetHeight() const { return aSize.Height(); }
88 SwTwips GetWidth() const { return aSize.Width(); }
89 void SetHeight( const SwTwips nNew ) { aSize.Height() = nNew; }
90 void SetWidth ( const SwTwips nNew ) { aSize.Width() = nNew; }
92 sal_uInt8 GetHeightPercent() const{ return nHeightPercent; }
93 sal_uInt8 GetWidthPercent() const { return nWidthPercent; }
94 void SetHeightPercent( sal_uInt8 n ) { nHeightPercent = n; }
95 void SetWidthPercent ( sal_uInt8 n ) { nWidthPercent = n; }
98 inline const SwFmtFrmSize &SwAttrSet::GetFrmSize(sal_Bool bInP) const
99 { return (const SwFmtFrmSize&)Get( RES_FRM_SIZE,bInP); }
101 inline const SwFmtFrmSize &SwFmt::GetFrmSize(sal_Bool bInP) const
102 { return aSet.GetFrmSize(bInP); }
104 #endif
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */