NameContainer need not be an UNO object itself
[LibreOffice.git] / include / editeng / escapementitem.hxx
blobd889d7bc309ea9a5ad6ef0f00b5b3786e66deedc
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 ASSERT_CHANGE_REFCOUNTED_ITEM;
68 if( SvxEscapement::Off == eNew )
70 nEsc = 0;
71 nProp = 100;
73 else
75 nProp = DFLT_ESC_PROP;
76 if( SvxEscapement::Superscript == eNew )
77 nEsc = DFLT_ESC_AUTO_SUPER;
78 else
79 nEsc = DFLT_ESC_AUTO_SUB;
82 SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); }
84 short GetEsc() const { return nEsc; }
85 void SetEsc(short nNewEsc) { ASSERT_CHANGE_REFCOUNTED_ITEM; nEsc = nNewEsc; }
87 sal_uInt8 GetProportionalHeight() const { return nProp; }
88 void SetProportionalHeight(sal_uInt8 n) { ASSERT_CHANGE_REFCOUNTED_ITEM; nProp = n; }
90 virtual sal_uInt16 GetValueCount() const override;
91 static OUString GetValueTextByPos( sal_uInt16 nPos );
92 virtual sal_uInt16 GetEnumValue() const override;
93 virtual void SetEnumValue( sal_uInt16 nNewVal ) override;
96 #endif
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */