Coverage Report

Created: 2026-08-14 10:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/editeng/lspcitem.hxx
Line
Count
Source
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 INCLUDED_EDITENG_LSPCITEM_HXX
20
#define INCLUDED_EDITENG_LSPCITEM_HXX
21
22
#include <editeng/svxenum.hxx>
23
#include <editeng/editengdllapi.h>
24
#include <svl/poolitem.hxx>
25
26
// class SvxLineSpacingItem ----------------------------------------------
27
28
/*  [Description]
29
    This item describes the distance between the lines.
30
*/
31
32
103k
#define LINE_SPACE_DEFAULT_HEIGHT 200
33
class EDITENG_DLLPUBLIC SvxLineSpacingItem final : public SfxPoolItem
34
{
35
    short                 nInterLineSpace;
36
    sal_uInt16            nLineHeight;
37
    sal_uInt16            nPropLineSpace;
38
    SvxLineSpaceRule      eLineSpaceRule;
39
    SvxInterLineSpaceRule eInterLineSpaceRule;
40
41
public:
42
    static SfxPoolItem* CreateDefault();
43
44
    // The writer relies on a default height of 200! Actually, I would
45
    // initialize all values to 0, but who can ignore the consequences in
46
    // writer? => Rather have a crooked vales as the default, but the
47
    // programmer sees that there's something special happening.
48
49
    DECLARE_ITEM_TYPE_FUNCTION(SvxLineSpacingItem)
50
    SvxLineSpacingItem( sal_uInt16 nLineHeight /*= LINE_SPACE_DEFAULT_HEIGHT*/, const sal_uInt16 nId  );
51
52
    // "pure virtual Methods" from SfxPoolItem
53
    virtual bool            operator==( const SfxPoolItem& ) const override;
54
6
    virtual bool            supportsHashCode() const override { return true; }
55
    virtual size_t          hashCode() const override;
56
    virtual bool            QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
57
    virtual bool            PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
58
59
    virtual bool GetPresentation( SfxItemPresentation ePres,
60
                                  MapUnit eCoreMetric,
61
                                  MapUnit ePresMetric,
62
                                  OUString &rText, const IntlWrapper& ) const override;
63
64
    virtual SvxLineSpacingItem* Clone( SfxItemPool *pPool = nullptr ) const override;
65
66
    // Methods to query and edit. InterlineSpace is added to the height.
67
0
    short GetInterLineSpace() const { return nInterLineSpace; }
68
    void SetInterLineSpace( const short nSpace )
69
0
    {
70
0
        ASSERT_CHANGE_REFCOUNTED_ITEM;
71
0
        nInterLineSpace = nSpace;
72
0
        eInterLineSpaceRule = SvxInterLineSpaceRule::Fix;
73
0
    }
Unexecuted instantiation: SvxLineSpacingItem::SetInterLineSpace(short)
Unexecuted instantiation: SvxLineSpacingItem::SetInterLineSpace(short)
74
75
    // Determines the absolute or minimum row height.
76
45.5k
    sal_uInt16 GetLineHeight() const { return nLineHeight; }
77
    void SetLineHeight( const sal_uInt16 nHeight )
78
27.3k
    {
79
27.3k
        ASSERT_CHANGE_REFCOUNTED_ITEM;
80
27.3k
        nLineHeight = nHeight;
81
27.3k
        eLineSpaceRule = SvxLineSpaceRule::Min;
82
27.3k
    }
83
84
    // To increase or decrease the row height.
85
1.93M
    sal_uInt16 GetPropLineSpace() const { return nPropLineSpace; }
86
    void SetPropLineSpace( const sal_uInt16 nProp )
87
187k
    {
88
187k
        ASSERT_CHANGE_REFCOUNTED_ITEM;
89
187k
        nPropLineSpace = nProp;
90
187k
        eInterLineSpaceRule = SvxInterLineSpaceRule::Prop;
91
187k
    }
92
93
139k
    void SetLineSpaceRule(SvxLineSpaceRule e) { ASSERT_CHANGE_REFCOUNTED_ITEM; eLineSpaceRule = e; }
94
9.47M
    SvxLineSpaceRule GetLineSpaceRule() const { return eLineSpaceRule; }
95
96
7.60k
    void SetInterLineSpaceRule(SvxInterLineSpaceRule e) { ASSERT_CHANGE_REFCOUNTED_ITEM; eInterLineSpaceRule = e; }
97
37.8M
    SvxInterLineSpaceRule GetInterLineSpaceRule() const { return eInterLineSpaceRule; }
98
};
99
100
#endif
101
102
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */