1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*1d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*1d2dbeb0SAndrew Rist * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*1d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at
10*1d2dbeb0SAndrew Rist *
11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*1d2dbeb0SAndrew Rist *
13*1d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the
17*1d2dbeb0SAndrew Rist * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist * under the License.
19*1d2dbeb0SAndrew Rist *
20*1d2dbeb0SAndrew Rist *************************************************************/
21*1d2dbeb0SAndrew Rist
22*1d2dbeb0SAndrew Rist
23cdf0e10cSrcweir #ifndef _FMTFSIZE_HXX
24cdf0e10cSrcweir #define _FMTFSIZE_HXX
25cdf0e10cSrcweir
26cdf0e10cSrcweir #include <tools/gen.hxx>
27cdf0e10cSrcweir #include <svl/poolitem.hxx>
28cdf0e10cSrcweir #include "swdllapi.h"
29cdf0e10cSrcweir #include <hintids.hxx>
30cdf0e10cSrcweir #include <swtypes.hxx>
31cdf0e10cSrcweir #include <format.hxx>
32cdf0e10cSrcweir
33cdf0e10cSrcweir class IntlWrapper;
34cdf0e10cSrcweir
35cdf0e10cSrcweir //Die Framesize ---------------------------------
36cdf0e10cSrcweir
37cdf0e10cSrcweir enum SwFrmSize
38cdf0e10cSrcweir {
39cdf0e10cSrcweir ATT_VAR_SIZE, //Frm ist in der Var-Richtung variabel
40cdf0e10cSrcweir ATT_FIX_SIZE, //Frm ist in der Var-Richtung unbeweglich
41cdf0e10cSrcweir ATT_MIN_SIZE //Der Wert in der Var-Richtung beschreibt eine
42cdf0e10cSrcweir //Minimalgroesse, die nicht unter- wohl aber
43cdf0e10cSrcweir //ueberschritten werden kann.
44cdf0e10cSrcweir };
45cdf0e10cSrcweir
46cdf0e10cSrcweir class SW_DLLPUBLIC SwFmtFrmSize: public SfxPoolItem
47cdf0e10cSrcweir {
48cdf0e10cSrcweir Size aSize;
49cdf0e10cSrcweir SwFrmSize eFrmHeightType;
50cdf0e10cSrcweir SwFrmSize eFrmWidthType;
51cdf0e10cSrcweir sal_uInt8 nWidthPercent; //Fuer Tabellen kann die Breite in Prozent
52cdf0e10cSrcweir sal_uInt8 nHeightPercent; //angegeben sein.
53cdf0e10cSrcweir //Fuer Rahmen koennen Hoehe und/oder Breite
54cdf0e10cSrcweir //in Prozent angegeben sein. Wenn nur eine
55cdf0e10cSrcweir //der Angaben in Prozent angeben ist, kann
56cdf0e10cSrcweir //durch den ausgezeichneten Wert 0xFF in der
57cdf0e10cSrcweir //anderen Prozentangabe bestimmt werden, das
58cdf0e10cSrcweir //sich diese Richtung proportional zur anderen
59cdf0e10cSrcweir //verhaelt. Basis fuer die Umrechnung sind fuer
60cdf0e10cSrcweir //diesen Fall die Angaben in der Size.
61cdf0e10cSrcweir //Die Prozentwerte beziehen sich immer auf die
62cdf0e10cSrcweir //Umgebung in der das Objekt steht (PrtArea)
63cdf0e10cSrcweir //Auf die Bildschirmbreite abzueglich Raender
64cdf0e10cSrcweir //in der BrowseView wenn die Umgebung die Seite
65cdf0e10cSrcweir //ist.
66cdf0e10cSrcweir public:
67cdf0e10cSrcweir SwFmtFrmSize( SwFrmSize eSize = ATT_VAR_SIZE,
68cdf0e10cSrcweir SwTwips nWidth = 0, SwTwips nHeight = 0 );
69cdf0e10cSrcweir SwFmtFrmSize& operator=( const SwFmtFrmSize& rCpy );
70cdf0e10cSrcweir
71cdf0e10cSrcweir // "pure virtual Methoden" vom SfxPoolItem
72cdf0e10cSrcweir virtual int operator==( const SfxPoolItem& ) const;
73cdf0e10cSrcweir virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
74cdf0e10cSrcweir virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
75cdf0e10cSrcweir SfxMapUnit eCoreMetric,
76cdf0e10cSrcweir SfxMapUnit ePresMetric,
77cdf0e10cSrcweir String &rText,
78cdf0e10cSrcweir const IntlWrapper* pIntl = 0 ) const;
79cdf0e10cSrcweir virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
80cdf0e10cSrcweir virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
81cdf0e10cSrcweir
GetHeightSizeType() const82cdf0e10cSrcweir SwFrmSize GetHeightSizeType() const { return eFrmHeightType; }
SetHeightSizeType(SwFrmSize eSize)83cdf0e10cSrcweir void SetHeightSizeType( SwFrmSize eSize ) { eFrmHeightType = eSize; }
84cdf0e10cSrcweir
GetWidthSizeType() const85cdf0e10cSrcweir SwFrmSize GetWidthSizeType() const { return eFrmWidthType; }
SetWidthSizeType(SwFrmSize eSize)86cdf0e10cSrcweir void SetWidthSizeType( SwFrmSize eSize ) { eFrmWidthType = eSize; }
87cdf0e10cSrcweir
GetSize() const88cdf0e10cSrcweir const Size& GetSize() const { return aSize; }
SetSize(const Size & rNew)89cdf0e10cSrcweir void SetSize( const Size &rNew ) { aSize = rNew; }
90cdf0e10cSrcweir
GetHeight() const91cdf0e10cSrcweir SwTwips GetHeight() const { return aSize.Height(); }
GetWidth() const92cdf0e10cSrcweir SwTwips GetWidth() const { return aSize.Width(); }
SetHeight(const SwTwips nNew)93cdf0e10cSrcweir void SetHeight( const SwTwips nNew ) { aSize.Height() = nNew; }
SetWidth(const SwTwips nNew)94cdf0e10cSrcweir void SetWidth ( const SwTwips nNew ) { aSize.Width() = nNew; }
95cdf0e10cSrcweir
GetHeightPercent() const96cdf0e10cSrcweir sal_uInt8 GetHeightPercent() const{ return nHeightPercent; }
GetWidthPercent() const97cdf0e10cSrcweir sal_uInt8 GetWidthPercent() const { return nWidthPercent; }
SetHeightPercent(sal_uInt8 n)98cdf0e10cSrcweir void SetHeightPercent( sal_uInt8 n ) { nHeightPercent = n; }
SetWidthPercent(sal_uInt8 n)99cdf0e10cSrcweir void SetWidthPercent ( sal_uInt8 n ) { nWidthPercent = n; }
100cdf0e10cSrcweir };
101cdf0e10cSrcweir
GetFrmSize(sal_Bool bInP) const102cdf0e10cSrcweir inline const SwFmtFrmSize &SwAttrSet::GetFrmSize(sal_Bool bInP) const
103cdf0e10cSrcweir { return (const SwFmtFrmSize&)Get( RES_FRM_SIZE,bInP); }
104cdf0e10cSrcweir
GetFrmSize(sal_Bool bInP) const105cdf0e10cSrcweir inline const SwFmtFrmSize &SwFmt::GetFrmSize(sal_Bool bInP) const
106cdf0e10cSrcweir { return aSet.GetFrmSize(bInP); }
107cdf0e10cSrcweir
108cdf0e10cSrcweir #endif
109cdf0e10cSrcweir
110