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_FWDTITEM_HXX 24cdf0e10cSrcweir #define _SVX_FWDTITEM_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir // include --------------------------------------------------------------- 27cdf0e10cSrcweir 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <svl/poolitem.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir 32cdf0e10cSrcweir // class SvxFontWidthItem ----------------------------------------------- 33cdf0e10cSrcweir 34cdf0e10cSrcweir 35cdf0e10cSrcweir /* [Beschreibung] 36cdf0e10cSrcweir 37cdf0e10cSrcweir Dieses Item beschreibt die Font-Breite. 38cdf0e10cSrcweir */ 39cdf0e10cSrcweir 40cdf0e10cSrcweir class SvxFontWidthItem : public SfxPoolItem 41cdf0e10cSrcweir { 42cdf0e10cSrcweir sal_uInt16 nWidth; // 0 = default 43cdf0e10cSrcweir sal_uInt16 nProp; // default 100% 44cdf0e10cSrcweir public: 45cdf0e10cSrcweir TYPEINFO(); 46cdf0e10cSrcweir 47cdf0e10cSrcweir SvxFontWidthItem( const sal_uInt16 nSz /*= 0*/, 48cdf0e10cSrcweir const sal_uInt16 nPropWidth /*= 100*/, 49cdf0e10cSrcweir const sal_uInt16 nId ); 50cdf0e10cSrcweir 51cdf0e10cSrcweir // "pure virtual Methoden" vom SfxPoolItem 52cdf0e10cSrcweir virtual int operator==( const SfxPoolItem& ) const; 53cdf0e10cSrcweir virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 54cdf0e10cSrcweir virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 55cdf0e10cSrcweir 56cdf0e10cSrcweir virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 57cdf0e10cSrcweir SfxMapUnit eCoreMetric, 58cdf0e10cSrcweir SfxMapUnit ePresMetric, 59cdf0e10cSrcweir String &rText, const IntlWrapper * = 0 ) const; 60cdf0e10cSrcweir 61cdf0e10cSrcweir virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 62cdf0e10cSrcweir virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; 63cdf0e10cSrcweir virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; 64cdf0e10cSrcweir virtual int ScaleMetrics( long nMult, long nDiv ); 65cdf0e10cSrcweir virtual int HasMetrics() const; 66cdf0e10cSrcweir operator =(const SvxFontWidthItem & rItem)67cdf0e10cSrcweir inline SvxFontWidthItem& operator=(const SvxFontWidthItem& rItem ) 68cdf0e10cSrcweir { 69cdf0e10cSrcweir SetWidthValue( rItem.GetWidth() ); 70cdf0e10cSrcweir SetProp( rItem.GetProp() ); 71cdf0e10cSrcweir return *this; 72cdf0e10cSrcweir } 73cdf0e10cSrcweir SetWidth(sal_uInt16 nNewWidth,const sal_uInt16 nNewProp=100)74cdf0e10cSrcweir void SetWidth( sal_uInt16 nNewWidth, const sal_uInt16 nNewProp = 100 ) 75cdf0e10cSrcweir { 76cdf0e10cSrcweir DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); 77cdf0e10cSrcweir nWidth = sal_uInt16(( (sal_uInt32)nNewWidth * nNewProp ) / 100 ); 78cdf0e10cSrcweir nProp = nNewProp; 79cdf0e10cSrcweir } 80cdf0e10cSrcweir GetWidth() const81cdf0e10cSrcweir sal_uInt16 GetWidth() const { return nWidth; } 82cdf0e10cSrcweir SetWidthValue(sal_uInt16 nNewWidth)83cdf0e10cSrcweir void SetWidthValue( sal_uInt16 nNewWidth ) 84cdf0e10cSrcweir { 85cdf0e10cSrcweir DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); 86cdf0e10cSrcweir nWidth = nNewWidth; 87cdf0e10cSrcweir } 88cdf0e10cSrcweir SetProp(const sal_uInt16 nNewProp)89cdf0e10cSrcweir void SetProp( const sal_uInt16 nNewProp ) 90cdf0e10cSrcweir { 91cdf0e10cSrcweir DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); 92cdf0e10cSrcweir nProp = nNewProp; 93cdf0e10cSrcweir } 94cdf0e10cSrcweir GetProp() const95cdf0e10cSrcweir sal_uInt16 GetProp() const { return nProp; } 96cdf0e10cSrcweir }; 97cdf0e10cSrcweir 98cdf0e10cSrcweir 99cdf0e10cSrcweir 100cdf0e10cSrcweir 101cdf0e10cSrcweir 102cdf0e10cSrcweir #endif 103cdf0e10cSrcweir 104cdf0e10cSrcweir 105