Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/editeng/escapementitem.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_ESCAPEMENTITEM_HXX
20
#define INCLUDED_EDITENG_ESCAPEMENTITEM_HXX
21
22
#include <editeng/svxenum.hxx>
23
#include <editeng/editengdllapi.h>
24
#include <svl/poolitem.hxx>
25
26
// class SvxEscapementItem -----------------------------------------------
27
28
1.71k
#define DFLT_ESC_SUPER   33     // 42% (100 - DFLT_ESC_PROP) of ascent (~80% of font height) = 33% of total font height
29
5.22k
#define DFLT_ESC_SUB     -8     // 42% of descent (~20% of font height) = -8%. previously -33% (pre-2020), previously 8/100 (pre-2000?)
30
58.3k
#define DFLT_ESC_PROP    58
31
104M
#define MAX_ESC_POS      13999
32
34.6M
#define DFLT_ESC_AUTO_SUPER  (MAX_ESC_POS+1)
33
26.1k
#define DFLT_ESC_AUTO_SUB    -DFLT_ESC_AUTO_SUPER
34
35
/*  [Description]
36
37
    This item describes the writing position.
38
*/
39
40
class EDITENG_DLLPUBLIC SvxEscapementItem final : public SfxPoolItem
41
{
42
    short nEsc;
43
    sal_uInt8  nProp;
44
public:
45
    static SfxPoolItem* CreateDefault();
46
47
    DECLARE_ITEM_TYPE_FUNCTION(SvxEscapementItem)
48
    explicit SvxEscapementItem( const sal_uInt16 nId  );
49
    SvxEscapementItem( const SvxEscapement eEscape,
50
                   const sal_uInt16 nId  );
51
    SvxEscapementItem( const short nEsc, const sal_uInt8 nProp,
52
                   const sal_uInt16 nId  );
53
54
    // "pure virtual Methods" from SfxPoolItem
55
    virtual bool             operator==( const SfxPoolItem& ) const override;
56
    virtual bool GetPresentation( SfxItemPresentation ePres,
57
                                    MapUnit eCoreMetric,
58
                                    MapUnit ePresMetric,
59
                                    OUString &rText, const IntlWrapper& ) const override;
60
61
    virtual bool             QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
62
    virtual bool             PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
63
64
    virtual SvxEscapementItem* Clone( SfxItemPool *pPool = nullptr ) const override;
65
66
    void SetEscapement( const SvxEscapement eNew )
67
11.7k
    {
68
11.7k
        ASSERT_CHANGE_REFCOUNTED_ITEM;
69
11.7k
        if( SvxEscapement::Off == eNew )
70
10.6k
        {
71
10.6k
            nEsc = 0;
72
10.6k
            nProp = 100;
73
10.6k
        }
74
1.16k
        else
75
1.16k
        {
76
1.16k
            nProp = DFLT_ESC_PROP;
77
1.16k
            if( SvxEscapement::Superscript == eNew )
78
342
                nEsc = DFLT_ESC_AUTO_SUPER;
79
824
            else
80
824
                nEsc = DFLT_ESC_AUTO_SUB;
81
1.16k
        }
82
11.7k
    }
83
    SvxEscapement GetEscapement() const;
84
85
34.6M
    short GetEsc() const { return nEsc; }
86
0
    void SetEsc(short nNewEsc) { ASSERT_CHANGE_REFCOUNTED_ITEM; nEsc = nNewEsc; }
87
88
34.5M
    sal_uInt8 GetProportionalHeight() const { return nProp; }
89
0
    void SetProportionalHeight(sal_uInt8 n) { ASSERT_CHANGE_REFCOUNTED_ITEM; nProp = n; }
90
};
91
92
#endif
93
94
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */