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