Fix typo in code
[LibreOffice.git] / include / editeng / escapementitem.hxx
blobd9d4f7d3006fc0b24c82b1667ff72af20b8f204a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_ESCAPEMENTITEM_HXX
20 #define INCLUDED_EDITENG_ESCAPEMENTITEM_HXX
22 #include <svl/cenumitm.hxx>
23 #include <editeng/svxenum.hxx>
24 #include <editeng/editengdllapi.h>
26 // class SvxEscapementItem -----------------------------------------------
28 #define DFLT_ESC_SUPER 33 // 42% (100 - DFLT_ESC_PROP) of ascent (~80% of font height) = 33% of total font height
29 #define DFLT_ESC_SUB -8 // 42% of descent (~20% of font height) = -8%. previously -33% (pre-2020), previously 8/100 (pre-2000?)
30 #define DFLT_ESC_PROP 58
31 #define MAX_ESC_POS 13999
32 #define DFLT_ESC_AUTO_SUPER (MAX_ESC_POS+1)
33 #define DFLT_ESC_AUTO_SUB -DFLT_ESC_AUTO_SUPER
35 /* [Description]
37 This item describes the writing position.
40 class EDITENG_DLLPUBLIC SvxEscapementItem final : public SfxEnumItemInterface
42 short nEsc;
43 sal_uInt8 nProp;
44 public:
45 static SfxPoolItem* CreateDefault();
47 explicit SvxEscapementItem( const sal_uInt16 nId );
48 SvxEscapementItem( const SvxEscapement eEscape,
49 const sal_uInt16 nId );
50 SvxEscapementItem( const short nEsc, const sal_uInt8 nProp,
51 const sal_uInt16 nId );
53 // "pure virtual Methods" from SfxPoolItem
54 virtual bool operator==( const SfxPoolItem& ) const override;
55 virtual bool GetPresentation( SfxItemPresentation ePres,
56 MapUnit eCoreMetric,
57 MapUnit ePresMetric,
58 OUString &rText, const IntlWrapper& ) const override;
60 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
61 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
63 virtual SvxEscapementItem* Clone( SfxItemPool *pPool = nullptr ) const override;
65 void SetEscapement( const SvxEscapement eNew )
67 if( SvxEscapement::Off == eNew )
69 nEsc = 0;
70 nProp = 100;
72 else
74 nProp = DFLT_ESC_PROP;
75 if( SvxEscapement::Superscript == eNew )
76 nEsc = DFLT_ESC_AUTO_SUPER;
77 else
78 nEsc = DFLT_ESC_AUTO_SUB;
81 SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); }
83 short &GetEsc() { return nEsc; }
84 short GetEsc() const { return nEsc; }
86 sal_uInt8 &GetProportionalHeight() { return nProp; }
87 sal_uInt8 GetProportionalHeight() const { return nProp; }
89 virtual sal_uInt16 GetValueCount() const override;
90 static OUString GetValueTextByPos( sal_uInt16 nPos );
91 virtual sal_uInt16 GetEnumValue() const override;
92 virtual void SetEnumValue( sal_uInt16 nNewVal ) override;
95 #endif
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */