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