xref: /trunk/main/editeng/inc/editeng/ulspitem.hxx (revision cea84f56765a2ac06f0f5a2718f45f6430edc781)
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     SvxULSpaceItem(const SvxULSpaceItem&) = default;
58 
59     // "pure virtual Methoden" vom SfxPoolItem
60     virtual int              operator==( const SfxPoolItem& ) const;
61 
62     virtual sal_Bool             QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
63     virtual sal_Bool             PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
64 
65     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
66                                     SfxMapUnit eCoreMetric,
67                                     SfxMapUnit ePresMetric,
68                                     String &rText, const IntlWrapper * = 0 ) const;
69 
70     virtual SfxPoolItem*     Clone( SfxItemPool *pPool = 0 ) const;
71     virtual SfxPoolItem*     Create(SvStream &, sal_uInt16) const;
72     virtual SvStream&        Store(SvStream &, sal_uInt16 nItemVersion ) const;
73     virtual sal_uInt16           GetVersion( sal_uInt16 nFileVersion ) const;
74     virtual int              ScaleMetrics( long nMult, long nDiv );
75     virtual int              HasMetrics() const;
76 
77     inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 );
78     inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 );
79 
SetUpperValue(const sal_uInt16 nU)80     void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; }
SetLowerValue(const sal_uInt16 nL)81     void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; }
SetPropUpper(const sal_uInt16 nU)82     void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; }
SetPropLower(const sal_uInt16 nL)83     void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; }
84 
GetUpper() const85     sal_uInt16 GetUpper() const { return nUpper; }
GetLower() const86     sal_uInt16 GetLower() const { return nLower; }
GetPropUpper() const87     sal_uInt16 GetPropUpper() const { return nPropUpper; }
GetPropLower() const88     sal_uInt16 GetPropLower() const { return nPropLower; }
89 };
90 
operator =(const SvxULSpaceItem & rCpy)91 inline SvxULSpaceItem &SvxULSpaceItem::operator=( const SvxULSpaceItem &rCpy )
92 {
93     nUpper = rCpy.GetUpper();
94     nLower = rCpy.GetLower();
95     nPropUpper = rCpy.GetPropUpper();
96     nPropLower = rCpy.GetPropLower();
97     return *this;
98 }
99 
SetUpper(const sal_uInt16 nU,const sal_uInt16 nProp)100 inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp )
101 {
102     nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp;
103 }
SetLower(const sal_uInt16 nL,const sal_uInt16 nProp)104 inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nProp )
105 {
106     nLower = sal_uInt16((sal_uInt32(nL) * nProp ) / 100); nPropLower = nProp;
107 }
108 
109 #endif
110