xref: /aoo41x/main/editeng/inc/editeng/fhgtitem.hxx (revision 4c5491ea)
1*4c5491eaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*4c5491eaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*4c5491eaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*4c5491eaSAndrew Rist  * distributed with this work for additional information
6*4c5491eaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*4c5491eaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*4c5491eaSAndrew Rist  * "License"); you may not use this file except in compliance
9*4c5491eaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*4c5491eaSAndrew Rist  *
11*4c5491eaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*4c5491eaSAndrew Rist  *
13*4c5491eaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*4c5491eaSAndrew Rist  * software distributed under the License is distributed on an
15*4c5491eaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*4c5491eaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*4c5491eaSAndrew Rist  * specific language governing permissions and limitations
18*4c5491eaSAndrew Rist  * under the License.
19*4c5491eaSAndrew Rist  *
20*4c5491eaSAndrew Rist  *************************************************************/
21*4c5491eaSAndrew Rist 
22*4c5491eaSAndrew Rist 
23cdf0e10cSrcweir #ifndef _SVX_FHGTITEM_HXX
24cdf0e10cSrcweir #define _SVX_FHGTITEM_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir // include ---------------------------------------------------------------
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <svl/poolitem.hxx>
29cdf0e10cSrcweir #include <editeng/editengdllapi.h>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir class SvXMLUnitConverter;
32cdf0e10cSrcweir namespace rtl
33cdf0e10cSrcweir {
34cdf0e10cSrcweir 	class OUString;
35cdf0e10cSrcweir }
36cdf0e10cSrcweir 
37cdf0e10cSrcweir // class SvxFontHeightItem -----------------------------------------------
38cdf0e10cSrcweir 
39cdf0e10cSrcweir // Achtung: Twips-Werte
40cdf0e10cSrcweir 
41cdf0e10cSrcweir /*	[Beschreibung]
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 	Dieses Item beschreibt die Font-Hoehe.
44cdf0e10cSrcweir */
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #define	FONTHEIGHT_16_VERSION	((sal_uInt16)0x0001)
47cdf0e10cSrcweir #define	FONTHEIGHT_UNIT_VERSION	((sal_uInt16)0x0002)
48cdf0e10cSrcweir 
49cdf0e10cSrcweir class EDITENG_DLLPUBLIC SvxFontHeightItem : public SfxPoolItem
50cdf0e10cSrcweir {
51cdf0e10cSrcweir 	sal_uInt32	nHeight;
52cdf0e10cSrcweir 	sal_uInt16	nProp;				// default 100%
53cdf0e10cSrcweir 	SfxMapUnit ePropUnit;		// Percent, Twip, ...
54cdf0e10cSrcweir public:
55cdf0e10cSrcweir 	TYPEINFO();
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     SvxFontHeightItem( const sal_uLong nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/,
58cdf0e10cSrcweir                        const sal_uInt16 nId  );
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	// "pure virtual Methoden" vom SfxPoolItem
61cdf0e10cSrcweir 	virtual int 			 operator==( const SfxPoolItem& ) const;
62cdf0e10cSrcweir 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
63cdf0e10cSrcweir 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
66cdf0e10cSrcweir 									SfxMapUnit eCoreMetric,
67cdf0e10cSrcweir 									SfxMapUnit ePresMetric,
68cdf0e10cSrcweir                                     String &rText, const IntlWrapper * = 0 ) const;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	virtual SfxPoolItem*	 Clone( SfxItemPool *pPool = 0 ) const;
71cdf0e10cSrcweir 	virtual SfxPoolItem*     Create(SvStream &, sal_uInt16) const;
72cdf0e10cSrcweir 	virtual SvStream&		 Store(SvStream &, sal_uInt16 nItemVersion) const;
73cdf0e10cSrcweir 	virtual sal_uInt16			 GetVersion( sal_uInt16 nItemVersion) const;
74cdf0e10cSrcweir 	virtual int				 ScaleMetrics( long nMult, long nDiv );
75cdf0e10cSrcweir 	virtual	int				 HasMetrics() const;
76cdf0e10cSrcweir 
operator =(const SvxFontHeightItem & rSize)77cdf0e10cSrcweir 	inline SvxFontHeightItem& operator=(const SvxFontHeightItem& rSize)
78cdf0e10cSrcweir 		{
79cdf0e10cSrcweir 			SetHeightValue( rSize.GetHeight() );
80cdf0e10cSrcweir 			SetProp( rSize.GetProp(), ePropUnit );
81cdf0e10cSrcweir 			return *this;
82cdf0e10cSrcweir 		}
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100,
85cdf0e10cSrcweir 					 SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE );
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 	void SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
88cdf0e10cSrcweir 					 SfxMapUnit eUnit, SfxMapUnit eCoreUnit );
89cdf0e10cSrcweir 
GetHeight() const90cdf0e10cSrcweir 	sal_uInt32 GetHeight() const { return nHeight; }
91cdf0e10cSrcweir 
SetHeightValue(sal_uInt32 nNewHeight)92cdf0e10cSrcweir 	void SetHeightValue( sal_uInt32 nNewHeight )
93cdf0e10cSrcweir 		{
94cdf0e10cSrcweir 			DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
95cdf0e10cSrcweir 			nHeight = nNewHeight;
96cdf0e10cSrcweir 		}
97cdf0e10cSrcweir 
SetProp(const sal_uInt16 nNewProp,SfxMapUnit eUnit=SFX_MAPUNIT_RELATIVE)98cdf0e10cSrcweir 	void SetProp( const sal_uInt16 nNewProp,
99cdf0e10cSrcweir 					SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE )
100cdf0e10cSrcweir 		{
101cdf0e10cSrcweir 			DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
102cdf0e10cSrcweir 			nProp = nNewProp;
103cdf0e10cSrcweir 			ePropUnit = eUnit;
104cdf0e10cSrcweir 		}
105cdf0e10cSrcweir 
GetProp() const106cdf0e10cSrcweir 	sal_uInt16 GetProp() const { return nProp; }
107cdf0e10cSrcweir 
GetPropUnit() const108cdf0e10cSrcweir 	SfxMapUnit GetPropUnit() const { return ePropUnit;  }	// Percent, Twip, ...
109cdf0e10cSrcweir };
110cdf0e10cSrcweir 
111cdf0e10cSrcweir #endif
112cdf0e10cSrcweir 
113