Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _SVX_ULSPITEM_HXX
20 : #define _SVX_ULSPITEM_HXX
21 :
22 : #include <svl/poolitem.hxx>
23 : #include <editeng/editengdllapi.h>
24 :
25 : namespace rtl
26 : {
27 : class OUString;
28 : }
29 :
30 : // class SvxULSpaceItem --------------------------------------------------
31 :
32 : /* [Description]
33 :
34 : This item describes the Upper- and Lower space of a page or paragraph.
35 : */
36 :
37 : #define ULSPACE_16_VERSION ((sal_uInt16)0x0001)
38 :
39 19779 : class EDITENG_DLLPUBLIC SvxULSpaceItem : public SfxPoolItem
40 : {
41 : sal_uInt16 nUpper; // Upper space
42 : sal_uInt16 nLower; // Lower space
43 : sal_Bool bContext; // Contextual spacing?
44 : sal_uInt16 nPropUpper, nPropLower; // relative or absolute (=100%)
45 : public:
46 : TYPEINFO();
47 :
48 : explicit SvxULSpaceItem( const sal_uInt16 nId );
49 : SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow,
50 : const sal_uInt16 nId );
51 : inline SvxULSpaceItem& operator=( const SvxULSpaceItem &rCpy );
52 :
53 : // "pure virtual Methods" from SfxPoolItem
54 : virtual int operator==( const SfxPoolItem& ) const;
55 :
56 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
57 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
58 :
59 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
60 : SfxMapUnit eCoreMetric,
61 : SfxMapUnit ePresMetric,
62 : String &rText, const IntlWrapper * = 0 ) const;
63 :
64 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
65 : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
66 : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
67 : virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
68 : virtual bool ScaleMetrics( long nMult, long nDiv );
69 : virtual bool HasMetrics() const;
70 :
71 : inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 );
72 : inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 );
73 :
74 150 : void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; }
75 150 : void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; }
76 160 : void SetContextValue( const sal_Bool bC ) { bContext = bC; }
77 0 : void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; }
78 0 : void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; }
79 :
80 5367 : sal_uInt16 GetUpper() const { return nUpper; }
81 29418 : sal_uInt16 GetLower() const { return nLower; }
82 2625 : sal_Bool GetContext() const { return bContext; }
83 805 : sal_uInt16 GetPropUpper() const { return nPropUpper; }
84 805 : sal_uInt16 GetPropLower() const { return nPropLower; }
85 : };
86 :
87 3 : inline SvxULSpaceItem &SvxULSpaceItem::operator=( const SvxULSpaceItem &rCpy )
88 : {
89 3 : nUpper = rCpy.GetUpper();
90 3 : nLower = rCpy.GetLower();
91 3 : bContext = rCpy.GetContext();
92 3 : nPropUpper = rCpy.GetPropUpper();
93 3 : nPropLower = rCpy.GetPropLower();
94 3 : return *this;
95 : }
96 :
97 2728 : inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp )
98 : {
99 2728 : nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp;
100 2728 : }
101 2995 : inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nProp )
102 : {
103 2995 : nLower = sal_uInt16((sal_uInt32(nL) * nProp ) / 100); nPropLower = nProp;
104 2995 : }
105 :
106 : #endif
107 :
108 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|