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 _SVX_ADJITEM_HXX 28 #define _SVX_ADJITEM_HXX 29 30 // include --------------------------------------------------------------- 31 32 #include <svl/eitem.hxx> 33 #include <editeng/svxenum.hxx> 34 #include <editeng/eeitem.hxx> 35 #include <editeng/editengdllapi.h> 36 37 class SvXMLUnitConverter; 38 namespace rtl 39 { 40 class OUString; 41 } 42 43 // class SvxAdjustItem --------------------------------------------------- 44 45 /* 46 [Beschreibung] 47 Dieses Item beschreibt die Zeilenausrichtung. 48 */ 49 #define ADJUST_LASTBLOCK_VERSION ((sal_uInt16)0x0001) 50 51 class EDITENG_DLLPUBLIC SvxAdjustItem : public SfxEnumItemInterface 52 { 53 sal_Bool bLeft : 1; 54 sal_Bool bRight : 1; 55 sal_Bool bCenter : 1; 56 sal_Bool bBlock : 1; 57 58 // nur aktiv, wenn bBlock 59 sal_Bool bOneBlock : 1; 60 sal_Bool bLastCenter : 1; 61 sal_Bool bLastBlock : 1; 62 63 friend SvStream& operator<<( SvStream&, SvxAdjustItem& ); //$ ostream 64 public: 65 TYPEINFO(); 66 67 SvxAdjustItem( const SvxAdjust eAdjst /*= SVX_ADJUST_LEFT*/, 68 const sal_uInt16 nId ); 69 70 // "pure virtual Methoden" vom SfxPoolItem 71 virtual int operator==( const SfxPoolItem& ) const; 72 73 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 74 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 75 76 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 77 SfxMapUnit eCoreMetric, 78 SfxMapUnit ePresMetric, 79 String &rText, const IntlWrapper * = 0 ) const; 80 virtual sal_uInt16 GetValueCount() const; 81 virtual String GetValueTextByPos( sal_uInt16 nPos ) const; 82 virtual sal_uInt16 GetEnumValue() const; 83 virtual void SetEnumValue( sal_uInt16 nNewVal ); 84 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 85 virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; 86 virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; 87 virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; 88 89 inline void SetOneWord( const SvxAdjust eType ) 90 { 91 bOneBlock = eType == SVX_ADJUST_BLOCK; 92 } 93 94 inline void SetLastBlock( const SvxAdjust eType ) 95 { 96 bLastBlock = eType == SVX_ADJUST_BLOCK; 97 bLastCenter = eType == SVX_ADJUST_CENTER; 98 } 99 100 inline void SetAdjust( const SvxAdjust eType ) 101 { 102 bLeft = eType == SVX_ADJUST_LEFT; 103 bRight = eType == SVX_ADJUST_RIGHT; 104 bCenter = eType == SVX_ADJUST_CENTER; 105 bBlock = eType == SVX_ADJUST_BLOCK; 106 } 107 108 inline SvxAdjust GetLastBlock() const 109 { 110 SvxAdjust eRet = SVX_ADJUST_LEFT; 111 112 if ( bLastBlock ) 113 eRet = SVX_ADJUST_BLOCK; 114 else if( bLastCenter ) 115 eRet = SVX_ADJUST_CENTER; 116 return eRet; 117 } 118 119 inline SvxAdjust GetOneWord() const 120 { 121 SvxAdjust eRet = SVX_ADJUST_LEFT; 122 123 if ( bBlock && bOneBlock ) 124 eRet = SVX_ADJUST_BLOCK; 125 return eRet; 126 } 127 128 inline SvxAdjust GetAdjust() const 129 { 130 SvxAdjust eRet = SVX_ADJUST_LEFT; 131 132 if ( bRight ) 133 eRet = SVX_ADJUST_RIGHT; 134 else if ( bCenter ) 135 eRet = SVX_ADJUST_CENTER; 136 else if ( bBlock ) 137 eRet = SVX_ADJUST_BLOCK; 138 return eRet; 139 } 140 }; 141 142 #endif 143 144