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