xref: /aoo4110/main/editeng/inc/editeng/lspcitem.hxx (revision b1cdbd2c)
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_LSPCITEM_HXX
24 #define _SVX_LSPCITEM_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 SvxLineSpacingItem ----------------------------------------------
39 
40 /*
41 [Beschreibung]
42 Dieses Item beschreibt den Abstand zwischen den Zeilen.
43 */
44 
45 #define LINE_SPACE_DEFAULT_HEIGHT 200
46 class EDITENG_DLLPUBLIC SvxLineSpacingItem : public SfxEnumItemInterface
47 {
48 	friend SvStream& operator<<( SvStream&, SvxLineSpacingItem& ); //$ ostream
49 
50 	short nInterLineSpace;
51 	sal_uInt16 nLineHeight;
52 	sal_uInt8 nPropLineSpace;
53 	SvxLineSpace eLineSpace;
54 	SvxInterLineSpace eInterLineSpace;
55 
56 public:
57 	TYPEINFO();
58 
59 	// Der Writer verlaesst sich auf eine Default-Hoehe von 200!
60 	// Eigentlich wuerde ich alle Werte mit 0 initialisieren, aber wer kann
61 	// die Folgen beim Writer absehen ?
62 	// => lieber einen krummen Wert als Default, aber der Programmierer
63 	// sieht, dass dort etwas besonderes passiert.
64 
65     SvxLineSpacingItem( sal_uInt16 nHeight /*= LINE_SPACE_DEFAULT_HEIGHT*/, const sal_uInt16 nId  );
66 
67 	// "pure virtual Methoden" vom SfxPoolItem
68 	virtual int 			 operator==( const SfxPoolItem& ) const;
69 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
70 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
71 
72 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
73 									SfxMapUnit eCoreMetric,
74 									SfxMapUnit ePresMetric,
75                                     String &rText, const IntlWrapper * = 0 ) const;
76 
77 	virtual SfxPoolItem*	 Clone( SfxItemPool *pPool = 0 ) const;
78 	virtual SfxPoolItem*	 Create(SvStream &, sal_uInt16) const;
79 	virtual SvStream&		 Store(SvStream &, sal_uInt16 nItemVersion ) const;
80 
81 	// Methoden zum Abfragen und Aendern
82 	// Interlinespace wird zur Hoehe addiert.
GetInterLineSpace() const83 	inline short GetInterLineSpace() const { return nInterLineSpace; }
SetInterLineSpace(const short nSpace)84 	inline void SetInterLineSpace( const short nSpace )
85 	{
86 		nInterLineSpace = nSpace;
87 		eInterLineSpace = SVX_INTER_LINE_SPACE_FIX;
88 	}
89 
90 	// Bestimmt absolute oder minimale Zeilenhoehe.
GetLineHeight() const91 	inline sal_uInt16 GetLineHeight() const { return nLineHeight; }
SetLineHeight(const sal_uInt16 nHeight)92 	inline void SetLineHeight( const sal_uInt16 nHeight )
93 	{
94 		nLineHeight = nHeight;
95 		eLineSpace = SVX_LINE_SPACE_MIN;
96 	}
97 
98 	// Vergroessert oder verkleinert die Zeilenhoehe.
GetPropLineSpace() const99 	sal_uInt8 GetPropLineSpace() const { return nPropLineSpace; }
SetPropLineSpace(const sal_uInt8 nProp)100 	inline void SetPropLineSpace( const sal_uInt8 nProp )
101 	{
102 		nPropLineSpace = nProp;
103 		eInterLineSpace = SVX_INTER_LINE_SPACE_PROP;
104 	}
105 
GetLineSpaceRule()106 	inline SvxLineSpace &GetLineSpaceRule() { return eLineSpace; }
GetLineSpaceRule() const107 	inline SvxLineSpace GetLineSpaceRule() const { return eLineSpace; }
108 
GetInterLineSpaceRule()109 	inline SvxInterLineSpace &GetInterLineSpaceRule() { return eInterLineSpace; }
GetInterLineSpaceRule() const110 	inline SvxInterLineSpace GetInterLineSpaceRule() const { return eInterLineSpace; }
111 
112 	virtual sal_uInt16			GetValueCount() const;
113 	virtual String			GetValueTextByPos( sal_uInt16 nPos ) const;
114 	virtual sal_uInt16			GetEnumValue() const;
115 	virtual void			SetEnumValue( sal_uInt16 nNewVal );
116 };
117 
118 #endif
119 
120