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/cenumitm.hxx>
23 #include <tools/mapunit.hxx>
24 #include <editeng/svxenum.hxx>
25 #include <editeng/editengdllapi.h>
27 // class SvxLineSpacingItem ----------------------------------------------
30 This item describes the distance between the lines.
33 #define LINE_SPACE_DEFAULT_HEIGHT 200
34 class EDITENG_DLLPUBLIC SvxLineSpacingItem final
: public SfxEnumItemInterface
36 short nInterLineSpace
;
37 sal_uInt16 nLineHeight
;
38 sal_uInt16 nPropLineSpace
;
39 SvxLineSpaceRule eLineSpaceRule
;
40 SvxInterLineSpaceRule eInterLineSpaceRule
;
43 static SfxPoolItem
* CreateDefault();
45 // The writer relies on a default height of 200! Actually, I would
46 // initialize all values to 0, but who can ignore the consequences in
47 // writer? => Rather have a crooked vales as the default, but the
48 // programmer sees that there's something special happening.
50 SvxLineSpacingItem( sal_uInt16 nLineHeight
/*= LINE_SPACE_DEFAULT_HEIGHT*/, const sal_uInt16 nId
);
52 // "pure virtual Methods" from SfxPoolItem
53 virtual bool operator==( const SfxPoolItem
& ) const override
;
54 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const override
;
55 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
) override
;
57 virtual bool GetPresentation( SfxItemPresentation ePres
,
60 OUString
&rText
, const IntlWrapper
& ) const override
;
62 virtual SvxLineSpacingItem
* Clone( SfxItemPool
*pPool
= nullptr ) const override
;
64 // Methods to query and edit. InterlineSpace is added to the height.
65 short GetInterLineSpace() const { return nInterLineSpace
; }
66 void SetInterLineSpace( const short nSpace
)
68 nInterLineSpace
= nSpace
;
69 eInterLineSpaceRule
= SvxInterLineSpaceRule::Fix
;
72 // Determines the absolute or minimum row height.
73 sal_uInt16
GetLineHeight() const { return nLineHeight
; }
74 void SetLineHeight( const sal_uInt16 nHeight
)
76 nLineHeight
= nHeight
;
77 eLineSpaceRule
= SvxLineSpaceRule::Min
;
80 // To increase or decrease the row height.
81 sal_uInt16
GetPropLineSpace() const { return nPropLineSpace
; }
82 void SetPropLineSpace( const sal_uInt16 nProp
)
84 nPropLineSpace
= nProp
;
85 eInterLineSpaceRule
= SvxInterLineSpaceRule::Prop
;
88 void SetLineSpaceRule(SvxLineSpaceRule e
) { eLineSpaceRule
= e
; }
89 SvxLineSpaceRule
GetLineSpaceRule() const { return eLineSpaceRule
; }
91 void SetInterLineSpaceRule(SvxInterLineSpaceRule e
) { eInterLineSpaceRule
= e
; }
92 SvxInterLineSpaceRule
GetInterLineSpaceRule() const { return eInterLineSpaceRule
; }
94 virtual sal_uInt16
GetValueCount() const override
;
95 virtual sal_uInt16
GetEnumValue() const override
;
96 virtual void SetEnumValue( sal_uInt16 nNewVal
) override
;
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */