merge the formfield patch from ooo-build
[ooovba.git] / sw / inc / fmtfsize.hxx
blob7cf2338e241e952e6c5f8713b7e5b30b2ce1bc49
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fmtfsize.hxx,v $
10 * $Revision: 1.13 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _FMTFSIZE_HXX
31 #define _FMTFSIZE_HXX
33 #include <tools/gen.hxx>
34 #include <svtools/poolitem.hxx>
35 #include "swdllapi.h"
36 #include <hintids.hxx>
37 #include <swtypes.hxx>
38 #include <format.hxx>
40 class IntlWrapper;
42 //Die Framesize ---------------------------------
44 enum SwFrmSize
46 ATT_VAR_SIZE, //Frm ist in der Var-Richtung variabel
47 ATT_FIX_SIZE, //Frm ist in der Var-Richtung unbeweglich
48 ATT_MIN_SIZE //Der Wert in der Var-Richtung beschreibt eine
49 //Minimalgroesse, die nicht unter- wohl aber
50 //ueberschritten werden kann.
53 class SW_DLLPUBLIC SwFmtFrmSize: public SfxPoolItem
55 Size aSize;
56 SwFrmSize eFrmHeightType;
57 SwFrmSize eFrmWidthType;
58 BYTE nWidthPercent; //Fuer Tabellen kann die Breite in Prozent
59 BYTE nHeightPercent; //angegeben sein.
60 //Fuer Rahmen koennen Hoehe und/oder Breite
61 //in Prozent angegeben sein. Wenn nur eine
62 //der Angaben in Prozent angeben ist, kann
63 //durch den ausgezeichneten Wert 0xFF in der
64 //anderen Prozentangabe bestimmt werden, das
65 //sich diese Richtung proportional zur anderen
66 //verhaelt. Basis fuer die Umrechnung sind fuer
67 //diesen Fall die Angaben in der Size.
68 //Die Prozentwerte beziehen sich immer auf die
69 //Umgebung in der das Objekt steht (PrtArea)
70 //Auf die Bildschirmbreite abzueglich Raender
71 //in der BrowseView wenn die Umgebung die Seite
72 //ist.
73 public:
74 SwFmtFrmSize( SwFrmSize eSize = ATT_VAR_SIZE,
75 SwTwips nWidth = 0, SwTwips nHeight = 0 );
76 SwFmtFrmSize& operator=( const SwFmtFrmSize& rCpy );
78 // "pure virtual Methoden" vom SfxPoolItem
79 virtual int operator==( const SfxPoolItem& ) const;
80 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
81 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
82 SfxMapUnit eCoreMetric,
83 SfxMapUnit ePresMetric,
84 String &rText,
85 const IntlWrapper* pIntl = 0 ) const;
86 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const;
87 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 );
89 SwFrmSize GetHeightSizeType() const { return eFrmHeightType; }
90 void SetHeightSizeType( SwFrmSize eSize ) { eFrmHeightType = eSize; }
92 SwFrmSize GetWidthSizeType() const { return eFrmWidthType; }
93 void SetWidthSizeType( SwFrmSize eSize ) { eFrmWidthType = eSize; }
95 const Size& GetSize() const { return aSize; }
96 void SetSize( const Size &rNew ) { aSize = rNew; }
98 SwTwips GetHeight() const { return aSize.Height(); }
99 SwTwips GetWidth() const { return aSize.Width(); }
100 void SetHeight( const SwTwips nNew ) { aSize.Height() = nNew; }
101 void SetWidth ( const SwTwips nNew ) { aSize.Width() = nNew; }
103 BYTE GetHeightPercent() const{ return nHeightPercent; }
104 BYTE GetWidthPercent() const { return nWidthPercent; }
105 void SetHeightPercent( BYTE n ) { nHeightPercent = n; }
106 void SetWidthPercent ( BYTE n ) { nWidthPercent = n; }
109 inline const SwFmtFrmSize &SwAttrSet::GetFrmSize(BOOL bInP) const
110 { return (const SwFmtFrmSize&)Get( RES_FRM_SIZE,bInP); }
112 inline const SwFmtFrmSize &SwFmt::GetFrmSize(BOOL bInP) const
113 { return aSet.GetFrmSize(bInP); }
115 #endif