Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / editeng / escapementitem.hxx
blob1e8585a0f11688c6f5d12f3eaec91d507692702d
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/eitem.hxx>
23 #include <editeng/svxenum.hxx>
24 #include <editeng/editengdllapi.h>
26 class SvXMLUnitConverter;
28 // class SvxEscapementItem -----------------------------------------------
30 #define DFLT_ESC_SUPER 33 // 1/3
31 #define DFLT_ESC_SUB -33 // also 1/3 previously 8/100
32 #define DFLT_ESC_PROP 58
33 #define DFLT_ESC_AUTO_SUPER 101
34 #define DFLT_ESC_AUTO_SUB -101
36 /* [Description]
38 This item describes the writing position.
41 class EDITENG_DLLPUBLIC SvxEscapementItem : public SfxEnumItemInterface
43 short nEsc;
44 sal_uInt8 nProp;
45 public:
46 static SfxPoolItem* CreateDefault();
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 );
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 * = nullptr ) const override;
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;
64 virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
65 virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override;
66 virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const override;
68 void SetEscapement( const SvxEscapement eNew )
70 if( SvxEscapement::Off == eNew )
72 nEsc = 0;
73 nProp = 100;
75 else
76 if( SvxEscapement::Superscript == eNew )
78 nEsc = DFLT_ESC_SUPER;
79 nProp = DFLT_ESC_PROP;
81 else
83 nEsc = DFLT_ESC_SUB;
84 nProp = DFLT_ESC_PROP;
87 SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); }
89 short &GetEsc() { return nEsc; }
90 short GetEsc() const { return nEsc; }
92 sal_uInt8 &GetProportionalHeight() { return nProp; }
93 sal_uInt8 GetProportionalHeight() const { return nProp; }
95 SvxEscapementItem& operator=(const SvxEscapementItem& rEsc)
97 nEsc = rEsc.GetEsc();
98 nProp = rEsc.GetProportionalHeight();
99 return *this;
102 virtual sal_uInt16 GetValueCount() const override;
103 virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const override;
104 virtual sal_uInt16 GetEnumValue() const override;
105 virtual void SetEnumValue( sal_uInt16 nNewVal ) override;
108 #endif
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */