xref: /AOO42X/main/editeng/inc/editeng/ulspitem.hxx (revision 9bce9b0d387299c68bd81d539e1478357a103de5)
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_ULSPITEM_HXX
24 #define _SVX_ULSPITEM_HXX
25 
26 // include ---------------------------------------------------------------
27 
28 #include <svl/poolitem.hxx>
29 #include <editeng/editengdllapi.h>
30 
31 namespace rtl
32 {
33     class OUString;
34 }
35 
36 // class SvxULSpaceItem --------------------------------------------------
37 
38 /*
39 [Beschreibung]
40 Dieses Item beschreibt den oberen und unteren Rand einer Seite oder Absatz.
41 */
42 
43 #define ULSPACE_16_VERSION  ((sal_uInt16)0x0001)
44 
45 class EDITENG_DLLPUBLIC SvxULSpaceItem : public SfxPoolItem
46 {
47     sal_uInt16 nUpper;  //Oberer Rand
48     sal_uInt16 nLower;  //Unterer Rand
49     sal_uInt16 nPropUpper, nPropLower;      // relativ oder absolut (=100%)
50 public:
51     TYPEINFO();
52 
53     SvxULSpaceItem( const sal_uInt16 nId  );
54     SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow,
55                     const sal_uInt16 nId  );
56     inline SvxULSpaceItem& operator=( const SvxULSpaceItem &rCpy );
57 
58     // "pure virtual Methoden" vom SfxPoolItem
59     virtual int              operator==( const SfxPoolItem& ) const;
60 
61     virtual sal_Bool             QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
62     virtual sal_Bool             PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
63 
64     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
65                                     SfxMapUnit eCoreMetric,
66                                     SfxMapUnit ePresMetric,
67                                     String &rText, const IntlWrapper * = 0 ) const;
68 
69     virtual SfxPoolItem*     Clone( SfxItemPool *pPool = 0 ) const;
70     virtual SfxPoolItem*     Create(SvStream &, sal_uInt16) const;
71     virtual SvStream&        Store(SvStream &, sal_uInt16 nItemVersion ) const;
72     virtual sal_uInt16           GetVersion( sal_uInt16 nFileVersion ) const;
73     virtual int              ScaleMetrics( long nMult, long nDiv );
74     virtual int              HasMetrics() const;
75 
76     inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 );
77     inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 );
78 
SetUpperValue(const sal_uInt16 nU)79     void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; }
SetLowerValue(const sal_uInt16 nL)80     void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; }
SetPropUpper(const sal_uInt16 nU)81     void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; }
SetPropLower(const sal_uInt16 nL)82     void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; }
83 
GetUpper() const84     sal_uInt16 GetUpper() const { return nUpper; }
GetLower() const85     sal_uInt16 GetLower() const { return nLower; }
GetPropUpper() const86     sal_uInt16 GetPropUpper() const { return nPropUpper; }
GetPropLower() const87     sal_uInt16 GetPropLower() const { return nPropLower; }
88 };
89 
operator =(const SvxULSpaceItem & rCpy)90 inline SvxULSpaceItem &SvxULSpaceItem::operator=( const SvxULSpaceItem &rCpy )
91 {
92     nUpper = rCpy.GetUpper();
93     nLower = rCpy.GetLower();
94     nPropUpper = rCpy.GetPropUpper();
95     nPropLower = rCpy.GetPropLower();
96     return *this;
97 }
98 
SetUpper(const sal_uInt16 nU,const sal_uInt16 nProp)99 inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp )
100 {
101     nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp;
102 }
SetLower(const sal_uInt16 nL,const sal_uInt16 nProp)103 inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nProp )
104 {
105     nLower = sal_uInt16((sal_uInt32(nL) * nProp ) / 100); nPropLower = nProp;
106 }
107 
108 #endif
109