LibreOffice Module editeng (master) 1
escapementitem.hxx
Go to the documentation of this file.
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 <svl/cenumitm.hxx>
23#include <editeng/svxenum.hxx>
25
26// class SvxEscapementItem -----------------------------------------------
27
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
34
35/* [Description]
36
37 This item describes the writing position.
38*/
39
41{
42 short nEsc;
44public:
45 static SfxPoolItem* CreateDefault();
46
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 );
52
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;
59
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;
62
63 virtual SvxEscapementItem* Clone( SfxItemPool *pPool = nullptr ) const override;
64
65 void SetEscapement( const SvxEscapement eNew )
66 {
67 if( SvxEscapement::Off == eNew )
68 {
69 nEsc = 0;
70 nProp = 100;
71 }
72 else
73 {
74 nProp = DFLT_ESC_PROP;
75 if( SvxEscapement::Superscript == eNew )
77 else
78 nEsc = DFLT_ESC_AUTO_SUB;
79 }
80 }
81 SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); }
82
83 short &GetEsc() { return nEsc; }
84 short GetEsc() const { return nEsc; }
85
86 sal_uInt8 &GetProportionalHeight() { return nProp; }
87 sal_uInt8 GetProportionalHeight() const { return nProp; }
88
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;
93};
94
95#endif
96
97/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_uInt16 GetValueCount() const=0
virtual sal_uInt16 GetEnumValue() const=0
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8) override
virtual bool operator==(const SfxPoolItem &rItem) const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8=0) const override
virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &) const override
virtual void SetEnumValue(sal_uInt16 nValue)=0
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
sal_uInt8 GetProportionalHeight() const
void SetEscapement(const SvxEscapement eNew)
SvxEscapement GetEscapement() const
short GetEsc() const
sal_uInt8 & GetProportionalHeight()
#define EDITENG_DLLPUBLIC
Definition: editengdllapi.h:28
#define DFLT_ESC_PROP
#define DFLT_ESC_AUTO_SUB
#define DFLT_ESC_AUTO_SUPER
MapUnit
SfxItemPresentation
SvxEscapement
Definition: svxenum.hxx:35
unsigned char sal_uInt8