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_ESCPITEM_HXX 24 #define _SVX_ESCPITEM_HXX 25 26 // include --------------------------------------------------------------- 27 28 #include <svl/eitem.hxx> 29 #include <editeng/svxenum.hxx> 30 #include <editeng/editengdllapi.h> 31 32 class SvXMLUnitConverter; 33 namespace rtl 34 { 35 class OUString; 36 } 37 38 // class SvxEscapementItem ----------------------------------------------- 39 40 #define DFLT_ESC_SUPER 33 // 1/3 41 #define DFLT_ESC_SUB -33 // auch 1/3 fr"uher 8/100 42 #define DFLT_ESC_PROP 58 43 #define DFLT_ESC_AUTO_SUPER 101 44 #define DFLT_ESC_AUTO_SUB -101 45 46 /* [Beschreibung] 47 48 Dieses Item beschreibt die Schrift-Position. 49 */ 50 51 class EDITENG_DLLPUBLIC SvxEscapementItem : public SfxEnumItemInterface 52 { 53 short nEsc; 54 sal_uInt8 nProp; 55 public: 56 TYPEINFO(); 57 58 SvxEscapementItem( const sal_uInt16 nId ); 59 SvxEscapementItem( const SvxEscapement eEscape, 60 const sal_uInt16 nId ); 61 SvxEscapementItem( const short nEsc, const sal_uInt8 nProp, 62 const sal_uInt16 nId ); 63 64 // "pure virtual Methoden" vom SfxPoolItem 65 virtual int operator==( const SfxPoolItem& ) const; 66 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 67 SfxMapUnit eCoreMetric, 68 SfxMapUnit ePresMetric, 69 String &rText, const IntlWrapper * = 0 ) const; 70 71 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 72 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 73 74 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 75 virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; 76 virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; 77 SetEscapement(const SvxEscapement eNew)78 inline void SetEscapement( const SvxEscapement eNew ) 79 { 80 if( SVX_ESCAPEMENT_OFF == eNew ) 81 nEsc = 0, nProp = 100; 82 else 83 if( SVX_ESCAPEMENT_SUPERSCRIPT == eNew ) 84 nEsc = DFLT_ESC_SUPER, nProp = DFLT_ESC_PROP; 85 else 86 nEsc = DFLT_ESC_SUB, nProp = DFLT_ESC_PROP; 87 } GetEscapement() const88 inline SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); } 89 GetEsc()90 inline short &GetEsc() { return nEsc; } GetEsc() const91 inline short GetEsc() const { return nEsc; } 92 GetProp()93 inline sal_uInt8 &GetProp() { return nProp; } GetProp() const94 inline sal_uInt8 GetProp() const { return nProp; } 95 operator =(const SvxEscapementItem & rEsc)96 inline SvxEscapementItem& operator=(const SvxEscapementItem& rEsc) 97 { 98 nEsc = rEsc.GetEsc(); 99 nProp = rEsc.GetProp(); 100 return *this; 101 } 102 103 virtual sal_uInt16 GetValueCount() const; 104 virtual String GetValueTextByPos( sal_uInt16 nPos ) const; 105 virtual sal_uInt16 GetEnumValue() const; 106 virtual void SetEnumValue( sal_uInt16 nNewVal ); 107 }; 108 109 #endif 110 111