Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SVX_ULSPITEM_HXX
29 : : #define _SVX_ULSPITEM_HXX
30 : :
31 : : #include <svl/poolitem.hxx>
32 : : #include <editeng/editengdllapi.h>
33 : :
34 : : namespace rtl
35 : : {
36 : : class OUString;
37 : : }
38 : :
39 : : // class SvxULSpaceItem --------------------------------------------------
40 : :
41 : : /* [Description]
42 : :
43 : : This item describes the Upper- and Lower space of a page or paragraph.
44 : : */
45 : :
46 : : #define ULSPACE_16_VERSION ((sal_uInt16)0x0001)
47 : :
48 [ - + ]: 84509 : class EDITENG_DLLPUBLIC SvxULSpaceItem : public SfxPoolItem
49 : : {
50 : : sal_uInt16 nUpper; // Upper space
51 : : sal_uInt16 nLower; // Lower space
52 : : sal_Bool bContext; // Contextual spacing?
53 : : sal_uInt16 nPropUpper, nPropLower; // relative or absolute (=100%)
54 : : public:
55 : : TYPEINFO();
56 : :
57 : : SvxULSpaceItem( const sal_uInt16 nId );
58 : : SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow,
59 : : const sal_uInt16 nId );
60 : : inline SvxULSpaceItem& operator=( const SvxULSpaceItem &rCpy );
61 : :
62 : : // "pure virtual Methods" from SfxPoolItem
63 : : virtual int operator==( const SfxPoolItem& ) const;
64 : :
65 : : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
66 : : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
67 : :
68 : : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
69 : : SfxMapUnit eCoreMetric,
70 : : SfxMapUnit ePresMetric,
71 : : String &rText, const IntlWrapper * = 0 ) const;
72 : :
73 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
74 : : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
75 : : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
76 : : virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
77 : : virtual bool ScaleMetrics( long nMult, long nDiv );
78 : : virtual bool HasMetrics() const;
79 : :
80 : : inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 );
81 : : inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 );
82 : :
83 : 330 : void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; }
84 : 330 : void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; }
85 : 450 : void SetContextValue( const sal_Bool bC ) { bContext = bC; }
86 : 0 : void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; }
87 : 0 : void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; }
88 : :
89 : 38537 : sal_uInt16 GetUpper() const { return nUpper; }
90 : 375488 : sal_uInt16 GetLower() const { return nLower; }
91 : 18857 : sal_Bool GetContext() const { return bContext; }
92 : 1896 : sal_uInt16 GetPropUpper() const { return nPropUpper; }
93 : 1896 : sal_uInt16 GetPropLower() const { return nPropLower; }
94 : : };
95 : :
96 : 9 : inline SvxULSpaceItem &SvxULSpaceItem::operator=( const SvxULSpaceItem &rCpy )
97 : : {
98 : 9 : nUpper = rCpy.GetUpper();
99 : 9 : nLower = rCpy.GetLower();
100 : 9 : bContext = rCpy.GetContext();
101 : 9 : nPropUpper = rCpy.GetPropUpper();
102 : 9 : nPropLower = rCpy.GetPropLower();
103 : 9 : return *this;
104 : : }
105 : :
106 : 9136 : inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp )
107 : : {
108 : 9136 : nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp;
109 : 9136 : }
110 : 10890 : inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nProp )
111 : : {
112 : 10890 : nLower = sal_uInt16((sal_uInt32(nL) * nProp ) / 100); nPropLower = nProp;
113 : 10890 : }
114 : :
115 : : #endif
116 : :
117 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|