1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_EDITENG_LSPCITEM_HXX
20 #define INCLUDED_EDITENG_LSPCITEM_HXX
22 #include <svl/eitem.hxx>
23 #include <editeng/svxenum.hxx>
24 #include <editeng/editengdllapi.h>
26 class SvXMLUnitConverter
;
28 // class SvxLineSpacingItem ----------------------------------------------
31 This item describes the distance between the lines.
34 #define LINE_SPACE_DEFAULT_HEIGHT 200
35 class EDITENG_DLLPUBLIC SvxLineSpacingItem
: public SfxEnumItemInterface
37 short nInterLineSpace
;
38 sal_uInt16 nLineHeight
;
39 sal_uInt16 nPropLineSpace
;
40 SvxLineSpaceRule eLineSpaceRule
;
41 SvxInterLineSpaceRule eInterLineSpaceRule
;
44 static SfxPoolItem
* CreateDefault();
46 // The writer relies on a default height of 200! Actually, I would
47 // initialize all values to 0, but who can ignore the consequences in
48 // writer? => Rather have a crooked vales as the default, but the
49 // programmer sees that there's something special happening.
51 SvxLineSpacingItem( sal_uInt16 nLineHeight
/*= LINE_SPACE_DEFAULT_HEIGHT*/, const sal_uInt16 nId
);
53 // "pure virtual Methods" from SfxPoolItem
54 virtual bool operator==( const SfxPoolItem
& ) const override
;
55 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const override
;
56 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
) override
;
58 virtual bool GetPresentation( SfxItemPresentation ePres
,
61 OUString
&rText
, const IntlWrapper
* = nullptr ) const override
;
63 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= nullptr ) const override
;
64 virtual SfxPoolItem
* Create(SvStream
&, sal_uInt16
) const override
;
65 virtual SvStream
& Store(SvStream
&, sal_uInt16 nItemVersion
) const override
;
67 // Methods to query and edit. InterlineSpace is added to the height.
68 inline short GetInterLineSpace() const { return nInterLineSpace
; }
69 inline void SetInterLineSpace( const short nSpace
)
71 nInterLineSpace
= nSpace
;
72 eInterLineSpaceRule
= SvxInterLineSpaceRule::Fix
;
75 // Determines the absolute or minimum row height.
76 inline sal_uInt16
GetLineHeight() const { return nLineHeight
; }
77 inline void SetLineHeight( const sal_uInt16 nHeight
)
79 nLineHeight
= nHeight
;
80 eLineSpaceRule
= SvxLineSpaceRule::Min
;
83 // To increase or decrease the row height.
84 sal_uInt16
GetPropLineSpace() const { return nPropLineSpace
; }
85 inline void SetPropLineSpace( const sal_uInt8 nProp
)
87 nPropLineSpace
= nProp
;
88 eInterLineSpaceRule
= SvxInterLineSpaceRule::Prop
;
91 inline void SetLineSpaceRule(SvxLineSpaceRule e
) { eLineSpaceRule
= e
; }
92 inline SvxLineSpaceRule
GetLineSpaceRule() const { return eLineSpaceRule
; }
94 inline void SetInterLineSpaceRule(SvxInterLineSpaceRule e
) { eInterLineSpaceRule
= e
; }
95 inline SvxInterLineSpaceRule
GetInterLineSpaceRule() const { return eInterLineSpaceRule
; }
97 virtual sal_uInt16
GetValueCount() const override
;
98 virtual OUString
GetValueTextByPos( sal_uInt16 nPos
) const override
;
99 virtual sal_uInt16
GetEnumValue() const override
;
100 virtual void SetEnumValue( sal_uInt16 nNewVal
) override
;
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */