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 _SVX_FHGTITEM_HXX 24 #define _SVX_FHGTITEM_HXX 25 26 // include --------------------------------------------------------------- 27 28 #include <svl/poolitem.hxx> 29 #include <editeng/editengdllapi.h> 30 31 class SvXMLUnitConverter; 32 namespace rtl 33 { 34 class OUString; 35 } 36 37 // class SvxFontHeightItem ----------------------------------------------- 38 39 // Achtung: Twips-Werte 40 41 /* [Beschreibung] 42 43 Dieses Item beschreibt die Font-Hoehe. 44 */ 45 46 #define FONTHEIGHT_16_VERSION ((sal_uInt16)0x0001) 47 #define FONTHEIGHT_UNIT_VERSION ((sal_uInt16)0x0002) 48 49 class EDITENG_DLLPUBLIC SvxFontHeightItem : public SfxPoolItem 50 { 51 sal_uInt32 nHeight; 52 sal_uInt16 nProp; // default 100% 53 SfxMapUnit ePropUnit; // Percent, Twip, ... 54 public: 55 TYPEINFO(); 56 57 SvxFontHeightItem( const sal_uLong nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/, 58 const sal_uInt16 nId ); 59 60 // "pure virtual Methoden" vom SfxPoolItem 61 virtual int operator==( const SfxPoolItem& ) const; 62 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 63 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 64 65 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 66 SfxMapUnit eCoreMetric, 67 SfxMapUnit ePresMetric, 68 String &rText, const IntlWrapper * = 0 ) const; 69 70 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 71 virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; 72 virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; 73 virtual sal_uInt16 GetVersion( sal_uInt16 nItemVersion) const; 74 virtual int ScaleMetrics( long nMult, long nDiv ); 75 virtual int HasMetrics() const; 76 operator =(const SvxFontHeightItem & rSize)77 inline SvxFontHeightItem& operator=(const SvxFontHeightItem& rSize) 78 { 79 SetHeightValue( rSize.GetHeight() ); 80 SetProp( rSize.GetProp(), ePropUnit ); 81 return *this; 82 } 83 84 void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100, 85 SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE ); 86 87 void SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp, 88 SfxMapUnit eUnit, SfxMapUnit eCoreUnit ); 89 GetHeight() const90 sal_uInt32 GetHeight() const { return nHeight; } 91 SetHeightValue(sal_uInt32 nNewHeight)92 void SetHeightValue( sal_uInt32 nNewHeight ) 93 { 94 DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); 95 nHeight = nNewHeight; 96 } 97 SetProp(const sal_uInt16 nNewProp,SfxMapUnit eUnit=SFX_MAPUNIT_RELATIVE)98 void SetProp( const sal_uInt16 nNewProp, 99 SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE ) 100 { 101 DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); 102 nProp = nNewProp; 103 ePropUnit = eUnit; 104 } 105 GetProp() const106 sal_uInt16 GetProp() const { return nProp; } 107 GetPropUnit() const108 SfxMapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ... 109 }; 110 111 #endif 112 113